DEVELOP WITH DOJIMA
Function to call the tokenTransferWithPayload function from the StateSender contract
IStateSender.sol
1// 1 endpoint send()
2/**
3 @notice Function to send token with data to the hermes chain.
4 @param destinationChain destination chain name.
5 @param destinationContract destination chain contract address.
6 @param asset address of the token that will be sent to the hermes chain.
7 @param tokenAmount amount of the token that will be sent to the hermes chain.
8 @param payload data that will be sent to the hermes chain.
9**/
10function tokenTransferWithPayload(
11 bytes32 destinationChain,
12 address destinationContract,
13 address asset,
14 uint256 tokenAmount,
15 bytes calldata payload)
1// 1 endpoint send()
2/**
3 @notice Function to send token with data to the hermes chain.
4 @param destinationChain destination chain name.
5 @param destinationContract destination chain contract address.
6 @param asset address of the token that will be sent to the hermes chain.
7 @param tokenAmount amount of the token that will be sent to the hermes chain.
8 @param payload data that will be sent to the hermes chain.
9**/
10function tokenTransferWithPayload(
11 bytes32 destinationChain,
12 address destinationContract,
13 address asset,
14 uint256 tokenAmount,
15 bytes calldata payload)
tx.go
1// 2 txs types
2type Tx struct {
3 ID string
4 Chain string
5 FromAddress string
6 ToAddress string
7 Coins Coins
8 Gas Gas
9 Memo string
10 Payload []byte
11}
12//tx details
13type MsgEVMTransferNative struct {
14 Txn Tx
15 Signer cosmos_sdk_types.AccAddress
16 DestinationContract string
17 DepositId uint64
18}
19type DojimaInput struct {
20 ID uint64
21 Contract string
22 Data []byte
23 TxHash string
24 ObservedTime time.Time
25 ChainID string
26}
1// 2 txs types
2type Tx struct {
3 ID string
4 Chain string
5 FromAddress string
6 ToAddress string
7 Coins Coins
8 Gas Gas
9 Memo string
10 Payload []byte
11}
12//tx details
13type MsgEVMTransferNative struct {
14 Txn Tx
15 Signer cosmos_sdk_types.AccAddress
16 DestinationContract string
17 DepositId uint64
18}
19type DojimaInput struct {
20 ID uint64
21 Contract string
22 Data []byte
23 TxHash string
24 ObservedTime time.Time
25 ChainID string
26}
IStateReceiver.sol
1// 3 endpoint receive()
2/**
3 @notice Function to receive state from the Dojima chain and execute data.
4 @params stateId unique identifier of the state.
5 @params stateData contact call data.
6**/
7
8function onStateReceive(uint256 stateId, bytes calldata stateData) external;
1// 3 endpoint receive()
2/**
3 @notice Function to receive state from the Dojima chain and execute data.
4 @params stateId unique identifier of the state.
5 @params stateData contact call data.
6**/
7
8function onStateReceive(uint256 stateId, bytes calldata stateData) external;
Examples
01 / IStateSender.sol
Function to call the tokenTransferWithPayload function from the StateSender contract
02 / tx.go
struct types required for transaction
03 / IStateReceiver.sol
Function to call the onStateReceive function from the StateReceiver contract