Abstract contract to be inherited by contracts that need to execute cross-chain commands via Axelar’s Gateway. It implements the IAxelarExecutable interface.
address gatewayAddress
Reference to the Axelar Gateway contract.
constructor(address gateway_) internal
Contract constructor that sets the Axelar Gateway address. Reverts if the provided address is the zero address.
Name | Type | Description |
---|---|---|
gateway_ | address | The address of the Axelar Gateway contract. |
function execute(bytes32 commandId, string sourceChain, string sourceAddress, bytes payload) external virtual
Executes the cross-chain command after validating it with the Axelar Gateway.
This function ensures the call is approved by Axelar Gateway before execution. It uses a hash of the payload for validation and internally calls _execute for the actual command execution. Reverts if the validation fails.
Name | Type | Description |
---|---|---|
commandId | bytes32 | The unique identifier of the cross-chain message being executed. |
sourceChain | string | The name of the source chain from which the message originated. |
sourceAddress | string | The address on the source chain that sent the message. |
payload | bytes | The payload of the message payload. |
function _execute(bytes32 commandId, string sourceChain, string sourceAddress, bytes payload) internal virtual
Internal virtual function to be overridden by child contracts to execute the command. It allows child contracts to define their custom command execution logic.
Name | Type | Description |
---|---|---|
commandId | bytes32 | The identifier of the command to execute. |
sourceChain | string | The name of the source chain from which the command originated. |
sourceAddress | string | The address on the source chain that sent the command. |
payload | bytes | The payload of the command to be executed. |
function gateway() public view returns (contract IAxelarGateway)
Returns the address of the AxelarGateway contract.
Name | Type | Description |
---|---|---|
[0] | contract IAxelarGateway | The Axelar Gateway instance. |