Skip to main content

Invocation & Environment

Invocation is a single call to an endpoint, an interaction with the logic. It has its identifier and participants. In case of cross-logic calls, Sender is always the same, i.e. the actor who has invoked the first call to the logic. If this logic calls another logic (through an interface), the Sender remains the same, but Invocation.Caller is the calling logic, so logics can have direct insight in what actor did the immediate call.

Environment is a more general source of data like interaction timestamp, effort (fuel) or available volume for data storage.

Invocation

The data about the current invocation is available through Invocation object. Invocation has two methods available:

MethodDescription
Invocation.ID() -> IdentifierIdentifier of the invocation itself
Identifier(Invocation) → Identifiertypecast of Invocation to Identifier, calls .ID() method as above
Invocation.Caller() -> IdentifierIdentifier of the caller, usually same as Sender, but in the case of cross-logic calls, Caller is the logic that has made the call while Sender is the actor who is the origin of the invocation

Environment

Environment object allows retrieval of runtime environment information. The following methods are supported:

MethodDescription
Environment.Timestamp() -> U64returns the timestamp of the current interaction
Environment.EffortCapacity() -> Stringtotal fuel available for interaction (called "effort"
Environment.EffortAvailable() -> Stringavailable fuel at this point
Environment.VolumeCapacity() -> Stringtotal available space in storage for interaction
Environment.VolumeAvailable() -> Stringavailable space in storage at this point
EnvIvocation.coco
coco EnvInvocation

endpoint TS1() -> (t0, t1, t2, t3, t4 U64, t5, t6 Identifier, ts U64):
t0 = Environment.Timestamp()
t1 = Environment.EffortCapacity()
t2 = Environment.EffortAvailable()
t3 = Environment.VolumeCapacity()
t4 = Environment.VolumeAvailable()
t5 = Invocation.ID()
t6 = Invocation.Caller()