Trait fil_actors_shared::v14::vm_api::VM
source · pub trait VM {
Show 20 methods
// Required methods
fn blockstore(&self) -> &dyn Blockstore;
fn actor(&self, address: &Address) -> Option<ActorState>;
fn set_actor(&self, key: &Address, a: ActorState);
fn balance(&self, address: &Address) -> TokenAmount;
fn resolve_id_address(&self, address: &Address) -> Option<Address>;
fn execute_message(
&self,
from: &Address,
to: &Address,
value: &TokenAmount,
method: MethodNum,
params: Option<IpldBlock>,
) -> Result<MessageResult, VMError>;
fn execute_message_implicit(
&self,
from: &Address,
to: &Address,
value: &TokenAmount,
method: MethodNum,
params: Option<IpldBlock>,
) -> Result<MessageResult, VMError>;
fn take_invocations(&self) -> Vec<InvocationTrace>;
fn primitives(&self) -> &dyn Primitives;
fn mut_primitives(&self) -> &dyn MockPrimitives;
fn actor_manifest(&self) -> BTreeMap<Cid, Type>;
fn actor_states(&self) -> BTreeMap<Address, ActorState>;
fn epoch(&self) -> ChainEpoch;
fn set_epoch(&self, epoch: ChainEpoch);
fn circulating_supply(&self) -> TokenAmount;
fn set_circulating_supply(&self, supply: TokenAmount);
fn base_fee(&self) -> TokenAmount;
fn set_base_fee(&self, amount: TokenAmount);
fn timestamp(&self) -> u64;
fn set_timestamp(&self, timestamp: u64);
}
Expand description
An abstract VM that is injected into integration tests
Required Methods§
sourcefn blockstore(&self) -> &dyn Blockstore
fn blockstore(&self) -> &dyn Blockstore
Returns the underlying blockstore of the VM
sourcefn actor(&self, address: &Address) -> Option<ActorState>
fn actor(&self, address: &Address) -> Option<ActorState>
Get information about an actor
sourcefn set_actor(&self, key: &Address, a: ActorState)
fn set_actor(&self, key: &Address, a: ActorState)
Upsert an actor into the state tree
sourcefn balance(&self, address: &Address) -> TokenAmount
fn balance(&self, address: &Address) -> TokenAmount
Get the balance of the specified actor
sourcefn resolve_id_address(&self, address: &Address) -> Option<Address>
fn resolve_id_address(&self, address: &Address) -> Option<Address>
Get the ID for the specified address
sourcefn execute_message(
&self,
from: &Address,
to: &Address,
value: &TokenAmount,
method: MethodNum,
params: Option<IpldBlock>,
) -> Result<MessageResult, VMError>
fn execute_message( &self, from: &Address, to: &Address, value: &TokenAmount, method: MethodNum, params: Option<IpldBlock>, ) -> Result<MessageResult, VMError>
Send a message between the two specified actors
sourcefn execute_message_implicit(
&self,
from: &Address,
to: &Address,
value: &TokenAmount,
method: MethodNum,
params: Option<IpldBlock>,
) -> Result<MessageResult, VMError>
fn execute_message_implicit( &self, from: &Address, to: &Address, value: &TokenAmount, method: MethodNum, params: Option<IpldBlock>, ) -> Result<MessageResult, VMError>
Send a message without charging gas
sourcefn take_invocations(&self) -> Vec<InvocationTrace>
fn take_invocations(&self) -> Vec<InvocationTrace>
Take all the invocations that have been made since the last call to this method
sourcefn primitives(&self) -> &dyn Primitives
fn primitives(&self) -> &dyn Primitives
Provides access to VM primitives
sourcefn mut_primitives(&self) -> &dyn MockPrimitives
fn mut_primitives(&self) -> &dyn MockPrimitives
Provides access to VM primitives that can be mocked
sourcefn actor_manifest(&self) -> BTreeMap<Cid, Type>
fn actor_manifest(&self) -> BTreeMap<Cid, Type>
Return a map of actor code CIDs to their corresponding types
sourcefn actor_states(&self) -> BTreeMap<Address, ActorState>
fn actor_states(&self) -> BTreeMap<Address, ActorState>
Returns a map of all actor addresses to their corresponding states
sourcefn epoch(&self) -> ChainEpoch
fn epoch(&self) -> ChainEpoch
Get the current chain epoch
sourcefn set_epoch(&self, epoch: ChainEpoch)
fn set_epoch(&self, epoch: ChainEpoch)
Sets the epoch to the specified value
sourcefn circulating_supply(&self) -> TokenAmount
fn circulating_supply(&self) -> TokenAmount
Get the circulating supply constant for the network
sourcefn set_circulating_supply(&self, supply: TokenAmount)
fn set_circulating_supply(&self, supply: TokenAmount)
Set the circulating supply constant for the network
sourcefn base_fee(&self) -> TokenAmount
fn base_fee(&self) -> TokenAmount
Get the current base fee
sourcefn set_base_fee(&self, amount: TokenAmount)
fn set_base_fee(&self, amount: TokenAmount)
Set the current base fee
sourcefn set_timestamp(&self, timestamp: u64)
fn set_timestamp(&self, timestamp: u64)
Set the current timestamp