@@ -7,6 +7,11 @@ import '../StreamUtilities.sol';
7
7
contract StreamUtilitiesMock {
8
8
// The provided struct object is stored here as StreamUtilities expects a storage variable.
9
9
Types.AztecStream public stream;
10
+ event ValidateRatioProof (bytes32 withdrawalNoteHash );
11
+ event ValidateJoinSplitProof (bytes32 withdrawalNoteHash );
12
+ event ProcessDeposit (bytes32 streamNoteHash );
13
+ event ProcessWithdrawal (bytes32 newStreamNoteHash );
14
+ event ProcessCancellation (bool cancellationSuccess );
10
15
11
16
function getRatio (bytes memory _proofData )
12
17
public
@@ -23,13 +28,13 @@ contract StreamUtilitiesMock {
23
28
Types.AztecStream memory _stream
24
29
) public returns (bytes32 ) {
25
30
stream = _stream;
26
- return
27
- StreamUtilities. _validateRatioProof (
28
- _aceContractAddress ,
29
- _proof1 ,
30
- _withdrawDuration,
31
- stream
32
- );
31
+ bytes32 withdrawalNoteHash = StreamUtilities. _validateRatioProof (
32
+ _aceContractAddress,
33
+ _proof1 ,
34
+ _withdrawDuration ,
35
+ stream
36
+ );
37
+ emit ValidateRatioProof (withdrawalNoteHash );
33
38
}
34
39
35
40
function validateJoinSplitProof (
@@ -39,7 +44,7 @@ contract StreamUtilitiesMock {
39
44
Types.AztecStream memory _stream
40
45
) public returns (bytes memory ) {
41
46
stream = _stream;
42
- return
47
+ bytes memory proofOutputs =
43
48
StreamUtilities._validateJoinSplitProof (
44
49
_aceContractAddress,
45
50
_proof2,
@@ -56,15 +61,15 @@ contract StreamUtilitiesMock {
56
61
address _recipient ,
57
62
address _tokenAddress
58
63
) public returns (bytes32 ) {
59
- return
60
- StreamUtilities. _processDeposit (
61
- _proof ,
62
- _proofSignature ,
63
- _aceContractAddress ,
64
- _sender ,
65
- _recipient,
66
- _tokenAddress
67
- );
64
+ bytes32 newStreamNoteHash = StreamUtilities. _processDeposit (
65
+ _proof,
66
+ _proofSignature ,
67
+ _aceContractAddress ,
68
+ _sender ,
69
+ _recipient ,
70
+ _tokenAddress
71
+ );
72
+ emit ProcessDeposit (newStreamNoteHash );
68
73
}
69
74
70
75
function processWithdrawal (
@@ -74,13 +79,13 @@ contract StreamUtilitiesMock {
74
79
Types.AztecStream memory _stream
75
80
) public returns (bytes32 ) {
76
81
stream = _stream;
77
- return
78
- StreamUtilities. _processWithdrawal (
79
- _aceContractAddress ,
80
- _proof2 ,
81
- _withdrawalNoteHash,
82
- stream
83
- );
82
+ bytes32 newStreamNoteHash = StreamUtilities. _processWithdrawal (
83
+ _aceContractAddress,
84
+ _proof2 ,
85
+ _withdrawalNoteHash ,
86
+ stream
87
+ );
88
+ emit ProcessWithdrawal (newStreamNoteHash );
84
89
}
85
90
86
91
function processCancellation (
@@ -90,12 +95,13 @@ contract StreamUtilitiesMock {
90
95
Types.AztecStream memory _stream
91
96
) public returns (bool ) {
92
97
stream = _stream;
93
- return
98
+ bool cancellationSuccess =
94
99
StreamUtilities._processCancellation (
95
100
_aceContractAddress,
96
101
_proof2,
97
102
_proof1OutputNotes,
98
103
stream
99
104
);
105
+ emit ProcessCancellation (cancellationSuccess);
100
106
}
101
107
}
0 commit comments