diff --git a/boxes/react/src/contracts/src/main.nr b/boxes/react/src/contracts/src/main.nr index e57aac08ab1..342ad0aa62a 100644 --- a/boxes/react/src/contracts/src/main.nr +++ b/boxes/react/src/contracts/src/main.nr @@ -1,8 +1,5 @@ contract BoxReact { - use dep::aztec::{ - protocol_types::address::AztecAddress, state_vars::{PrivateMutable, Map}, - note::{utils as note_utils, note_interface::NoteInterface, note_header::NoteHeader} - }; + use dep::aztec::prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader}; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/boxes/vanilla-js/src/contracts/src/main.nr b/boxes/vanilla-js/src/contracts/src/main.nr index bb374393d5d..fb08ae0a550 100644 --- a/boxes/vanilla-js/src/contracts/src/main.nr +++ b/boxes/vanilla-js/src/contracts/src/main.nr @@ -1,8 +1,5 @@ contract Vanilla { - use dep::aztec::{ - protocol_types::address::AztecAddress, state_vars::{PrivateMutable, Map}, - note::{utils as note_utils, note_interface::NoteInterface, note_header::NoteHeader} - }; + use dep::aztec::prelude::{AztecAddress, PrivateMutable, Map, NoteInterface, NoteHeader}; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr b/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr index dc04a740238..529b5e78c32 100644 --- a/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr +++ b/noir-projects/aztec-nr/authwit/src/entrypoint/app.nr @@ -1,4 +1,4 @@ -use dep::aztec::context::PrivateContext; +use dep::aztec::prelude::PrivateContext; use dep::aztec::protocol_types::{constants::GENERATOR_INDEX__SIGNATURE_PAYLOAD, hash::pedersen_hash, traits::{Hash, Serialize}}; use crate::entrypoint::function_call::{FunctionCall, FUNCTION_CALL_SIZE_IN_BYTES}; diff --git a/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr b/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr index 657d21dff30..89616efa830 100644 --- a/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr +++ b/noir-projects/aztec-nr/authwit/src/entrypoint/fee.nr @@ -1,6 +1,6 @@ -use dep::aztec::context::PrivateContext; +use dep::aztec::prelude::PrivateContext; use dep::aztec::protocol_types::{constants::GENERATOR_INDEX__FEE_PAYLOAD, hash::pedersen_hash, traits::{Hash, Serialize}}; -use crate::entrypoint::function_call::{FunctionCall}; +use crate::entrypoint::function_call::FunctionCall; // 2 * 4 (function call) + 1 global FEE_PAYLOAD_SIZE: Field = 9; diff --git a/noir-projects/aztec-nr/aztec/src/context/private_context.nr b/noir-projects/aztec-nr/aztec/src/context/private_context.nr index 7a60c69bdbf..61746bdd239 100644 --- a/noir-projects/aztec-nr/aztec/src/context/private_context.nr +++ b/noir-projects/aztec-nr/aztec/src/context/private_context.nr @@ -30,7 +30,6 @@ use dep::protocol_types::{ grumpkin_private_key::GrumpkinPrivateKey, hash::hash_args, header::Header, messaging::l2_to_l1_message::L2ToL1Message, utils::reader::Reader, traits::is_empty }; -use dep::std::option::Option; // TODO(https://github.com/AztecProtocol/aztec-packages/issues/1165) // use dep::std::collections::vec::Vec; diff --git a/noir-projects/aztec-nr/aztec/src/lib.nr b/noir-projects/aztec-nr/aztec/src/lib.nr index 2d6eeb862c9..a57f6c018b5 100644 --- a/noir-projects/aztec-nr/aztec/src/lib.nr +++ b/noir-projects/aztec-nr/aztec/src/lib.nr @@ -11,4 +11,5 @@ mod messaging; mod note; mod oracle; mod state_vars; +mod prelude; use dep::protocol_types; diff --git a/noir-projects/aztec-nr/aztec/src/note/note_getter.nr b/noir-projects/aztec-nr/aztec/src/note/note_getter.nr index a42e9f89318..25398adad28 100644 --- a/noir-projects/aztec-nr/aztec/src/note/note_getter.nr +++ b/noir-projects/aztec-nr/aztec/src/note/note_getter.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use dep::protocol_types::{ constants::{ MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, GET_NOTE_ORACLE_RETURN_LENGTH, GET_NOTES_ORACLE_RETURN_LENGTH, @@ -13,11 +12,7 @@ use crate::note::{ }; use crate::oracle; -fn check_note_header( - context: PrivateContext, - storage_slot: Field, - note: Note -) where Note: NoteInterface { +fn check_note_header(context: PrivateContext, storage_slot: Field, note: Note) where Note: NoteInterface { let header = note.get_header(); let contract_address = context.this_address(); assert(header.contract_address.eq(contract_address)); diff --git a/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr b/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr index 24c9a223ab4..b24104a2662 100644 --- a/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr +++ b/noir-projects/aztec-nr/aztec/src/note/note_getter_options.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use dep::protocol_types::{constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}; use crate::note::note_interface::NoteInterface; diff --git a/noir-projects/aztec-nr/aztec/src/note/note_viewer_options.nr b/noir-projects/aztec-nr/aztec/src/note/note_viewer_options.nr index e7fe43a66bf..97496eb7c42 100644 --- a/noir-projects/aztec-nr/aztec/src/note/note_viewer_options.nr +++ b/noir-projects/aztec-nr/aztec/src/note/note_viewer_options.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use crate::note::note_getter_options::{Select, Sort, Comparator, NoteStatus}; use dep::protocol_types::{constants::MAX_NOTES_PER_PAGE}; use crate::note::note_interface::NoteInterface; diff --git a/noir-projects/aztec-nr/aztec/src/oracle/notes.nr b/noir-projects/aztec-nr/aztec/src/oracle/notes.nr index 02194699c8f..cfad47101d2 100644 --- a/noir-projects/aztec-nr/aztec/src/oracle/notes.nr +++ b/noir-projects/aztec-nr/aztec/src/oracle/notes.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use crate::note::{note_header::NoteHeader, note_interface::NoteInterface}; use dep::protocol_types::{address::AztecAddress, utils::arr_copy_slice}; diff --git a/noir-projects/aztec-nr/aztec/src/prelude.nr b/noir-projects/aztec-nr/aztec/src/prelude.nr new file mode 100644 index 00000000000..9d65d3f1dc6 --- /dev/null +++ b/noir-projects/aztec-nr/aztec/src/prelude.nr @@ -0,0 +1,14 @@ +use dep::protocol_types::{address::{AztecAddress, EthAddress}, abis::function_selector::FunctionSelector}; +use crate::{ + state_vars::{ + map::Map, private_immutable::PrivateImmutable, private_mutable::PrivateMutable, + public_immutable::PublicImmutable, public_mutable::PublicMutable, private_set::PrivateSet, + shared_immutable::SharedImmutable +}, + log::{emit_unencrypted_log, emit_encrypted_log}, context::PrivateContext, + note::{ + note_header::NoteHeader, note_interface::NoteInterface, note_getter_options::NoteGetterOptions, + note_viewer_options::NoteViewerOptions, + utils::compute_note_hash_and_nullifier as utils_compute_note_hash_and_nullifier +} +}; diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/map.nr b/noir-projects/aztec-nr/aztec/src/state_vars/map.nr index 043c8a3f615..0deee4556df 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/map.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/map.nr @@ -1,5 +1,4 @@ use crate::context::{PrivateContext, PublicContext, Context}; -use dep::std::option::Option; use dep::protocol_types::{hash::pedersen_hash, traits::{ToField}}; use crate::state_vars::storage::Storage; diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr b/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr index 0803486551c..29772b2d600 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/private_immutable.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use dep::protocol_types::{address::AztecAddress, constants::{GENERATOR_INDEX__INITIALIZATION_NULLIFIER}, hash::pedersen_hash}; use crate::context::{PrivateContext, Context}; diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr b/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr index 14dd9609c05..6e06c66d97b 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/private_mutable.nr @@ -1,5 +1,3 @@ -use dep::std::option::Option; - use dep::protocol_types::{address::AztecAddress, constants::{GENERATOR_INDEX__INITIALIZATION_NULLIFIER}, hash::pedersen_hash}; use crate::context::{PrivateContext, PublicContext, Context}; diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr b/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr index ec0b254bb4b..b72b405d197 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/private_set.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use dep::protocol_types::{ constants::{MAX_NOTES_PER_PAGE, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}, abis::side_effect::{SideEffect, SideEffectLinkedToNoteHash} diff --git a/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr b/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr index 5c474846357..0b24bb08723 100644 --- a/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr +++ b/noir-projects/aztec-nr/aztec/src/state_vars/public_mutable.nr @@ -1,7 +1,6 @@ use crate::context::{Context}; use crate::oracle::storage::storage_read; use crate::oracle::storage::storage_write; -use dep::std::option::Option; use dep::protocol_types::traits::{Deserialize, Serialize}; use crate::state_vars::storage::Storage; diff --git a/noir-projects/aztec-nr/value-note/src/filter.nr b/noir-projects/aztec-nr/value-note/src/filter.nr index 2621ffb49f9..af5b3ee03e0 100644 --- a/noir-projects/aztec-nr/value-note/src/filter.nr +++ b/noir-projects/aztec-nr/value-note/src/filter.nr @@ -1,4 +1,3 @@ -use dep::std::option::Option; use dep::aztec::protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL; use crate::value_note::ValueNote; diff --git a/noir-projects/aztec-nr/value-note/src/utils.nr b/noir-projects/aztec-nr/value-note/src/utils.nr index 03a2fd637f3..446a00c232c 100644 --- a/noir-projects/aztec-nr/value-note/src/utils.nr +++ b/noir-projects/aztec-nr/value-note/src/utils.nr @@ -1,10 +1,7 @@ -use dep::std::option::Option; -use dep::aztec::context::PrivateContext; -use dep::aztec::note::note_getter_options::{NoteGetterOptions, SortOrder}; +use dep::aztec::prelude::{AztecAddress, PrivateContext, PrivateSet, NoteGetterOptions}; +use dep::aztec::note::note_getter_options::SortOrder; use dep::aztec::oracle::get_public_key::get_public_key; -use dep::aztec::state_vars::PrivateSet; use crate::{filter::filter_notes_min_sum, value_note::{ValueNote, VALUE_NOTE_LEN}}; -use dep::aztec::protocol_types::address::AztecAddress; // Sort the note values (0th field) in descending order. // Pick the fewest notes whose sum is equal to or greater than `amount`. diff --git a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr index 941f86472f0..234c5d0aefe 100644 --- a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr +++ b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/dapp_payload.nr @@ -1,8 +1,5 @@ -use dep::aztec::context::PrivateContext; -use dep::aztec::protocol_types::{ - constants::GENERATOR_INDEX__SIGNATURE_PAYLOAD, hash::pedersen_hash, traits::{Hash, Serialize}, - address::AztecAddress -}; +use dep::aztec::prelude::{PrivateContext, AztecAddress}; +use dep::aztec::protocol_types::{constants::GENERATOR_INDEX__SIGNATURE_PAYLOAD, hash::pedersen_hash, traits::{Hash, Serialize}}; use dep::authwit::entrypoint::function_call::{FunctionCall, FUNCTION_CALL_SIZE_IN_BYTES}; diff --git a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr index 740dab33bc5..8d53aaf5506 100644 --- a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/main.nr @@ -3,16 +3,14 @@ mod dapp_payload; contract AppSubscription { use dep::std; - use dep::std::option::Option; use crate::dapp_payload::DAppPayload; - use dep::aztec::protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}; - - use dep::aztec::{ - context::{PrivateContext, Context}, note::{note_header::NoteHeader, utils as note_utils}, - oracle::get_public_key::get_public_key, - state_vars::{Map, PrivateMutable, PublicMutable, SharedImmutable} + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, PrivateContext, NoteHeader, Map, PrivateMutable, PublicMutable, + SharedImmutable }; + + use dep::aztec::{context::Context, oracle::get_public_key::get_public_key}; use dep::authwit::{account::AccountActions, auth_witness::get_auth_witness, auth::assert_current_call_valid_authwit}; use crate::subscription_note::{SubscriptionNote, SUBSCRIPTION_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/subscription_note.nr b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/subscription_note.nr index 8bb87a798ac..3f454f7c469 100644 --- a/noir-projects/noir-contracts/contracts/app_subscription_contract/src/subscription_note.nr +++ b/noir-projects/noir-contracts/contracts/app_subscription_contract/src/subscription_note.nr @@ -1,8 +1,7 @@ +use dep::aztec::prelude::{AztecAddress, PrivateContext, NoteHeader, emit_encrypted_log, NoteInterface}; use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - hash::pedersen_hash, - oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}, - log::emit_encrypted_log, context::PrivateContext, protocol_types::{address::AztecAddress} + note::utils::compute_note_hash_for_consumption, hash::pedersen_hash, + oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key} }; global SUBSCRIPTION_NOTE_LEN: Field = 3; diff --git a/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr b/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr index 4044cdd6920..9b55d8005de 100644 --- a/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/benchmarking_contract/src/main.nr @@ -5,14 +5,13 @@ // arise from code changes. contract Benchmarking { + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, emit_unencrypted_log, Map, + PublicMutable, PrivateSet + }; use dep::value_note::{utils::{increment, decrement}, value_note::ValueNote}; - use dep::aztec::{ - protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}, - context::{Context}, - note::{utils as note_utils, note_getter_options::NoteGetterOptions, note_header::NoteHeader}, - log::emit_unencrypted_log, state_vars::{Map, PublicMutable, PrivateSet} - }; + use dep::aztec::{context::{Context}}; struct Storage { notes: Map>, diff --git a/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr b/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr index 4f66b724ff6..8df4508c0b2 100644 --- a/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr +++ b/noir-projects/noir-contracts/contracts/card_game_contract/src/cards.nr @@ -1,11 +1,8 @@ +use dep::aztec::prelude::{AztecAddress, FunctionSelector, PrivateContext, NoteHeader, NoteGetterOptions, NoteViewerOptions}; + use dep::aztec::{ - protocol_types::{address::AztecAddress, constants::{MAX_NOTES_PER_PAGE, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}}, - context::{PrivateContext, PublicContext, Context}, - note::{ - note_getter_options::NoteGetterOptions, note_viewer_options::NoteViewerOptions, - note_getter::view_notes -}, - state_vars::PrivateSet + protocol_types::constants::{MAX_NOTES_PER_PAGE, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}, + context::{PublicContext, Context}, note::note_getter::view_notes, state_vars::PrivateSet }; use dep::std; use dep::std::{option::Option}; @@ -161,7 +158,11 @@ impl Deck { global PACK_CARDS = 3; // Limited by number of write requests (max 4) -pub fn get_pack_cards(seed: Field, owner: AztecAddress, context: &mut PrivateContext) -> [Card; PACK_CARDS] { +pub fn get_pack_cards( + seed: Field, + owner: AztecAddress, + context: &mut PrivateContext +) -> [Card; PACK_CARDS] { // generate pseudo randomness deterministically from 'seed' and user secret let secret = context.request_nullifier_secret_key(owner); let mix = secret.high + secret.low + seed; diff --git a/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr b/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr index 930215d7802..e63eea84e8e 100644 --- a/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/card_game_contract/src/main.nr @@ -5,10 +5,9 @@ contract CardGame { use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress, constants::MAX_NOTES_PER_PAGE}; use dep::aztec::{context::Context, hash::pedersen_hash, state_vars::{Map, PublicMutable}}; - use dep::std::option::Option; use dep::value_note::{balance_utils, value_note::{ValueNote, VALUE_NOTE_LEN}}; - use dep::aztec::note::{note_header::NoteHeader, utils as note_utils}; + use dep::aztec::note::note_header::NoteHeader; use crate::cards::{PACK_CARDS, Deck, Card, get_pack_cards, compute_deck_strength}; use crate::game::{NUMBER_OF_PLAYERS, NUMBER_OF_CARDS_DECK, PLAYABLE_CARDS, PlayerEntry, Game, GAME_SERIALIZED_LEN}; diff --git a/noir-projects/noir-contracts/contracts/child_contract/src/main.nr b/noir-projects/noir-contracts/contracts/child_contract/src/main.nr index 315c4c7ec34..1571bfa6353 100644 --- a/noir-projects/noir-contracts/contracts/child_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/child_contract/src/main.nr @@ -1,12 +1,10 @@ // A contract used along with `Parent` contract to test nested calls. contract Child { - use dep::std::option::Option; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, PublicMutable, PrivateSet, PrivateContext, emit_unencrypted_log}; use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, log::emit_unencrypted_log, - state_vars::{PublicMutable, PrivateSet}, - protocol_types::{abis::{function_selector::FunctionSelector, call_context::CallContext}, address::AztecAddress}, - note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader, utils as note_utils} + context::{PublicContext, Context}, protocol_types::{abis::{call_context::CallContext}}, + note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader} }; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/private_function_broadcasted.nr b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/private_function_broadcasted.nr index 99092cf70e3..c2888d7430b 100644 --- a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/private_function_broadcasted.nr +++ b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/private_function_broadcasted.nr @@ -1,6 +1,7 @@ +use dep::aztec::prelude::FunctionSelector; use dep::aztec::protocol_types; use dep::aztec::protocol_types::{ - contract_class_id::ContractClassId, abis::function_selector::FunctionSelector, + contract_class_id::ContractClassId, constants::{ FUNCTION_TREE_HEIGHT, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS, diff --git a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/unconstrained_function_broadcasted.nr b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/unconstrained_function_broadcasted.nr index aeaeaeaf627..c40c52a06a4 100644 --- a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/unconstrained_function_broadcasted.nr +++ b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/events/unconstrained_function_broadcasted.nr @@ -1,6 +1,7 @@ +use dep::aztec::prelude::FunctionSelector; use dep::aztec::protocol_types; use dep::aztec::protocol_types::{ - contract_class_id::ContractClassId, abis::function_selector::FunctionSelector, + contract_class_id::ContractClassId, constants::{ ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS, REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_MAGIC_VALUE diff --git a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr index 760b4e5ff64..d1f72aa53e6 100644 --- a/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/contract_class_registerer_contract/src/main.nr @@ -2,9 +2,9 @@ mod events; mod capsule; contract ContractClassRegisterer { - use dep::std::option::Option; + use dep::aztec::prelude::{AztecAddress, EthAddress, FunctionSelector, emit_unencrypted_log}; use dep::aztec::protocol_types::{ - address::{AztecAddress, EthAddress}, contract_class_id::ContractClassId, + contract_class_id::ContractClassId, constants::{ ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, FUNCTION_TREE_HEIGHT, MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS, REGISTERER_CONTRACT_CLASS_REGISTERED_MAGIC_VALUE @@ -12,7 +12,7 @@ contract ContractClassRegisterer { traits::{Serialize} }; - use dep::aztec::log::{emit_unencrypted_log, emit_unencrypted_log_from_private}; + use dep::aztec::log::{emit_unencrypted_log_from_private}; use crate::events::{ class_registered::ContractClassRegistered, diff --git a/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr b/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr index aceccc3ab11..ba62e9b22e7 100644 --- a/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/contract_instance_deployer_contract/src/main.nr @@ -1,7 +1,6 @@ mod events; contract ContractInstanceDeployer { - use dep::std::option::Option; use dep::aztec::protocol_types::{ address::{AztecAddress, EthAddress, PublicKeysHash, PartialAddress}, contract_class_id::ContractClassId, diff --git a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr index 7782c5c3bf8..54e3bec7244 100644 --- a/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/counter_contract/src/main.nr @@ -1,10 +1,7 @@ contract Counter { // docs:start:imports - use dep::aztec::protocol_types::address::AztecAddress; - use dep::aztec::{ - context::{PrivateContext, Context}, note::{note_header::NoteHeader, utils as note_utils}, - state_vars::Map - }; + use dep::aztec::prelude::{AztecAddress, Map}; + use dep::aztec::context::Context; use dep::value_note::{balance_utils, value_note::{ValueNote, VALUE_NOTE_LEN}}; use dep::easy_private_state::EasyPrivateUint; // docs:end:imports diff --git a/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr b/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr index 928760f048f..8b45ca01741 100644 --- a/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/delegated_on_contract/src/main.nr @@ -1,16 +1,11 @@ // A contract used along with `Parent` contract to test nested calls. contract DelegatedOn { - use dep::std::option::Option; - - use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, log::emit_unencrypted_log, - state_vars::{PublicMutable, PrivateSet}, - protocol_types::{abis::{function_selector::FunctionSelector, call_context::CallContext}, address::AztecAddress}, - note::{ - note_getter_options::NoteGetterOptions, note_viewer_options::NoteViewerOptions, - utils as note_utils, note_header::NoteHeader - } + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, NoteViewerOptions, + emit_unencrypted_log, PublicMutable, PrivateSet, PrivateContext }; + + use dep::aztec::{context::{PublicContext, Context}, protocol_types::abis::call_context::CallContext}; use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; struct Storage { diff --git a/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr b/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr index d93629e4fea..fde7188bc23 100644 --- a/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/delegator_contract/src/main.nr @@ -1,12 +1,10 @@ // A contract used along with `Parent` contract to test nested calls. contract Delegator { - use dep::std::option::Option; - - use dep::aztec::{ - log::emit_unencrypted_log, state_vars::{PublicMutable, PrivateSet}, - protocol_types::{abis::{function_selector::FunctionSelector}, address::AztecAddress}, - note::{note_viewer_options::NoteViewerOptions, utils as note_utils, note_header::NoteHeader} + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteViewerOptions, emit_unencrypted_log, + PublicMutable, PrivateSet }; + use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN}; struct Storage { @@ -66,6 +64,6 @@ contract Delegator { serialized_note: [Field; VALUE_NOTE_LEN] ) -> pub [Field; 4] { let note_header = NoteHeader::new(contract_address, nonce, storage_slot); - note_utils::compute_note_hash_and_nullifier(ValueNote::deserialize_content, note_header, serialized_note) + dep::aztec::note::utils::compute_note_hash_and_nullifier(ValueNote::deserialize_content, note_header, serialized_note) } } diff --git a/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr b/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr index de6e6b629db..7378f2b6139 100644 --- a/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/docs_example_contract/src/main.nr @@ -13,15 +13,12 @@ mod types; contract DocsExample { // how to import dependencies defined in your workspace - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}; - use dep::aztec::{ - note::{ - note_header::NoteHeader, note_getter_options::{NoteGetterOptions, Comparator}, - note_viewer_options::{NoteViewerOptions}, utils as note_utils - }, - context::{PrivateContext, PublicContext, Context}, - state_vars::{Map, PublicMutable, PublicImmutable, PrivateMutable, PrivateImmutable, PrivateSet, SharedImmutable} + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, NoteViewerOptions, + PrivateContext, Map, PublicMutable, PublicImmutable, PrivateMutable, PrivateImmutable, + PrivateSet, SharedImmutable }; + use dep::aztec::{note::note_getter_options::Comparator, context::{PublicContext, Context}}; // how to import methods from other files/folders within your workspace use crate::options::create_account_card_getter_options; use crate::types::{card_note::{CardNote, CARD_NOTE_LEN}, leader::Leader}; diff --git a/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr b/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr index 362828f7ce7..7083ff65f75 100644 --- a/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr +++ b/noir-projects/noir-contracts/contracts/docs_example_contract/src/options.nr @@ -1,7 +1,8 @@ use crate::types::card_note::{CardNote, CARD_NOTE_LEN}; -use dep::aztec::protocol_types::{address::AztecAddress, constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}; -use dep::aztec::note::note_getter_options::{NoteGetterOptions, Sort, SortOrder}; -use dep::std::option::Option; +use dep::aztec::prelude::{AztecAddress, NoteGetterOptions}; + +use dep::aztec::protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL; +use dep::aztec::note::note_getter_options::{Sort, SortOrder}; // Shows how to use NoteGetterOptions and query for notes. diff --git a/noir-projects/noir-contracts/contracts/docs_example_contract/src/types/card_note.nr b/noir-projects/noir-contracts/contracts/docs_example_contract/src/types/card_note.nr index 356e6421c21..6d9add2ee86 100644 --- a/noir-projects/noir-contracts/contracts/docs_example_contract/src/types/card_note.nr +++ b/noir-projects/noir-contracts/contracts/docs_example_contract/src/types/card_note.nr @@ -1,8 +1,8 @@ +use dep::aztec::prelude::{AztecAddress, NoteInterface, NoteHeader, PrivateContext, emit_encrypted_log}; use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, + note::{utils::compute_note_hash_for_consumption}, oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}, - log::emit_encrypted_log, hash::pedersen_hash, context::PrivateContext, - protocol_types::{address::AztecAddress, traits::Empty} + hash::pedersen_hash, protocol_types::traits::Empty }; // Shows how to create a custom note diff --git a/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr b/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr index 0acb8c4e028..12261322cf0 100644 --- a/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr @@ -1,7 +1,6 @@ // docs:start:easy_private_token_contract contract EasyPrivateToken { - use dep::aztec::protocol_types::address::AztecAddress; - use dep::aztec::{note::{note_header::NoteHeader, utils as note_utils}, state_vars::Map}; + use dep::aztec::prelude::{AztecAddress, NoteHeader, Map}; use dep::value_note::{balance_utils, value_note::ValueNote}; use dep::easy_private_state::EasyPrivateUint; diff --git a/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr b/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr index 5a25136195d..86991286193 100644 --- a/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/easy_private_voting_contract/src/main.nr @@ -1,9 +1,10 @@ contract EasyPrivateVoting { // docs:start:imports - use dep::aztec::{ - protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}, - context::{PrivateContext, Context}, state_vars::{Map, PublicMutable} + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteInterface, NoteGetterOptions, PrivateContext, + Map, PublicMutable }; + use dep::aztec::context::Context; // docs:end:imports // docs:start:storage_struct struct Storage { diff --git a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr b/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr index 1ac71be5690..992dd56b5a6 100644 --- a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr +++ b/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/ecdsa_public_key_note.nr @@ -1,8 +1,12 @@ -use dep::aztec::protocol_types::address::AztecAddress; +use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteInterface, NoteGetterOptions, PrivateContext, + emit_encrypted_log +}; + use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, + note::utils::compute_note_hash_for_consumption, oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}, - log::emit_encrypted_log, hash::pedersen_hash, context::PrivateContext + hash::pedersen_hash }; global ECDSA_PUBLIC_KEY_NOTE_LEN: Field = 5; diff --git a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr index 3ab9a2edfcd..94bdd54d3d8 100644 --- a/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/ecdsa_account_contract/src/main.nr @@ -3,14 +3,12 @@ mod ecdsa_public_key_note; // Account contract that uses ECDSA signatures for authentication on the same curve as Ethereum. // The signing key is stored in an immutable private note and should be different from the signing key. contract EcdsaAccount { - use dep::aztec::protocol_types::{abis::{call_context::CallContext, function_selector::FunctionSelector}, address::AztecAddress}; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, PrivateImmutable}; + + use dep::aztec::protocol_types::abis::call_context::CallContext; use dep::std; - use dep::std::option::Option; - use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, - note::{note_header::NoteHeader, utils as note_utils}, oracle::get_public_key::get_public_key, - state_vars::PrivateImmutable - }; + + use dep::aztec::{context::{PublicContext, Context}, oracle::get_public_key::get_public_key}; use dep::authwit::{ entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions, auth_witness::get_auth_witness diff --git a/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr b/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr index db9c51eab85..e8c8f968adf 100644 --- a/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/escrow_contract/src/main.nr @@ -1,14 +1,8 @@ // Sample escrow contract that stores a balance of a private token on behalf of an owner. contract Escrow { - use dep::std::option::Option; + use dep::aztec::prelude::{AztecAddress, EthAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, PrivateSet}; - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}; - - use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, - note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader, utils as note_utils}, - oracle::get_public_key::get_public_key, state_vars::PrivateSet - }; + use dep::aztec::{context::{PublicContext, Context}, oracle::get_public_key::get_public_key}; use dep::address_note::address_note::{AddressNote, ADDRESS_NOTE_LEN}; diff --git a/noir-projects/noir-contracts/contracts/fpc_contract/src/interfaces.nr b/noir-projects/noir-contracts/contracts/fpc_contract/src/interfaces.nr index 0c49a06111f..717c8223f0e 100644 --- a/noir-projects/noir-contracts/contracts/fpc_contract/src/interfaces.nr +++ b/noir-projects/noir-contracts/contracts/fpc_contract/src/interfaces.nr @@ -1,6 +1,7 @@ -use dep::aztec::context::{PrivateContext, PublicContext}; +use dep::aztec::prelude::{AztecAddress, EthAddress, FunctionSelector, PrivateContext}; +use dep::aztec::context::PublicContext; -use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress, constants::RETURN_VALUES_LENGTH}; +use dep::aztec::protocol_types::constants::RETURN_VALUES_LENGTH; struct Token { address: AztecAddress, diff --git a/noir-projects/noir-contracts/contracts/gas_token_contract/src/lib.nr b/noir-projects/noir-contracts/contracts/gas_token_contract/src/lib.nr index 9d7dbf3b74e..5210894d79f 100644 --- a/noir-projects/noir-contracts/contracts/gas_token_contract/src/lib.nr +++ b/noir-projects/noir-contracts/contracts/gas_token_contract/src/lib.nr @@ -1,5 +1,6 @@ +use dep::aztec::prelude::{AztecAddress, EthAddress}; use dep::aztec::context::PublicContext; -use dep::aztec::protocol_types::{address::{AztecAddress, EthAddress}, hash::sha256_to_field}; +use dep::aztec::protocol_types::hash::sha256_to_field; pub fn calculate_fee(_context: PublicContext) -> U128 { U128::from_integer(1) diff --git a/noir-projects/noir-contracts/contracts/import_test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/import_test_contract/src/main.nr index e575b117ae9..0c06ea7e276 100644 --- a/noir-projects/noir-contracts/contracts/import_test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/import_test_contract/src/main.nr @@ -3,7 +3,8 @@ mod test_contract_interface; // Contract that uses the autogenerated interface of the Test contract for calling its functions. // Used for testing calling into other contracts via autogenerated interfaces. contract ImportTest { - use dep::aztec::protocol_types::address::AztecAddress; + use dep::aztec::prelude::AztecAddress; + use crate::test_contract_interface::{ TestPrivateContextInterface, TestPublicContextInterface, AStructTestCodeGenStruct, ADeepStructTestCodeGenStruct, ANoteADeepStructTestCodeGenStruct, diff --git a/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr b/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr index 2ca5b2111e6..cc272615374 100644 --- a/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr @@ -1,16 +1,12 @@ // A demonstration of inclusion and non-inclusion proofs. contract InclusionProofs { - use dep::aztec::protocol_types::{ - abis::function_selector::FunctionSelector, address::{AztecAddress, EthAddress}, - grumpkin_point::GrumpkinPoint, contract_class_id::ContractClassId - }; - use dep::aztec::{ - state_vars::{Map, PrivateSet, PublicMutable}, context::Context, - note::{ - note_getter_options::NoteGetterOptions, note_getter_options::NoteStatus, - note_header::NoteHeader, utils as note_utils - } + use dep::aztec::prelude::{ + AztecAddress, EthAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, Map, + PrivateSet, PublicMutable }; + + use dep::aztec::protocol_types::{grumpkin_point::GrumpkinPoint, contract_class_id::ContractClassId}; + use dep::aztec::{context::Context, note::note_getter_options::NoteStatus}; // docs:start:imports use dep::aztec::history::{ contract_inclusion::{prove_contract_inclusion, prove_contract_inclusion_at}, diff --git a/noir-projects/noir-contracts/contracts/lending_contract/src/asset.nr b/noir-projects/noir-contracts/contracts/lending_contract/src/asset.nr index 88f95f6e848..5dc8cb7f300 100644 --- a/noir-projects/noir-contracts/contracts/lending_contract/src/asset.nr +++ b/noir-projects/noir-contracts/contracts/lending_contract/src/asset.nr @@ -1,4 +1,5 @@ -use dep::aztec::protocol_types::{address::AztecAddress, traits::{Deserialize, Serialize}}; +use dep::aztec::prelude::AztecAddress; +use dep::aztec::protocol_types::traits::{Deserialize, Serialize}; // Struct to be used to represent "totals". Generally, there should be one per asset. // It stores the global values that are shared among all users, such as an accumulator diff --git a/noir-projects/noir-contracts/contracts/lending_contract/src/interfaces.nr b/noir-projects/noir-contracts/contracts/lending_contract/src/interfaces.nr index 631f5eed5ca..7593f8353d2 100644 --- a/noir-projects/noir-contracts/contracts/lending_contract/src/interfaces.nr +++ b/noir-projects/noir-contracts/contracts/lending_contract/src/interfaces.nr @@ -1,7 +1,9 @@ -use dep::aztec::context::{PrivateContext, PublicContext}; +use dep::aztec::prelude::{FunctionSelector, AztecAddress, PrivateContext}; + +use dep::aztec::context::PublicContext; +use dep::aztec::protocol_types::constants::RETURN_VALUES_LENGTH; use crate::asset::Asset; -use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress, constants::RETURN_VALUES_LENGTH}; struct PriceFeed { address: AztecAddress, diff --git a/noir-projects/noir-contracts/contracts/lending_contract/src/main.nr b/noir-projects/noir-contracts/contracts/lending_contract/src/main.nr index 7a6e6d1376c..7ed23878394 100644 --- a/noir-projects/noir-contracts/contracts/lending_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/lending_contract/src/main.nr @@ -11,9 +11,9 @@ mod interfaces; // - A way to repay all debt at once // - Liquidations contract Lending { - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}; - use dep::std::option::Option; - use dep::aztec::{context::{PrivateContext, PublicContext, Context}, state_vars::{Map, PublicMutable}}; + use dep::aztec::prelude::{FunctionSelector, AztecAddress, PrivateContext, Map, PublicMutable}; + use dep::aztec::context::{PublicContext, Context}; + use crate::asset::Asset; use crate::interest_math::compute_multiplier; use crate::helpers::{covered_by_collateral, DebtReturn, debt_updates, debt_value, compute_identifier}; diff --git a/noir-projects/noir-contracts/contracts/parent_contract/src/main.nr b/noir-projects/noir-contracts/contracts/parent_contract/src/main.nr index b89dcb83d39..056ba803ec7 100644 --- a/noir-projects/noir-contracts/contracts/parent_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/parent_contract/src/main.nr @@ -1,6 +1,6 @@ // A contract used along with `Child` contract to test nested calls. contract Parent { - use dep::aztec::protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}; + use dep::aztec::prelude::{AztecAddress, FunctionSelector}; #[aztec(private)] fn constructor() {} diff --git a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr index 4115f9c34c7..6983d1db955 100644 --- a/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/pending_note_hashes_contract/src/main.nr @@ -4,14 +4,12 @@ // be read/nullified before their creation etc. contract PendingNoteHashes { // Libs - use dep::std::option::Option; - use dep::value_note::{balance_utils, filter::filter_notes_min_sum, value_note::{VALUE_NOTE_LEN, ValueNote}}; - use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, log::emit_encrypted_log, - note::{note_getter::NoteGetterOptions, note_header::NoteHeader, utils as note_utils}, - state_vars::{Map, PrivateSet} + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteGetterOptions, PrivateContext, Map, PrivateSet, + emit_encrypted_log }; - use dep::aztec::protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}; + use dep::value_note::{balance_utils, filter::filter_notes_min_sum, value_note::{VALUE_NOTE_LEN, ValueNote}}; + use dep::aztec::context::{PublicContext, Context}; struct Storage { balances: Map>, diff --git a/noir-projects/noir-contracts/contracts/price_feed_contract/src/main.nr b/noir-projects/noir-contracts/contracts/price_feed_contract/src/main.nr index afd14a72400..4741a390917 100644 --- a/noir-projects/noir-contracts/contracts/price_feed_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/price_feed_contract/src/main.nr @@ -1,9 +1,8 @@ mod asset; contract PriceFeed { - use dep::std::option::Option; - use dep::aztec::{context::{PrivateContext, PublicContext, Context}, state_vars::{Map, PublicMutable}}; - use dep::aztec::protocol_types::address::AztecAddress; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, PrivateContext, Map, PublicMutable}; + use dep::aztec::{context::{PublicContext, Context}}; use crate::asset::Asset; // Storage structure, containing all storage, and specifying what slots they use. diff --git a/noir-projects/noir-contracts/contracts/reader_contract/src/main.nr b/noir-projects/noir-contracts/contracts/reader_contract/src/main.nr index cfe709c3ee8..058c26129b5 100644 --- a/noir-projects/noir-contracts/contracts/reader_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/reader_contract/src/main.nr @@ -1,5 +1,5 @@ contract Reader { - use dep::aztec::protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}; + use dep::aztec::prelude::{AztecAddress, FunctionSelector}; use dep::compressed_string::FieldCompressedString; diff --git a/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr index 5717762a7c1..7d122947eb5 100644 --- a/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/main.nr @@ -4,14 +4,10 @@ mod public_key_note; // The signing key is stored in an immutable private note and should be different from the encryption/nullifying key. contract SchnorrAccount { use dep::std; - use dep::std::option::Option; - use dep::aztec::protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, NoteHeader, PrivateContext, PrivateImmutable}; - use dep::aztec::{ - context::{PrivateContext, Context}, note::{note_header::NoteHeader, utils as note_utils}, - oracle::get_public_key::get_public_key, state_vars::PrivateImmutable - }; + use dep::aztec::{context::Context, oracle::get_public_key::get_public_key}; use dep::authwit::{ entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions, auth_witness::get_auth_witness diff --git a/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/public_key_note.nr b/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/public_key_note.nr index d552a44f4a0..7b55db4476c 100644 --- a/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/public_key_note.nr +++ b/noir-projects/noir-contracts/contracts/schnorr_account_contract/src/public_key_note.nr @@ -1,8 +1,7 @@ +use dep::aztec::prelude::{AztecAddress, NoteHeader, NoteInterface, PrivateContext, emit_encrypted_log}; use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - hash::pedersen_hash, - oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}, - log::emit_encrypted_log, context::PrivateContext, protocol_types::{address::AztecAddress} + note::utils::compute_note_hash_for_consumption, hash::pedersen_hash, + oracle::{nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key} }; global PUBLIC_KEY_NOTE_LEN: Field = 3; diff --git a/noir-projects/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr index dc1d8912af6..5411e14a692 100644 --- a/noir-projects/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/schnorr_hardcoded_account_contract/src/main.nr @@ -2,10 +2,7 @@ // Account contract that uses Schnorr signatures for authentication using a hardcoded public key. contract SchnorrHardcodedAccount { use dep::std; - use dep::aztec::{ - context::PrivateContext, - protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector} - }; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, PrivateContext}; use dep::authwit::{ entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions, diff --git a/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/main.nr b/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/main.nr index cdaf950180f..ed6bfef6352 100644 --- a/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/main.nr @@ -2,10 +2,7 @@ mod util; mod auth_oracle; contract SchnorrSingleKeyAccount { - use dep::aztec::{ - context::{PrivateContext}, - protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector} - }; + use dep::aztec::prelude::{AztecAddress, FunctionSelector, PrivateContext}; use dep::authwit::{entrypoint::{app::AppPayload, fee::FeePayload}, account::AccountActions}; diff --git a/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/util.nr b/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/util.nr index fff77376e94..f30cdc2bd18 100644 --- a/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/util.nr +++ b/noir-projects/noir-contracts/contracts/schnorr_single_key_account_contract/src/util.nr @@ -1,4 +1,5 @@ -use dep::aztec::protocol_types::address::{AztecAddress, PublicKeysHash}; +use dep::aztec::prelude::AztecAddress; +use dep::aztec::protocol_types::address::PublicKeysHash; use dep::std::{schnorr::verify_signature}; use crate::auth_oracle::{AuthWitness}; diff --git a/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr b/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr index 5161f7b04db..7962e69f110 100644 --- a/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/slow_tree_contract/src/main.nr @@ -7,15 +7,13 @@ mod types; // This is made as a separate contract for one thing mainly. Making it simpler to use. // TODO(#4760): Rename slow updates to shared mutable and ideally move the impl to state-vars in aztec-nr. contract SlowTree { - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}; - use dep::std::option::Option; - use dep::value_note::{balance_utils, utils::{increment, decrement}, value_note::ValueNote}; - use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, - note::{note_header::NoteHeader, utils as note_utils}, - state_vars::{Map, PublicMutable, PrivateSet}, - protocol_types::type_serialization::FIELD_SERIALIZED_LEN + use dep::aztec::prelude::{ + AztecAddress, FunctionSelector, NoteHeader, NoteInterface, NoteViewerOptions, PrivateContext, + Map, PublicMutable, PrivateSet }; + + use dep::value_note::{balance_utils, utils::{increment, decrement}, value_note::ValueNote}; + use dep::aztec::{context::{PublicContext, Context}, protocol_types::type_serialization::FIELD_SERIALIZED_LEN}; use dep::slow_updates_tree::{SlowMap, Leaf, SlowUpdateProof, compute_merkle_root, deserialize_slow_update_proof}; // docs:start:import_pop_capsule diff --git a/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr index 587f7713fd8..6e51a861eea 100644 --- a/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/stateful_test_contract/src/main.nr @@ -1,15 +1,11 @@ // A contract used for testing a random hodgepodge of small features from simulator and end-to-end tests. contract StatefulTest { - use dep::std::option::Option; + use dep::aztec::prelude::{PrivateContext, NoteHeader, Map, PublicMutable, PrivateSet, AztecAddress, FunctionSelector}; use dep::value_note::{balance_utils, utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote}}; use dep::aztec::{ - deploy::{deploy_contract as aztec_deploy_contract}, - context::{PrivateContext, PublicContext, Context}, - note::{note_header::NoteHeader, utils as note_utils}, - state_vars::{Map, PublicMutable, PrivateSet}, + deploy::{deploy_contract as aztec_deploy_contract}, context::{PublicContext, Context}, oracle::get_contract_instance::get_contract_instance, - initializer::{mark_as_initialized, assert_is_initialized}, - protocol_types::{address::AztecAddress, abis::function_selector::FunctionSelector}, + initializer::{mark_as_initialized, assert_is_initialized} }; struct Storage { @@ -65,7 +61,6 @@ contract StatefulTest { increment(recipient_notes, amount, recipient); } - #[aztec(public)] fn increment_public_value(owner: AztecAddress, value: Field) { assert_is_initialized(&mut context); @@ -89,4 +84,4 @@ contract StatefulTest { unconstrained fn get_public_value(owner: AztecAddress) -> pub Field { storage.public_values.at(owner).read() } -} \ No newline at end of file +} diff --git a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr index 771a301cbe7..34943b7cedc 100644 --- a/noir-projects/noir-contracts/contracts/test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/test_contract/src/main.nr @@ -1,27 +1,28 @@ // A contract used for testing a random hodgepodge of small features from simulator and end-to-end tests. contract Test { - use dep::std::option::Option; + use dep::aztec::prelude::{ + AztecAddress, EthAddress, NoteHeader, NoteGetterOptions, NoteViewerOptions, PrivateContext, + PrivateImmutable, PrivateSet + }; + use dep::aztec::protocol_types::{ abis::private_circuit_public_inputs::PrivateCircuitPublicInputs, - address::{AztecAddress, EthAddress}, constants::{MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NOTES_PER_PAGE}, hash::hash_args }; // docs:start:unencrypted_import - use dep::aztec::log::emit_unencrypted_log; + use dep::aztec::prelude::emit_unencrypted_log; // docs:end:unencrypted_import use dep::aztec::{ - context::{Context, inputs::private_context_inputs::PrivateContextInputs}, + context::{Context, inputs::private_context_inputs::PrivateContextInputs}, hash::{pedersen_hash, compute_secret_hash}, - context::PrivateContext, note::{ - note_header::NoteHeader, utils as note_utils, lifecycle::{create_note, destroy_note}, - note_getter::{get_notes, view_notes}, note_getter_options::{NoteGetterOptions, NoteStatus}, - note_viewer_options::NoteViewerOptions + lifecycle::{create_note, destroy_note}, note_getter::{get_notes, view_notes}, + note_getter_options::NoteStatus }, deploy::{deploy_contract as aztec_deploy_contract}, oracle::{get_public_key::get_public_key as get_public_key_oracle, context::get_portal_address, rand::rand}, - state_vars::{PrivateImmutable, PrivateSet}, log::emit_unencrypted_log_from_private + log::emit_unencrypted_log_from_private }; use dep::token_portal_content_hash_lib::{get_mint_private_content_hash, get_mint_public_content_hash}; use dep::field_note::field_note::FieldNote; diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr index 34928ebc3d9..7bf5cd8bca4 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/main.nr @@ -14,11 +14,10 @@ mod interfaces; contract TokenBlacklist { // Libs - use dep::std::option::Option; use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress}; use dep::aztec::{ - note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader, utils as note_utils}, + note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, hash::{compute_secret_hash}, state_vars::{Map, PublicMutable, PrivateSet, SharedImmutable} }; diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr index 95653508f0d..c14dfadf4c3 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/balances_map.nr @@ -1,12 +1,7 @@ -use dep::std::option::Option; +use dep::aztec::prelude::{AztecAddress, NoteHeader, NoteInterface, NoteGetterOptions, NoteViewerOptions, PrivateSet, Map}; use dep::aztec::{ - context::Context, - protocol_types::{address::AztecAddress, constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}, - state_vars::{PrivateSet, Map}, - note::{ - note_getter::view_notes, note_getter_options::{NoteGetterOptions, SortOrder}, - note_viewer_options::NoteViewerOptions, note_header::NoteHeader, note_interface::NoteInterface -} + context::Context, protocol_types::{constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}, + note::{note_getter::view_notes, note_getter_options::SortOrder} }; use crate::types::token_note::{TokenNote, OwnedNote}; @@ -26,7 +21,10 @@ impl BalancesMap { } } - unconstrained pub fn balance_of(self: Self, owner: AztecAddress) -> U128 where T: NoteInterface + OwnedNote { + unconstrained pub fn balance_of( + self: Self, + owner: AztecAddress + ) -> U128 where T: NoteInterface + OwnedNote { self.balance_of_with_offset(owner, 0) } diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/roles.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/roles.nr index 57dab6e890d..8f010dc43b6 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/roles.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/roles.nr @@ -10,33 +10,29 @@ struct UserFlags { impl UserFlags { - pub fn new(value: U128) -> Self { - let is_admin = value & ADMIN_FLAG == ADMIN_FLAG; - let is_minter = value & MINTER_FLAG == MINTER_FLAG; - let is_blacklisted = value & BLACKLIST_FLAG == BLACKLIST_FLAG; - - Self { - is_admin, - is_minter, - is_blacklisted, + pub fn new(value: U128) -> Self { + let is_admin = value & ADMIN_FLAG == ADMIN_FLAG; + let is_minter = value & MINTER_FLAG == MINTER_FLAG; + let is_blacklisted = value & BLACKLIST_FLAG == BLACKLIST_FLAG; + + Self { is_admin, is_minter, is_blacklisted } } - } - pub fn get_value(self) -> U128 { - let mut value: U128 = U128::from_integer(0); + pub fn get_value(self) -> U128 { + let mut value: U128 = U128::from_integer(0); - if self.is_admin { - value = value | ADMIN_FLAG; - } + if self.is_admin { + value = value | ADMIN_FLAG; + } - if self.is_minter { - value = value | MINTER_FLAG; - } + if self.is_minter { + value = value | MINTER_FLAG; + } - if self.is_blacklisted { - value = value | BLACKLIST_FLAG; - } + if self.is_blacklisted { + value = value | BLACKLIST_FLAG; + } - value - } + value + } } diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/token_note.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/token_note.nr index c9233038f30..ee921232453 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/token_note.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/token_note.nr @@ -1,10 +1,6 @@ -use dep::aztec::{ - protocol_types::address::AztecAddress, - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - context::PrivateContext, log::emit_encrypted_log, hash::pedersen_hash -}; +use dep::aztec::prelude::{AztecAddress, NoteHeader, NoteInterface, PrivateContext, emit_encrypted_log}; +use dep::aztec::{note::utils::compute_note_hash_for_consumption, hash::pedersen_hash}; use dep::aztec::oracle::{rand::rand, nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}; -use dep::std::option::Option; trait OwnedNote { fn new(amount: U128, owner: AztecAddress) -> Self; diff --git a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/transparent_note.nr b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/transparent_note.nr index a444d27df26..1f7136d8004 100644 --- a/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/transparent_note.nr +++ b/noir-projects/noir-contracts/contracts/token_blacklist_contract/src/types/transparent_note.nr @@ -1,8 +1,6 @@ // docs:start:token_types_all -use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - hash::{compute_secret_hash, pedersen_hash}, context::PrivateContext -}; +use dep::aztec::prelude::{NoteHeader, NoteInterface, PrivateContext}; +use dep::aztec::{note::utils::compute_note_hash_for_consumption, hash::{compute_secret_hash, pedersen_hash}}; global TRANSPARENT_NOTE_LEN: Field = 2; @@ -86,4 +84,4 @@ impl TransparentNote { assert(self.secret_hash == hash); } } -// docs:end:token_types_all \ No newline at end of file +// docs:end:token_types_all diff --git a/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr index 352d86e1980..22274097e2d 100644 --- a/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_bridge_contract/src/main.nr @@ -7,9 +7,9 @@ mod token_interface; // Bridge has to be set as a minter on the token before it can be used contract TokenBridge { - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::{AztecAddress, EthAddress}}; + use dep::aztec::prelude::{FunctionSelector, AztecAddress, EthAddress, PublicMutable}; - use dep::aztec::{context::{Context}, hash::{compute_secret_hash}, state_vars::{PublicMutable}}; + use dep::aztec::{context::Context, hash::compute_secret_hash}; use dep::token_portal_content_hash_lib::{get_mint_public_content_hash, get_mint_private_content_hash, get_withdraw_content_hash}; diff --git a/noir-projects/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr b/noir-projects/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr index 4f0ef61e978..26c852a58bb 100644 --- a/noir-projects/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr +++ b/noir-projects/noir-contracts/contracts/token_bridge_contract/src/token_interface.nr @@ -1,6 +1,6 @@ // docs:start:token_bridge_token_interface -use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::{AztecAddress, EthAddress}}; -use dep::aztec::{context::{PrivateContext, PublicContext, Context}}; +use dep::aztec::prelude::{FunctionSelector, AztecAddress, EthAddress, PrivateContext}; +use dep::aztec::context::{PublicContext, Context}; struct Token { address: AztecAddress, diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr index b1a37a66a77..79f9d70bd71 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/main.nr @@ -11,15 +11,14 @@ mod types; contract Token { // Libs - use dep::std::option::Option; use dep::compressed_string::FieldCompressedString; - use dep::aztec::{ - note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader, utils as note_utils}, - hash::{compute_secret_hash}, state_vars::{Map, PublicMutable, SharedImmutable, PrivateSet}, - protocol_types::{abis::function_selector::FunctionSelector, address::AztecAddress} + use dep::aztec::prelude::{ + NoteGetterOptions, NoteHeader, Map, PublicMutable, SharedImmutable, PrivateSet, + FunctionSelector, AztecAddress }; + use dep::aztec::hash::compute_secret_hash; // docs:start:import_authwit use dep::authwit::{auth::{assert_current_call_valid_authwit, assert_current_call_valid_authwit_public}}; diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr b/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr index 740d328413f..0736abbab62 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/types/balances_map.nr @@ -1,12 +1,11 @@ -use dep::std::option::Option; +use dep::aztec::prelude::{ + AztecAddress, NoteGetterOptions, NoteViewerOptions, NoteHeader, NoteInterface, PrivateContext, + PrivateSet, Map, emit_encrypted_log +}; use dep::aztec::{ - context::{PrivateContext, PublicContext, Context}, hash::pedersen_hash, - protocol_types::{address::AztecAddress, constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}, - state_vars::{PrivateSet, Map}, - note::{ - note_getter::view_notes, note_getter_options::{NoteGetterOptions, SortOrder}, - note_viewer_options::NoteViewerOptions, note_header::NoteHeader, note_interface::NoteInterface -} + context::{PublicContext, Context}, hash::pedersen_hash, + protocol_types::constants::MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, + note::{note_getter::view_notes, note_getter_options::SortOrder} }; use crate::types::token_note::{TokenNote, OwnedNote}; @@ -26,7 +25,10 @@ impl BalancesMap { } } - unconstrained pub fn balance_of(self: Self, owner: AztecAddress) -> U128 where T: NoteInterface + OwnedNote { + unconstrained pub fn balance_of( + self: Self, + owner: AztecAddress + ) -> U128 where T: NoteInterface + OwnedNote { self.balance_of_with_offset(owner, 0) } diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr b/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr index c9233038f30..37179b2f326 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/types/token_note.nr @@ -1,10 +1,9 @@ -use dep::aztec::{ - protocol_types::address::AztecAddress, - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - context::PrivateContext, log::emit_encrypted_log, hash::pedersen_hash +use dep::aztec::prelude::{ + AztecAddress, NoteInterface, NoteGetterOptions, NoteViewerOptions, NoteHeader, PrivateContext, + PrivateSet, Map, emit_encrypted_log }; +use dep::aztec::{note::utils::compute_note_hash_for_consumption, hash::pedersen_hash}; use dep::aztec::oracle::{rand::rand, nullifier_key::get_nullifier_secret_key, get_public_key::get_public_key}; -use dep::std::option::Option; trait OwnedNote { fn new(amount: U128, owner: AztecAddress) -> Self; diff --git a/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr b/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr index a444d27df26..79f059b20c2 100644 --- a/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr +++ b/noir-projects/noir-contracts/contracts/token_contract/src/types/transparent_note.nr @@ -1,8 +1,6 @@ // docs:start:token_types_all -use dep::aztec::{ - note::{note_header::NoteHeader, note_interface::NoteInterface, utils::compute_note_hash_for_consumption}, - hash::{compute_secret_hash, pedersen_hash}, context::PrivateContext -}; +use dep::aztec::prelude::{NoteHeader, NoteInterface, PrivateContext}; +use dep::aztec::{note::{utils::compute_note_hash_for_consumption}, hash::{compute_secret_hash, pedersen_hash}}; global TRANSPARENT_NOTE_LEN: Field = 2; @@ -86,4 +84,4 @@ impl TransparentNote { assert(self.secret_hash == hash); } } -// docs:end:token_types_all \ No newline at end of file +// docs:end:token_types_all diff --git a/noir-projects/noir-contracts/contracts/token_portal_content_hash_lib/src/lib.nr b/noir-projects/noir-contracts/contracts/token_portal_content_hash_lib/src/lib.nr index 2106b0a585d..f0bda067f1f 100644 --- a/noir-projects/noir-contracts/contracts/token_portal_content_hash_lib/src/lib.nr +++ b/noir-projects/noir-contracts/contracts/token_portal_content_hash_lib/src/lib.nr @@ -1,16 +1,10 @@ // docs:start:mint_public_content_hash_nr -use dep::aztec::protocol_types::{ - address::{ - AztecAddress, - EthAddress, - }, - hash::sha256_to_field, -}; +use dep::aztec::prelude::{AztecAddress, EthAddress}; +use dep::aztec::protocol_types::hash::sha256_to_field; // Computes a content hash of a deposit/mint_public message. // Refer TokenPortal.sol for reference on L1. pub fn get_mint_public_content_hash(owner: AztecAddress, amount: Field, canceller: EthAddress) -> Field { - let mut hash_bytes: [u8; 100] = [0; 100]; let recipient_bytes = owner.to_field().to_be_bytes(32); let amount_bytes = amount.to_be_bytes(32); @@ -36,7 +30,11 @@ pub fn get_mint_public_content_hash(owner: AztecAddress, amount: Field, cancelle // docs:start:get_mint_private_content_hash // Computes a content hash of a deposit/mint_private message. // Refer TokenPortal.sol for reference on L1. -pub fn get_mint_private_content_hash(secret_hash_for_redeeming_minted_notes: Field, amount: Field, canceller: EthAddress) -> Field { +pub fn get_mint_private_content_hash( + secret_hash_for_redeeming_minted_notes: Field, + amount: Field, + canceller: EthAddress +) -> Field { let mut hash_bytes: [u8; 100] = [0; 100]; let secret_hash_bytes = secret_hash_for_redeeming_minted_notes.to_be_bytes(32); let amount_bytes = amount.to_be_bytes(32); diff --git a/noir-projects/noir-contracts/contracts/uniswap_contract/src/interfaces.nr b/noir-projects/noir-contracts/contracts/uniswap_contract/src/interfaces.nr index f70a2f93c38..77ef1575390 100644 --- a/noir-projects/noir-contracts/contracts/uniswap_contract/src/interfaces.nr +++ b/noir-projects/noir-contracts/contracts/uniswap_contract/src/interfaces.nr @@ -1,6 +1,6 @@ // docs:start:interfaces -use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::{AztecAddress, EthAddress}}; -use dep::aztec::{context::{PrivateContext, PublicContext}}; +use dep::aztec::prelude::{FunctionSelector, AztecAddress, EthAddress, PrivateContext}; +use dep::aztec::context::PublicContext; struct Token { address: AztecAddress, diff --git a/noir-projects/noir-contracts/contracts/uniswap_contract/src/main.nr b/noir-projects/noir-contracts/contracts/uniswap_contract/src/main.nr index 1188a027c8e..7295fd47488 100644 --- a/noir-projects/noir-contracts/contracts/uniswap_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/uniswap_contract/src/main.nr @@ -6,8 +6,8 @@ mod util; // Has two separate flows for private and public respectively // Uses the token bridge contract, which tells which input token we need to talk to and handles the exit funds to L1 contract Uniswap { - use dep::aztec::protocol_types::{abis::function_selector::FunctionSelector, address::{AztecAddress, EthAddress}}; - use dep::aztec::{oracle::{context::get_portal_address}, state_vars::{Map, PublicMutable}}; + use dep::aztec::prelude::{FunctionSelector, AztecAddress, EthAddress, Map, PublicMutable}; + use dep::aztec::oracle::context::get_portal_address; use dep::authwit::auth::{ IS_VALID_SELECTOR, assert_current_call_valid_authwit_public, compute_call_authwit_hash, diff --git a/noir-projects/noir-contracts/contracts/uniswap_contract/src/util.nr b/noir-projects/noir-contracts/contracts/uniswap_contract/src/util.nr index 6be6bab884e..b5928337197 100644 --- a/noir-projects/noir-contracts/contracts/uniswap_contract/src/util.nr +++ b/noir-projects/noir-contracts/contracts/uniswap_contract/src/util.nr @@ -1,5 +1,6 @@ // docs:start:uniswap_public_content_hash -use dep::aztec::protocol_types::{address::{AztecAddress, EthAddress}, hash::sha256_to_field}; +use dep::aztec::prelude::{AztecAddress, EthAddress}; +use dep::aztec::protocol_types::hash::sha256_to_field; // This method computes the L2 to L1 message content hash for the public // refer `l1-contracts/test/portals/UniswapPortal.sol` on how L2 to L1 message is expected diff --git a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr index d239cc82b2d..01570f0aa9f 100644 --- a/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr +++ b/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/base_rollup_inputs.nr @@ -583,7 +583,6 @@ mod tests { }, utils::{field::full_field_less_than, uint256::U256} }; - use dep::std::option::Option; struct NullifierInsertion { existing_index: u64, diff --git a/noir/noir-repo/aztec_macros/src/lib.rs b/noir/noir-repo/aztec_macros/src/lib.rs index 6191108de86..febea007bd4 100644 --- a/noir/noir-repo/aztec_macros/src/lib.rs +++ b/noir/noir-repo/aztec_macros/src/lib.rs @@ -1887,7 +1887,7 @@ fn generate_compute_note_hash_and_nullifier_source(note_types: &Vec) -> let if_statements: Vec = note_types.iter().map(|note_type| format!( "if (note_type_id == {0}::get_note_type_id()) {{ - note_utils::compute_note_hash_and_nullifier({0}::deserialize_content, note_header, serialized_note) + dep::aztec::note::utils::compute_note_hash_and_nullifier({0}::deserialize_content, note_header, serialized_note) }}" , note_type)).collect(); @@ -1907,7 +1907,7 @@ fn generate_compute_note_hash_and_nullifier_source(note_types: &Vec) -> note_type_id: Field, serialized_note: [Field; 20] ) -> pub [Field; 4] {{ - let note_header = NoteHeader::new(contract_address, nonce, storage_slot); + let note_header = dep::aztec::prelude::NoteHeader::new(contract_address, nonce, storage_slot); {} }}", diff --git a/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr b/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr index a03b8774700..c5b19a686d2 100644 --- a/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr +++ b/noir/noir-repo/tooling/nargo_fmt/tests/expected/contract.nr @@ -8,8 +8,7 @@ contract Benchmarking { use dep::value_note::{utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote, ValueNoteMethods}}; use dep::aztec::{ - context::{Context}, - note::{utils as note_utils, note_getter_options::NoteGetterOptions, note_header::NoteHeader}, + context::Context, note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, log::emit_unencrypted_log, state_vars::{Map, PublicMutable, PrivateSet}, types::type_serialization::field_serialization::{FieldSerializationMethods, FIELD_SERIALIZED_LEN}, types::address::{AztecAddress} diff --git a/noir/noir-repo/tooling/nargo_fmt/tests/input/contract.nr b/noir/noir-repo/tooling/nargo_fmt/tests/input/contract.nr index a03b8774700..c5b19a686d2 100644 --- a/noir/noir-repo/tooling/nargo_fmt/tests/input/contract.nr +++ b/noir/noir-repo/tooling/nargo_fmt/tests/input/contract.nr @@ -8,8 +8,7 @@ contract Benchmarking { use dep::value_note::{utils::{increment, decrement}, value_note::{VALUE_NOTE_LEN, ValueNote, ValueNoteMethods}}; use dep::aztec::{ - context::{Context}, - note::{utils as note_utils, note_getter_options::NoteGetterOptions, note_header::NoteHeader}, + context::Context, note::{note_getter_options::NoteGetterOptions, note_header::NoteHeader}, log::emit_unencrypted_log, state_vars::{Map, PublicMutable, PrivateSet}, types::type_serialization::field_serialization::{FieldSerializationMethods, FIELD_SERIALIZED_LEN}, types::address::{AztecAddress}