@clearproof/contracts 0.3.0 → 0.6.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.
Files changed (29) hide show
  1. package/README.md +33 -5
  2. package/artifacts/contracts/ComplianceRegistry.sol/ComplianceRegistry.json +356 -5
  3. package/artifacts/contracts/Groth16Verifier.sol/Groth16Verifier.json +7 -2
  4. package/artifacts/contracts/MockVerifier.sol/MockVerifier.json +45 -0
  5. package/artifacts/contracts/Pairing.sol/Pairing.json +10 -0
  6. package/artifacts/contracts/PairingHarness.sol/PairingHarness.json +252 -0
  7. package/artifacts/contracts/PilotCurrentRegistry.sol/PilotCurrentRegistry.json +1063 -0
  8. package/artifacts/contracts/PilotGroth16Verifier.sol/PilotGroth16Verifier.json +155 -0
  9. package/artifacts/contracts/PilotRootCheckpoint.sol/PilotRootCheckpoint.json +476 -0
  10. package/artifacts/contracts/SanctionsOracle.sol/SanctionsOracle.json +27 -2
  11. package/artifacts/contracts/SanctionsRootRelay.sol/SanctionsRootRelay.json +12 -2
  12. package/artifacts/contracts/VASPRegistry.sol/VASPRegistry.json +27 -2
  13. package/artifacts/contracts/{ComplianceRegistry.sol → VerifierRouter.sol}/IGroth16Verifier.json +1 -1
  14. package/artifacts/contracts/VerifierRouter.sol/VerifierRouter.json +741 -0
  15. package/artifacts/contracts/bench/Groth16VerifierBLS.sol/Groth16VerifierBLS.json +35 -0
  16. package/contracts/ComplianceRegistry.sol +186 -35
  17. package/contracts/Groth16Verifier.sol +135 -267
  18. package/contracts/MockVerifier.sol +14 -0
  19. package/contracts/Pairing.sol +147 -0
  20. package/contracts/PairingHarness.sol +27 -0
  21. package/contracts/PilotCurrentRegistry.sol +216 -0
  22. package/contracts/PilotGroth16Verifier.sol +95 -0
  23. package/contracts/PilotRootCheckpoint.sol +68 -0
  24. package/contracts/SanctionsOracle.sol +12 -5
  25. package/contracts/SanctionsRootRelay.sol +6 -2
  26. package/contracts/VASPRegistry.sol +13 -6
  27. package/contracts/VerifierRouter.sol +207 -0
  28. package/contracts/bench/Groth16VerifierBLS.sol +127 -0
  29. package/package.json +6 -2
