Skip to content

Commit

Permalink
feat: add and sub methods of EasyPrivateUint throw when called …
Browse files Browse the repository at this point in the history
…in public (#5581)
  • Loading branch information
benesjan authored Apr 8, 2024
1 parent d2a6860 commit 29f337d
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ impl EasyPrivateUint {

// Very similar to `value_note::utils::increment`.
pub fn add(self, addend: u64, owner: AztecAddress) {
assert(self.context.public.is_none(), "EasyPrivateUint::add can be called from private only.");

// Creates new note for the owner.
let mut addend_note = ValueNote::new(addend as Field, owner);

Expand All @@ -31,6 +33,8 @@ impl EasyPrivateUint {

// Very similar to `value_note::utils::decrement`.
pub fn sub(self, subtrahend: u64, owner: AztecAddress) {
assert(self.context.public.is_none(), "EasyPrivateUint::sub can be called from private only.");

// docs:start:get_notes
let options = NoteGetterOptions::with_filter(filter_notes_min_sum, subtrahend as Field);
let maybe_notes = self.set.get_notes(options);
Expand Down

0 comments on commit 29f337d

Please sign in to comment.