Trait fvm_actor_utils::syscalls::Syscalls
source · pub trait Syscalls {
// Required methods
fn root(&self) -> Result<Cid, NoStateError>;
fn set_root(&self, cid: &Cid) -> Result<(), NoStateError>;
fn receiver(&self) -> ActorID;
fn caller(&self) -> ActorID;
fn send(
&self,
to: &Address,
method: MethodNum,
params: Option<IpldBlock>,
value: TokenAmount,
) -> Result<Response, ErrorNumber>;
fn resolve_address(&self, addr: &Address) -> Option<ActorID>;
}
Expand description
The Syscalls trait defines methods available to the actor from its execution environment.
The methods available are a subset of the methods exported by fvm_sdk
Required Methods§
sourcefn root(&self) -> Result<Cid, NoStateError>
fn root(&self) -> Result<Cid, NoStateError>
Get the IPLD root CID. Fails if the actor doesn’t have state (before the first call to
set_root
and after actor deletion).
sourcefn set_root(&self, cid: &Cid) -> Result<(), NoStateError>
fn set_root(&self, cid: &Cid) -> Result<(), NoStateError>
Set the actor’s state-tree root.
Fails if:
- The new root is not in the actor’s “reachable” set.
- Fails if the actor has been deleted.
sourcefn send(
&self,
to: &Address,
method: MethodNum,
params: Option<IpldBlock>,
value: TokenAmount,
) -> Result<Response, ErrorNumber>
fn send( &self, to: &Address, method: MethodNum, params: Option<IpldBlock>, value: TokenAmount, ) -> Result<Response, ErrorNumber>
Sends a message to an actor
sourcefn resolve_address(&self, addr: &Address) -> Option<ActorID>
fn resolve_address(&self, addr: &Address) -> Option<ActorID>
Resolves the ID address of an actor.
Returns None if the address cannot be resolved. Successfully resolving an address doesn’t necessarily mean the actor exists (e.g., if the addresss was already an actor ID).