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:
Method | Description |
---|---|
Invocation.ID() -> Identifier | Identifier of the invocation itself |
Identifier(Invocation) → Identifier | typecast of Invocation to Identifier, calls .ID() method as above |
Invocation.Caller() -> Identifier | Identifier 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:
Method | Description |
---|---|
Environment.Timestamp() -> U64 | returns the timestamp of the current interaction |
Environment.EffortCapacity() -> String | total fuel available for interaction (called "effort" |
Environment.EffortAvailable() -> String | available fuel at this point |
Environment.VolumeCapacity() -> String | total available space in storage for interaction |
Environment.VolumeAvailable() -> String | available space in storage at this point |
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()