Trait darwinia_evm::CurrencyAdapt
source · [−]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
fn account_balance(account_id: &T::AccountId) -> U256
fn account_balance(account_id: &T::AccountId) -> U256
Get account balance, the decimal of the returned result is consistent with Ethereum.
fn evm_total_supply() -> U256
fn evm_total_supply() -> U256
Get the total supply of token in Ethereum decimal.
fn mutate_account_balance(account_id: &T::AccountId, balance: U256)
fn mutate_account_balance(account_id: &T::AccountId, balance: U256)
Mutate account balance, the new_balance’s decimal should be the same as Ethereum.
fn ensure_can_withdraw(
who: &T::AccountId,
amount: U256,
reasons: WithdrawReasons
) -> Result<(), ExitError>
fn ensure_can_withdraw(
who: &T::AccountId,
amount: U256,
reasons: WithdrawReasons
) -> Result<(), ExitError>
Ensure that an account can withdraw from their fee balance.
fn evm_transfer(
source: &T::AccountId,
target: &T::AccountId,
value: U256
) -> Result<(), ExitError>
fn evm_transfer(
source: &T::AccountId,
target: &T::AccountId,
value: U256
) -> Result<(), ExitError>
Transfer value. the value’s decimal should be the same as Ethereum.
Provided Methods
fn evm_balance(address: &H160) -> U256
fn evm_balance(address: &H160) -> U256
Get the account balance by ethereum address, the decimal of the returned result is consistent with Ethereum.