Store
trait enables types to be stored in and retrieved from Starknet’s contract storage.
Cairo implements Store
for most primitive types. However, collection types (arrays, dicts,
etc.) do not implement Store
directly. Instead, use specialized storage types, such as Vec
or Map
.
Store
trait:
Size
struct to be stored in a contract’s storage.
There’s no real reason to implement this trait yourself, as it can be trivially derived.
For efficiency purposes, consider manually implementing StorePacking
to optimize storage
usage.
address_domain
- The storage domain (currently only 0 is supported)base
- The base storage address to read fromaddress_domain
- The storage domain (currently only 0 is supported)base
- The base storage address to write tovalue
- The value to storeaddress_domain
- The storage domain (currently only 0 is supported)base
- The base storage addressoffset
- The offset from the base address where the value should be readaddress_domain
- The storage domain (currently only 0 is supported)base
- The base storage addressoffset
- The offset from the base address where the value should be writtenvalue
- The value to storeaddress_domain
- The storage domainbase
- The base storage address to start clearingoffset
- The offset from the base address where clearing should startsize()
function.