Skip to content

Commit

Permalink
deps cleanup + updating prelude with SharedMutable
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Apr 23, 2024
1 parent 1c5f67d commit 0e0258d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/prelude.nr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
state_vars::{
map::Map, private_immutable::PrivateImmutable, private_mutable::PrivateMutable,
public_immutable::PublicImmutable, public_mutable::PublicMutable, private_set::PrivateSet,
shared_immutable::SharedImmutable, storage::Storable
shared_immutable::SharedImmutable, shared_mutable::SharedMutable, storage::Storable
},
log::emit_encrypted_log, context::{PrivateContext, PackedReturns, FunctionReturns},
note::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@ mod types;

contract TokenBlacklist {
// Libs

use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress};
use dep::aztec::{
note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader},
hash::compute_note_secret_hash,
state_vars::{Map, PublicMutable, PrivateSet, SharedMutable, SharedImmutable}
hash::poseidon2_hash,
prelude::{AztecAddress, FunctionSelector, Map, NoteGetterOptions, PrivateSet, PublicMutable, SharedMutable}
};

use dep::field_note::field_note::FieldNote;

use dep::authwit::{auth::{assert_current_call_valid_authwit, assert_current_call_valid_authwit_public}};

use crate::types::{transparent_note::TransparentNote, token_note::TokenNote, balances_map::BalancesMap, roles::UserFlags};
use crate::types::{
transparent_note::{TransparentNote, GENERATOR_INDEX__TRANSPARENT_NOTE}, token_note::TokenNote,
balances_map::BalancesMap, roles::UserFlags
};

// Changing an address' roles has a certain block delay before it goes into effect.
global CHANGE_ROLES_DELAY_BLOCKS = 5;
Expand Down Expand Up @@ -154,7 +152,7 @@ contract TokenBlacklist {
assert(!to_roles.is_blacklisted, "Blacklisted: Recipient");

let pending_shields = storage.pending_shields;
let secret_hash = compute_note_secret_hash(secret);
let secret_hash = poseidon2_hash([secret, GENERATOR_INDEX__TRANSPARENT_NOTE]);
// Get 1 note (set_limit(1)) which has amount stored in field with index 0 (select(0, amount)) and secret_hash
// stored in field with index 1 (select(1, secret_hash)).
let mut options = NoteGetterOptions::new();
Expand Down Expand Up @@ -257,4 +255,4 @@ contract TokenBlacklist {
unconstrained fn balance_of_public(owner: AztecAddress) -> pub Field {
storage.public_balances.at(owner).read().to_field()
}
}
}

0 comments on commit 0e0258d

Please sign in to comment.