Expand description
Functions for accessing and mutating local and global state.
Functions§
- add
- Adds
value
to the one currently underuref
in the global state. - add_
contract_ version - Add a new version of a contract to the contract stored at the given
Key
. Note that this contract must have been created bycreate_contract
orcreate_contract_package_at_hash
first. - create_
contract_ package_ at_ hash - Create a new (versioned) contract stored under a Key::Hash. Initially there
are no versions; a version must be added via
add_contract_version
before the contract can be executed. - create_
contract_ user_ group - Create a new “user group” for a (versioned) contract. User groups associate
a set of URefs with a label. Entry points on a contract can be given a list of
labels they accept and the runtime will check that a URef from at least one
of the allowed groups is present in the caller’s context before
execution. This allows access control for entry_points of a contract. This
function returns the list of new URefs created for the group (the list will
contain
num_new_urefs
elements). - dictionary_
get - Retrieve
value
stored underdictionary_item_key
in the dictionary accessed bydictionary_seed_uref
. - dictionary_
put - Writes
value
underdictionary_item_key
in the dictionary accessed bydictionary_seed_uref
. - dictionary_
read - Reads value under
dictionary_key
in the global state. - disable_
contract_ version - Disable a version of a contract from the contract stored at the given
Key
. That version of the contract will no longer be callable bycall_versioned_contract
. Note that this contract must have been created bycreate_contract
orcreate_contract_package_at_hash
first. - enable_
contract_ version - Enable a version of a contract from the contract stored at the given hash.
That version of the contract will no longer be callable by
call_versioned_contract
. Note that this contract must have been created bynew_contract
orcreate_contract_package_at_hash
first. - named_
dictionary_ get - Gets a value out of a named dictionary.
- named_
dictionary_ put - Writes a value in a named dictionary.
- new_
contract - Create a new contract stored under a Key::Hash at version 1. You may upgrade this contract in
the future; if you want a contract that is locked (i.e. cannot be upgraded) call
new_locked_contract
instead. ifnamed_keys
are provided, will apply them ifhash_name
is provided, puts contract hash in current context’s named keys underhash_name
ifuref_name
is provided, puts access_uref in current context’s named keys underuref_name
- new_
dictionary - Creates new
URef
that represents a seed for a dictionary partition of the global state and puts it under named keys. - new_
locked_ contract - Create a locked contract stored under a Key::Hash, which can never be upgraded. This is an
irreversible decision; for a contract that can be upgraded use
new_contract
instead. ifnamed_keys
are provided, will apply them ifhash_name
is provided, puts contract hash in current context’s named keys underhash_name
ifuref_name
is provided, puts access_uref in current context’s named keys underuref_name
- new_
uref - Returns a new unforgeable pointer, where the value is initialized to
init
. - provision_
contract_ user_ group_ uref - Extends specified group with a new
URef
. - read
- Reads value under
uref
in the global state. - read_
from_ key - Reads value under
key
in the global state. - read_
or_ revert - Reads value under
uref
in the global state, reverts if value not found or is notT
. - remove_
contract_ user_ group - Remove a named group from given contract.
- remove_
contract_ user_ group_ urefs - Removes specified urefs from a named group.
- write
- Writes
value
underuref
in the global state.