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 a- b256value which represents the wallet address
- ContractIdA struct containing a- b256value which represents the ID of a contract
- Identity: An enum containing- Address&- ContractIDstructs
- Vec: A growable, heap-allocated vector
- StorageMap: A key-value mapping in contract storage
- Option: 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 containing- assert: A function that reverts the VM if the condition provided to it is false
- assert_eq: A function that reverts the VM and logs its two inputs v1 and v2 if the condition v1 == v2 is false
- assert_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 containing- require: A function that reverts and logs a given value if the condition is- false
- revert: A function that reverts
 
- log: A function that logs arbitrary stack types
- msg_sender: A function that gets the Identity from which a call was made