ab_contracts_standards/
fungible.rs

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