@@ -0,0 +1,35 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "Groth16VerifierBLS",
4
+ "sourceName": "contracts/bench/Groth16VerifierBLS.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [
8
+ {
9
+ "internalType": "bytes",
10
+ "name": "_proof",
11
+ "type": "bytes"
12
+ },
13
+ {
14
+ "internalType": "uint256[]",
15
+ "name": "_pubSignals",
16
+ "type": "uint256[]"
17
+ }
18
+ ],
19
+ "name": "verifyProof",
20
+ "outputs": [
21
+ {
22
+ "internalType": "bool",
23
+ "name": "",
24
+ "type": "bool"
25
+ }
26
+ ],
27
+ "stateMutability": "view",
28
+ "type": "function"
29
+ }
30
+ ],
31
+ "bytecode": "0x608060405234801561001057600080fd5b506116c4806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80631e8e1e1314610030575b600080fd5b61004361003e3660046107d0565b610057565b604051901515815260200160405180910390f35b600061020084146100c05760405162461bcd60e51b815260206004820152602860248201527f50726f6f66206d7573742062652035313220627974657320284731207c7c204760448201526732207c7c2047312960c01b60648201526084015b60405180910390fd5b601082146101105760405162461bcd60e51b815260206004820152601960248201527f57726f6e67207075626c6963207369676e616c20636f756e740000000000000060448201526064016100b7565b600061011c848461016b565b90506000610135610130608083898b610895565b6105f8565b90506101608161014a61018060808a8c610895565b8561015b6102006101808d8f610895565b61068f565b979650505050505050565b606060006040518060a0016040528060808152602001610f8f60809139600160001b6040518060a001604052806080815260200161130f60809139868660008181106101b9576101b96108bf565b9050602002013560001b6040518060a001604052806080815260200161128f60809139888860018181106101ef576101ef6108bf565b9050602002013560001b6040518060a001604052806080815260200161100f608091398a8a6002818110610225576102256108bf565b9050602002013560001b6040518060a001604052806080815260200161108f608091398c8c600381811061025b5761025b6108bf565b9050602002013560001b6040518060a001604052806080815260200161140f608091398e8e6004818110610291576102916108bf565b6040516102b29e9d9c9b9a9998979695949360209283020135925001610905565b60408051601f1981840301815260a083019091526080808352909190610d8f6020830139858560058181106102e9576102e96108bf565b9050602002013560001b6040518060a001604052806080815260200161110f608091398787600681811061031f5761031f6108bf565b9050602002013560001b6040518060a001604052806080815260200161158f6080913989896007818110610355576103556108bf565b9050602002013560001b6040518060a001604052806080815260200161148f608091398b8b600881811061038b5761038b6108bf565b9050602002013560001b6040518060a001604052806080815260200161160f608091398d8d60098181106103c1576103c16108bf565b9050602002013560001b6040518060a001604052806080815260200161118f608091398f8f600a8181106103f7576103f76108bf565b6040516104189e9d9c9b9a9998979695949360209283020135925001610905565b60408051601f1981840301815260a083019091526080808352909190610a8f60208301398686600b81811061044f5761044f6108bf565b9050602002013560001b6040518060a001604052806080815260200161120f608091398888600c818110610485576104856108bf565b9050602002013560001b6040518060a001604052806080815260200161150f608091398a8a600d8181106104bb576104bb6108bf565b9050602002013560001b6040518060a0016040528060808152602001610d0f608091398c8c600e8181106104f1576104f16108bf565b9050602002013560001b6040518060a0016040528060808152602001610f0f608091398e8e600f818110610527576105276108bf565b6040516105469c9b9a999897969594936020928302013592500161097e565b60408051601f19818403018152908290526105659392916020016109e8565b60408051808303601f19018152608080845260a0840190925292506020820181803683370190505091506000608060208401835160208501600c5afa9050806105f05760405162461bcd60e51b815260206004820152601760248201527f47314d534d20707265636f6d70696c65206661696c656400000000000000000060448201526064016100b7565b505092915050565b60606106078260008186610895565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050506060820180516080840180517f64774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab8181109093016f1a0111ea397fe69a4b1ba7b6434bacd7039093529190039052509392505050565b6000808787876040518060a001604052806080815260200161138f608091396040518061012001604052806101008152602001610e0f6101009139896040518061012001604052806101008152602001610c0f61010091398a8a6040518061012001604052806101008152602001610b0f610100913960405160200161071e9a99989796959493929190610a0f565b60408051808303601f19018152602080845283830190925292506000919060208201818036833701905050905060006020808301845160208601600f5afa9050806107ab5760405162461bcd60e51b815260206004820152601960248201527f50414952494e4720707265636f6d70696c65206661696c65640000000000000060448201526064016100b7565b818060200190518101906107bf9190610a75565b6001149a9950505050505050505050565b600080600080604085870312156107e657600080fd5b843567ffffffffffffffff808211156107fe57600080fd5b818701915087601f83011261081257600080fd5b81358181111561082157600080fd5b88602082850101111561083357600080fd5b60209283019650945090860135908082111561084e57600080fd5b818701915087601f83011261086257600080fd5b81358181111561087157600080fd5b8860208260051b850101111561088657600080fd5b95989497505060200194505050565b600080858511156108a557600080fd5b838611156108b257600080fd5b5050820193919092039150565b634e487b7160e01b600052603260045260246000fd5b6000815160005b818110156108f657602081850181015186830152016108dc565b50600093019283525090919050565b6000610911828f6108d5565b8d815260206109228183018f6108d5565b91508c82526109338183018d6108d5565b91508a82526109448183018b6108d5565b9150888252610955818301896108d5565b9150868252610966818301876108d5565b9485529093019e9d5050505050505050505050505050565b600061098a828d6108d5565b8b815261099a602082018c6108d5565b90508981526109ac602082018a6108d5565b90508781526109be60208201886108d5565b90508581526109d060208201866108d5565b938452505060209091019a9950505050505050505050565b6000610a06610a006109fa84886108d5565b866108d5565b846108d5565b95945050505050565b6000610a1b828d6108d5565b8a8c82376000908b01908152610a4c610a46610a40610a3a848e6108d5565b8c6108d5565b8a6108d5565b886108d5565b9050848682376000908501908152610a6481856108d5565b9d9c50505050505050505050505050565b600060208284031215610a8757600080fd5b505191905056fe0000000000000000000000000000000015b4afad69aa5004351acdedf135ea8c119136e4a9cc5264ad5fdb7ac0e5c672e2e7db1fb78f7f199209b435805e149b00000000000000000000000000000000076c13e81b51a85b2359ec8a74e58d50dd4390caccb722e9d418f498f76b73d05258b7f6469a3d297bfd1bcce79c48a30000000000000000000000000000000012c235cd0dff21c90a874f40194a90bb0ae28ad8a9e1e0d4bb28c867b8a9ed399774c4c4a4bbac8987895b874083209700000000000000000000000000000000051628e805cdffe595ac56d89d6980e17aeb75e7829d5f8e2238bd6971ad7d42aca6030a6922c7a0a984c6bcd42a354000000000000000000000000000000000056cb05353be57f36e8e8b3fe252d73494868849f84c5771287377c0cca83d11c62e961eaf4f39aae27585bda6e34bd7000000000000000000000000000000000af47b229fe71ec574e734d329afda71bcefd6eaf7c1f8b0520db0598d556acbeaad9bf62b5266111286a952ec351bdb00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be000000000000000000000000000000000d6f250ecee36fe47789791fd7fe1c3f2be7cad885362874de470c603d0ba8ec6496d2e6b43e8649fa2a86c3471303aa0000000000000000000000000000000015675af24c902bf92fc34b4346612c7b44d2c5a6d9177aea288ce4110c97762b7927bf175211ccb26ab940920292fa45000000000000000000000000000000000cd898802f34737dda55593aa140657150dd82c296c9ff1bcb8c8ee219555729f6ea0a47d7df1379ce5647d9560ca6e10000000000000000000000000000000006243e1b4c1541e45f9b12f466aebb6a87df58dd4993a354ecd56f69478c8c91534f7cd618232c98d8c798d787d5e6f000000000000000000000000000000000176bc78390ab973aee8d3a4f1435ad04909d9329e8925700e23823afecc676f34faa0a9d03278390fcaf75203e5dd22500000000000000000000000000000000199a69c8578edb77cf1b8fdf4615122e9d7e3b8e71bbe06926066a6c3dd733d43ec894a7eef5b360ecc6d90f016b538f00000000000000000000000000000000081ea159928872494adafccaf79137c9d21b17cf95cd661b490b00149e49ac0668248bda8a909293eaeac14335a94c01000000000000000000000000000000000de272f24956ec3fae1e49bd09d379aa5974ebd66127eec1e29ed2a2e46dd04060495521560cb38d501fef7d8fd8999d000000000000000000000000000000000e7d2f3424d49642a3aa383209d3ebf24fc08c9de6830557f8ec19e663f9db8f64205eb5ef79739a508e9991f9b56dd20000000000000000000000000000000008f89dfb735c2e849f234046630ba1f02f3634f39a3f661a9b93fd20782ae744bbbc9d705cd26929c4293fdb992bd548000000000000000000000000000000000b44a9cf91a0819d99e675afb4991c1aeb62f16fa1684f4dcb3abbef8f93d17c801b002337bc8e85e7165bca6a19ad2c000000000000000000000000000000000bde393e39b0d8f1abbd8594e93a77b5a37ce239e32e038a5470722c7b658ddf0fc37ed6b93b4321dff90d2af3f1dfdf000000000000000000000000000000000288965e6de9a6fddf856ca6cd50e03c633087b6c5fd4c321ca9634b6b2abc58ea5d7505f30a07cc98e738c57f01106d0000000000000000000000000000000012f6908276cfad592e34bae58ca157dc43b78fb52902b56169bdae74d5fda9bd78336a8432533bae531cb52c26497c2300000000000000000000000000000000193fafc9ccefe38b2e62cd92ae119cde6a3d46a6d282c94ed60702a542090f1bb2613ab6f1fc8501388fe2055004e886000000000000000000000000000000001031cc6ce8e2c56a4f944fcd07a1174e59ea26cf52871da643a6ca59d49bbdee6e4f18fd1fbdf8b2c1a52b60b04bedd70000000000000000000000000000000007019c05abbf779a8a77771578c7f06293328d676199e15cf604ec3e71af87b30e477b4bc4cd854e211e4f877ff89f12000000000000000000000000000000001384cc15729ce8ecf98fb9110ff0cc01767f713efd16d5b5be33caed239a51c2bd166fd5e7e1daf9d5573d0cb456466e0000000000000000000000000000000017a7f7ce3bf32f67348a4024a41b0bb52665f952055f297eaff649f4373e7ae524f07a1332e615793ed8009823ebf604000000000000000000000000000000000e58b2533b47262e945ac75f181dd935bf9377b5a51458bfef7ed4c8bd8e6fab48615501d8f4cec5b2ce2009e4de5053000000000000000000000000000000000230535028c450282775bdbc473f44acaa00f66432c0b93597fdc515518ec6be771afb9aab24170f2c1c4621ec9e88160000000000000000000000000000000004d1bc54ccab6d686e6eaa1e5346b4f6da4b0a04930b215c01467daa5c70e781ea83f45a1811e4659cd6168cb0f4aedb000000000000000000000000000000000c47199cf838eb957a41b7b5434ae82605662e5faac49933df54922f5f430600106373503437e79dcd919d9c9b951a1a000000000000000000000000000000000116548093120fdb220f819bdbca1164cc126939ebf93f69aa9d2899f80cc08fa8da71928792867d0a58b265f9d088a3000000000000000000000000000000000b212f6892cbc4bbbeeab38360da635cdb7fd14eeeabb20ca6bbce4e6b7c82aa2c3809f3655471e97b583dfaab2a1f2d0000000000000000000000000000000010969cf5a414796388e99a12d2921a319a9cbe0a35b070f4e07fa5172cd96f06f83e51250dbe7fa3f8108c730121ea530000000000000000000000000000000007052ac25c8174d68c3ccf74a9a5aa45fcab0a85cbd744e92e49c74b309f6ba1dd514aa40c487d82e67f68312fd59baf000000000000000000000000000000000e47efdfb3aa439ddf7227dbefa230a24305cb3f1e6153363069e1ed0dd2c223ae78834227d6679a0d075304afbd667e000000000000000000000000000000000358050c6f5ca4b7a26012c8d9b3843fc3696f241a8ef569627a791d930f07a431625dba3c7c789b5dc123e6092bd03c0000000000000000000000000000000004c862a03af198e5d356b0d20251a7cb0a463a6caaabccd44125cc0e27d1fac434aebf392a6933e47eb7383d25fc0f80000000000000000000000000000000000ae9253f27002d5a8f1b63529ce9d9000cc9cd93bc27040fd885340c8678bfd5aeae333e97891077dfebdd766665465000000000000000000000000000000000019c356555305f804abb5bf2c8d53dc6b95dd88458ed7a934e3f49317b936c80f5652df4c0e9f817dd069214905085d20000000000000000000000000000000003d9483b2738978b77d9bda476ecb635dbe8606942071e73dc30ef6d2d2b6b54282f4e5a057773cd087b905f8c2bb7c500000000000000000000000000000000095aa27ee0baaedbc3e545b9001c82c80fb7b1b2f9617b3946da04f4968b426e6601f179ada9f144ab6faf97fe613c450000000000000000000000000000000004dcddc74ede686ad7c366b7dd1b5009f60fc339a39ba20527eebfba7b6469b5d6ecd9a84c9b4e4c87e87b6cb8e97b4000000000000000000000000000000000037501970bf6aa06777d3ecb7a830e538f4e43b2a4d71104d4309e226412024b2c4dd26a2cc370e855737c186e888a4100000000000000000000000000000000028362e4bb2b941ecbb4d40b55855075288496c2781bc6785b3ddde0c3a128d0848ab60f6bb0880a3fe12c2cbca3c47800000000000000000000000000000000026d0fe733a26ce9f4a2d8109d2b62988aa60d0f96c35f35aa9ebd6b43ff69811cd685dde445f4a71ce38308252345c3a2646970667358221220b598547bbc178cee09e665657f55777cddcada61433a67015f24f7218580ea7864736f6c63430008180033",
32
+ "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80631e8e1e1314610030575b600080fd5b61004361003e3660046107d0565b610057565b604051901515815260200160405180910390f35b600061020084146100c05760405162461bcd60e51b815260206004820152602860248201527f50726f6f66206d7573742062652035313220627974657320284731207c7c204760448201526732207c7c2047312960c01b60648201526084015b60405180910390fd5b601082146101105760405162461bcd60e51b815260206004820152601960248201527f57726f6e67207075626c6963207369676e616c20636f756e740000000000000060448201526064016100b7565b600061011c848461016b565b90506000610135610130608083898b610895565b6105f8565b90506101608161014a61018060808a8c610895565b8561015b6102006101808d8f610895565b61068f565b979650505050505050565b606060006040518060a0016040528060808152602001610f8f60809139600160001b6040518060a001604052806080815260200161130f60809139868660008181106101b9576101b96108bf565b9050602002013560001b6040518060a001604052806080815260200161128f60809139888860018181106101ef576101ef6108bf565b9050602002013560001b6040518060a001604052806080815260200161100f608091398a8a6002818110610225576102256108bf565b9050602002013560001b6040518060a001604052806080815260200161108f608091398c8c600381811061025b5761025b6108bf565b9050602002013560001b6040518060a001604052806080815260200161140f608091398e8e6004818110610291576102916108bf565b6040516102b29e9d9c9b9a9998979695949360209283020135925001610905565b60408051601f1981840301815260a083019091526080808352909190610d8f6020830139858560058181106102e9576102e96108bf565b9050602002013560001b6040518060a001604052806080815260200161110f608091398787600681811061031f5761031f6108bf565b9050602002013560001b6040518060a001604052806080815260200161158f6080913989896007818110610355576103556108bf565b9050602002013560001b6040518060a001604052806080815260200161148f608091398b8b600881811061038b5761038b6108bf565b9050602002013560001b6040518060a001604052806080815260200161160f608091398d8d60098181106103c1576103c16108bf565b9050602002013560001b6040518060a001604052806080815260200161118f608091398f8f600a8181106103f7576103f76108bf565b6040516104189e9d9c9b9a9998979695949360209283020135925001610905565b60408051601f1981840301815260a083019091526080808352909190610a8f60208301398686600b81811061044f5761044f6108bf565b9050602002013560001b6040518060a001604052806080815260200161120f608091398888600c818110610485576104856108bf565b9050602002013560001b6040518060a001604052806080815260200161150f608091398a8a600d8181106104bb576104bb6108bf565b9050602002013560001b6040518060a0016040528060808152602001610d0f608091398c8c600e8181106104f1576104f16108bf565b9050602002013560001b6040518060a0016040528060808152602001610f0f608091398e8e600f818110610527576105276108bf565b6040516105469c9b9a999897969594936020928302013592500161097e565b60408051601f19818403018152908290526105659392916020016109e8565b60408051808303601f19018152608080845260a0840190925292506020820181803683370190505091506000608060208401835160208501600c5afa9050806105f05760405162461bcd60e51b815260206004820152601760248201527f47314d534d20707265636f6d70696c65206661696c656400000000000000000060448201526064016100b7565b505092915050565b60606106078260008186610895565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050506060820180516080840180517f64774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab8181109093016f1a0111ea397fe69a4b1ba7b6434bacd7039093529190039052509392505050565b6000808787876040518060a001604052806080815260200161138f608091396040518061012001604052806101008152602001610e0f6101009139896040518061012001604052806101008152602001610c0f61010091398a8a6040518061012001604052806101008152602001610b0f610100913960405160200161071e9a99989796959493929190610a0f565b60408051808303601f19018152602080845283830190925292506000919060208201818036833701905050905060006020808301845160208601600f5afa9050806107ab5760405162461bcd60e51b815260206004820152601960248201527f50414952494e4720707265636f6d70696c65206661696c65640000000000000060448201526064016100b7565b818060200190518101906107bf9190610a75565b6001149a9950505050505050505050565b600080600080604085870312156107e657600080fd5b843567ffffffffffffffff808211156107fe57600080fd5b818701915087601f83011261081257600080fd5b81358181111561082157600080fd5b88602082850101111561083357600080fd5b60209283019650945090860135908082111561084e57600080fd5b818701915087601f83011261086257600080fd5b81358181111561087157600080fd5b8860208260051b850101111561088657600080fd5b95989497505060200194505050565b600080858511156108a557600080fd5b838611156108b257600080fd5b5050820193919092039150565b634e487b7160e01b600052603260045260246000fd5b6000815160005b818110156108f657602081850181015186830152016108dc565b50600093019283525090919050565b6000610911828f6108d5565b8d815260206109228183018f6108d5565b91508c82526109338183018d6108d5565b91508a82526109448183018b6108d5565b9150888252610955818301896108d5565b9150868252610966818301876108d5565b9485529093019e9d5050505050505050505050505050565b600061098a828d6108d5565b8b815261099a602082018c6108d5565b90508981526109ac602082018a6108d5565b90508781526109be60208201886108d5565b90508581526109d060208201866108d5565b938452505060209091019a9950505050505050505050565b6000610a06610a006109fa84886108d5565b866108d5565b846108d5565b95945050505050565b6000610a1b828d6108d5565b8a8c82376000908b01908152610a4c610a46610a40610a3a848e6108d5565b8c6108d5565b8a6108d5565b886108d5565b9050848682376000908501908152610a6481856108d5565b9d9c50505050505050505050505050565b600060208284031215610a8757600080fd5b505191905056fe0000000000000000000000000000000015b4afad69aa5004351acdedf135ea8c119136e4a9cc5264ad5fdb7ac0e5c672e2e7db1fb78f7f199209b435805e149b00000000000000000000000000000000076c13e81b51a85b2359ec8a74e58d50dd4390caccb722e9d418f498f76b73d05258b7f6469a3d297bfd1bcce79c48a30000000000000000000000000000000012c235cd0dff21c90a874f40194a90bb0ae28ad8a9e1e0d4bb28c867b8a9ed399774c4c4a4bbac8987895b874083209700000000000000000000000000000000051628e805cdffe595ac56d89d6980e17aeb75e7829d5f8e2238bd6971ad7d42aca6030a6922c7a0a984c6bcd42a354000000000000000000000000000000000056cb05353be57f36e8e8b3fe252d73494868849f84c5771287377c0cca83d11c62e961eaf4f39aae27585bda6e34bd7000000000000000000000000000000000af47b229fe71ec574e734d329afda71bcefd6eaf7c1f8b0520db0598d556acbeaad9bf62b5266111286a952ec351bdb00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be000000000000000000000000000000000d6f250ecee36fe47789791fd7fe1c3f2be7cad885362874de470c603d0ba8ec6496d2e6b43e8649fa2a86c3471303aa0000000000000000000000000000000015675af24c902bf92fc34b4346612c7b44d2c5a6d9177aea288ce4110c97762b7927bf175211ccb26ab940920292fa45000000000000000000000000000000000cd898802f34737dda55593aa140657150dd82c296c9ff1bcb8c8ee219555729f6ea0a47d7df1379ce5647d9560ca6e10000000000000000000000000000000006243e1b4c1541e45f9b12f466aebb6a87df58dd4993a354ecd56f69478c8c91534f7cd618232c98d8c798d787d5e6f000000000000000000000000000000000176bc78390ab973aee8d3a4f1435ad04909d9329e8925700e23823afecc676f34faa0a9d03278390fcaf75203e5dd22500000000000000000000000000000000199a69c8578edb77cf1b8fdf4615122e9d7e3b8e71bbe06926066a6c3dd733d43ec894a7eef5b360ecc6d90f016b538f00000000000000000000000000000000081ea159928872494adafccaf79137c9d21b17cf95cd661b490b00149e49ac0668248bda8a909293eaeac14335a94c01000000000000000000000000000000000de272f24956ec3fae1e49bd09d379aa5974ebd66127eec1e29ed2a2e46dd04060495521560cb38d501fef7d8fd8999d000000000000000000000000000000000e7d2f3424d49642a3aa383209d3ebf24fc08c9de6830557f8ec19e663f9db8f64205eb5ef79739a508e9991f9b56dd20000000000000000000000000000000008f89dfb735c2e849f234046630ba1f02f3634f39a3f661a9b93fd20782ae744bbbc9d705cd26929c4293fdb992bd548000000000000000000000000000000000b44a9cf91a0819d99e675afb4991c1aeb62f16fa1684f4dcb3abbef8f93d17c801b002337bc8e85e7165bca6a19ad2c000000000000000000000000000000000bde393e39b0d8f1abbd8594e93a77b5a37ce239e32e038a5470722c7b658ddf0fc37ed6b93b4321dff90d2af3f1dfdf000000000000000000000000000000000288965e6de9a6fddf856ca6cd50e03c633087b6c5fd4c321ca9634b6b2abc58ea5d7505f30a07cc98e738c57f01106d0000000000000000000000000000000012f6908276cfad592e34bae58ca157dc43b78fb52902b56169bdae74d5fda9bd78336a8432533bae531cb52c26497c2300000000000000000000000000000000193fafc9ccefe38b2e62cd92ae119cde6a3d46a6d282c94ed60702a542090f1bb2613ab6f1fc8501388fe2055004e886000000000000000000000000000000001031cc6ce8e2c56a4f944fcd07a1174e59ea26cf52871da643a6ca59d49bbdee6e4f18fd1fbdf8b2c1a52b60b04bedd70000000000000000000000000000000007019c05abbf779a8a77771578c7f06293328d676199e15cf604ec3e71af87b30e477b4bc4cd854e211e4f877ff89f12000000000000000000000000000000001384cc15729ce8ecf98fb9110ff0cc01767f713efd16d5b5be33caed239a51c2bd166fd5e7e1daf9d5573d0cb456466e0000000000000000000000000000000017a7f7ce3bf32f67348a4024a41b0bb52665f952055f297eaff649f4373e7ae524f07a1332e615793ed8009823ebf604000000000000000000000000000000000e58b2533b47262e945ac75f181dd935bf9377b5a51458bfef7ed4c8bd8e6fab48615501d8f4cec5b2ce2009e4de5053000000000000000000000000000000000230535028c450282775bdbc473f44acaa00f66432c0b93597fdc515518ec6be771afb9aab24170f2c1c4621ec9e88160000000000000000000000000000000004d1bc54ccab6d686e6eaa1e5346b4f6da4b0a04930b215c01467daa5c70e781ea83f45a1811e4659cd6168cb0f4aedb000000000000000000000000000000000c47199cf838eb957a41b7b5434ae82605662e5faac49933df54922f5f430600106373503437e79dcd919d9c9b951a1a000000000000000000000000000000000116548093120fdb220f819bdbca1164cc126939ebf93f69aa9d2899f80cc08fa8da71928792867d0a58b265f9d088a3000000000000000000000000000000000b212f6892cbc4bbbeeab38360da635cdb7fd14eeeabb20ca6bbce4e6b7c82aa2c3809f3655471e97b583dfaab2a1f2d0000000000000000000000000000000010969cf5a414796388e99a12d2921a319a9cbe0a35b070f4e07fa5172cd96f06f83e51250dbe7fa3f8108c730121ea530000000000000000000000000000000007052ac25c8174d68c3ccf74a9a5aa45fcab0a85cbd744e92e49c74b309f6ba1dd514aa40c487d82e67f68312fd59baf000000000000000000000000000000000e47efdfb3aa439ddf7227dbefa230a24305cb3f1e6153363069e1ed0dd2c223ae78834227d6679a0d075304afbd667e000000000000000000000000000000000358050c6f5ca4b7a26012c8d9b3843fc3696f241a8ef569627a791d930f07a431625dba3c7c789b5dc123e6092bd03c0000000000000000000000000000000004c862a03af198e5d356b0d20251a7cb0a463a6caaabccd44125cc0e27d1fac434aebf392a6933e47eb7383d25fc0f80000000000000000000000000000000000ae9253f27002d5a8f1b63529ce9d9000cc9cd93bc27040fd885340c8678bfd5aeae333e97891077dfebdd766665465000000000000000000000000000000000019c356555305f804abb5bf2c8d53dc6b95dd88458ed7a934e3f49317b936c80f5652df4c0e9f817dd069214905085d20000000000000000000000000000000003d9483b2738978b77d9bda476ecb635dbe8606942071e73dc30ef6d2d2b6b54282f4e5a057773cd087b905f8c2bb7c500000000000000000000000000000000095aa27ee0baaedbc3e545b9001c82c80fb7b1b2f9617b3946da04f4968b426e6601f179ada9f144ab6faf97fe613c450000000000000000000000000000000004dcddc74ede686ad7c366b7dd1b5009f60fc339a39ba20527eebfba7b6469b5d6ecd9a84c9b4e4c87e87b6cb8e97b4000000000000000000000000000000000037501970bf6aa06777d3ecb7a830e538f4e43b2a4d71104d4309e226412024b2c4dd26a2cc370e855737c186e888a4100000000000000000000000000000000028362e4bb2b941ecbb4d40b55855075288496c2781bc6785b3ddde0c3a128d0848ab60f6bb0880a3fe12c2cbca3c47800000000000000000000000000000000026d0fe733a26ce9f4a2d8109d2b62988aa60d0f96c35f35aa9ebd6b43ff69811cd685dde445f4a71ce38308252345c3a2646970667358221220b598547bbc178cee09e665657f55777cddcada61433a67015f24f7218580ea7864736f6c63430008180033",
33
+ "linkReferences": {},
34
+ "deployedLinkReferences": {}
35
+ }
@@ -7,22 +7,60 @@ import "@openzeppelin/contracts/access/AccessControl.sol";
7
7
  import "@openzeppelin/contracts/utils/Pausable.sol";
