Liquid1155

Git Source

Inherits: Native1155, ILiquid1155

Author: 0xvv @ Kiln

This contract allows users to stake in any of the vPools with any amount of ETH and track their position

Users are given transferable shares to track their stake, shares of different pools are not equivalent

Users can interact with the contract using the ERC-1155 interface

State Variables

$approvals

Stores the approvals.

Type: mapping(address => mapping(address => bool))

Slot: keccak256(bytes("liquid1155.1.approvals")) - 1

uctypes.OperatorApprovalsMapping internal constant $approvals =
    uctypes.OperatorApprovalsMapping.wrap(0xf49f1126f15fa50e7f83c3d26f874246f4209fea59edc2c13d900d8b240b28c5);

Functions

setApprovalForAll

Give the right to an operator to transfer all tokens of the sender.

function setApprovalForAll(address operator, bool approved) external;

Parameters

NameTypeDescription
operatoraddressThe address of the operator.
approvedboolThe status of the operator.

isApprovedForAll

Returns the operator status of an operator for a given owner.

function isApprovedForAll(address account, address operator) public view returns (bool);

Parameters

NameTypeDescription
accountaddressThe address of the owner.
operatoraddressThe address of the operator.

safeTransferFrom

Transfers amount tokens of token type id from from to to with extra data.

The caller must be operator of 'from' or 'from' & 'from' must have a balance of at least amount.

function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) public virtual override;

Parameters

NameTypeDescription
fromaddressThe address of the sender.
toaddressThe address of the receiver.
iduint256The id of the token.
amountuint256The token amount.
databytesThe data passed to the receiver.

safeBatchTransferFrom

Batched version of safeTransferFrom.

function safeBatchTransferFrom(address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
    public
    virtual
    override;

Parameters

NameTypeDescription
fromaddressThe address of the sender.
toaddressThe address of the receiver.
idsuint256[]The ids of the tokens.
amountsuint256[]The token amounts.
databytesThe data passed to the receiver.

supportsInterface

function supportsInterface(bytes4 interfaceId) public pure returns (bool);

_safeTransferFrom

Private functions

function _safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) internal virtual;

_safeBatchTransferFrom

function _safeBatchTransferFrom(address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
    internal
    virtual;

_setApprovalForAll

function _setApprovalForAll(address owner, address operator, bool approved) internal virtual;

_doSafeTransferAcceptanceCheck

function _doSafeTransferAcceptanceCheck(address operator, address from, address to, uint256 id, uint256 amount, bytes memory data)
    private;

_doSafeBatchTransferAcceptanceCheck

function _doSafeBatchTransferAcceptanceCheck(
    address operator,
    address from,
    address to,
    uint256[] memory ids,
    uint256[] memory amounts,
    bytes memory data
) private;

_isContract

function _isContract(address account) internal view returns (bool);