Trait StateVariable
pub trait StateVariable<let N: u32, Context> {
// Required methods
pub fn new(context: Context, storage_slot: Field) -> Self;
pub fn get_storage_slot(self) -> Field;
}
Required methods
pub fn new(context: Context, storage_slot: Field) -> Self
Initializes a new state variable at a given storage slot.
This function is automatically called within the #[storage] macro and needs to be manually called only when #[storage_no_init] is used.
pub fn get_storage_slot(self) -> Field
Returns the storage slot at which the state variable is placed. Typically used only when testing the contract or
when using a lower-level API like get_notes function.
Implementors
impl<Context, let InitialDelay: u64, let M: u32, T> StateVariable<M + 1, Context> for DelayedPublicMutable<T, InitialDelay, Context>
where
DelayedPublicMutableValues<T, InitialDelay>: Packable<N = M>
where
DelayedPublicMutableValues<T, InitialDelay>: Packable<N = M>
impl<Context, K, V> StateVariable<1, Context> for Map<K, V, Context>
impl<Context, V> StateVariable<1, Context> for Owned<V, Context>
impl<Context, let M: u32, T> StateVariable<M + 1, Context> for PublicImmutable<T, Context>
where
T: Packable<N = M>
where
T: Packable<N = M>
impl<Context, let M: u32, T> StateVariable<M, Context> for PublicMutable<T, Context>
where
T: Packable<N = M>
where
T: Packable<N = M>
A trait that defines the common interface for all Aztec state variables. State variables are variables that can be stored in the contract's storage. Examples of state variables are
Owned,PublicMutable,MaporDelayedPublicMutable.Type Parameters
N- A compile-time constant that determines how many storage slots need to be reserved for this state variable.Context- The execution context type (e.g.,PublicContext,PrivateContext,UtilityContext). The context determines which methods of the state variable are available and controls whether the variable can be accessed in public, private or utility functions.