pub trait CurrencyAdapt<T: Config> {
    fn account_balance(account_id: &T::AccountId) -> U256;
    fn evm_total_supply() -> U256;
    fn mutate_account_balance(account_id: &T::AccountId, balance: U256);
    fn ensure_can_withdraw(
        who: &T::AccountId,
        amount: U256,
        reasons: WithdrawReasons
    ) -> Result<(), ExitError>; fn evm_transfer(
        source: &T::AccountId,
        target: &T::AccountId,
        value: U256
    ) -> Result<(), ExitError>; fn evm_balance(address: &H160) -> U256 { ... } fn mutate_evm_balance(address: &H160, new_balance: U256) { ... } }
Expand description

A trait for handling currency decimal difference between native and evm tokens.

Required Methods

Get account balance, the decimal of the returned result is consistent with Ethereum.

Get the total supply of token in Ethereum decimal.

Mutate account balance, the new_balance’s decimal should be the same as Ethereum.

Ensure that an account can withdraw from their fee balance.

Transfer value. the value’s decimal should be the same as Ethereum.

Provided Methods

Get the account balance by ethereum address, the decimal of the returned result is consistent with Ethereum.

Implementors