Zum Hauptinhalt überspringen

TransferManager

This contract provides the transfer functions for ERC721/ERC1155 for contracts that require them. Collection type "0" refers to ERC721 transfer functions. Collection type "1" refers to ERC1155 transfer functions.

"Safe" transfer functions for ERC721 are not implemented since they come with added gas costs to verify if the recipient is a contract as it requires verifying the receiver interface is valid.

hasUserApprovedOperator

mapping(address => mapping(address => bool)) hasUserApprovedOperator

This returns whether the user has approved the operator address. The first address is the user and the second address is the operator (e.g. LooksRareProtocol).

isOperatorAllowed

mapping(address => bool) isOperatorAllowed

This returns whether the operator address is allowed by this contract's owner.

constructor

constructor(address _owner) public

Constructor

Parameters

NameTypeDescription
_owneraddressOwner address

transferItemsERC721

function transferItemsERC721(address collection, address from, address to, uint256[] itemIds, uint256[] amounts) external

This function transfers items for a single ERC721 collection.

Parameters

NameTypeDescription
collectionaddressCollection address
fromaddressSender address
toaddressRecipient address
itemIdsuint256[]Array of itemIds
amountsuint256[]Array of amounts

transferItemsERC1155

function transferItemsERC1155(address collection, address from, address to, uint256[] itemIds, uint256[] amounts) external

This function transfers items for a single ERC1155 collection.

It does not allow batch transferring if from = msg.sender since native function should be used.

Parameters

NameTypeDescription
collectionaddressCollection address
fromaddressSender address
toaddressRecipient address
itemIdsuint256[]Array of itemIds
amountsuint256[]Array of amounts

transferBatchItemsAcrossCollections

function transferBatchItemsAcrossCollections(struct ITransferManager.BatchTransferItem[] items, address from, address to) external

This function transfers items across an array of collections that can be both ERC721 and ERC1155.

Parameters

NameTypeDescription
itemsstruct ITransferManager.BatchTransferItem[]Array of BatchTransferItem
fromaddressSender address
toaddressRecipient address

grantApprovals

function grantApprovals(address[] operators) external

This function allows a user to grant approvals for an array of operators. Users cannot grant approvals if the operator is not allowed by this contract's owner.

Each operator address must be globally allowed to be approved.

Parameters

NameTypeDescription
operatorsaddress[]Array of operator addresses

revokeApprovals

function revokeApprovals(address[] operators) external

This function allows a user to revoke existing approvals for an array of operators.

Each operator address must be approved at the user level to be revoked.

Parameters

NameTypeDescription
operatorsaddress[]Array of operator addresses

allowOperator

function allowOperator(address operator) external

This function allows an operator to be added for the shared transfer system. Once the operator is allowed, users can grant NFT approvals to this operator.

Only callable by owner.

Parameters

NameTypeDescription
operatoraddressOperator address to allow

removeOperator

function removeOperator(address operator) external

This function allows the user to remove an operator for the shared transfer system.

Only callable by owner.

Parameters

NameTypeDescription
operatoraddressOperator address to remove