Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ In keeping with the origins of blockchain, here's an example of a simple private

#include_code easy_private_token_contract /noir-projects/noir-contracts/contracts/easy_private_token_contract/src/main.nr rust

The prelude consists of more commonly imported aztec types that are needed for development. Here is what the prelude includes:

#include_code prelude /noir-projects/aztec-nr/aztec/src/prelude.nr rust

:::info Disclaimer
Please note that any example contract set out herein is provided solely for informational purposes only and does not constitute any inducement to use or deploy. Any implementation of any such contract with an interface or any other infrastructure should be used in accordance with applicable laws and regulations.
:::
:::
24 changes: 24 additions & 0 deletions docs/docs/misc/migration_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@ Aztec is in full-speed development. Literally every version breaks compatibility

## 0.25.0

### [Aztec.nr] Introduction to `prelude`

A new `prelude` module to include common Aztec modules and types.
This simplifies dependency syntax. For example:
```rust
use dep::aztec::protocol_types::address::AztecAddress;
use dep::aztec::{
context::{PrivateContext, Context}, note::{note_header::NoteHeader, utils as note_utils},
state_vars::Map
};
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add prelude file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noir-projects/aztec-nr/aztec/src/prelude.nr

Becomes:
```rust
use dep::aztec::prelude::{AztecAddress, NoteHeader, PrivateContext, Map};
use dep::aztec::context::Context;
use dep::aztec::notes::utils as note_utils;
```

This will be further simplified in future versions (See [4496](https://github.com/AztecProtocol/aztec-packages/pull/4496) for further details).

The prelude consists of

#include_code prelude /noir-projects/aztec-nr/aztec/src/prelude.nr rust

### [Aztec.nr] No SafeU120 anymore!
Noir now have overflow checks by default. So we don't need SafeU120 like libraries anymore.

Expand Down
18 changes: 10 additions & 8 deletions noir-projects/aztec-nr/aztec/src/prelude.nr
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// docs:start:prelude
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
},
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
}
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
}
};
// docs:end:prelude