srb_trfc/
aplk_oprs.rs

1use soroban_sdk::{contractclient, contracterror, Address, Env, Symbol, Val, Vec};
2
3#[contracterror]
4#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
5#[repr(u32)]
6pub enum OperatorError {
7    OperatorAlreadyAdded = 1,
8    NotAnOperator = 2,
9    AlreadyInitialized = 3,
10    NotInitialized = 4,
11}
12
13/// Interface for the Axelar Operators contract.
14#[contractclient(name = "AxelarOperators")]
15pub trait AxelarOperatorsInterface {
16    /// Initialize the operators contract with an owner.
17    fn initialize(env: Env, owner: Address) -> Result<(), OperatorError>;
18
19    /// Return true if the account is an operator.
20    fn is_operator(env: Env, account: Address) -> bool;
21
22    /// Add an address as an operator. Only callable by the contract owner.
23    fn add_operator(env: Env, operator: Address) -> Result<(), OperatorError>;
24
25    /// Remove an address as an operator. Only callable by the contract owner.
26    fn remove_operator(env: Env, operator: Address) -> Result<(), OperatorError>;
27
28    /// Execute a function on a contract as an operator.
29    fn execute(
30        env: Env,
31        operator: Address,
32        contract: Address,
33        function_name: Symbol,
34        args: Vec<Val>,
35    ) -> Result<Val, OperatorError>;
36}