You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/dev/general-message-passing/executable.mdx
+40-10
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,11 @@
2
2
3
3
## Overview
4
4
5
-
The [Axelar Executable Contract](https://github.com/axelarnetwork/axelar-gmp-sdk-solidity/blob/main/contracts/executable/AxelarExecutable.sol) is a component of the Axelar General Message Passing (GMP) flow, allowing the execution of custom logic in response to messages from different blockchains. By simply inheriting from the Axelar Executable your contract can process and respond to incoming cross-chain GMP data.
5
+
The Axelar Executable is a component of the Axelar General Message Passing (GMP) flow, allowing the execution of custom logic in response to messages from different blockchains. By simply inheriting from the Axelar Executable your contract can process and respond to incoming cross-chain GMP data.
6
6
7
-
## Integration
7
+
## Integration For GMP Executable
8
+
9
+
For a [plain GMP executable](/dev/general-message-passing/gmp-tokens-with-messages/) message you can inherit from the [Axelar Executable](https://github.com/axelarnetwork/axelar-gmp-sdk-solidity/blob/b5d0b7bdda0437fce983daffb776669437b809d0/contracts/executable/AxelarExecutable.sol) contract.
@@ -18,40 +20,68 @@ The [Axelar Executable Contract](https://github.com/axelarnetwork/axelar-gmp-sdk
18
20
contract MyContract is AxelarExecutable {}
19
21
```
20
22
21
-
1. Implement the `virtual` functions defined in Axelar Executable on your own contracts. The functions you implement on your own contract will be automatically triggered by an Axelar relayer on the destination chain once the multichain transaction arrives on the destination chain
23
+
1. Implement the `virtual` functions defined in `AxelarExecutable` on your own contracts. The functions you implement on your own contract will be automatically triggered by an Axelar relayer on the destination chain once the multichain transaction arrives on the destination chain
24
+
25
+
## Integration For GMP With Token Executable
26
+
27
+
If you are [sending a GMP message with a token](/dev/general-message-passing/gmp-tokens-with-messages/) and need to handle the executable for a token + gmp msg then you will need to inherit from the [Axelar Executable With Token](https://github.com/axelarnetwork/axelar-gmp-sdk-solidity/blob/b5d0b7bdda0437fce983daffb776669437b809d0/contracts/executable/AxelarExecutableWithToken.sol) contract.
contract MyContract is AxelarExecutableWithToken {}
40
+
```
41
+
42
+
1. Implement the `virtual` functions defined in `AxelarExecutableWithToken` on your own contracts. The functions you implement on your own contract will be automatically triggered by an Axelar relayer on the destination chain once the multichain transaction arrives on the destination chain
43
+
44
+
22
45
23
-
## GMP Message vs. GMP Message With Token
46
+
## Implementation Comparison
24
47
25
-
There are two relevant functions that can be overriden from AxelarExecutable. The function you want to override depends on whether your sending a GMP message or a GMP message WITH a [Gateway Token](/resources/contract-addresses/mainnet#assets). These two functions are [\_execute()](https://github.com/axelarnetwork/axelar-gmp-sdk-solidity/blob/be86ab9a171f8e12d7695127cf1a6ca867fa1b09/contracts/executable/AxelarExecutable.sol#L55) and [\_executeWithToken()](https://github.com/axelarnetwork/axelar-gmp-sdk-solidity/blob/be86ab9a171f8e12d7695127cf1a6ca867fa1b09/contracts/executable/AxelarExecutable.sol#L61)
48
+
Once you have inherited from the respective Executable contract you can now defined the execution function. This varies slightly depending on whether you are using an execution for a plain GMP message or a GMP message with a token.
26
49
50
+
<tabs>
51
+
<tab-itemtitle="execute">
27
52
```solidity
28
53
/*** For GMP Message ***/
29
54
/**
55
+
@param commandId identifier tx that is guaranteed to be unique from the Axelar network
30
56
@param sourceChain The chain where the GMP message is sent from
31
57
@param sourceAddress The address on where the GMP msg is sent from
To call a contract on chain B from chain A, the user needs to call `callContract` on the gateway of chain A, specifying:
16
15
17
-
- The destination chain, which must be an EVM chain from [Chain names](/dev/reference/mainnet-chain-names).
16
+
- The destination chain, which must be an EVM chain from [Chain names](/dev/reference/mainnet-chain-names/).
18
17
- The destination contract address, which must inherit from `AxelarExecutable` defined in [AxelarExecutable.sol](https://github.com/axelarnetwork/axelar-gmp-sdk-solidity/blob/main/contracts/executable/AxelarExecutable.sol).
19
18
- The payload `bytes` to pass to the destination contract.
20
19
@@ -39,6 +38,7 @@ function callContract(
39
38
40
39
```solidity
41
40
function _execute(
41
+
bytes32 commandId,
42
42
string memory sourceChain,
43
43
string memory sourceAddress,
44
44
bytes calldata payload
@@ -65,6 +65,7 @@ Example of payload decoding in Solidity:
Copy file name to clipboardExpand all lines: src/content/docs/dev/general-message-passing/gmp-tokens-with-messages.mdx
+1-1
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ import { Callout } from "/src/components/callout";
14
14
To call chain B from chain A and send some tokens along the way, the user needs to call `callContractWithToken` on the gateway of chain A, specifying:
15
15
16
16
- The destination chain, which must be an EVM chain from [Chain names](/dev/reference/mainnet-chain-names/).
17
-
- The destination contract address, which must inherit from `AxelarExecutable` defined in [AxelarExecutable.sol](https://github.com/axelarnetwork/axelar-gmp-sdk-solidity/blob/main/contracts/executables/AxelarExecutable.sol).
17
+
- The destination contract address, which must inherit from `AxelarExecutable` defined in [AxelarExecutable.sol](https://github.com/axelarnetwork/axelar-gmp-sdk-solidity/blob/main/contracts/executable/AxelarExecutable.sol).
18
18
- The payload `bytes` to pass to the destination contract.
19
19
- The symbol of the token to transfer, which must be a supported asset ([Mainnet](/resources/contract-addresses/mainnet/) | [Testnet](/resources/contract-addresses/testnet/)).
0 commit comments