Expand description
Functions for accessing and mutating local and global state.
Functions§
- add
- Adds
valueto the one currently underurefin the global state. - add_
contract_ version - Add version to existing Package.
- 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_versionbefore 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_urefselements). - dictionary_
get - Retrieve
valuestored underdictionary_item_keyin the dictionary accessed bydictionary_seed_uref. - dictionary_
put - Writes
valueunderdictionary_item_keyin the dictionary accessed bydictionary_seed_uref. - dictionary_
read - Reads value under
dictionary_keyin the global state. - disable_
contract_ version - Disables a specific version of a contract within the contract package identified by
contract_package_hash. Once disabled, the specified version will no longer be callable bycall_versioned_contract. Please note that the contract must have been previously created usingcreate_contractorcreate_contract_package_at_hash. - enable_
contract_ version - Enables a specific version of a contract from the contract package stored at the given hash.
Once enabled, that version of the contract becomes callable again by
call_versioned_contract. - 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_contractinstead. ifnamed_keysis provided, puts all of the included named keys into the newly created contract version’s named keys. ifhash_nameis provided, puts Key::Hash(contract_package_hash) into the installing account’s named keys underhash_name. ifuref_nameis provided, puts Key::URef(access_uref) into the installing account’s named keys underuref_name - new_
dictionary - Creates new
URefthat 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_contractinstead. ifnamed_keysis provided, puts all of the included named keys into the newly created contract version’s named keys. ifhash_nameis provided, puts Key::Hash(contract_package_hash) into the installing account’s named keys underhash_name. ifuref_nameis provided, puts Key::URef(access_uref) into the installing account’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
urefin the global state. - read_
from_ key - Reads value under
keyin the global state. - read_
or_ revert - Reads value under
urefin 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
valueunderurefin the global state.