Check stateful annotations
Functions must be annotated as `stateful` in order to - Update the contract state (using `put`) - Call `Chain.spend` or other primitive functions that cost tokens - Call an Oracle or AENS function that requires a signature - Make a remote call with a non-zero value - Construct a lambda calling a stateful function It does not need to be stateful to - Read the contract state - Call another contract with value=0, even when the remote function is stateful
This commit is contained in:
@@ -12,7 +12,7 @@ contract Environment =
|
||||
|
||||
function init(remote) = {remote = remote}
|
||||
|
||||
function set_remote(remote) = put({remote = remote})
|
||||
stateful function set_remote(remote) = put({remote = remote})
|
||||
|
||||
// -- Information about the this contract ---
|
||||
|
||||
@@ -38,7 +38,7 @@ contract Environment =
|
||||
|
||||
// Value
|
||||
function call_value() : int = Call.value
|
||||
function nested_value(value : int) : int =
|
||||
stateful function nested_value(value : int) : int =
|
||||
state.remote.call_value(value = value / 2)
|
||||
|
||||
// Gas price
|
||||
|
||||
Reference in New Issue
Block a user