Skip to content

Commit

Permalink
chore: moved AddressNote to aztec.nr (#2752)
Browse files Browse the repository at this point in the history
`AddressNote` is very generic and for this reason it makes sense to have
it in `aztec.nr`. This PR moves it there.

# Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if
the PR is ready to merge.
- [ ] If the pull request requires a cryptography review (e.g.
cryptographic algorithm implementations) I have added the 'crypto' tag.
- [ ] I have reviewed my diff in github, line by line and removed
unexpected formatting changes, testing logs, or commented-out code.
- [ ] Every change is related to the PR description.
- [ ] I have
[linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
this pull request to relevant issues (if any exist).
  • Loading branch information
benesjan authored Oct 11, 2023
1 parent 0cc553a commit 5f99066
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 86 deletions.
8 changes: 8 additions & 0 deletions yarn-project/aztec-nr/address-note/Nargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "address_note"
authors = ["aztec-labs"]
compiler_version = "0.7.1"
type = "lib"

[dependencies]
aztec = { path = "../aztec" }
1 change: 1 addition & 0 deletions yarn-project/aztec-nr/address-note/src/lib.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mod address_note;
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ type = "contract"

[dependencies]
aztec = { path = "../../../../aztec-nr/aztec" }
address_note = { path = "../../../../aztec-nr/address-note"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
mod address_note;

// Sample escrow contract that stores a balance of a private token on behalf of an owner.
contract Escrow {
use dep::std::option::Option;
Expand All @@ -17,7 +15,7 @@ contract Escrow {
state_vars::set::Set,
};

use crate::address_note::{
use dep::address_note::address_note::{
AddressNote,
AddressNoteMethods,
ADDRESS_NOTE_LEN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ type = "contract"

[dependencies]
aztec = { path = "../../../../aztec-nr/aztec" }
address_note = { path = "../../../../aztec-nr/address-note"}
value_note = { path = "../../../../aztec-nr/value-note"}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
mod address_note;

contract PokeableToken {
// Libs
use dep::std::option::Option;
Expand All @@ -19,7 +17,11 @@ contract PokeableToken {
state_vars::{immutable_singleton::ImmutableSingleton, map::Map, set::Set},
types::point::Point,
};
use crate::address_note::{AddressNote, AddressNoteMethods, ADDRESS_NOTE_LEN};
use dep::address_note::address_note::{
AddressNote,
AddressNoteMethods,
ADDRESS_NOTE_LEN,
};

struct Storage {
sender: ImmutableSingleton<AddressNote, ADDRESS_NOTE_LEN>,
Expand Down Expand Up @@ -50,8 +52,8 @@ contract PokeableToken {
sender: Field,
recipient: Field
) {
let mut sender_note = AddressNote::new(sender);
let mut recipient_note = AddressNote::new(recipient);
let mut sender_note = AddressNote::new(sender, sender);
let mut recipient_note = AddressNote::new(recipient, recipient);

storage.sender.initialize(&mut sender_note, Option::none());
storage.recipient.initialize(&mut recipient_note, Option::none());
Expand Down

0 comments on commit 5f99066

Please sign in to comment.