Interaction
Basic Commands
| Command | Description |
|---|---|
deploy <logic>.<endpoint>(args) | Run deploy endpoint (one-time, initializes logic) |
invoke <logic>.<endpoint>(args) | Run regular endpoint |
create <logic>(args) | Create an asset on an asset logic |
enlist <logic>.<endpoint>(args) | Legacy. See below |
>>> deploy Store.Init()
Execution Complete! [158 FUEL] [0xbe18...2090]
Execution Outputs |||
>>> invoke Store.Register(name: "akash", supply: 999)
Execution Complete! [344 FUEL] [0xc5c0...9d6b]
Execution Outputs |||
>>> invoke Store.GetName()
Execution Complete! [76 FUEL] [0xc370...8f69]
Execution Outputs ||| name:akash
invoke persists state: each call sees the writes of the calls before it, as GetName() does here.
A logic with state logic must be deployed before it can be invoked. Otherwise the call fails
with error: logic is not ready. must be deployed first.
enlist (legacy)
The enlist command is still accepted, but it was meant for endpoint enlist, which the compiler
rejects since v0.9.2 (see Migrating enlist endpoints).
Run against a dynamic endpoint, it behaves exactly like invoke. Use invoke instead: lab
scripts written for v0.9.1 need enlist X.Y() changed to invoke X.Y().
Invoke as Different Sender
Use as to invoke as a different user:
register robert
invoke F.Flip() as robert
The name is validated: as accepts a registered user or a compiled logic (one logic can invoke an
endpoint on another), by name or by address. Anything else is rejected with
"invalid user '<name>': not a registered user or a compiled logic" rather than running as an
actor that holds no state.
Controlling Participants
By default, all registered users are participants with write access. Use with to restrict:
# Restrict robert to read-only
invoke F.Flip() as robert with robert/read
# → error: unable to store bool: slot is read-only
Access levels: write, read, none
The level is a separate gate from the access policy: bob/read and bob/none refuse a write
into bob's state with "cannot access actor dynamically" even when bob granted storage_mutate
wide open. bob/write (the default) hands the decision back to the policy.
# Only include specific participants
invoke Logic.Transfer() with alice/write, bob/read
If with is not specified, all registered users are participants. Each name must be a registered
user.
On PISA v0.8.0, writing another actor's state requires that actor's storage_mutate grant — see
Access Control. with bob without a grant still fails with "actor is not allowed to
write into other actor's storage", and because Cocolab resolves the touched participants itself, a
grant works even without with bob.
Specifying Fuel
Each deploy and invoke accepts an optional trailing fuel <N> clause (after as/with) to override the session default for that call:
invoke F.Flip() fuel 100000
deploy F.Init() as alice with bob fuel 50000
If omitted, the call uses default.basefuel (see Default Fuel). A call that runs out of fuel reports meter exhausted.
Emitted Events
Events emitted during a deploy/invoke are printed inline beneath the result. They are shown even when the interaction fails (e.g. throw/revert or meter exhausted), so you can see what a failing transaction emitted before it aborted. Use get events afterward to re-query stored events with filters.