sayHello()
method to demonstrate the same.printf()
method can only be used for debugging. A more realistic smart contract would need to implement many more complex features.self_address
if invocation is not external)self_address
if invocation is not external)redEnvelope.cpp
.createRedEnvlope
: To create a new red envelopequeryEnvlope
: Query existing red envelope detailsclaimEnvlope
: To claim a red envelopestruct
type data before storage.ontio_assert(expr, errormsg)
, when expr
is false
, an exception is thrown and the process is quit.self_address()
method can be used to fetch the address of the invocation. The amount of token imported to the contract is based on the token type input by the user.ont::transfer
API method provided in the CDT. Other OEP-4 based tokens need to be transferred using the standard cross-contract invocation methods.claimEnvlope()
method is the only way to move an asset out of this contract. Hence, we establish that the assets stored in the contract are safe.