8
8
  import "./VASPRegistry.sol";
9
9
  import "./SanctionsOracle.sol";
10
-
11
- /// @dev Interface for the Groth16 verifier with 16 public signals.
12
- /// The concrete Groth16Verifier.sol will be regenerated after circuit recompilation.
13
- interface IGroth16Verifier {
14
- function verifyProof(
15
- uint[2] calldata _pA,
16
- uint[2][2] calldata _pB,
17
- uint[2] calldata _pC,
18
- uint[16] calldata _pubSignals
19
- ) external view returns (bool);
20
- }
10
+ import "./VerifierRouter.sol";
21
11
 
22
12
  contract ComplianceRegistry is AccessControl, Pausable {
13
+ // Custom errors
14
+ error ZeroVerifierRouter();
15
+ error ZeroRegistry();
16
+ error ZeroOracle();
17
+ error TransferAlreadyRecorded();
18
+ error SanctionsOraclePaused();
19
+ error VASPRegistryPaused();
20
+ error SanctionsOracleStale();
21
+ error VASPNotActive();
22
+ error NotRegisteredVASPWallet();
23
+ error WrongChain();
24
+ error WrongContract();
25
+ error ProofExpired();
26
+ error ProofTimestampInFuture();
27
+ error SanctionsRootMismatch();
28
+ error IssuerRootMismatch();
29
+ error TransferIDMismatch();
30
+ error CredentialAlreadyRevoked();
31
+ error ProofAlreadyUsed();
32
+ error ProofVerificationFailed();
33
+ error AlreadyRevoked();
34
+ error MalformedJurisdictionCode();
35
+ error ThresholdMismatch();
36
+ error ThresholdsNotOrdered();
37
+ error VerifierSelectorNotSet();
38
+
23
39
  bytes32 public constant REVOKER_ROLE = keccak256("REVOKER_ROLE");
40
+ bytes32 public constant THRESHOLD_ADMIN_ROLE = keccak256("THRESHOLD_ADMIN_ROLE");
41
+
42
+ /// @dev Reserved key for the FATF default. Real jurisdiction codes are the
43
+ /// big-endian ASCII value of two uppercase letters, so they always fall in
44
+ /// [0x4141, 0x5A5A] and can never collide with 0.
45
+ uint16 public constant DEFAULT_JURISDICTION_KEY = 0;
46
+
47
+ /// @notice Lower bounds for amount tiers 2, 3 and 4, in USD-equivalent.
48
+ struct Thresholds {
49
+ uint64 tier2;
50
+ uint64 tier3;
51
+ uint64 tier4;
52
+ bool registered;
53
+ }
54
+
55
+ /// @notice jurisdiction_code (public signal 6) => thresholds this contract accepts.
56
+ /// @dev Key DEFAULT_JURISDICTION_KEY holds the fallback for unregistered codes.
57
+ mapping(uint16 => Thresholds) public jurisdictionThresholds;
24
58
 
25
- IGroth16Verifier public immutable verifier;
59
+ event JurisdictionThresholdsSet(uint16 indexed jurisdictionCode, uint64 tier2, uint64 tier3, uint64 tier4);
60
+ event JurisdictionCodeMismatch(bytes32 indexed transferId, uint256 claimedJurisdictionCode, uint256 expectedJurisdictionCode);
61
+
62
+ VerifierRouter public verifierRouter;
63
+ bytes32 public verifierSelector;
26
64
  VASPRegistry public immutable vaspRegistry;
27
65
  SanctionsOracle public immutable sanctionsOracle;
28
66
 
@@ -39,18 +77,104 @@ contract ComplianceRegistry is AccessControl, Pausable {
39
77
  event ProofVerified(bytes32 indexed transferId, bytes32 indexed nullifier, bool isCompliant, bool sarFlag);
40
78
  event CredentialRevoked(bytes32 indexed commitment, address revoker);
41
79
 
42
- constructor(address _verifier, address _vaspRegistry, address _sanctionsOracle) {
80
+ /// @param defaultTier2 Lower bound of tier 2 for jurisdictions with no explicit entry.
81
+ /// @param defaultTier3 Lower bound of tier 3 for the same.
82
+ /// @param defaultTier4 Lower bound of tier 4 for the same.
83
+ ///
84
+ /// @dev The default entry is set here rather than in a follow-up transaction
85
+ /// on purpose. verifyAndRecord rejects any proof whose thresholds disagree
86
+ /// with this table, and every lookup falls through to the default entry, so
87
+ /// a registry deployed with an empty table accepts *nothing* — a silent,
88
+ /// total outage with no on-chain signal. Taking the default in the
89
+ /// constructor makes that state unrepresentable.
90
+ constructor(
91
+ address _verifierRouter,
92
+ bytes32 _verifierSelector,
93
+ address _vaspRegistry,
94
+ address _sanctionsOracle,
95
+ uint64 defaultTier2,
96
+ uint64 defaultTier3,
97
+ uint64 defaultTier4
98
+ ) {
43
99
  // M-7: Zero-address validation
44
- require(_verifier != address(0), "Zero verifier");
45
- require(_vaspRegistry != address(0), "Zero registry");
46
- require(_sanctionsOracle != address(0), "Zero oracle");
100
+ if (_verifierRouter == address(0)) revert ZeroVerifierRouter();
101
+ if (_vaspRegistry == address(0)) revert ZeroRegistry();
102
+ if (_sanctionsOracle == address(0)) revert ZeroOracle();
47
103
 
48
- verifier = IGroth16Verifier(_verifier);
104
+ verifierRouter = VerifierRouter(_verifierRouter);
105
+ verifierSelector = _verifierSelector;
49
106
  vaspRegistry = VASPRegistry(_vaspRegistry);
50
107
  sanctionsOracle = SanctionsOracle(_sanctionsOracle);
51
108
 
52
109
  _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
53
110
  _grantRole(REVOKER_ROLE, msg.sender);
111
+ _grantRole(THRESHOLD_ADMIN_ROLE, msg.sender);
112
+
113
+ // Shares validation with the external setter, so the constructor cannot
114
+ // install an out-of-order default.
115
+ _setJurisdictionThresholds(DEFAULT_JURISDICTION_KEY, defaultTier2, defaultTier3, defaultTier4);
116
+ }
117
+
118
+ /// @notice Set the verifier selector to use
119
+ /// @param _verifierSelector The selector for the verifier to use
120
+ function setVerifierSelector(bytes32 _verifierSelector) external onlyRole(DEFAULT_ADMIN_ROLE) {
121
+ verifierSelector = _verifierSelector;
122
+ }
123
+
124
+ /// @notice Register or update the thresholds accepted for a jurisdiction.
125
+ /// @dev Pass DEFAULT_JURISDICTION_KEY to set the fallback used by codes with
126
+ /// no explicit entry. Seed from config/jurisdiction_thresholds.json — the
127
+ /// Python and TypeScript SDKs must agree with this table or proofs will
128
+ /// verify off-chain and revert here.
129
+ function setJurisdictionThresholds(uint16 jurisdictionCode, uint64 tier2, uint64 tier3, uint64 tier4)
130
+ external
131
+ onlyRole(THRESHOLD_ADMIN_ROLE)
132
+ {
133
+ _setJurisdictionThresholds(jurisdictionCode, tier2, tier3, tier4);
134
+ }
135
+
136
+ function _setJurisdictionThresholds(uint16 jurisdictionCode, uint64 tier2, uint64 tier3, uint64 tier4) internal {
137
+ // Ordering is what makes the tier comparison meaningful; an out-of-order
138
+ // table would silently make some tiers unreachable.
139
+ if (!(tier2 < tier3 && tier3 < tier4)) revert ThresholdsNotOrdered();
140
+
141
+ jurisdictionThresholds[jurisdictionCode] =
142
+ Thresholds({tier2: tier2, tier3: tier3, tier4: tier4, registered: true});
143
+ emit JurisdictionThresholdsSet(jurisdictionCode, tier2, tier3, tier4);
144
+ }
145
+
146
+ /// @notice Thresholds this contract will accept for a jurisdiction code,
147
+ /// resolving through the default entry when the code is not registered.
148
+ function thresholdsFor(uint16 jurisdictionCode) public view returns (Thresholds memory) {
149
+ Thresholds memory t = jurisdictionThresholds[jurisdictionCode];
150
+ if (t.registered) return t;
151
+ return jurisdictionThresholds[DEFAULT_JURISDICTION_KEY];
152
+ }
153
+
154
+ /// @dev Reverts unless signals 8-10 carry the thresholds this contract
155
+ /// accepts for signal 6.
156
+ ///
157
+ /// tier2/3/4_threshold are *unconstrained* public inputs — the circuit does
158
+ /// not derive them, the prover supplies them. Without this check a prover
159
+ /// submits tier2_threshold = 2**63, lands a $50M transfer in tier 1, and
160
+ /// the proof verifies: both the tier attestation and the SAR review flag
161
+ /// (tier >= 3) are defeated. Same class as domain binding: the security
162
+ /// lives in the verifier, not the circuit.
163
+ function _checkThresholds(uint[16] calldata _pubSignals) internal view {
164
+ uint256 rawCode = _pubSignals[6];
165
+ // Must be two uppercase ASCII letters, i.e. the encoding the circuit uses.
166
+ if (rawCode > 0xFFFF) revert MalformedJurisdictionCode();
167
+ uint8 hi = uint8(rawCode >> 8);
168
+ uint8 lo = uint8(rawCode);
169
+ if (hi < 0x41 || hi > 0x5A || lo < 0x41 || lo > 0x5A) revert MalformedJurisdictionCode();
170
+
171
+ Thresholds memory t = thresholdsFor(uint16(rawCode));
172
+ // Construction registers the fallback; every table write preserves
173
+ // registered=true and no removal path exists. Resolution is total.
174
+
175
+ if (_pubSignals[8] != t.tier2 || _pubSignals[9] != t.tier3 || _pubSignals[10] != t.tier4) {
176
+ revert ThresholdMismatch();
177
+ }
54
178
  }
55
179
 
56
180
  function verifyAndRecord(
@@ -62,49 +186,56 @@ contract ComplianceRegistry is AccessControl, Pausable {
62
186
  bytes32 vaspDidHash
63
187
  ) external whenNotPaused returns (bool) {
64
188
  // Replay prevention
65
- require(proofs[transferId].timestamp == 0, "Transfer already recorded");
189
+ if (proofs[transferId].timestamp != 0) revert TransferAlreadyRecorded();
66
190
 
67
191
  // H-6: Dependency health checks
68
- require(!sanctionsOracle.paused(), "Sanctions oracle paused");
69
- require(!vaspRegistry.paused(), "VASP registry paused");
70
- require(!sanctionsOracle.isStale(), "Sanctions oracle stale");
71
- require(vaspRegistry.isActive(vaspDidHash), "VASP not active");
192
+ if (sanctionsOracle.paused()) revert SanctionsOraclePaused();
193
+ if (vaspRegistry.paused()) revert VASPRegistryPaused();
194
+ if (sanctionsOracle.isStale()) revert SanctionsOracleStale();
195
+ if (!vaspRegistry.isActive(vaspDidHash)) revert VASPNotActive();
72
196
 
73
197
  // Sender binding
74
198
  (address vaspWallet,,,, ) = vaspRegistry.vasps(vaspDidHash);
75
- require(msg.sender == vaspWallet, "Not registered VASP wallet");
199
+ if (msg.sender != vaspWallet) revert NotRegisteredVASPWallet();
76
200
 
77
201
  // C-3: Domain binding (cross-chain replay protection)
78
- require(_pubSignals[11] == block.chainid, "Wrong chain");
202
+ if (_pubSignals[11] != block.chainid) revert WrongChain();
79
203
  // Circuit signals are reduced mod BN128 scalar field order (r).
80
204
  // keccak256 produces 256-bit values that may exceed r, so we must
81
205
  // reduce the contract-side hash to match what the circuit stores.
82
206
  uint256 BN128_R = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
83
- require(uint256(keccak256(abi.encodePacked(address(this)))) % BN128_R == _pubSignals[12], "Wrong contract");
207
+ if (uint256(keccak256(abi.encodePacked(address(this)))) % BN128_R != _pubSignals[12]) revert WrongContract();
84
208
 
85
209
  // Proof expiration: proof_expires_at (signal[15]) is a circuit public signal.
86
210
  // The circuit constrains proof_expires_at > transfer_timestamp.
87
211
  // Here we check the proof hasn't expired yet.
88
- require(block.timestamp <= _pubSignals[15], "Proof expired");
89
- require(_pubSignals[5] <= block.timestamp, "Proof timestamp in future");
212
+ if (block.timestamp > _pubSignals[15]) revert ProofExpired();
213
+ if (_pubSignals[5] > block.timestamp) revert ProofTimestampInFuture();
90
214
 
91
215
  // C-4: State binding (proof matches current on-chain roots)
92
- require(bytes32(_pubSignals[2]) == sanctionsOracle.currentRoot(), "Sanctions root mismatch");
93
- require(bytes32(_pubSignals[3]) == vaspRegistry.issuerMerkleRoot(), "Issuer root mismatch");
216
+ if (bytes32(_pubSignals[2]) != sanctionsOracle.currentRoot()) revert SanctionsRootMismatch();
217
+ if (bytes32(_pubSignals[3]) != vaspRegistry.issuerMerkleRoot()) revert IssuerRootMismatch();
94
218
 
95
219
  // M-1: Transfer binding (proof bound to this transfer)
96
- require(uint256(keccak256(abi.encodePacked(transferId))) % BN128_R == _pubSignals[13], "Transfer ID mismatch");
220
+ if (uint256(keccak256(abi.encodePacked(transferId))) % BN128_R != _pubSignals[13]) revert TransferIDMismatch();
221
+
222
+ _observeJurisdiction(transferId, vaspDidHash, _pubSignals[6]);
223
+
224
+ // AIF-79: Threshold binding (prover cannot choose its own tier boundaries)
225
+ _checkThresholds(_pubSignals);
97
226
 
98
227
  // C-5: Credential revocation check
99
- require(!revokedCredentials[bytes32(_pubSignals[7])], "Credential revoked");
228
+ if (revokedCredentials[bytes32(_pubSignals[7])]) revert CredentialAlreadyRevoked();
100
229
 
101
230
  // M-3: Nullifier — one-time proof use (prevents same proof on different transferIds)
102
231
  bytes32 nullifier = bytes32(_pubSignals[14]);
103
- require(!usedNullifiers[nullifier], "Proof already used");
232
+ if (usedNullifiers[nullifier]) revert ProofAlreadyUsed();
104
233
 
105
234
  // C-1: Cryptographic verification — revert on invalid proof
106
- bool valid = verifier.verifyProof(_pA, _pB, _pC, _pubSignals);
107
- require(valid, "Proof verification failed");
235
+ if (verifierSelector == bytes32(0)) revert VerifierSelectorNotSet();
236
+
237
+ bool valid = verifierRouter.verifyProof(verifierSelector, _pA, _pB, _pC, _pubSignals);
238
+ if (!valid) revert ProofVerificationFailed();
108
239
 
109
240
  // Record
110
241
  usedNullifiers[nullifier] = true;
@@ -122,7 +253,7 @@ contract ComplianceRegistry is AccessControl, Pausable {
122
253
  }
123
254
 
124
255
  function revokeCredential(bytes32 commitment) external onlyRole(REVOKER_ROLE) {
125
- require(!revokedCredentials[commitment], "Already revoked");
256
+ if (revokedCredentials[commitment]) revert AlreadyRevoked();
126
257
  revokedCredentials[commitment] = true;
127
258
  emit CredentialRevoked(commitment, msg.sender);
128
259
  }
@@ -142,4 +273,24 @@ contract ComplianceRegistry is AccessControl, Pausable {
142
273
  function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {
143
274
  _unpause();
144
275
  }
276
+
277
+ /// @dev Informational legacy observation; zero expected code means unverified.
278
+ function _observeJurisdiction(bytes32 transferId, bytes32 didHash, uint256 claimed) internal {
279
+ (, string memory jurisdiction,,,) = vaspRegistry.vasps(didHash);
280
+ uint256 expected = _encodeJurisdiction(jurisdiction);
281
+ if (expected == 0 || claimed != expected) {
282
+ emit JurisdictionCodeMismatch(transferId, claimed, expected);
283
+ }
284
+ }
285
+
286
+ function _encodeJurisdiction(string memory code) internal pure returns (uint256) {
287
+ bytes memory codeBytes = bytes(code);
288
+ if (codeBytes.length != 2) return 0;
289
+ uint8 hi = uint8(codeBytes[0]);
290
+ uint8 lo = uint8(codeBytes[1]);
291
+ // Check that both characters are uppercase ASCII letters
292
+ if (hi < 0x41 || hi > 0x5A) return 0;
293
+ if (lo < 0x41 || lo > 0x5A) return 0;
294
+ return (uint256(hi) << 8) | uint256(lo);
295
+ }
145
296
  }