ab_contracts_standards/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#![no_std]

use ab_contracts_common::env::Env;
use ab_contracts_common::{Address, Balance, ContractError};
use ab_contracts_macros::contract;

/// Fungible token trait prototype
#[contract]
pub trait Fungible {
    /// Transfer some `amount` of tokens `from` one contract `to` another
    #[update]
    fn transfer(
        #[env] env: &mut Env,
        #[input] from: &Address,
        #[input] to: &Address,
        #[input] amount: &Balance,
    ) -> Result<(), ContractError>;

    /// Get balance of specified address
    #[view]
    fn balance(#[env] env: &Env, #[input] address: &Address) -> Result<Balance, ContractError>;
}