Standard Library Prelude
The prelude is a list of commonly used features from the standard library which is automatically imported into every Sway program.
The prelude contains the following:
Address
: A struct containing ab256
value which represents the wallet addressContractId
A struct containing ab256
value which represents the ID of a contractIdentity
: An enum containingAddress
&ContractID
structsVec
: A growable, heap-allocated vectorStorageMap
: A key-value mapping in contract storageOption
: An enum containing either some generic value<T>
or an absence of that value, we also expose the variants directly:Some
None
Result
: An enum used to represent either a success or failure of an operation, we also expose the variants directly:Ok
Err
assert
: A module containingassert
: A function that reverts the VM if the condition provided to it is falseassert_eq
: A function that reverts the VM and logs its two inputs v1 and v2 if the condition v1 == v2 is falseassert_ne
: A function that reverts the VM and logs its two inputs v1 and v2 if the condition v1 != v2 is false
revert
: A module containingrequire
: A function that reverts and logs a given value if the condition isfalse
revert
: A function that reverts
log
: A function that logs arbitrary stack typesmsg_sender
: A function that gets the Identity from which a call was made