srb_trfc/
gz_srv.rs

1use srb_std::types::Token;
2use soroban_sdk::{contractclient, contracterror, Address, Bytes, Env, String};
3
4#[contracterror]
5#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
6#[repr(u32)]
7pub enum GasServiceError {
8    InvalidAddress = 1,
9    InvalidAmount = 2,
10    InsufficientBalance = 3,
11    AlreadyInitialized = 4,
12    NotInitialized = 5,
13}
14
15/// Interface for the Axelar Gas Service.
16#[contractclient(name = "AxelarGasServiceClient")]
17pub trait AxelarGasServiceInterface {
18    /// Initialize the gas service contract with a gas_collector address.
19    fn initialize(env: Env, gas_collector: Address) -> Result<(), GasServiceError>;
20
21    /// Pay for gas using a token for a contract call on a destination chain. This function is called on the source chain before calling the gateway to execute a remote contract.
22    fn pay_gas_for_contract_call(
23        env: Env,
24        sender: Address,
25        destination_chain: String,
26        destination_address: String,
27        payload: Bytes,
28        refund_address: Address,
29        token: Token,
30    ) -> Result<(), GasServiceError>;
31
32    /// Allows the `gas_collector` to collect accumulated fees from the contract. Only callable by the gas_collector.
33    fn collect_fees(env: Env, receiver: Address, token: Token) -> Result<(), GasServiceError>;
34
35    /// Refunds gas payment to the receiver in relation to a specific cross-chain transaction. Only callable by the gas_collector.
36    fn refund(
37        env: Env,
38        message_id: String,
39        receiver: Address,
40        token: Token,
41    ) -> Result<(), GasServiceError>;
42}