barretenberg
Loading...
Searching...
No Matches
claim_note.hpp
1#pragma once
2#include "../bridge_call_data.hpp"
3#include "barretenberg/common/serialize.hpp"
4#include "barretenberg/crypto/pedersen_commitment/pedersen.hpp"
5#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
6#include "complete_partial_commitment.hpp"
7#include "create_partial_commitment.hpp"
8
9namespace join_split_example::proofs::notes::native::claim {
10
11struct claim_note {
12 uint256_t deposit_value;
14 uint32_t defi_interaction_nonce;
15 uint256_t fee;
16 grumpkin::fq value_note_partial_commitment;
17 grumpkin::fq input_nullifier;
18
19 bool operator==(claim_note const&) const = default;
20
21 grumpkin::fq commit() const { return complete_partial_commitment(partial_commit(), defi_interaction_nonce, fee); }
22
23 grumpkin::fq partial_commit() const
24 {
25 return create_partial_commitment(
26 deposit_value, bridge_call_data, value_note_partial_commitment, input_nullifier);
27 }
28};
29
30template <typename B> inline void read(B& buf, claim_note& note)
31{
32 using serialize::read;
33 read(buf, note.deposit_value);
34 read(buf, note.bridge_call_data);
35 read(buf, note.defi_interaction_nonce);
36 read(buf, note.fee);
37 read(buf, note.value_note_partial_commitment);
38 read(buf, note.input_nullifier);
39}
40template <typename B> inline void write(B& buf, claim_note const& note)
41{
42 write(buf, note.deposit_value);
43 write(buf, note.bridge_call_data);
44 write(buf, note.defi_interaction_nonce);
45 write(buf, note.fee);
46 write(buf, note.value_note_partial_commitment);
47 write(buf, note.input_nullifier);
48}
49
50inline std::ostream& operator<<(std::ostream& os, claim_note const& note)
51{
52 return os << format("{ deposit_value: ",
53 note.deposit_value,
54 ", bridge_call_data: ",
55 note.bridge_call_data,
56 ", interaction_nonce: ",
57 note.defi_interaction_nonce,
58 ", fee: ",
59 note.fee,
60 ", value_note_partial_commitment: ",
61 note.value_note_partial_commitment,
62 ", input_nullifier: ",
63 note.input_nullifier,
64 " }");
65}
66
67} // namespace join_split_example::proofs::notes::native::claim
Definition: uint256.hpp:25