OmnichainFungibleTokenDO
DataObject with base functionality of a fungible cross-chain token
_This contract exposes base functionality of a omnichain fungible token, allowing to mint, burn, transfer (locally and cross-chain), check balances and local total supply.
InsufficientBalance
Error thrown when the balance is insufficient
Parameters
Name | Type | Description |
---|---|---|
diid | bytes32 | The owner identifier |
balance | uint256 | The current balance |
amount | uint256 | The requested amount |
InsufficientTotalSupply
Error thrown when the total supply is insufficient
Parameters
Name | Type | Description |
---|---|---|
totalSupply | uint256 | The current total supply |
amount | uint256 | The requested amount NOTE: This should never happen because we've already checked "from" balance |
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) |
NativePaymentNotAllowed
Error thrown when the native payment is not allowed for the operation
HandlerAlreadyRegistered
Error thrown when handler couldn't be added.
HandlerNotRemoved
Error thrown when handler couldn't be removed.
ZeroAddressHandler
Error thrown when the handler is the zero address
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 |
amount | uint256 | Amount of tokens |
OmnichainTransferRefund
Event emitted when an omnichain transfer is refunded
Parameters
Name | Type | Description |
---|---|---|
rid | bytes32 | The request ID (GUID) |
dp | DataPoint | DataPoint identifier |
from | address | Address where tokens were taken from |
amount | uint256 | The amounts of tokens refunded |
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) |
to | OmnichainAddress | The target Omnichain Address |
amount | uint256 | The amount 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 |
---|
PendingOmnichainTransfer
Data structure for pending omnichain transfer
Parameters
Name | Type | Description |
---|
DpData
Data structure for Fungible Token data
Parameters
Name | Type | Description |
---|
DiidData
Data structure for Data Index id data
Parameters
Name | Type | Description |
---|
constructor
onDataPointTransfer
Transfers data from one id to another
onDataPointTransfer in this implementation does nothing
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | Identifier of the DataPoint |
fromDiid | bytes32 | ID to transfer from |
toDiid | bytes32 | ID to transfer to |
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
_dispatchRead
_dispatchWrite
_balanceOf
Function used to get the balance of an account
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
account | address | The account address |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The balance of the account |
_totalSupply
Function used to get the total supply of the token
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The total supply of the token |
_mint
Function used to mint new tokens
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
to | address | The account address to mint the tokens to |
amount | uint256 | The amount of tokens to mint |
_burn
Function used to burn tokens
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
from | address | The account address to burn the tokens from |
amount | uint256 | The amount of tokens to burn |
_transfer
Function used to transfer tokens
Parameters
Name | Type | Description |
---|---|---|
dp | DataPoint | DataPoint identifier |
from | address | The account address to transfer the tokens from |
to | address | The account address to transfer the tokens to |
amount | uint256 | The amount of tokens to transfer |
_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 | address | Address where to take tokens from (on current chain) |
to | OmnichainAddress | Address to send tokens to |
amount | 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 |
_increaseOmnichainBalance
Function used to increase balance on another 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 |
_retryIncreaseOmnichainBalance
_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 |
amount | 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 |
_handleNativePaymentInWrite
Empty to allow native coin payment in write()