In order to interact with other contracts and accounts so-called operations can be emitted.
sp.transfer) are collected and executed only after the entrypoint has completed.
This means that changes in e.g. the contract balance are not reflected immediately:
@sp.entrypoint def ep(self, destination): b = sp.balance sp.transfer(sp.unit, sp.tez(5), destination) assert b == sp.balance # sp.balance is unchanged at this point
sp.transfer(argument: t, amount: sp.mutez, destination: sp.contract[t])
Call the contract at
argument while transferring
amount to it.
sp.transfer(100, sp.mutez(0), c) sp.transfer(42, sp.mutez(0), sp.self_entrypoint("abc"))
Sets the delegate.
sp.emit(event, tag="...", with_type=[True|False])
event as an event, optionally tagged with
with_type=True is given the type of
event is explicitly given in the compiled Michelson code.
sp.emit("Hello") sp.emit("World", tag="mytag") sp.emit(sp.record(a="ABC", b="XYZ"), tag="mytag2", with_type=True)