Skip to content

Commit

Permalink
feat: crowdfunding contract (#4917)
Browse files Browse the repository at this point in the history
Crowdfunding contract implemented during offsite.
  • Loading branch information
superstar0402 committed Mar 19, 2024
1 parent 3be81ab commit eef235e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion aztec/src/note/note_header.nr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use dep::protocol_types::address::AztecAddress;
use dep::protocol_types::traits::Empty;
use dep::protocol_types::traits::{Empty, Serialize};

struct NoteHeader {
contract_address: AztecAddress,
Expand All @@ -21,3 +21,9 @@ impl NoteHeader {
NoteHeader { contract_address, nonce, storage_slot, is_transient: false }
}
}

impl Serialize<4> for NoteHeader {
fn serialize(self) -> [Field; 4] {
[self.contract_address.to_field(), self.nonce, self.storage_slot, self.is_transient as Field]
}
}
8 changes: 8 additions & 0 deletions value-note/src/value_note.nr
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,11 @@ impl ValueNote {
ValueNote { value, owner, randomness, header }
}
}

impl Serialize<7> for ValueNote {
fn serialize(self) -> [Field; 7] {
let header = self.header.serialize();

[self.value, self.owner.to_field(), self.randomness, header[0], header[1], header[2], header[3]]
}
}

0 comments on commit eef235e

Please sign in to comment.