stellar_interchain_token/
interface.rs

1use stellar_axelar_std::interfaces::{OwnableInterface, UpgradableInterface};
2use stellar_axelar_std::token::{self, StellarAssetInterface};
3use stellar_axelar_std::{contractclient, soroban_sdk, Address, BytesN, Env};
4
5use crate::error::ContractError;
6
7#[contractclient(name = "InterchainTokenClient")]
8pub trait InterchainTokenInterface:
9    token::Interface + StellarAssetInterface + OwnableInterface + UpgradableInterface
10{
11    /// Returns the Interchain Token ID
12    fn token_id(env: &Env) -> BytesN<32>;
13
14    /// Returns if the specified address is a minter.
15    fn is_minter(env: &Env, minter: Address) -> bool;
16
17    /// Mints new tokens from a specified minter to a specified address.
18    ///
19    /// # Arguments
20    /// * `minter` - The address of the minter.
21    /// * `to` - The address to which the tokens will be minted.
22    /// * `amount` - The amount of tokens to be minted.
23    ///
24    /// # Errors
25    /// - [`ContractError::NotMinter`]: If the specified minter is not authorized to mint tokens.
26    /// - [`ContractError::InvalidAmount`]: If the specified amount is invalid (e.g. negative).
27    ///
28    /// # Authorization
29    /// - The `minter` must authorize.
30    fn mint_from(
31        env: &Env,
32        minter: Address,
33        to: Address,
34        amount: i128,
35    ) -> Result<(), ContractError>;
36
37    /// Adds a new minter to the Interchain Token contract.
38    ///
39    /// # Arguments
40    /// * `minter` - The address to be added as a minter.
41    ///
42    /// # Authorization
43    /// - [`OwnableInterface::owner`] must authorize.
44    fn add_minter(env: &Env, minter: Address);
45
46    /// Removes a new minter from the Interchain Token contract.
47    ///
48    /// # Arguments
49    /// * `minter` - The address to be added as a minter.
50    ///
51    /// # Authorization
52    /// - [`OwnableInterface::owner`] must authorize.
53    fn remove_minter(env: &Env, minter: Address);
54}