OmnichainNonFungibleTokenDO
DataObject with base functionality of a non-fungible cross-chain token
_This contract exposes base functionality of a omnichain non-fungible token, allowing to mint, burn, transfer (locally and cross-chain), check balances and owners.
ExpectedAndActualRequestIdDoNotMatch
Error thrown when the expected and actual request IDs do not match
Parameters
Name | Type | Description |
---|---|---|
expectedRequestId | bytes32 | The expected request ID (GUID) |
actualRequestId | bytes32 | The actual request ID (GUID) |
InvalidRequestId
Error thrown when a call to retry omnichain increase balance is provided with wrong or already deleted request id
Parameters
Name | Type | Description |
---|---|---|
rid | bytes32 | The request ID (GUID) to retry |
IncreaseBalanceCallbackHandlerFailed
Error thrown when call to handler failed
Parameters
Name | Type | Description |
---|---|---|
handler | address | Address of the handler |
receiver | address | Address of the receiver of token |
tokenId | uint256 | Id of token |
NotEnoughGasForBalanceHandlers
Error thrown when we do not have enough gas left to call Balance Handler Callbacks
ZeroAddressHandler
Error thrown when the handler is the zero address
HandlerAlreadyRegistered
Error thrown when handler couldn't be added.
HandlerNotRemoved
Error thrown when handler couldn't be removed.
OmnichainTransferRefund
Event emitted when an omnichain transfer is refunded
Parameters
Name | Type | Description |
---|---|---|
rid | bytes32 | The request ID (GUID) |
dp | DataPoint | DataPoint identifier |
from | OmnichainAddress | Address where tokens were taken from |
to | address | Address which received refund (refund address provided with original transaction) |
tokenId | uint256 | Id of token refunded |
OmnichainTransferFailedRefund
Event emitted when an omnichain transfer refunded is required but was not accepted by provided refundAddress
if refundAccepted
is false, that means ERC-721 was formally violated, some actions by DM (actualRefundTarget) are probably required to handle this correctly
Parameters
Name | Type | Description |
---|---|---|
rid | bytes32 | The request ID (GUID) |
dp | DataPoint | DataPoint identifier |
from | OmnichainAddress | Address where tokens were taken from |
to | address | Address which should have received refund (refund address provided with original transaction) |
tokenId | uint256 | Id of the token refunded |
actualRefundTarget | address | Address finally used for refund (its balance was actually increased) |
refundAccepted | bool | If actualRefundTarget accepted refund, if false - it means balance was increased but no Transfer event emitted and onERC1155Received call was reverted |
OmnichainTransferSent
Event emitted when an omnichain transfer is sent
Data (rid) from this event can be used for retry
Parameters
Name | Type | Description |
---|---|---|
rid | bytes32 | The request ID (GUID) |
chainid | uint32 | The target chain ID |
target | address | The target address |
tokenId | uint256 | Id of token sent |
OmnichainRetryIncompleteOmnichainIncreaseBalanceSent
Event emitted when an incomplete omnichain increase balance request is retried
Parameters
Name | Type | Description |
---|---|---|
originalRid | bytes32 | The original request ID (GUID) |
retryRequestRid | bytes32 | The retry request ID (GUID) |
OmnichainIncreaseBalanceHandlerRegistered
Event emitted when an omnichain increase balance handler is registered
Parameters
Name | Type | Description |
---|---|---|
handler | address | The handler address |
added | bool | True if the handler was added, false if removed |
CallResult
Enum for call result
Parameters
Name | Type | Description |
---|
DpData2
Data structure for storing omnichain increase balance handlers
Parameters
Name | Type | Description |
---|
PendingOmnichainTransfer
Data structure for storing pending omnichain transfers for retry or refund
Parameters
Name | Type | Description |
---|
IncreaseBalanceQueryParams
Data structure for storing parameters for increase balance query
Parameters
Name | Type | Description |
---|
retryIncompleteOmnichainIncreaseBalance
Retry sending incomplete omnichain increase balance request
Parameters
Name | Type | Description |
---|---|---|
rid | bytes32 | Request ID of failed message (GUID) |
refundAddress | address payable | Where to send refund |
buildTokenId
Function to build the Omnichain Identifier
Parameters
Name | Type | Description |
---|---|---|
chainId | uint32 | Chain ID |
tokenId | uint224 | Token ID |
Return Values
Name | Type | Description |
---|---|---|
[0] | OmnichainIdentifier | Omnichain Identifier |
callIncreaseBalanceHandlersAndRevertOnFail
Function only callable by the same contract to call increase balance handlers and revert on fail
_dispatchWrite
_mint
Operation used to mint new token
Overridden to prevent minting tokens with wrong chainId in the highest 32 bits
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
to | address | The account address to mint the token to |
tokenId | uint256 | The tokenId of token to mint |
_registerOmnichainIncreaseBalanceHandler
Internal operation to register an omnichain increase balance handler
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
handler | address | Address of the handler to register NOTE: The handler MUST implement the IOmnichainNonFungibleTokenIncreaseBalanceCallback interface |
_unregisterOmnichainIncreaseBalanceHandler
Internal operation to unregister an omnichain increase balance handler
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
handler | address | Address of the handler to unregister |
_omnichainTransfer
Internal operation used to transfer tokens to another chain
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
from | OmnichainAddress | Address where to take token from (on current chain) |
to | OmnichainAddress | Address to send token to |
tokenId | uint256 | Id of token to send |
refundAddress | address payable | Where to send refund NOTE: Native Coin payment for sending omnichain tx should be sent with the call |
_omnichainIncreaseBalance
Internal operation used to increase the balance of a target account
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
rid | bytes32 | Request ID (GUID) |
from | OmnichainAddress | Omnichain Address token transferred from (used to emit correct event) |
to | OmnichainAddress | Omnichain Address to send token to |
tokenId | uint256 | Id of the token NOTE: This function SHOULD be called only by the other-chain DataObject to transfer tokens to someone on this chain which MUST decrease the balance of the user in the origin chain and increase the balance of the target account in the current chain |
_omnichainCallback
Callback function for omnichain operations
Parameters
Name | Type | Description |
---|---|---|
rid | bytes32 | Request ID of the message (GUID) |
data | bytes | Data received in the callback |
_increaseOmnichainBalance
Function used to increase balance on another chain
_retryIncreaseOmnichainBalance
_handleNativePaymentInWrite
Empty to allow native coin payment in write()