Skip to main content

utils

Standalone Functions

create_note_getter_options_for_decreasing_balance

create_note_getter_options_for_decreasing_balance(amount);

Pick the fewest notes whose sum is equal to or greater than amount.

Parameters

NameType
amountField

increment

increment(balance, &mut PrivateContext>, amount, recipient, outgoing_viewer);

Inserts it to the recipient's set of notes.

Parameters

NameType
balancePrivateSet<ValueNote
&mut PrivateContext>
amountField
recipientAztecAddress
outgoing_viewerAztecAddress

decrement

decrement(balance, &mut PrivateContext>, amount, owner, outgoing_viewer);

Fail if the sum of the selected notes is less than the amount.

Parameters

NameType
balancePrivateSet<ValueNote
&mut PrivateContext>
amountField
ownerAztecAddress
outgoing_viewerAztecAddress

decrement_by_at_most

decrement_by_at_most(balance, &mut PrivateContext>, max_amount, owner, outgoing_viewer);

// It returns the decremented amount, which should be less than or equal to max_amount.

Parameters

NameType
balancePrivateSet<ValueNote
&mut PrivateContext>
max_amountField
ownerAztecAddress
outgoing_viewerAztecAddress

destroy_note

destroy_note(balance, &mut PrivateContext>, note);

Returns the value of the destroyed note.

Parameters

NameType
balancePrivateSet<ValueNote
&mut PrivateContext>
noteValueNote