Trait forest_filecoin::shim::fvm_latest::kernel::ActorOps
source · pub trait ActorOps {
// Required methods
fn resolve_address(&self, address: &Address) -> Result<u64, ExecutionError>;
fn lookup_delegated_address(
&self,
actor_id: u64,
) -> Result<Option<Address>, ExecutionError>;
fn get_actor_code_cid(&self, id: u64) -> Result<Cid<64>, ExecutionError>;
fn next_actor_address(&self) -> Result<Address, ExecutionError>;
fn create_actor(
&mut self,
code_cid: Cid<64>,
actor_id: u64,
delegated_address: Option<Address>,
) -> Result<(), ExecutionError>;
fn install_actor(&mut self, code_cid: Cid<64>) -> Result<(), ExecutionError>;
fn get_builtin_actor_type(
&self,
code_cid: &Cid<64>,
) -> Result<u32, ExecutionError>;
fn get_code_cid_for_type(&self, typ: u32) -> Result<Cid<64>, ExecutionError>;
fn balance_of(&self, actor_id: u64) -> Result<TokenAmount, ExecutionError>;
}
Expand description
Actors operations whose scope of action is actors other than the calling actor. The calling actor’s state may be consulted to resolve some.
Required Methods§
sourcefn resolve_address(&self, address: &Address) -> Result<u64, ExecutionError>
fn resolve_address(&self, address: &Address) -> Result<u64, ExecutionError>
Resolves an address of any protocol to an ID address (via the Init actor’s table). This allows resolution of externally-provided SECP, BLS, or actor addresses to the canonical form. If the argument is an ID address it is returned directly.
sourcefn lookup_delegated_address(
&self,
actor_id: u64,
) -> Result<Option<Address>, ExecutionError>
fn lookup_delegated_address( &self, actor_id: u64, ) -> Result<Option<Address>, ExecutionError>
Looks up the “delegated” (f4) address of the specified actor, if any.
sourcefn get_actor_code_cid(&self, id: u64) -> Result<Cid<64>, ExecutionError>
fn get_actor_code_cid(&self, id: u64) -> Result<Cid<64>, ExecutionError>
Look up the code CID of an actor.
sourcefn next_actor_address(&self) -> Result<Address, ExecutionError>
fn next_actor_address(&self) -> Result<Address, ExecutionError>
Computes an address for a new actor. The returned address is intended to uniquely refer to the actor even in the event of a chain re-org (whereas an ID-address might refer to a different actor after messages are re-ordered). Always an ActorExec address.
sourcefn create_actor(
&mut self,
code_cid: Cid<64>,
actor_id: u64,
delegated_address: Option<Address>,
) -> Result<(), ExecutionError>
fn create_actor( &mut self, code_cid: Cid<64>, actor_id: u64, delegated_address: Option<Address>, ) -> Result<(), ExecutionError>
Creates an actor with given code_cid
, actor_id
, delegated_address
(if specified),
and an empty state.
fn install_actor(&mut self, code_cid: Cid<64>) -> Result<(), ExecutionError>
sourcefn get_builtin_actor_type(
&self,
code_cid: &Cid<64>,
) -> Result<u32, ExecutionError>
fn get_builtin_actor_type( &self, code_cid: &Cid<64>, ) -> Result<u32, ExecutionError>
Returns the actor’s “type” (if builitin) or 0 (if not).
sourcefn get_code_cid_for_type(&self, typ: u32) -> Result<Cid<64>, ExecutionError>
fn get_code_cid_for_type(&self, typ: u32) -> Result<Cid<64>, ExecutionError>
Returns the CodeCID for the supplied built-in actor type.
sourcefn balance_of(&self, actor_id: u64) -> Result<TokenAmount, ExecutionError>
fn balance_of(&self, actor_id: u64) -> Result<TokenAmount, ExecutionError>
Returns the balance associated with an actor id