OmnichainFungibleFractionsDO
DataObject with base funtionality of a fungible cross-chain fractions
_This contract exposes base functionality of a omnichain fungible fractions, allowing to mint, burn, transfer (locally and cross-chain), check balances and supply.
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 the tokens |
id | uint256 | Id of the token |
value | uint256 | Amount of tokens NOTE: id and value are set to 0 in case of batch transfer |
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) |
ids | uint256[] | Ids of the tokens refunded |
values | uint256[] | The amounts of tokens 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-1155 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) |
ids | uint256[] | Ids of the tokens refunded |
values | uint256[] | The amounts of tokens 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 |
ids | uint256[] | Ids of the tokens sent |
values | uint256[] | The amounts of tokens 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 |
callIncreaseBalanceHandlersAndRevertOnFail
Function only callable by the same contract to call increase balance handlers and revert on fail
callIncreaseBalanceHandlersAndRevertOnFail
Function only callable by the same contract to call increase balance handlers and revert on fail
_dispatchWrite
_registerOmnichainIncreaseBalanceHandler
Function 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 IOmnichainFungibleFractionsIncreaseBalanceCallback interface |
_unregisterOmnichainIncreaseBalanceHandler
Function to unregister an omnichain increase balance handler
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
handler | address | Address of the handler to unregister |
_omnichainTransfer
Operation used to transfer tokens to another chain
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
from | OmnichainAddress | Address where to take tokens from (on current chain) |
to | OmnichainAddress | Address to send tokens to |
id | uint256 | Id of the token |
value | uint256 | How much 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 tokens transferred from (used to emit correct event) |
to | OmnichainAddress | Omnichain Address to send tokens to |
id | uint256 | Id of the token |
value | uint256 | Amount of tokens to send 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 |
_omnichainBatchTransfer
Function used to transfer a batch of tokens to another chain
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
from | OmnichainAddress | Address where to take tokens from (on current chain) |
to | OmnichainAddress | Address to send tokens to |
ids | uint256[] | The ids of the tokens |
values | uint256[] | The amounts of tokens to transfer |
refundAddress | address payable | Where to send refund NOTE: Native Coin payment for sending omnichain tx should be sent with the call |
_omnichainBatchIncreaseBalance
Internal operation used to increase the balance of a target account with a batch of tokens
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
rid | bytes32 | Request ID (GUID) |
from | OmnichainAddress | Omnichain Address tokens transferred from (used to emit correct event) |
to | OmnichainAddress | Omnichain Address to send tokens to |
ids | uint256[] | The id of the token |
values | uint256[] | Amount of tokens to send 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
_increaseOmnichainBatchBalance
Function used to increase batch balance on another chain
_retryIncreaseOmnichainBalance
_handleNativePaymentInWrite
Empty to allow native coin payment in write()