AxelarExecutable

Derive Macro AxelarExecutable 

Source
#[derive(AxelarExecutable)]
{
    // Attributes available to this derive:
    #[axelar_executable]
}
Expand description

Implements the Axelar Executable interface for a Soroban contract.

The concrete error type must be specified with #[axelar_executable(error = ...)]. It must match the contract’s CustomAxelarExecutable::Error associated type and define a NotApproved variant used when the gateway has not approved the message.

§Example

use stellar_axelar_std_derive::AxelarExecutable;
use stellar_axelar_gateway::executable::CustomAxelarExecutable;

#[contracterror]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(u32)]
pub enum ContractError {
    NotApproved = 1,
}

#[contract]
#[derive(AxelarExecutable)]
#[axelar_executable(error = ContractError)]
pub struct Contract;

impl CustomAxelarExecutable for Contract {
    type Error = ContractError;

    fn __gateway(env: &Env) -> Address {
        todo!()
    }

    fn __execute(
        env: &Env,
        source_chain: String,
        message_id: String,
        source_address: String,
        payload: Bytes,
    ) -> Result<(), Self::Error> {
        Ok(())
    }
}