Skip to main content

Slow Updates Tree

Struct SlowMap

Overview

The SlowMap struct is used to interact with a slow updates tree deployed via the SlowTree smart contract.

Fields

NameTypeDescription
addressFieldThe address of the SlowTree contract

Functions

at

Returns an instance of SlowMap at the specified address.

Parameters

NameTypeDescription
addressAztecAddressThe address of the SlowTree

Return

NameTypeDescription
-SlowMapThe SlowMap instance

Example

slowmap_at
let slow = SlowMap::at(storage.slow_update.read_private());
Source code: noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr#L83-L85

initialize

Initializes the SlowMap.

Parameters

NameTypeDescription
contextPublicContextThe execution context

Return

NameTypeDescription
---

Example

slowmap_initialize
SlowMap::at(slow_updates_contract).initialize(&mut context);
Source code: noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr#L53-L55

read_at_pub

Reads a value at a specified index from a public function.

Parameters

NameTypeDescription
contextPublicContextThe execution context
indexFieldThe index to read at

Return

NameTypeDescription
resultFieldThe value at index

Example

read_at_pub
let to_roles = UserFlags::new(U128::from_integer(slow.read_at_pub(&mut context, to.to_field())));
Source code: noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr#L97-L99

read_at

Reads a value at a specified index from a private function.

Parameters

NameTypeDescription
contextPrivateContextThe execution context
indexFieldThe index to read at

Return

NameTypeDescription
resultFieldThe value at index

Example

slowmap_read_at
let to_roles = UserFlags::new(U128::from_integer(slow.read_at(&mut context, to.to_field())));
Source code: noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr#L195-L197

update_at_private

Updates a value at a specified index from a private function. Does not return anything.

Parameters

NameTypeDescription
contextPrivateContextThe execution context
indexFieldThe index to update
new_valueFieldThe new value

Example

get_and_update_private
let slow = SlowMap::at(storage.slow_update.read_private());
slow.update_at_private(&mut context, user.to_field(), roles);
Source code: noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr#L64-L67

Updating from public

This is not a method in the interface as it can be done using regular Aztec.nr public storage update syntax.

Example

write_slow_update_public
storage.slow_update.initialize(slow_updates_contract);
Source code: noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr#L50-L52