@lfdecentralizedtrust/zeto-contracts 0.2.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -162
- package/contracts/factory.sol +30 -34
- package/contracts/factory_upgradeable.sol +160 -0
- package/contracts/lib/common/util.sol +40 -0
- package/contracts/lib/interfaces/ILockableCapability.sol +318 -0
- package/contracts/lib/interfaces/{izeto.sol → IZeto.sol} +13 -1
- package/contracts/lib/interfaces/{izeto_initializable.sol → IZetoInitializable.sol} +14 -12
- package/contracts/lib/interfaces/{izeto_kyc.sol → IZetoKyc.sol} +3 -3
- package/contracts/lib/interfaces/IZetoLockableCapability.sol +237 -0
- package/contracts/lib/interfaces/IZetoStorage.sol +106 -0
- package/contracts/lib/interfaces/{izeto_lockable.sol → IZetoVerifier.sol} +8 -21
- package/contracts/lib/registry.sol +77 -27
- package/contracts/lib/storage/base.sol +210 -0
- package/contracts/lib/storage/nullifier.sol +166 -0
- package/contracts/lib/zeto_common.sol +277 -28
- package/contracts/lib/zeto_fungible.sol +451 -33
- package/contracts/lib/zeto_fungible_base.sol +69 -0
- package/contracts/lib/zeto_fungible_burn.sol +83 -53
- package/contracts/lib/zeto_fungible_burn_nullifier.sol +115 -72
- package/contracts/lib/zeto_fungible_nullifier.sol +167 -0
- package/contracts/lib/zeto_lockable.sol +613 -0
- package/contracts/lib/zeto_non_fungible.sol +236 -0
- package/contracts/lib/zeto_non_fungible_base.sol +61 -0
- package/contracts/lib/zeto_non_fungible_nullifier.sol +61 -0
- package/contracts/test/escrow1.sol +90 -34
- package/contracts/test/escrow2.sol +64 -29
- package/contracts/test/qurrency.sol +10 -2
- package/contracts/test/smt.sol +8 -3
- package/contracts/test/tendecimals.sol +14 -12
- package/contracts/verifiers/impl/anon.sol +189 -0
- package/contracts/verifiers/impl/anon_batch.sol +301 -0
- package/contracts/verifiers/impl/anon_enc.sol +266 -0
- package/contracts/verifiers/impl/anon_enc_batch.sol +602 -0
- package/contracts/verifiers/impl/anon_enc_nullifier.sol +287 -0
- package/contracts/verifiers/impl/anon_enc_nullifier_batch.sol +679 -0
- package/contracts/verifiers/impl/anon_enc_nullifier_kyc.sol +294 -0
- package/contracts/verifiers/impl/anon_enc_nullifier_kyc_batch.sol +686 -0
- package/contracts/verifiers/impl/anon_enc_nullifier_non_repudiation.sol +413 -0
- package/contracts/verifiers/impl/anon_enc_nullifier_non_repudiation_batch.sol +1141 -0
- package/contracts/verifiers/impl/anon_nullifier_kyc_transfer.sol +217 -0
- package/contracts/verifiers/impl/anon_nullifier_kyc_transferLocked.sol +196 -0
- package/contracts/verifiers/impl/anon_nullifier_kyc_transferLocked_batch.sol +308 -0
- package/contracts/verifiers/impl/anon_nullifier_kyc_transfer_batch.sol +385 -0
- package/contracts/verifiers/impl/anon_nullifier_qurrency_transfer.sol +497 -0
- package/contracts/verifiers/impl/anon_nullifier_qurrency_transfer_batch.sol +1001 -0
- package/contracts/verifiers/{verifier_anon_nullifier_transferLocked.sol → impl/anon_nullifier_transfer.sol} +12 -19
- package/contracts/verifiers/{verifier_anon_nullifier_transferLocked_batch.sol → impl/anon_nullifier_transfer_batch.sol} +44 -51
- package/contracts/verifiers/impl/burn.sol +182 -0
- package/contracts/verifiers/impl/burn_batch.sol +238 -0
- package/contracts/verifiers/impl/burn_nullifier.sol +203 -0
- package/contracts/verifiers/impl/burn_nullifier_batch.sol +315 -0
- package/contracts/verifiers/impl/deposit.sol +182 -0
- package/contracts/verifiers/impl/deposit_kyc.sol +189 -0
- package/contracts/verifiers/impl/nf_anon.sol +175 -0
- package/contracts/verifiers/{verifier_nf_anon_nullifier_transferLocked.sol → impl/nf_anon_nullifier_transfer.sol} +6 -13
- package/contracts/verifiers/impl/withdraw.sol +189 -0
- package/contracts/verifiers/impl/withdraw_batch.sol +245 -0
- package/contracts/verifiers/impl/withdraw_nullifier.sol +210 -0
- package/contracts/verifiers/impl/withdraw_nullifier_batch.sol +322 -0
- package/contracts/verifiers/verifier_anon.sol +31 -186
- package/contracts/verifiers/verifier_anon_batch.sol +31 -298
- package/contracts/verifiers/verifier_anon_enc.sol +31 -263
- package/contracts/verifiers/verifier_anon_enc_batch.sol +31 -599
- package/contracts/verifiers/verifier_anon_enc_nullifier.sol +31 -284
- package/contracts/verifiers/verifier_anon_enc_nullifier_batch.sol +33 -676
- package/contracts/verifiers/verifier_anon_enc_nullifier_kyc.sol +31 -291
- package/contracts/verifiers/verifier_anon_enc_nullifier_kyc_batch.sol +33 -683
- package/contracts/verifiers/verifier_anon_enc_nullifier_non_repudiation.sol +33 -410
- package/contracts/verifiers/verifier_anon_enc_nullifier_non_repudiation_batch.sol +33 -1138
- package/contracts/verifiers/verifier_anon_nullifier_kyc_transfer.sol +33 -214
- package/contracts/verifiers/verifier_anon_nullifier_kyc_transferLocked.sol +33 -221
- package/contracts/verifiers/verifier_anon_nullifier_kyc_transferLocked_batch.sol +33 -389
- package/contracts/verifiers/verifier_anon_nullifier_kyc_transfer_batch.sol +33 -382
- package/contracts/verifiers/verifier_anon_nullifier_qurrency_transfer.sol +33 -221
- package/contracts/verifiers/verifier_anon_nullifier_qurrency_transfer_batch.sol +33 -389
- package/contracts/verifiers/verifier_anon_nullifier_transfer.sol +33 -207
- package/contracts/verifiers/verifier_anon_nullifier_transfer_batch.sol +33 -375
- package/contracts/verifiers/verifier_burn.sol +31 -179
- package/contracts/verifiers/verifier_burn_batch.sol +31 -235
- package/contracts/verifiers/verifier_burn_nullifier.sol +31 -200
- package/contracts/verifiers/verifier_burn_nullifier_batch.sol +31 -312
- package/contracts/verifiers/verifier_deposit.sol +31 -179
- package/contracts/verifiers/verifier_deposit_kyc.sol +34 -0
- package/contracts/verifiers/verifier_nf_anon.sol +31 -172
- package/contracts/verifiers/verifier_nf_anon_nullifier_transfer.sol +33 -179
- package/contracts/verifiers/verifier_withdraw.sol +31 -186
- package/contracts/verifiers/verifier_withdraw_batch.sol +31 -242
- package/contracts/verifiers/verifier_withdraw_nullifier.sol +31 -207
- package/contracts/verifiers/verifier_withdraw_nullifier_batch.sol +33 -319
- package/contracts/zeto_anon.sol +77 -231
- package/contracts/zeto_anon_burnable.sol +56 -12
- package/contracts/zeto_anon_enc.sol +93 -190
- package/contracts/zeto_anon_enc_nullifier.sol +249 -195
- package/contracts/zeto_anon_enc_nullifier_kyc.sol +51 -232
- package/contracts/zeto_anon_enc_nullifier_non_repudiation.sol +231 -238
- package/contracts/zeto_anon_nullifier.sol +164 -298
- package/contracts/zeto_anon_nullifier_burnable.sol +68 -18
- package/contracts/zeto_anon_nullifier_kyc.sol +40 -345
- package/contracts/zeto_anon_nullifier_qurrency.sol +218 -360
- package/contracts/zeto_nf_anon.sol +55 -130
- package/contracts/zeto_nf_anon_nullifier.sol +90 -152
- package/hardhat.config.ts +9 -3
- package/ignition/modules/lib/deps.ts +9 -6
- package/ignition/modules/zeto_anon_burnable.ts +8 -7
- package/ignition/modules/zeto_anon_enc_nullifier.ts +33 -1
- package/ignition/modules/zeto_anon_enc_nullifier_kyc.ts +2 -2
- package/ignition/modules/zeto_anon_enc_nullifier_non_repudiation.ts +2 -1
- package/ignition/modules/zeto_anon_nullifier.ts +30 -5
- package/ignition/modules/zeto_anon_nullifier_burnable.ts +52 -17
- package/ignition/modules/zeto_anon_nullifier_kyc.ts +27 -12
- package/ignition/modules/zeto_anon_nullifier_qurrency.ts +2 -1
- package/ignition/modules/zeto_nf_anon_nullifier.ts +16 -12
- package/package.json +4 -2
- package/scripts/deploy_cloneable.ts +19 -10
- package/scripts/deploy_upgradeable.ts +9 -5
- package/scripts/tokens/Zeto_Anon.ts +3 -3
- package/scripts/tokens/Zeto_AnonBurnable.ts +1 -1
- package/scripts/tokens/Zeto_AnonEnc.ts +12 -3
- package/scripts/tokens/Zeto_AnonEncNullifier.ts +7 -3
- package/scripts/tokens/Zeto_AnonEncNullifierKyc.ts +1 -1
- package/scripts/tokens/Zeto_AnonEncNullifierNonRepudiation.ts +3 -1
- package/scripts/tokens/Zeto_AnonNullifier.ts +3 -1
- package/scripts/tokens/Zeto_AnonNullifierBurnable.ts +3 -1
- package/scripts/tokens/Zeto_AnonNullifierKyc.ts +1 -1
- package/scripts/tokens/Zeto_AnonNullifierQurrency.ts +3 -1
- package/scripts/tokens/Zeto_NfAnon.ts +2 -2
- package/scripts/tokens/Zeto_NfAnonNullifier.ts +3 -2
- package/test/factory.ts +46 -73
- package/test/factory_upgradeable.ts +311 -0
- package/test/lib/anon_nullifier_helpers.ts +89 -0
- package/test/lib/anon_zeto_helpers.ts +76 -0
- package/test/lib/deploy.ts +3 -2
- package/test/lib/utils.ts +74 -35
- package/test/test/escrow1.ts +185 -58
- package/test/test/escrow2.ts +200 -107
- package/test/test/qurrency.ts +13 -33
- package/test/usdc-shielding.ts +39 -26
- package/test/utils.ts +144 -21
- package/test/zeto_anon.ts +956 -465
- package/test/zeto_anon_enc.ts +881 -142
- package/test/zeto_anon_enc_nullifier.ts +847 -38
- package/test/zeto_anon_enc_nullifier_kyc.ts +120 -181
- package/test/zeto_anon_enc_nullifier_non_repudiation.ts +77 -46
- package/test/zeto_anon_nullifier.ts +1212 -953
- package/test/zeto_anon_nullifier_kyc.ts +674 -655
- package/test/zeto_anon_nullifier_qurrency.ts +452 -306
- package/test/zeto_nf_anon.ts +737 -137
- package/test/zeto_nf_anon_nullifier.ts +876 -246
- package/contracts/lib/zeto_base.sol +0 -293
- package/contracts/lib/zeto_fungible_withdraw.sol +0 -132
- package/contracts/lib/zeto_fungible_withdraw_nullifier.sol +0 -144
- package/contracts/lib/zeto_nullifier.sol +0 -334
- package/contracts/zkDvP.sol_ +0 -273
- package/test/zkDvP.ts_ +0 -455
- /package/contracts/lib/{common.sol → common/common.sol} +0 -0
|
@@ -1,224 +1,36 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
You should have received a copy of the GNU General Public License
|
|
18
|
-
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
-
*/
|
|
1
|
+
// Copyright © 2025 Kaleido, Inc.
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
//
|
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
// you may not use this file except in compliance with the License.
|
|
7
|
+
// You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
// See the License for the specific language governing permissions and
|
|
15
|
+
// limitations under the License.
|
|
20
16
|
|
|
21
17
|
pragma solidity >=0.7.0 <0.9.0;
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
uint256 constant deltax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
|
42
|
-
uint256 constant deltay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
|
43
|
-
uint256 constant deltay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
uint256 constant IC0x = 5903941879013718988081172462893635473765585811323635470514735721095700963702;
|
|
47
|
-
uint256 constant IC0y = 21080368968148086049976470300075598267152959623874995939107123143909817947630;
|
|
48
|
-
|
|
49
|
-
uint256 constant IC1x = 277297534438112389180931574864286821885419665717177767601706304294709064040;
|
|
50
|
-
uint256 constant IC1y = 11466710444362729136960387929371222359273358701587036714483949566745055621830;
|
|
51
|
-
|
|
52
|
-
uint256 constant IC2x = 5619666232197961834865995108107159282382923386466834757057363204096037651764;
|
|
53
|
-
uint256 constant IC2y = 15973294500823479376020315199547194992254305102551062619795669271634881254131;
|
|
54
|
-
|
|
55
|
-
uint256 constant IC3x = 16994365193196666529444222678662986964837189489839761617081637536084667700567;
|
|
56
|
-
uint256 constant IC3y = 19320170842519457147495348046335776444028148306160216329435959930056589238336;
|
|
57
|
-
|
|
58
|
-
uint256 constant IC4x = 8498610473957547996900321269894382432325081969475947517083968711252676854434;
|
|
59
|
-
uint256 constant IC4y = 12728107717434555757183263731054279132059277069143869361510124517810824142633;
|
|
60
|
-
|
|
61
|
-
uint256 constant IC5x = 18511559663930149009135574067307212897873211022818368060918697035060259565029;
|
|
62
|
-
uint256 constant IC5y = 20804557254714858706397640997162389384167991925053762942540110532256230134678;
|
|
63
|
-
|
|
64
|
-
uint256 constant IC6x = 9373814069952600731332993487809060613417950312335152043923307393139824873734;
|
|
65
|
-
uint256 constant IC6y = 16865467207038098604194455172286157376570508997936659278795086623618594346915;
|
|
66
|
-
|
|
67
|
-
uint256 constant IC7x = 12145839442248256913972414977521448580312614560974030542947427181163264459741;
|
|
68
|
-
uint256 constant IC7y = 18090427452121523061184380667980763703935420996985767299962855565988460373436;
|
|
69
|
-
|
|
70
|
-
uint256 constant IC8x = 10474776404215989914860932066594458738983457343662916641445752614561642689469;
|
|
71
|
-
uint256 constant IC8y = 3378834796931378107199253750169106725596319638791117099719497080177733386540;
|
|
72
|
-
|
|
73
|
-
uint256 constant IC9x = 1887249157430528165374401635262372006182704854335611145585690423537839735888;
|
|
74
|
-
uint256 constant IC9y = 7080674530581255597858145142316212286106173969722576181725459826182095923364;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
// Memory data
|
|
78
|
-
uint16 constant pVk = 0;
|
|
79
|
-
uint16 constant pPairing = 128;
|
|
80
|
-
|
|
81
|
-
uint16 constant pLastMem = 896;
|
|
82
|
-
|
|
83
|
-
function verifyProof(uint[2] calldata _pA, uint[2][2] calldata _pB, uint[2] calldata _pC, uint[9] calldata _pubSignals) public view returns (bool) {
|
|
84
|
-
assembly {
|
|
85
|
-
function checkField(v) {
|
|
86
|
-
if iszero(lt(v, r)) {
|
|
87
|
-
mstore(0, 0)
|
|
88
|
-
return(0, 0x20)
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// G1 function to multiply a G1 value(x,y) to value in an address
|
|
93
|
-
function g1_mulAccC(pR, x, y, s) {
|
|
94
|
-
let success
|
|
95
|
-
let mIn := mload(0x40)
|
|
96
|
-
mstore(mIn, x)
|
|
97
|
-
mstore(add(mIn, 32), y)
|
|
98
|
-
mstore(add(mIn, 64), s)
|
|
99
|
-
|
|
100
|
-
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
|
101
|
-
|
|
102
|
-
if iszero(success) {
|
|
103
|
-
mstore(0, 0)
|
|
104
|
-
return(0, 0x20)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
mstore(add(mIn, 64), mload(pR))
|
|
108
|
-
mstore(add(mIn, 96), mload(add(pR, 32)))
|
|
109
|
-
|
|
110
|
-
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
|
111
|
-
|
|
112
|
-
if iszero(success) {
|
|
113
|
-
mstore(0, 0)
|
|
114
|
-
return(0, 0x20)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
|
119
|
-
let _pPairing := add(pMem, pPairing)
|
|
120
|
-
let _pVk := add(pMem, pVk)
|
|
121
|
-
|
|
122
|
-
mstore(_pVk, IC0x)
|
|
123
|
-
mstore(add(_pVk, 32), IC0y)
|
|
124
|
-
|
|
125
|
-
// Compute the linear combination vk_x
|
|
126
|
-
|
|
127
|
-
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
|
128
|
-
|
|
129
|
-
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
|
130
|
-
|
|
131
|
-
g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))
|
|
132
|
-
|
|
133
|
-
g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))
|
|
134
|
-
|
|
135
|
-
g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))
|
|
136
|
-
|
|
137
|
-
g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))
|
|
138
|
-
|
|
139
|
-
g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))
|
|
140
|
-
|
|
141
|
-
g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))
|
|
142
|
-
|
|
143
|
-
g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
// -A
|
|
147
|
-
mstore(_pPairing, calldataload(pA))
|
|
148
|
-
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
|
149
|
-
|
|
150
|
-
// B
|
|
151
|
-
mstore(add(_pPairing, 64), calldataload(pB))
|
|
152
|
-
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
|
153
|
-
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
|
154
|
-
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
|
155
|
-
|
|
156
|
-
// alpha1
|
|
157
|
-
mstore(add(_pPairing, 192), alphax)
|
|
158
|
-
mstore(add(_pPairing, 224), alphay)
|
|
159
|
-
|
|
160
|
-
// beta2
|
|
161
|
-
mstore(add(_pPairing, 256), betax1)
|
|
162
|
-
mstore(add(_pPairing, 288), betax2)
|
|
163
|
-
mstore(add(_pPairing, 320), betay1)
|
|
164
|
-
mstore(add(_pPairing, 352), betay2)
|
|
165
|
-
|
|
166
|
-
// vk_x
|
|
167
|
-
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
|
168
|
-
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
// gamma2
|
|
172
|
-
mstore(add(_pPairing, 448), gammax1)
|
|
173
|
-
mstore(add(_pPairing, 480), gammax2)
|
|
174
|
-
mstore(add(_pPairing, 512), gammay1)
|
|
175
|
-
mstore(add(_pPairing, 544), gammay2)
|
|
176
|
-
|
|
177
|
-
// C
|
|
178
|
-
mstore(add(_pPairing, 576), calldataload(pC))
|
|
179
|
-
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
|
180
|
-
|
|
181
|
-
// delta2
|
|
182
|
-
mstore(add(_pPairing, 640), deltax1)
|
|
183
|
-
mstore(add(_pPairing, 672), deltax2)
|
|
184
|
-
mstore(add(_pPairing, 704), deltay1)
|
|
185
|
-
mstore(add(_pPairing, 736), deltay2)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
|
189
|
-
|
|
190
|
-
isOk := and(success, mload(_pPairing))
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
let pMem := mload(0x40)
|
|
194
|
-
mstore(0x40, add(pMem, pLastMem))
|
|
195
|
-
|
|
196
|
-
// Validate that all evaluations ∈ F
|
|
197
|
-
|
|
198
|
-
checkField(calldataload(add(_pubSignals, 0)))
|
|
199
|
-
|
|
200
|
-
checkField(calldataload(add(_pubSignals, 32)))
|
|
201
|
-
|
|
202
|
-
checkField(calldataload(add(_pubSignals, 64)))
|
|
203
|
-
|
|
204
|
-
checkField(calldataload(add(_pubSignals, 96)))
|
|
205
|
-
|
|
206
|
-
checkField(calldataload(add(_pubSignals, 128)))
|
|
207
|
-
|
|
208
|
-
checkField(calldataload(add(_pubSignals, 160)))
|
|
209
|
-
|
|
210
|
-
checkField(calldataload(add(_pubSignals, 192)))
|
|
211
|
-
|
|
212
|
-
checkField(calldataload(add(_pubSignals, 224)))
|
|
213
|
-
|
|
214
|
-
checkField(calldataload(add(_pubSignals, 256)))
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
// Validate all evaluations
|
|
218
|
-
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
|
219
|
-
|
|
220
|
-
mstore(0, isValid)
|
|
221
|
-
return(0, 0x20)
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
19
|
+
import {Verifier_AnonNullifierQurrencyTransfer} from "./impl/anon_nullifier_qurrency_transfer.sol";
|
|
20
|
+
|
|
21
|
+
contract Groth16Verifier_AnonNullifierQurrencyTransfer is
|
|
22
|
+
Verifier_AnonNullifierQurrencyTransfer
|
|
23
|
+
{
|
|
24
|
+
function verify(
|
|
25
|
+
uint[2] calldata _pA,
|
|
26
|
+
uint[2][2] calldata _pB,
|
|
27
|
+
uint[2] calldata _pC,
|
|
28
|
+
uint[] calldata _pubSignals
|
|
29
|
+
) public view returns (bool) {
|
|
30
|
+
uint256[48] memory fixedSizeInputs;
|
|
31
|
+
for (uint256 i = 0; i < fixedSizeInputs.length; i++) {
|
|
32
|
+
fixedSizeInputs[i] = _pubSignals[i];
|
|
33
|
+
}
|
|
34
|
+
return this.verifyProof(_pA, _pB, _pC, fixedSizeInputs);
|
|
35
|
+
}
|
|
36
|
+
}
|