Struct BlockchainMock

Source
pub struct BlockchainMock {
    pub accounts: HashMap<Address, AccountData>,
    pub new_addresses: HashMap<(Address, u64), Address>,
    pub previous_block_info: BlockInfo,
    pub current_block_info: BlockInfo,
}

Fields§

§accounts: HashMap<Address, AccountData>§new_addresses: HashMap<(Address, u64), Address>§previous_block_info: BlockInfo§current_block_info: BlockInfo

Implementations§

Source§

impl BlockchainMock

Source

pub fn new() -> Self

Source§

impl BlockchainMock

Source

pub fn add_account(&mut self, acct: AccountData)

Source

pub fn validate_and_add_account(&mut self, acct: AccountData)

Source

pub fn print_accounts(&self)

Source

pub fn put_new_address( &mut self, creator_address: Address, creator_nonce: u64, new_address: Address, )

Source

pub fn validate_account(&self, account: &AccountData)

Source

pub fn is_smart_contract_address(&self, address: &Address) -> bool

Source

pub fn check_account_has_code(&self, account: &AccountData) -> bool

Source

pub fn subtract_tx_payment( &mut self, address: &Address, call_value: &BigUint, ) -> Result<(), BlockchainMockError>

Source

pub fn subtract_tx_gas( &mut self, address: &Address, gas_limit: u64, gas_price: u64, )

Source

pub fn increase_balance(&mut self, address: &Address, amount: &BigUint)

Source

pub fn send_balance( &mut self, contract_address: &Address, send_balance_list: &[SendBalance], result_logs: &mut Vec<TxLog>, ) -> Result<(), BlockchainMockError>

Source

pub fn substract_dcdt_balance( &mut self, address: &Address, dcdt_token_identifier: &[u8], value: &BigUint, )

Source

pub fn increase_dcdt_balance( &mut self, address: &Address, dcdt_token_identifier: &[u8], value: &BigUint, )

Source

pub fn increase_nonce(&mut self, address: &Address)

Source

pub fn create_account_after_deploy( &mut self, tx_input: &TxInput, new_storage: HashMap<Vec<u8>, Vec<u8>>, contract_path: Vec<u8>, ) -> Address

Source

pub fn increase_validator_reward(&mut self, address: &Address, amount: &BigUint)

Source

pub fn try_set_username(&mut self, address: &Address, username: &[u8]) -> bool

Source§

impl BlockchainMock

Source

pub fn create_tx_info(&self, contract_address: &Address) -> BlockchainTxInfo

Trait Implementations§

Source§

impl Default for BlockchainMock

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<M, F> ManagedFrom<M, F> for F
where M: ManagedTypeApi,

Source§

fn managed_from(_: M, t: F) -> F

Source§

impl<M, F, T> ManagedInto<M, T> for F
where T: ManagedFrom<M, F>, M: ManagedTypeApi,

Source§

fn managed_into(self, api: M) -> T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.