ODCdataManagersomnichainERC721

OmnichainERC721DataManager

Contract for managing an Omnichain ERC721 token using a Omnichain Fungible Token Data Object

_This contract is used to manage an Omnichain ERC721 token where a Data Object contract is used to store the token data on that chain.

 NOTE: This contract and the Data Object contract MUST be approved in the Data Index contract to interact with the given
 Data Point
 For the correct functioning of this contract, it must be registered as a handler in the Omnichain Non Fungible
 Token Data Object through the registerOmnichainIncreaseBalanceHandler function._

OmnichainMintBurnNotSupported

error OmnichainMintBurnNotSupported()

Error thrown when the from or to address is the zero address in a transfer

UnauthorizedCaller

error UnauthorizedCaller()

Error thrown when the caller is not the Non Fungible Token Data Object

NotRegisteredAsOmnichainIncreaseBalanceHandler

error NotRegisteredAsOmnichainIncreaseBalanceHandler()

Error thrown when the contract is not registered as an Omnichain Increase Balance handler

_isRegisteredAsOmnichainIncreaseBalanceHandler

bool _isRegisteredAsOmnichainIncreaseBalanceHandler

Variable to know if the contract is registered as an Omnichain Increase Balance handler

constructor

constructor(bytes32 datapoint_, address _dataIndex, address _nonFungibleTokenDO, string name_, string symbol_) public

registerOmnichainIncreaseBalanceHandler

function registerOmnichainIncreaseBalanceHandler() external

Function to register this contract as an omnichain increase balance handler NOTE: This function must be called after the contract is deployed

afterOmnichainNonFungibleTokenIncreaseBalanceOnTargetChain

function afterOmnichainNonFungibleTokenIncreaseBalanceOnTargetChain(OmnichainAddress from, address to, uint256 tokenId) public virtual returns (bool)

Function called after a token transfer on target chain

Parameters

NameTypeDescription
fromOmnichainAddressThe address from which the token was transferred
toaddressThe address to which the token was transferred
tokenIduint256Id of the token

Return Values

NameTypeDescription
[0]boolbool True if the callback was successful, false otherwise

afterOmnichainNonFungibleTokenFailedRefund

function afterOmnichainNonFungibleTokenFailedRefund(OmnichainAddress, OmnichainAddress to, address, uint256 tokenId) public virtual

Function called if normal token refund procedure failed and balance of this contract (the one which is called) is increased

Parameters

NameTypeDescription
OmnichainAddress
toOmnichainAddressThe address to which the token was originally transferred
address
tokenIduint256Id of the token

recoverTokens

function recoverTokens(address to, uint256 tokenId) external virtual

Allows contract owner to transfer tokens which was sent to this contract Can be used to recover failed refunds

If onERC721Received will be added in an overriding contract, it should also override this function and maybe afterOmnichainFungibleFractionsFailedRefund to implement more sophisticated refund mechanics.

Parameters

NameTypeDescription
toaddressDestination address
tokenIduint256Token id to recover

buildTokenId

function buildTokenId(uint32 chainId, uint224 tokenId) public pure returns (OmnichainIdentifier)

Function to build the Omnichain Identifier

Parameters

NameTypeDescription
chainIduint32Chain ID
tokenIduint224Token ID

Return Values

NameTypeDescription
[0]OmnichainIdentifierOmnichain Identifier

_writeTransfer

function _writeTransfer(address from, OmnichainAddress to, uint256 tokenId, address payable refundAddress) internal virtual