Skip to main content

TransferManager

LooksRare protocol team (👀,💎); bitbeckers

TransferManager

This contract provides the transfer functions for ERC721/ERC1155/Hypercert for contracts that require them. Collection type "0" refers to ERC721 transfer functions. Collection type "1" refers to ERC1155 transfer functions. Collection type "2" refers to Hypercert 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.

Methods​

allowOperator​

function allowOperator(address operator) external nonpayable

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

cancelOwnershipTransfer​

function cancelOwnershipTransfer() external nonpayable

This function is used to cancel the ownership transfer.

This function can be used for both cancelling a transfer to a new owner and cancelling the renouncement of the ownership.

confirmOwnershipRenouncement​

function confirmOwnershipRenouncement() external nonpayable

This function is used to confirm the ownership renouncement.

confirmOwnershipTransfer​

function confirmOwnershipTransfer() external nonpayable

This function is used to confirm the ownership transfer.

This function can only be called by the current potential owner.

grantApprovals​

function grantApprovals(address[] operators) external nonpayable

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

hasUserApprovedOperator​

function hasUserApprovedOperator(address, address) external view returns (bool)

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).

Parameters​

NameTypeDescription
_0addressundefined
_1addressundefined

Returns​

NameTypeDescription
_0boolundefined

initiateOwnershipRenouncement​

function initiateOwnershipRenouncement() external nonpayable

This function is used to initiate the ownership renouncement.

initiateOwnershipTransfer​

function initiateOwnershipTransfer(address newPotentialOwner) external nonpayable

This function is used to initiate the transfer of ownership to a new owner.

Parameters​

NameTypeDescription
newPotentialOwneraddressNew potential owner address

isOperatorAllowed​

function isOperatorAllowed(address) external view returns (bool)

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

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
_0boolundefined

owner​

function owner() external view returns (address)

Address of the current owner.

Returns​

NameTypeDescription
_0addressundefined

ownershipStatus​

function ownershipStatus() external view returns (enum IOwnableTwoSteps.Status)

Ownership status.

Returns​

NameTypeDescription
_0enum IOwnableTwoSteps.Statusundefined

potentialOwner​

function potentialOwner() external view returns (address)

Address of the potential owner.

Returns​

NameTypeDescription
_0addressundefined

removeOperator​

function removeOperator(address operator) external nonpayable

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

Only callable by owner.

Parameters​

NameTypeDescription
operatoraddressOperator address to remove

revokeApprovals​

function revokeApprovals(address[] operators) external nonpayable

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

splitItemsHypercert​

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

This function splits and transfers a fraction of a hypercert.

It does not allow batch transferring.

Parameters​

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

transferBatchItemsAcrossCollections​

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

Parameters​

NameTypeDescription
itemsITransferManager.BatchTransferItem[]undefined
fromaddressundefined
toaddressundefined

transferItemsERC1155​

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

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

transferItemsERC721​

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

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

transferItemsHypercert​

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

This function transfers items for a single Hypercert.

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

Events​

ApprovalsGranted​

event ApprovalsGranted(address user, address[] operators)

It is emitted if operators' approvals to transfer NFTs are granted by a user.

Parameters​

NameTypeDescription
useraddressundefined
operatorsaddress[]undefined

ApprovalsRemoved​

event ApprovalsRemoved(address user, address[] operators)

It is emitted if operators' approvals to transfer NFTs are revoked by a user.

Parameters​

NameTypeDescription
useraddressundefined
operatorsaddress[]undefined

CancelOwnershipTransfer​

event CancelOwnershipTransfer()

This is emitted if the ownership transfer is cancelled.

InitiateOwnershipRenouncement​

event InitiateOwnershipRenouncement()

This is emitted if the ownership renouncement is initiated.

InitiateOwnershipTransfer​

event InitiateOwnershipTransfer(address previousOwner, address potentialOwner)

This is emitted if the ownership transfer is initiated.

Parameters​

NameTypeDescription
previousOwneraddressundefined
potentialOwneraddressundefined

NewOwner​

event NewOwner(address newOwner)

This is emitted when there is a new owner.

Parameters​

NameTypeDescription
newOwneraddressundefined

OperatorAllowed​

event OperatorAllowed(address operator)

It is emitted if a new operator is added to the global allowlist.

Parameters​

NameTypeDescription
operatoraddressundefined

OperatorRemoved​

event OperatorRemoved(address operator)

It is emitted if an operator is removed from the global allowlist.

Parameters​

NameTypeDescription
operatoraddressundefined

Errors​

AmountInvalid​

error AmountInvalid()

It is returned if the amount is invalid. For ERC721 and Hypercert, any number that is not 1. For ERC1155, if amount is 0.

ERC1155SafeBatchTransferFromFail​

error ERC1155SafeBatchTransferFromFail()

It is emitted if the ERC1155 safeBatchTransferFrom fails.

ERC1155SafeTransferFromFail​

error ERC1155SafeTransferFromFail()

It is emitted if the ERC1155 safeTransferFrom fails.

ERC721TransferFromFail​

error ERC721TransferFromFail()

It is emitted if the ERC721 transferFrom fails.

HypercertSplitFractionError​

error HypercertSplitFractionError()

LengthsInvalid​

error LengthsInvalid()

It is returned if there is either a mismatch or an error in the length of the array(s).

NoOngoingTransferInProgress​

error NoOngoingTransferInProgress()

This is returned when there is no transfer of ownership in progress.

NotAContract​

error NotAContract()

It is emitted if the call recipient is not a contract.

NotOwner​

error NotOwner()

This is returned when the caller is not the owner.

OperatorAlreadyAllowed​

error OperatorAlreadyAllowed()

It is returned if the transfer caller is already allowed by the owner.

This error can only be returned for owner operations.

OperatorAlreadyApprovedByUser​

error OperatorAlreadyApprovedByUser()

It is returned if the operator to approve has already been approved by the user.

OperatorNotAllowed​

error OperatorNotAllowed()

It is returned if the operator to approve is not in the global allowlist defined by the owner.

This error can be returned if the user tries to grant approval to an operator address not in the allowlist or if the owner tries to remove the operator from the global allowlist.

OperatorNotApprovedByUser​

error OperatorNotApprovedByUser()

It is returned if the operator to revoke has not been previously approved by the user.

RenouncementNotInProgress​

error RenouncementNotInProgress()

This is returned when there is no renouncement in progress but the owner tries to validate the ownership renouncement.

TransferAlreadyInProgress​

error TransferAlreadyInProgress()

This is returned when the transfer is already in progress but the owner tries initiate a new ownership transfer.

TransferCallerInvalid​

error TransferCallerInvalid()

It is returned if the transfer caller is invalid. For a transfer called to be valid, the operator must be in the global allowlist and approved by the 'from' user.

TransferNotInProgress​

error TransferNotInProgress()

This is returned when there is no ownership transfer in progress but the ownership change tries to be approved.

WrongPotentialOwner​

error WrongPotentialOwner()

This is returned when the ownership transfer is attempted to be validated by the a caller that is not the potential owner.