Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Jul 11, 2024
1 parent 94f450b commit d42370f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use dep::aztec::prelude::{AztecAddress, NoteInterface, NoteHeader, PrivateContext};
use dep::aztec::{
note::{utils::compute_note_hash_for_consumption}, keys::getters::get_nsk_app,
protocol_types::{traits::{Empty, Serialize}, constants::GENERATOR_INDEX__NOTE_NULLIFIER, hash::poseidon2_hash}
protocol_types::{traits::{Empty, Eq, Serialize}, constants::GENERATOR_INDEX__NOTE_NULLIFIER, hash::poseidon2_hash}
};

// Shows how to create a custom note
Expand Down Expand Up @@ -55,3 +55,11 @@ impl Serialize<3> for CardNote {
[ self.points.to_field(), self.randomness, self.npk_m_hash.to_field() ]
}
}

impl Eq for CardNote {
fn eq(self, other: Self) -> bool {
(self.points == other.points) &
(self.npk_m_hash == other.npk_m_hash) &
(self.randomness == other.randomness)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<T> BalancesMap<T, &mut PrivateContext> {
self: Self,
owner_npk_m_hash: Field,
addend: U128
) -> OuterNoteEmission<T> where T: NoteInterface<T_SERIALIZED_LEN, T_SERIALIZED_BYTES_LEN> + OwnedNote {
) -> OuterNoteEmission<T> where T: NoteInterface<T_SERIALIZED_LEN, T_SERIALIZED_BYTES_LEN> + OwnedNote + Eq {
let mut addend_note = T::new(addend, owner_npk_m_hash);
OuterNoteEmission::new(Option::some(self.map.insert(&mut addend_note)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<T> BalancesMap<T, &mut PrivateContext> {
self: Self,
owner: AztecAddress,
addend: U128
) -> OuterNoteEmission<T> where T: NoteInterface<T_SERIALIZED_LEN, T_SERIALIZED_BYTES_LEN> + OwnedNote {
) -> OuterNoteEmission<T> where T: NoteInterface<T_SERIALIZED_LEN, T_SERIALIZED_BYTES_LEN> + OwnedNote + Eq {
if addend == U128::from_integer(0) {
OuterNoteEmission::new(Option::none())
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<T> BalancesMap<T, &mut PrivateContext> {
self: Self,
owner: AztecAddress,
addend: U128
) -> OuterNoteEmission<T> where T: NoteInterface<T_SERIALIZED_LEN, T_SERIALIZED_BYTES_LEN> + OwnedNote {
) -> OuterNoteEmission<T> where T: NoteInterface<T_SERIALIZED_LEN, T_SERIALIZED_BYTES_LEN> + OwnedNote + Eq {
if addend == U128::from_integer(0) {
OuterNoteEmission::new(Option::none())
} else {
Expand Down

0 comments on commit d42370f

Please sign in to comment.