pub trait ActorOps {
// Required methods
fn resolve_address(&self, address: &Address) -> Result<ActorID>;
fn lookup_delegated_address(
&self,
actor_id: ActorID,
) -> Result<Option<Address>>;
fn get_actor_code_cid(&self, id: ActorID) -> Result<Cid>;
fn next_actor_address(&self) -> Result<Address>;
fn create_actor(
&mut self,
code_cid: Cid,
actor_id: ActorID,
delegated_address: Option<Address>,
) -> Result<()>;
fn install_actor(&mut self, code_cid: Cid) -> Result<()>;
fn get_builtin_actor_type(&self, code_cid: &Cid) -> Result<u32>;
fn get_code_cid_for_type(&self, typ: u32) -> Result<Cid>;
fn balance_of(&self, actor_id: ActorID) -> Result<TokenAmount>;
}
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<ActorID>
fn resolve_address(&self, address: &Address) -> Result<ActorID>
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: ActorID) -> Result<Option<Address>>
fn lookup_delegated_address(&self, actor_id: ActorID) -> Result<Option<Address>>
Looks up the “delegated” (f4) address of the specified actor, if any.
sourcefn get_actor_code_cid(&self, id: ActorID) -> Result<Cid>
fn get_actor_code_cid(&self, id: ActorID) -> Result<Cid>
Look up the code CID of an actor.
sourcefn next_actor_address(&self) -> Result<Address>
fn next_actor_address(&self) -> Result<Address>
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,
actor_id: ActorID,
delegated_address: Option<Address>,
) -> Result<()>
fn create_actor( &mut self, code_cid: Cid, actor_id: ActorID, delegated_address: Option<Address>, ) -> Result<()>
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) -> Result<()>
sourcefn get_builtin_actor_type(&self, code_cid: &Cid) -> Result<u32>
fn get_builtin_actor_type(&self, code_cid: &Cid) -> Result<u32>
Returns the actor’s “type” (if builitin) or 0 (if not).
sourcefn get_code_cid_for_type(&self, typ: u32) -> Result<Cid>
fn get_code_cid_for_type(&self, typ: u32) -> Result<Cid>
Returns the CodeCID for the supplied built-in actor type.
sourcefn balance_of(&self, actor_id: ActorID) -> Result<TokenAmount>
fn balance_of(&self, actor_id: ActorID) -> Result<TokenAmount>
Returns the balance associated with an actor id