ab_contracts_standards/
fungible.rs

1use ab_contracts_common::ContractError;
2use ab_contracts_common::env::Env;
3use ab_contracts_macros::contract;
4use ab_core_primitives::address::Address;
5use ab_core_primitives::balance::Balance;
6
7/// Fungible token trait prototype
8#[contract]
9pub trait Fungible {
10    /// Transfer some `amount` of tokens `from` one contract `to` another
11    #[update]
12    fn transfer(
13        #[env] env: &mut Env<'_>,
14        #[input] from: &Address,
15        #[input] to: &Address,
16        #[input] amount: &Balance,
17    ) -> Result<(), ContractError>;
18
19    /// Get balance of specified address
20    #[view]
21    fn balance(#[env] env: &Env<'_>, #[input] address: &Address) -> Result<Balance, ContractError>;
22}