pub struct MockedExternal {
pub fake_trie: HashMap<Vec<u8>, Vec<u8>>,
pub validators: HashMap<AccountId, Balance>,
/* private fields */
}Expand description
Emulates the trie and the mock handling code.
Fields§
§fake_trie: HashMap<Vec<u8>, Vec<u8>>§validators: HashMap<AccountId, Balance>Implementations§
Trait Implementations§
Source§impl Clone for MockedExternal
impl Clone for MockedExternal
Source§fn clone(&self) -> MockedExternal
fn clone(&self) -> MockedExternal
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for MockedExternal
impl Default for MockedExternal
Source§fn default() -> MockedExternal
fn default() -> MockedExternal
Returns the “default value” for a type. Read more
Source§impl External for MockedExternal
impl External for MockedExternal
Source§fn storage_set(&mut self, key: &[u8], value: &[u8]) -> Result<(), VMLogicError>
fn storage_set(&mut self, key: &[u8], value: &[u8]) -> Result<(), VMLogicError>
Write to the storage trie of the current account Read more
Source§fn storage_get(
&self,
key: &[u8],
) -> Result<Option<Box<dyn ValuePtr>>, VMLogicError>
fn storage_get( &self, key: &[u8], ) -> Result<Option<Box<dyn ValuePtr>>, VMLogicError>
Reads from the storage trie of the current account Read more
Source§fn storage_remove(&mut self, key: &[u8]) -> Result<(), VMLogicError>
fn storage_remove(&mut self, key: &[u8]) -> Result<(), VMLogicError>
Removes the key from the storage Read more
Source§fn storage_remove_subtree(&mut self, prefix: &[u8]) -> Result<(), VMLogicError>
fn storage_remove_subtree(&mut self, prefix: &[u8]) -> Result<(), VMLogicError>
Removes all keys under given suffix in the storage. Read more
Source§fn storage_has_key(&mut self, key: &[u8]) -> Result<bool, VMLogicError>
fn storage_has_key(&mut self, key: &[u8]) -> Result<bool, VMLogicError>
Check whether key exists. Returns Ok(true) if key exists or Ok(false) otherwise Read more
Source§fn create_receipt(
&mut self,
receipt_indices: Vec<u64>,
receiver_id: String,
) -> Result<u64, VMLogicError>
fn create_receipt( &mut self, receipt_indices: Vec<u64>, receiver_id: String, ) -> Result<u64, VMLogicError>
Creates a receipt which will be executed after
receipt_indices Read moreSource§fn append_action_create_account(
&mut self,
receipt_index: u64,
) -> Result<(), VMLogicError>
fn append_action_create_account( &mut self, receipt_index: u64, ) -> Result<(), VMLogicError>
Attaches an
Action::CreateAccount action to an existing receipt Read moreSource§fn append_action_deploy_contract(
&mut self,
receipt_index: u64,
code: Vec<u8>,
) -> Result<(), VMLogicError>
fn append_action_deploy_contract( &mut self, receipt_index: u64, code: Vec<u8>, ) -> Result<(), VMLogicError>
Attaches an
Action::DeployContract action to an existing receipt Read moreSource§fn append_action_function_call(
&mut self,
receipt_index: u64,
method_name: Vec<u8>,
arguments: Vec<u8>,
attached_deposit: u128,
prepaid_gas: u64,
) -> Result<(), VMLogicError>
fn append_action_function_call( &mut self, receipt_index: u64, method_name: Vec<u8>, arguments: Vec<u8>, attached_deposit: u128, prepaid_gas: u64, ) -> Result<(), VMLogicError>
Attaches an
Action::FunctionCall action to an existing receipt Read moreSource§fn append_action_transfer(
&mut self,
receipt_index: u64,
amount: u128,
) -> Result<(), VMLogicError>
fn append_action_transfer( &mut self, receipt_index: u64, amount: u128, ) -> Result<(), VMLogicError>
Attaches an
TransferAction action to an existing receipt Read moreSource§fn append_action_stake(
&mut self,
receipt_index: u64,
stake: u128,
public_key: Vec<u8>,
) -> Result<(), VMLogicError>
fn append_action_stake( &mut self, receipt_index: u64, stake: u128, public_key: Vec<u8>, ) -> Result<(), VMLogicError>
Attaches an
StakeAction action to an existing receipt Read moreSource§fn append_action_add_key_with_full_access(
&mut self,
receipt_index: u64,
public_key: Vec<u8>,
nonce: u64,
) -> Result<(), VMLogicError>
fn append_action_add_key_with_full_access( &mut self, receipt_index: u64, public_key: Vec<u8>, nonce: u64, ) -> Result<(), VMLogicError>
Attaches an
AddKeyAction action to an existing receipt Read moreSource§fn append_action_add_key_with_function_call(
&mut self,
receipt_index: u64,
public_key: Vec<u8>,
nonce: u64,
allowance: Option<u128>,
receiver_id: String,
method_names: Vec<Vec<u8>>,
) -> Result<(), VMLogicError>
fn append_action_add_key_with_function_call( &mut self, receipt_index: u64, public_key: Vec<u8>, nonce: u64, allowance: Option<u128>, receiver_id: String, method_names: Vec<Vec<u8>>, ) -> Result<(), VMLogicError>
Attaches an
AddKeyAction action to an existing receipt with AccessKeyPermission::FunctionCall Read moreSource§fn append_action_delete_key(
&mut self,
receipt_index: u64,
public_key: Vec<u8>,
) -> Result<(), VMLogicError>
fn append_action_delete_key( &mut self, receipt_index: u64, public_key: Vec<u8>, ) -> Result<(), VMLogicError>
Attaches an
DeleteKeyAction action to an existing receipt Read moreSource§fn append_action_delete_account(
&mut self,
receipt_index: u64,
beneficiary_id: String,
) -> Result<(), VMLogicError>
fn append_action_delete_account( &mut self, receipt_index: u64, beneficiary_id: String, ) -> Result<(), VMLogicError>
Attaches an
DeleteAccountAction action to an existing receipt Read moreSource§fn get_touched_nodes_count(&self) -> u64
fn get_touched_nodes_count(&self) -> u64
Returns amount of touched trie nodes by storage operations
Source§fn reset_touched_nodes_counter(&mut self)
fn reset_touched_nodes_counter(&mut self)
Resets amount of touched trie nodes by storage operations
Source§fn validator_stake(
&self,
account_id: &AccountId,
) -> Result<Option<Balance>, VMLogicError>
fn validator_stake( &self, account_id: &AccountId, ) -> Result<Option<Balance>, VMLogicError>
Returns the validator stake for given account in the current epoch.
If the account is not a validator, returns
None.Source§fn validator_total_stake(&self) -> Result<Balance, VMLogicError>
fn validator_total_stake(&self) -> Result<Balance, VMLogicError>
Returns total stake of validators in the current epoch.
Auto Trait Implementations§
impl Freeze for MockedExternal
impl RefUnwindSafe for MockedExternal
impl Send for MockedExternal
impl Sync for MockedExternal
impl Unpin for MockedExternal
impl UnwindSafe for MockedExternal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more