From 8a27dfc4d1d1d85b09ed4f6f52284d776f2d3f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gm=E1=B5=8D=E1=B5=90?= <4529189+oyyblin@users.noreply.github.com> Date: Fri, 24 May 2024 22:26:37 -0700 Subject: [PATCH] chore(contracts): deploy on gravity alpha mainnet (#5) Deployed and verified core and primitive contracts on gravity alpha mainnet. Example: https://explorer.gravity.xyz/address/0x5F6CFf23e9A4f63e934891eE8eb6071423385aD0?tab=contract --- .../deployments/gravity/.chainId | 1 + .../gravity/BabyZKGroth16BooleanVerifier.json | 109 ++ .../BabyZKGroth16PassportVerifier.json | 109 ++ .../BabyZKGroth16PropertyVerifier.json | 109 ++ .../BabyZKGroth16Scalar256Verifier.json | 109 ++ .../gravity/BabyZKGroth16ScalarVerifier.json | 109 ++ .../gravity/BabyZKGroth16UnitVerifier.json | 109 ++ .../gravity/BabyzkDefaultPsGetter.json | 76 ++ .../gravity/BabyzkStatefulVerifier.json | 447 +++++++ .../deployments/gravity/ContextRegistry.json | 160 +++ .../deployments/gravity/IssuerRegistry.json | 966 +++++++++++++++ .../deployments/gravity/TypeRegistry.json | 1052 +++++++++++++++++ .../e08d6b930820ab219ef1afbfaba72b7a.json | 106 ++ packages/evm-contracts/hardhat.config.ts | 12 + packages/evm-contracts/package.json | 6 +- 15 files changed, 3479 insertions(+), 1 deletion(-) create mode 100644 packages/evm-contracts/deployments/gravity/.chainId create mode 100644 packages/evm-contracts/deployments/gravity/BabyZKGroth16BooleanVerifier.json create mode 100644 packages/evm-contracts/deployments/gravity/BabyZKGroth16PassportVerifier.json create mode 100644 packages/evm-contracts/deployments/gravity/BabyZKGroth16PropertyVerifier.json create mode 100644 packages/evm-contracts/deployments/gravity/BabyZKGroth16Scalar256Verifier.json create mode 100644 packages/evm-contracts/deployments/gravity/BabyZKGroth16ScalarVerifier.json create mode 100644 packages/evm-contracts/deployments/gravity/BabyZKGroth16UnitVerifier.json create mode 100644 packages/evm-contracts/deployments/gravity/BabyzkDefaultPsGetter.json create mode 100644 packages/evm-contracts/deployments/gravity/BabyzkStatefulVerifier.json create mode 100644 packages/evm-contracts/deployments/gravity/ContextRegistry.json create mode 100644 packages/evm-contracts/deployments/gravity/IssuerRegistry.json create mode 100644 packages/evm-contracts/deployments/gravity/TypeRegistry.json create mode 100644 packages/evm-contracts/deployments/gravity/solcInputs/e08d6b930820ab219ef1afbfaba72b7a.json diff --git a/packages/evm-contracts/deployments/gravity/.chainId b/packages/evm-contracts/deployments/gravity/.chainId new file mode 100644 index 0000000..48d20d9 --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/.chainId @@ -0,0 +1 @@ +1625 \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/BabyZKGroth16BooleanVerifier.json b/packages/evm-contracts/deployments/gravity/BabyZKGroth16BooleanVerifier.json new file mode 100644 index 0000000..a248de2 --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/BabyZKGroth16BooleanVerifier.json @@ -0,0 +1,109 @@ +{ + "address": "0x03d01B9d3F3eF125bdfC4a66DCb4362d4064E522", + "abi": [ + { + "inputs": [], + "name": "AliasedPublicSignal", + "type": "error" + }, + { + "inputs": [], + "name": "getVerificationKeys", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "isAliased", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_proofs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "verifyProof", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x8a9df13ec7cfb437d10efbcdd63c12fce952099605feffbd0a6e84ea08f0d62f", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0xb85b3D61439a3d70D3DF7913a3A764F352b32C55", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "1191372", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2f1aa57d1a584d73a1b532617e6ba765b4de9a477bee3e67d4bf3cc8946ea727", + "transactionHash": "0x8a9df13ec7cfb437d10efbcdd63c12fce952099605feffbd0a6e84ea08f0d62f", + "logs": [], + "blockNumber": 32, + "cumulativeGasUsed": "1191372", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e08d6b930820ab219ef1afbfaba72b7a", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AliasedPublicSignal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"getVerificationKeys\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"isAliased\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_proofs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"verifyProof\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getVerificationKeys()\":{\"details\":\"returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs..\"},\"isAliased(uint256[])\":{\"details\":\"return true if the public signal is aliased\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/primitive/boolean_verifier.sol\":\"BabyZKGroth16BooleanVerifier\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"contracts/primitive/boolean_verifier.sol\":{\"content\":\"\\n// SPDX-License-Identifier: GPL-3.0\\n/*\\n Copyright (c) 2021 0KIMS association.\\n Copyright (c) [2024] Galxe.com.\\n\\n Modifications to this file are part of the Galxe Identity Protocol SDK,\\n which is built using the snarkJS template and is subject to the GNU\\n General Public License v3.0.\\n\\n snarkJS is free software: you can redistribute it and/or modify it\\n under the terms of the GNU General Public License as published by\\n the Free Software Foundation, either version 3 of the License, or\\n (at your option) any later version.\\n\\n This program is distributed in the hope that it will be useful,\\n but WITHOUT ANY WARRANTY; without even the implied warranty of\\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n GNU General Public License for more details.\\n\\n You should have received a copy of the GNU General Public License\\n along with this program. If not, see .\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ncontract BabyZKGroth16BooleanVerifier {\\n error AliasedPublicSignal();\\n\\n // Scalar field size\\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\\n // Base field size\\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\\n\\n // Verification Key data\\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n uint256 constant deltax1 = 18281420389139490670240572462309728931069762758666384847478890846556477812965;\\n uint256 constant deltax2 = 13401048439837810951017914211936278660216063821494073603722338220435396604496;\\n uint256 constant deltay1 = 21202874041022648331698980994305693341595566632225027482785352902129485264727;\\n uint256 constant deltay2 = 18936150877052652216308940020674055541483409091516037105694618299681834990474;\\n\\n uint256 constant IC0x = 11708618300626501124421915901735889591197446563131571476394569301508043971365;\\n uint256 constant IC0y = 5667514267789447089323739319302611763465078048052662562196140462383395872508;\\n uint256 constant IC1x = 15195705616700521012127976013459675996720680873721938174087344817064767499959;\\n uint256 constant IC1y = 10672412375348497688974862364812884221172587257800457800668811962573422720732;\\n uint256 constant IC2x = 4469767714974381441038544382870449937983870305031160934495947295783672104013;\\n uint256 constant IC2y = 4361256855208731585297541461256540828791924499734176154562126034217325411934;\\n uint256 constant IC3x = 4065007474830663054201212769345725643214519104637863460251326998261224908568;\\n uint256 constant IC3y = 6722062532354494177039541269624640687683302797177341622876247091615420138062;\\n uint256 constant IC4x = 1608339021418891675882917683154745444281045012507703357182246989049514310802;\\n uint256 constant IC4y = 8128620874671164172824065936832829796083958521475019452105747777459375950633;\\n uint256 constant IC5x = 5257146532344065012887276372955246831140342551839377880655400784457099064055;\\n uint256 constant IC5y = 7978844236199995179937224040162027377080018126978522079920482177471499890762;\\n uint256 constant IC6x = 10919099488333612709240051641143996285651554605790292501117844479164219585395;\\n uint256 constant IC6y = 635941112977521509791637454846079128545601403436336522285604528441058883176;\\n uint256 constant IC7x = 705061730669005706983263006435004752941196689804428750178681337792905619800;\\n uint256 constant IC7y = 18860749750051025290426084402442253763575791772481148599856400050650550936756;\\n uint256 constant IC8x = 11127748386585527685549602598855629727831492527374704844754329658052519779790;\\n uint256 constant IC8y = 21812178917568511189373133106334498782516965982617079750055782729466471342097;\\n uint256 constant IC9x = 14606668935673508299530739594649429081565836775860125129151272617815996710514;\\n uint256 constant IC9y = 17331858016265809439561525313334479042500557416338688182261061090557648779826;\\n // Memory data\\n uint16 constant pVk = 0;\\n uint16 constant pPairing = 128;\\n\\n uint16 constant pLastMem = 896;\\n\\n uint16 constant proofLength = 8;\\n uint32 constant pubSignalLength = 9;\\n\\n /// @dev returns the verification keys in the order that the verifier expects them:\\n /// alpha, beta, gamma, delta, ICs..\\n function getVerificationKeys() public pure returns (uint[] memory) {\\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n vks[10] = 18281420389139490670240572462309728931069762758666384847478890846556477812965;\\n vks[11] = 13401048439837810951017914211936278660216063821494073603722338220435396604496;\\n vks[12] = 21202874041022648331698980994305693341595566632225027482785352902129485264727;\\n vks[13] = 18936150877052652216308940020674055541483409091516037105694618299681834990474;\\n vks[14] = 11708618300626501124421915901735889591197446563131571476394569301508043971365;\\n vks[15] = 5667514267789447089323739319302611763465078048052662562196140462383395872508;\\n vks[16] = 15195705616700521012127976013459675996720680873721938174087344817064767499959;\\n vks[17] = 10672412375348497688974862364812884221172587257800457800668811962573422720732;\\n vks[18] = 4469767714974381441038544382870449937983870305031160934495947295783672104013;\\n vks[19] = 4361256855208731585297541461256540828791924499734176154562126034217325411934;\\n vks[20] = 4065007474830663054201212769345725643214519104637863460251326998261224908568;\\n vks[21] = 6722062532354494177039541269624640687683302797177341622876247091615420138062;\\n vks[22] = 1608339021418891675882917683154745444281045012507703357182246989049514310802;\\n vks[23] = 8128620874671164172824065936832829796083958521475019452105747777459375950633;\\n vks[24] = 5257146532344065012887276372955246831140342551839377880655400784457099064055;\\n vks[25] = 7978844236199995179937224040162027377080018126978522079920482177471499890762;\\n vks[26] = 10919099488333612709240051641143996285651554605790292501117844479164219585395;\\n vks[27] = 635941112977521509791637454846079128545601403436336522285604528441058883176;\\n vks[28] = 705061730669005706983263006435004752941196689804428750178681337792905619800;\\n vks[29] = 18860749750051025290426084402442253763575791772481148599856400050650550936756;\\n vks[30] = 11127748386585527685549602598855629727831492527374704844754329658052519779790;\\n vks[31] = 21812178917568511189373133106334498782516965982617079750055782729466471342097;\\n vks[32] = 14606668935673508299530739594649429081565836775860125129151272617815996710514;\\n vks[33] = 17331858016265809439561525313334479042500557416338688182261061090557648779826;\\n return vks;\\n }\\n\\n /// @dev return true if the public signal is aliased\\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\\n // Alias check\\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\\n if (_pubSignals[8] >= 4) { return true; }\\n return false;\\n }\\n\\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\\n // Check Argument\\n require(_proofs.length == proofLength, \\\"Invalid proof\\\");\\n require(_pubSignals.length == pubSignalLength, \\\"Invalid public signal\\\");\\n if (isAliased(_pubSignals)) { return false; }\\n assembly {\\n // G1 function to multiply a G1 value(x,y) to value in an address\\n function g1_mulAccC(pR, x, y, s) {\\n let success\\n let mIn := mload(0x40)\\n mstore(mIn, x)\\n mstore(add(mIn, 32), y)\\n mstore(add(mIn, 64), s)\\n\\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n\\n mstore(add(mIn, 64), mload(pR))\\n mstore(add(mIn, 96), mload(add(pR, 32)))\\n\\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n }\\n\\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\\n let _pPairing := add(pMem, pPairing)\\n let _pVk := add(pMem, pVk)\\n\\n mstore(_pVk, IC0x)\\n mstore(add(_pVk, 32), IC0y)\\n\\n // Compute the linear combination it.vkey.vk_x\\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\\n // -A\\n mstore(_pPairing, calldataload(pA))\\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\\n\\n // B\\n mstore(add(_pPairing, 64), calldataload(pB))\\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\\n\\n // alpha1\\n mstore(add(_pPairing, 192), alphax)\\n mstore(add(_pPairing, 224), alphay)\\n\\n // beta2\\n mstore(add(_pPairing, 256), betax1)\\n mstore(add(_pPairing, 288), betax2)\\n mstore(add(_pPairing, 320), betay1)\\n mstore(add(_pPairing, 352), betay2)\\n\\n // it.vkey.vk_x\\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\\n\\n // gamma2\\n mstore(add(_pPairing, 448), gammax1)\\n mstore(add(_pPairing, 480), gammax2)\\n mstore(add(_pPairing, 512), gammay1)\\n mstore(add(_pPairing, 544), gammay2)\\n\\n // C\\n mstore(add(_pPairing, 576), calldataload(pC))\\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\\n\\n // delta2\\n mstore(add(_pPairing, 640), deltax1)\\n mstore(add(_pPairing, 672), deltax2)\\n mstore(add(_pPairing, 704), deltay1)\\n mstore(add(_pPairing, 736), deltay2)\\n\\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\\n\\n isOk := and(success, mload(_pPairing))\\n }\\n\\n let pMem := mload(0x40)\\n mstore(0x40, add(pMem, pLastMem))\\n\\n // Validate all evaluations\\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\\n\\n mstore(0, isValid)\\n return(0, 0x20)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4707d1b26cd472eb8fdec125a04dbde3d453c3d742756628b5759b331fca41ff\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50611488806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b6100596100543660046112fb565b610096565b60405190151581526020015b60405180910390f35b61005961007c36600461133d565b610268565b6100896109c6565b60405161006591906113a9565b6000600160a01b838360008181106100b0576100b06113ed565b90506020020135106100c457506001610262565b600160a01b838360018181106100dc576100dc6113ed565b90506020020135106100f057506001610262565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000183836002818110610124576101246113ed565b905060200201351061013857506001610262565b600160a01b83836003818110610150576101506113ed565b905060200201351061016457506001610262565b600160f81b8383600481811061017c5761017c6113ed565b905060200201351061019057506001610262565b68010000000000000000838360058181106101ad576101ad6113ed565b90506020020135106101c157506001610262565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f5576101f56113ed565b905060200201351061020957506001610262565b600160f91b83836007818110610221576102216113ed565b905060200201351061023557506001610262565b60048383600881811061024a5761024a6113ed565b905060200201351061025e57506001610262565b5060005b92915050565b6000600884146102bf5760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b6009821461030f5760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c000000000000000000000060448201526064016102b6565b6103198383610096565b15610326575060006109be565b610994565b600060405183815284602082015285604082015260408160608360076107d05a03fa91508161035e576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa9150508061038f576000805260206000f35b5050505050565b7f19e2d7d62ad78778d538aa4cc1906ab8cd031dabdc8423c60c2aa4b5b1761b2585527f0c87b30bcfdadd1de71439b78c03dda1947937ed7f5b2e1649745f1f7c6d9efc60208601526000608086018661043387357f17985f1040ce91df7b3e108e7aa3348447ddaa0657c0df3548fcf8aabdb5f6dc7f219876ef6000a27263d16bffbe37b82559e0ef7ed574742349a26073e7b1aeb78461032b565b61048360208801357f09a46247854b3962a0f894c582c521e89087e17051d0e4cf906e7d03f701be5e7f09e1cc8301596613c230bb82a716d20bee6716b1d9ed1184f7fd36b0e91c444d8461032b565b6104d360408801357f0edc8d74e734ad3eaafc9b978b07a785ac8fd158bd8f8b677d4e79f0ac08424e7f08fcb673484647aa4270363d4cfed3ee21f47d3bce6f1f3f2ad1d0cfd00727188461032b565b61052360608801357f11f8a2e973098d25436c4927593eb9f7ee6c106395df37c7a8b148ad92a9cb297f038e49a1e8083817b49fdd5067e17f00a57652b0171902d27c5cf75d6cee3c928461032b565b61057360808801357f11a3dda529b3c032a76f5a26d10da0c7c0b1277912495d4c0805e8446832704a7f0b9f708287425feefa2ba54448ae4af0e55d83d07cdf41d21dd32f87dcbf32f78461032b565b6105c360a08801357f0167ee0ee09789790e058689f11a7a737dc1913ab023b93b07f511ce868376687f1823fdc5d229b8b6aee4d37fb3ad7a91e2df36cdaad091d78759c1185f5af3738461032b565b61061360c08801357f29b2ce59cb6e8403d47d47339ed9f5ce4d1fb160d46e8b8cf0e69d361100a4b47f018f0d0114829c003026b3cd65b0c4d41cd0ea61543b7289785f5539867829588461032b565b61066360e08801357f3039417a0267ca94dea225649f643fcc7becfbb76f10656f5f71673c027d60117f189a1517969798e3c098dfaf8152ecb78090c6fd8f1b7674d7df6514f9d1ddce8461032b565b6106b46101008801357f26517be791578f3e57c579a290d4c8f7d77110cd677279aa05ccd214ca7d3a327f204b14e69292ae6cee5af78a657dff23aa9b3588b5885af411b2676539893e728461032b565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f286aead181c9dae38744e63ffa598a133c7b85b42358e3d41b9f6669d45570e56102808201527f1da0b980fcb04777d82f2ecd9d9fbe4dcfdf592928524f84ccd04df2ff7fb2506102a08201527f2ee066c40d57a67121b8ed51bd61604d3d6ded5f8cf0bc0b2cc1e1c14a56b7576102c08201527f29dd7b4908fb7746df6308f0047f8298215b04b055f0b6b380df7783a23afb8a6102e08201526020816103008360086107d05a03fa9051169695505050505050565b60405161038081016040526109b2818560c0890160408a018a610396565b90508060005260206000f35b949350505050565b606060006109d660096002611419565b6109e1906010611441565b63ffffffff1667ffffffffffffffff8111156109ff576109ff611465565b604051908082528060200260200182016040528015610a28578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e281600081518110610a5f57610a5f6113ed565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192681600181518110610a9f57610a9f6113ed565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c81600281518110610adf57610adf6113ed565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab81600381518110610b1f57610b1f6113ed565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a781600481518110610b5f57610b5f6113ed565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec881600581518110610b9f57610b9f6113ed565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c281600681518110610bdf57610bdf6113ed565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed81600781518110610c1f57610c1f6113ed565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81600881518110610c5f57610c5f6113ed565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa81600981518110610c9f57610c9f6113ed565b6020026020010181815250507f286aead181c9dae38744e63ffa598a133c7b85b42358e3d41b9f6669d45570e581600a81518110610cdf57610cdf6113ed565b6020026020010181815250507f1da0b980fcb04777d82f2ecd9d9fbe4dcfdf592928524f84ccd04df2ff7fb25081600b81518110610d1f57610d1f6113ed565b6020026020010181815250507f2ee066c40d57a67121b8ed51bd61604d3d6ded5f8cf0bc0b2cc1e1c14a56b75781600c81518110610d5f57610d5f6113ed565b6020026020010181815250507f29dd7b4908fb7746df6308f0047f8298215b04b055f0b6b380df7783a23afb8a81600d81518110610d9f57610d9f6113ed565b6020026020010181815250507f19e2d7d62ad78778d538aa4cc1906ab8cd031dabdc8423c60c2aa4b5b1761b2581600e81518110610ddf57610ddf6113ed565b6020026020010181815250507f0c87b30bcfdadd1de71439b78c03dda1947937ed7f5b2e1649745f1f7c6d9efc81600f81518110610e1f57610e1f6113ed565b6020026020010181815250507f219876ef6000a27263d16bffbe37b82559e0ef7ed574742349a26073e7b1aeb781601081518110610e5f57610e5f6113ed565b6020026020010181815250507f17985f1040ce91df7b3e108e7aa3348447ddaa0657c0df3548fcf8aabdb5f6dc81601181518110610e9f57610e9f6113ed565b6020026020010181815250507f09e1cc8301596613c230bb82a716d20bee6716b1d9ed1184f7fd36b0e91c444d81601281518110610edf57610edf6113ed565b6020026020010181815250507f09a46247854b3962a0f894c582c521e89087e17051d0e4cf906e7d03f701be5e81601381518110610f1f57610f1f6113ed565b6020026020010181815250507f08fcb673484647aa4270363d4cfed3ee21f47d3bce6f1f3f2ad1d0cfd007271881601481518110610f5f57610f5f6113ed565b6020026020010181815250507f0edc8d74e734ad3eaafc9b978b07a785ac8fd158bd8f8b677d4e79f0ac08424e81601581518110610f9f57610f9f6113ed565b6020026020010181815250507f038e49a1e8083817b49fdd5067e17f00a57652b0171902d27c5cf75d6cee3c9281601681518110610fdf57610fdf6113ed565b6020026020010181815250507f11f8a2e973098d25436c4927593eb9f7ee6c106395df37c7a8b148ad92a9cb298160178151811061101f5761101f6113ed565b6020026020010181815250507f0b9f708287425feefa2ba54448ae4af0e55d83d07cdf41d21dd32f87dcbf32f78160188151811061105f5761105f6113ed565b6020026020010181815250507f11a3dda529b3c032a76f5a26d10da0c7c0b1277912495d4c0805e8446832704a8160198151811061109f5761109f6113ed565b6020026020010181815250507f1823fdc5d229b8b6aee4d37fb3ad7a91e2df36cdaad091d78759c1185f5af37381601a815181106110df576110df6113ed565b6020026020010181815250507f0167ee0ee09789790e058689f11a7a737dc1913ab023b93b07f511ce8683766881601b8151811061111f5761111f6113ed565b6020026020010181815250507f018f0d0114829c003026b3cd65b0c4d41cd0ea61543b7289785f55398678295881601c8151811061115f5761115f6113ed565b6020026020010181815250507f29b2ce59cb6e8403d47d47339ed9f5ce4d1fb160d46e8b8cf0e69d361100a4b481601d8151811061119f5761119f6113ed565b6020026020010181815250507f189a1517969798e3c098dfaf8152ecb78090c6fd8f1b7674d7df6514f9d1ddce81601e815181106111df576111df6113ed565b6020026020010181815250507f3039417a0267ca94dea225649f643fcc7becfbb76f10656f5f71673c027d601181601f8151811061121f5761121f6113ed565b6020026020010181815250507f204b14e69292ae6cee5af78a657dff23aa9b3588b5885af411b2676539893e728160208151811061125f5761125f6113ed565b6020026020010181815250507f26517be791578f3e57c579a290d4c8f7d77110cd677279aa05ccd214ca7d3a328160218151811061129f5761129f6113ed565b6020908102919091010152919050565b60008083601f8401126112c157600080fd5b50813567ffffffffffffffff8111156112d957600080fd5b6020830191508360208260051b85010111156112f457600080fd5b9250929050565b6000806020838503121561130e57600080fd5b823567ffffffffffffffff81111561132557600080fd5b611331858286016112af565b90969095509350505050565b6000806000806040858703121561135357600080fd5b843567ffffffffffffffff8082111561136b57600080fd5b611377888389016112af565b9096509450602087013591508082111561139057600080fd5b5061139d878288016112af565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156113e1578351835292840192918401916001016113c5565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461143957611439611403565b505092915050565b63ffffffff81811683821601908082111561145e5761145e611403565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b6100596100543660046112fb565b610096565b60405190151581526020015b60405180910390f35b61005961007c36600461133d565b610268565b6100896109c6565b60405161006591906113a9565b6000600160a01b838360008181106100b0576100b06113ed565b90506020020135106100c457506001610262565b600160a01b838360018181106100dc576100dc6113ed565b90506020020135106100f057506001610262565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000183836002818110610124576101246113ed565b905060200201351061013857506001610262565b600160a01b83836003818110610150576101506113ed565b905060200201351061016457506001610262565b600160f81b8383600481811061017c5761017c6113ed565b905060200201351061019057506001610262565b68010000000000000000838360058181106101ad576101ad6113ed565b90506020020135106101c157506001610262565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f5576101f56113ed565b905060200201351061020957506001610262565b600160f91b83836007818110610221576102216113ed565b905060200201351061023557506001610262565b60048383600881811061024a5761024a6113ed565b905060200201351061025e57506001610262565b5060005b92915050565b6000600884146102bf5760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b6009821461030f5760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c000000000000000000000060448201526064016102b6565b6103198383610096565b15610326575060006109be565b610994565b600060405183815284602082015285604082015260408160608360076107d05a03fa91508161035e576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa9150508061038f576000805260206000f35b5050505050565b7f19e2d7d62ad78778d538aa4cc1906ab8cd031dabdc8423c60c2aa4b5b1761b2585527f0c87b30bcfdadd1de71439b78c03dda1947937ed7f5b2e1649745f1f7c6d9efc60208601526000608086018661043387357f17985f1040ce91df7b3e108e7aa3348447ddaa0657c0df3548fcf8aabdb5f6dc7f219876ef6000a27263d16bffbe37b82559e0ef7ed574742349a26073e7b1aeb78461032b565b61048360208801357f09a46247854b3962a0f894c582c521e89087e17051d0e4cf906e7d03f701be5e7f09e1cc8301596613c230bb82a716d20bee6716b1d9ed1184f7fd36b0e91c444d8461032b565b6104d360408801357f0edc8d74e734ad3eaafc9b978b07a785ac8fd158bd8f8b677d4e79f0ac08424e7f08fcb673484647aa4270363d4cfed3ee21f47d3bce6f1f3f2ad1d0cfd00727188461032b565b61052360608801357f11f8a2e973098d25436c4927593eb9f7ee6c106395df37c7a8b148ad92a9cb297f038e49a1e8083817b49fdd5067e17f00a57652b0171902d27c5cf75d6cee3c928461032b565b61057360808801357f11a3dda529b3c032a76f5a26d10da0c7c0b1277912495d4c0805e8446832704a7f0b9f708287425feefa2ba54448ae4af0e55d83d07cdf41d21dd32f87dcbf32f78461032b565b6105c360a08801357f0167ee0ee09789790e058689f11a7a737dc1913ab023b93b07f511ce868376687f1823fdc5d229b8b6aee4d37fb3ad7a91e2df36cdaad091d78759c1185f5af3738461032b565b61061360c08801357f29b2ce59cb6e8403d47d47339ed9f5ce4d1fb160d46e8b8cf0e69d361100a4b47f018f0d0114829c003026b3cd65b0c4d41cd0ea61543b7289785f5539867829588461032b565b61066360e08801357f3039417a0267ca94dea225649f643fcc7becfbb76f10656f5f71673c027d60117f189a1517969798e3c098dfaf8152ecb78090c6fd8f1b7674d7df6514f9d1ddce8461032b565b6106b46101008801357f26517be791578f3e57c579a290d4c8f7d77110cd677279aa05ccd214ca7d3a327f204b14e69292ae6cee5af78a657dff23aa9b3588b5885af411b2676539893e728461032b565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f286aead181c9dae38744e63ffa598a133c7b85b42358e3d41b9f6669d45570e56102808201527f1da0b980fcb04777d82f2ecd9d9fbe4dcfdf592928524f84ccd04df2ff7fb2506102a08201527f2ee066c40d57a67121b8ed51bd61604d3d6ded5f8cf0bc0b2cc1e1c14a56b7576102c08201527f29dd7b4908fb7746df6308f0047f8298215b04b055f0b6b380df7783a23afb8a6102e08201526020816103008360086107d05a03fa9051169695505050505050565b60405161038081016040526109b2818560c0890160408a018a610396565b90508060005260206000f35b949350505050565b606060006109d660096002611419565b6109e1906010611441565b63ffffffff1667ffffffffffffffff8111156109ff576109ff611465565b604051908082528060200260200182016040528015610a28578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e281600081518110610a5f57610a5f6113ed565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192681600181518110610a9f57610a9f6113ed565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c81600281518110610adf57610adf6113ed565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab81600381518110610b1f57610b1f6113ed565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a781600481518110610b5f57610b5f6113ed565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec881600581518110610b9f57610b9f6113ed565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c281600681518110610bdf57610bdf6113ed565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed81600781518110610c1f57610c1f6113ed565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81600881518110610c5f57610c5f6113ed565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa81600981518110610c9f57610c9f6113ed565b6020026020010181815250507f286aead181c9dae38744e63ffa598a133c7b85b42358e3d41b9f6669d45570e581600a81518110610cdf57610cdf6113ed565b6020026020010181815250507f1da0b980fcb04777d82f2ecd9d9fbe4dcfdf592928524f84ccd04df2ff7fb25081600b81518110610d1f57610d1f6113ed565b6020026020010181815250507f2ee066c40d57a67121b8ed51bd61604d3d6ded5f8cf0bc0b2cc1e1c14a56b75781600c81518110610d5f57610d5f6113ed565b6020026020010181815250507f29dd7b4908fb7746df6308f0047f8298215b04b055f0b6b380df7783a23afb8a81600d81518110610d9f57610d9f6113ed565b6020026020010181815250507f19e2d7d62ad78778d538aa4cc1906ab8cd031dabdc8423c60c2aa4b5b1761b2581600e81518110610ddf57610ddf6113ed565b6020026020010181815250507f0c87b30bcfdadd1de71439b78c03dda1947937ed7f5b2e1649745f1f7c6d9efc81600f81518110610e1f57610e1f6113ed565b6020026020010181815250507f219876ef6000a27263d16bffbe37b82559e0ef7ed574742349a26073e7b1aeb781601081518110610e5f57610e5f6113ed565b6020026020010181815250507f17985f1040ce91df7b3e108e7aa3348447ddaa0657c0df3548fcf8aabdb5f6dc81601181518110610e9f57610e9f6113ed565b6020026020010181815250507f09e1cc8301596613c230bb82a716d20bee6716b1d9ed1184f7fd36b0e91c444d81601281518110610edf57610edf6113ed565b6020026020010181815250507f09a46247854b3962a0f894c582c521e89087e17051d0e4cf906e7d03f701be5e81601381518110610f1f57610f1f6113ed565b6020026020010181815250507f08fcb673484647aa4270363d4cfed3ee21f47d3bce6f1f3f2ad1d0cfd007271881601481518110610f5f57610f5f6113ed565b6020026020010181815250507f0edc8d74e734ad3eaafc9b978b07a785ac8fd158bd8f8b677d4e79f0ac08424e81601581518110610f9f57610f9f6113ed565b6020026020010181815250507f038e49a1e8083817b49fdd5067e17f00a57652b0171902d27c5cf75d6cee3c9281601681518110610fdf57610fdf6113ed565b6020026020010181815250507f11f8a2e973098d25436c4927593eb9f7ee6c106395df37c7a8b148ad92a9cb298160178151811061101f5761101f6113ed565b6020026020010181815250507f0b9f708287425feefa2ba54448ae4af0e55d83d07cdf41d21dd32f87dcbf32f78160188151811061105f5761105f6113ed565b6020026020010181815250507f11a3dda529b3c032a76f5a26d10da0c7c0b1277912495d4c0805e8446832704a8160198151811061109f5761109f6113ed565b6020026020010181815250507f1823fdc5d229b8b6aee4d37fb3ad7a91e2df36cdaad091d78759c1185f5af37381601a815181106110df576110df6113ed565b6020026020010181815250507f0167ee0ee09789790e058689f11a7a737dc1913ab023b93b07f511ce8683766881601b8151811061111f5761111f6113ed565b6020026020010181815250507f018f0d0114829c003026b3cd65b0c4d41cd0ea61543b7289785f55398678295881601c8151811061115f5761115f6113ed565b6020026020010181815250507f29b2ce59cb6e8403d47d47339ed9f5ce4d1fb160d46e8b8cf0e69d361100a4b481601d8151811061119f5761119f6113ed565b6020026020010181815250507f189a1517969798e3c098dfaf8152ecb78090c6fd8f1b7674d7df6514f9d1ddce81601e815181106111df576111df6113ed565b6020026020010181815250507f3039417a0267ca94dea225649f643fcc7becfbb76f10656f5f71673c027d601181601f8151811061121f5761121f6113ed565b6020026020010181815250507f204b14e69292ae6cee5af78a657dff23aa9b3588b5885af411b2676539893e728160208151811061125f5761125f6113ed565b6020026020010181815250507f26517be791578f3e57c579a290d4c8f7d77110cd677279aa05ccd214ca7d3a328160218151811061129f5761129f6113ed565b6020908102919091010152919050565b60008083601f8401126112c157600080fd5b50813567ffffffffffffffff8111156112d957600080fd5b6020830191508360208260051b85010111156112f457600080fd5b9250929050565b6000806020838503121561130e57600080fd5b823567ffffffffffffffff81111561132557600080fd5b611331858286016112af565b90969095509350505050565b6000806000806040858703121561135357600080fd5b843567ffffffffffffffff8082111561136b57600080fd5b611377888389016112af565b9096509450602087013591508082111561139057600080fd5b5061139d878288016112af565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156113e1578351835292840192918401916001016113c5565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461143957611439611403565b505092915050565b63ffffffff81811683821601908082111561145e5761145e611403565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "devdoc": { + "kind": "dev", + "methods": { + "getVerificationKeys()": { + "details": "returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs.." + }, + "isAliased(uint256[])": { + "details": "return true if the public signal is aliased" + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/BabyZKGroth16PassportVerifier.json b/packages/evm-contracts/deployments/gravity/BabyZKGroth16PassportVerifier.json new file mode 100644 index 0000000..518f621 --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/BabyZKGroth16PassportVerifier.json @@ -0,0 +1,109 @@ +{ + "address": "0xCA355CE1D55670F7CE29Bb2d23061fe041Fd4B35", + "abi": [ + { + "inputs": [], + "name": "AliasedPublicSignal", + "type": "error" + }, + { + "inputs": [], + "name": "getVerificationKeys", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "isAliased", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_proofs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "verifyProof", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x058722b8c4af5193f9af779dc083fe7cf9062a76e6971693eacf851323688d3d", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0xb85b3D61439a3d70D3DF7913a3A764F352b32C55", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "1846005", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x177b92a430a1d91c7971a288fa5831ce991e8e533ff4daff3965a84d71dac0b3", + "transactionHash": "0x058722b8c4af5193f9af779dc083fe7cf9062a76e6971693eacf851323688d3d", + "logs": [], + "blockNumber": 33, + "cumulativeGasUsed": "1846005", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e08d6b930820ab219ef1afbfaba72b7a", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AliasedPublicSignal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"getVerificationKeys\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"isAliased\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_proofs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"verifyProof\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getVerificationKeys()\":{\"details\":\"returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs..\"},\"isAliased(uint256[])\":{\"details\":\"return true if the public signal is aliased\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/primitive/passport_verifier.sol\":\"BabyZKGroth16PassportVerifier\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"contracts/primitive/passport_verifier.sol\":{\"content\":\"\\n// SPDX-License-Identifier: GPL-3.0\\n/*\\n Copyright (c) 2021 0KIMS association.\\n Copyright (c) [2024] Galxe.com.\\n\\n Modifications to this file are part of the Galxe Identity Protocol SDK,\\n which is built using the snarkJS template and is subject to the GNU\\n General Public License v3.0.\\n\\n snarkJS is free software: you can redistribute it and/or modify it\\n under the terms of the GNU General Public License as published by\\n the Free Software Foundation, either version 3 of the License, or\\n (at your option) any later version.\\n\\n This program is distributed in the hope that it will be useful,\\n but WITHOUT ANY WARRANTY; without even the implied warranty of\\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n GNU General Public License for more details.\\n\\n You should have received a copy of the GNU General Public License\\n along with this program. If not, see .\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ncontract BabyZKGroth16PassportVerifier {\\n error AliasedPublicSignal();\\n\\n // Scalar field size\\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\\n // Base field size\\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\\n\\n // Verification Key data\\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n uint256 constant deltax1 = 19465865793281917433205729628238261619528912558571179302590449641923237336493;\\n uint256 constant deltax2 = 9836552181821908562825916423250803559339661121322145769320042878374376765273;\\n uint256 constant deltay1 = 2972527452298515494899373054205226502120059050542082406518238980762330882252;\\n uint256 constant deltay2 = 12421615868696903838937420292736115333185255389288618736203999552328749392036;\\n\\n uint256 constant IC0x = 14776984778530556927051751502780752183532812497404227468852865294447689899684;\\n uint256 constant IC0y = 17685773495787771094438025456819460668298495540048327298895397288184307325705;\\n uint256 constant IC1x = 6664034107315858311511422569979074983940834486517859620395348427249564206809;\\n uint256 constant IC1y = 12760303119269580208319586542009971848846817012628300531806360956833814629985;\\n uint256 constant IC2x = 19366280974360769350356367686803112440430113251959095768046213591385594101452;\\n uint256 constant IC2y = 17093801976549281609260567293079493225703051358912668487337441826987698704629;\\n uint256 constant IC3x = 386851811089208845300030074706526125506346469239487083374842154361030488565;\\n uint256 constant IC3y = 18722900404056108381554785792201341384763351744307988156700500270397393292732;\\n uint256 constant IC4x = 4682885476595323933561358213075143845865774565593388066206531532132885959348;\\n uint256 constant IC4y = 5850994174503380950194612080364128937581319994284055744730951666132926716666;\\n uint256 constant IC5x = 15671798360572900223707477220512929244521356522801969550571363436690903144802;\\n uint256 constant IC5y = 10365135309026182539079935651272653598311663268323515026144018074820112882940;\\n uint256 constant IC6x = 19044951846105234723485623366315216752655547854406509098803621396685828349735;\\n uint256 constant IC6y = 19119610279035899152877324941264186837683296682672983594588992458876011602394;\\n uint256 constant IC7x = 3538973459932245424591080247559641414911379468388749572642782649132300694873;\\n uint256 constant IC7y = 15450719178532314846227623080510163606699070908397610381718487804798251587693;\\n uint256 constant IC8x = 16876617330818855626116296478024652384126117123695368471762633545558573896773;\\n uint256 constant IC8y = 16193141427372493169292876992166155262969525209114649123090477166198873198166;\\n uint256 constant IC9x = 12245164925172007974734702097824026495870184765972763204164284229199196985191;\\n uint256 constant IC9y = 12877388159301963624026183752692400587898554342657425638914901104687244639616;\\n uint256 constant IC10x = 1642518435529379014933816046234663107124606721915453421690810126711022023230;\\n uint256 constant IC10y = 15532519778263684349242587058200885042110074093745843241055075421064406476669;\\n uint256 constant IC11x = 1653927913992255150899961094135665055425982831140138862712571865555131509868;\\n uint256 constant IC11y = 19393088897719280708581363655688228044720171045462825030543833052850948179740;\\n uint256 constant IC12x = 13966415817554039303739898824237199730701799478932718815462469052086437585191;\\n uint256 constant IC12y = 754271034707522992282394485482277485341974743131758625275366007666120138859;\\n uint256 constant IC13x = 15884825247689712408312925540215748703066083669829831328659638305740457476879;\\n uint256 constant IC13y = 12771933037538988398040840113815326310960186624471152131651855797745402277939;\\n uint256 constant IC14x = 8394770979324344966026278699875572494666589345829918109276181251315274817937;\\n uint256 constant IC14y = 11484580623249470639116718499851788517924543321814685177346338720867864440295;\\n uint256 constant IC15x = 2607410923300790366774499215286000362261472013817978473990399675507507574512;\\n uint256 constant IC15y = 6958758652141884706015711090185066201141278356799200066863982636406009987588;\\n uint256 constant IC16x = 16765204562724608091354341011996342229773188726287008240326829505597474712634;\\n uint256 constant IC16y = 19739567344797965471793313547844484828999916933327397878003982434835796394260;\\n uint256 constant IC17x = 14074679229462710819872164161119812718373415447195746807959578699883989143186;\\n uint256 constant IC17y = 10588000997939792236273108802221683663922471858182522013077384244140964700796;\\n uint256 constant IC18x = 18426230130554689199393080729988153687119207645378405098824079273992586065141;\\n uint256 constant IC18y = 8226264301303767066406457085142607073537275812022598298127625299231198633417;\\n uint256 constant IC19x = 12018424623824039804768990498045015717817358670618610760607022379116842166459;\\n uint256 constant IC19y = 19818733566309795525407328598613797183517002730310020378704719724980933829476;\\n uint256 constant IC20x = 2155416569781886977751998854462475956858609815137594097300025364802951637558;\\n uint256 constant IC20y = 141128875753766578724317791812215586543301183501077871848828184088510192733;\\n uint256 constant IC21x = 13790369610773720064654435593502578583928416453136099982166437289553717459667;\\n uint256 constant IC21y = 1426290107802354671423278516763628976372973919574173083902016091405801970355;\\n // Memory data\\n uint16 constant pVk = 0;\\n uint16 constant pPairing = 128;\\n\\n uint16 constant pLastMem = 896;\\n\\n uint16 constant proofLength = 8;\\n uint32 constant pubSignalLength = 21;\\n\\n /// @dev returns the verification keys in the order that the verifier expects them:\\n /// alpha, beta, gamma, delta, ICs..\\n function getVerificationKeys() public pure returns (uint[] memory) {\\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n vks[10] = 19465865793281917433205729628238261619528912558571179302590449641923237336493;\\n vks[11] = 9836552181821908562825916423250803559339661121322145769320042878374376765273;\\n vks[12] = 2972527452298515494899373054205226502120059050542082406518238980762330882252;\\n vks[13] = 12421615868696903838937420292736115333185255389288618736203999552328749392036;\\n vks[14] = 14776984778530556927051751502780752183532812497404227468852865294447689899684;\\n vks[15] = 17685773495787771094438025456819460668298495540048327298895397288184307325705;\\n vks[16] = 6664034107315858311511422569979074983940834486517859620395348427249564206809;\\n vks[17] = 12760303119269580208319586542009971848846817012628300531806360956833814629985;\\n vks[18] = 19366280974360769350356367686803112440430113251959095768046213591385594101452;\\n vks[19] = 17093801976549281609260567293079493225703051358912668487337441826987698704629;\\n vks[20] = 386851811089208845300030074706526125506346469239487083374842154361030488565;\\n vks[21] = 18722900404056108381554785792201341384763351744307988156700500270397393292732;\\n vks[22] = 4682885476595323933561358213075143845865774565593388066206531532132885959348;\\n vks[23] = 5850994174503380950194612080364128937581319994284055744730951666132926716666;\\n vks[24] = 15671798360572900223707477220512929244521356522801969550571363436690903144802;\\n vks[25] = 10365135309026182539079935651272653598311663268323515026144018074820112882940;\\n vks[26] = 19044951846105234723485623366315216752655547854406509098803621396685828349735;\\n vks[27] = 19119610279035899152877324941264186837683296682672983594588992458876011602394;\\n vks[28] = 3538973459932245424591080247559641414911379468388749572642782649132300694873;\\n vks[29] = 15450719178532314846227623080510163606699070908397610381718487804798251587693;\\n vks[30] = 16876617330818855626116296478024652384126117123695368471762633545558573896773;\\n vks[31] = 16193141427372493169292876992166155262969525209114649123090477166198873198166;\\n vks[32] = 12245164925172007974734702097824026495870184765972763204164284229199196985191;\\n vks[33] = 12877388159301963624026183752692400587898554342657425638914901104687244639616;\\n vks[34] = 1642518435529379014933816046234663107124606721915453421690810126711022023230;\\n vks[35] = 15532519778263684349242587058200885042110074093745843241055075421064406476669;\\n vks[36] = 1653927913992255150899961094135665055425982831140138862712571865555131509868;\\n vks[37] = 19393088897719280708581363655688228044720171045462825030543833052850948179740;\\n vks[38] = 13966415817554039303739898824237199730701799478932718815462469052086437585191;\\n vks[39] = 754271034707522992282394485482277485341974743131758625275366007666120138859;\\n vks[40] = 15884825247689712408312925540215748703066083669829831328659638305740457476879;\\n vks[41] = 12771933037538988398040840113815326310960186624471152131651855797745402277939;\\n vks[42] = 8394770979324344966026278699875572494666589345829918109276181251315274817937;\\n vks[43] = 11484580623249470639116718499851788517924543321814685177346338720867864440295;\\n vks[44] = 2607410923300790366774499215286000362261472013817978473990399675507507574512;\\n vks[45] = 6958758652141884706015711090185066201141278356799200066863982636406009987588;\\n vks[46] = 16765204562724608091354341011996342229773188726287008240326829505597474712634;\\n vks[47] = 19739567344797965471793313547844484828999916933327397878003982434835796394260;\\n vks[48] = 14074679229462710819872164161119812718373415447195746807959578699883989143186;\\n vks[49] = 10588000997939792236273108802221683663922471858182522013077384244140964700796;\\n vks[50] = 18426230130554689199393080729988153687119207645378405098824079273992586065141;\\n vks[51] = 8226264301303767066406457085142607073537275812022598298127625299231198633417;\\n vks[52] = 12018424623824039804768990498045015717817358670618610760607022379116842166459;\\n vks[53] = 19818733566309795525407328598613797183517002730310020378704719724980933829476;\\n vks[54] = 2155416569781886977751998854462475956858609815137594097300025364802951637558;\\n vks[55] = 141128875753766578724317791812215586543301183501077871848828184088510192733;\\n vks[56] = 13790369610773720064654435593502578583928416453136099982166437289553717459667;\\n vks[57] = 1426290107802354671423278516763628976372973919574173083902016091405801970355;\\n return vks;\\n }\\n\\n /// @dev return true if the public signal is aliased\\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\\n // Alias check\\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\\n if (_pubSignals[8] >= 18446744073709551616) { return true; }\\n if (_pubSignals[9] >= 18446744073709551616) { return true; }\\n if (_pubSignals[10] >= 512) { return true; }\\n if (_pubSignals[11] >= 131072) { return true; }\\n if (_pubSignals[12] >= 512) { return true; }\\n if (_pubSignals[13] >= 18446744073709551616) { return true; }\\n if (_pubSignals[14] >= 18446744073709551616) { return true; }\\n if (_pubSignals[15] >= 18446744073709551616) { return true; }\\n if (_pubSignals[16] >= 18446744073709551616) { return true; }\\n if (_pubSignals[17] >= 18446744073709551616) { return true; }\\n if (_pubSignals[18] >= 18446744073709551616) { return true; }\\n if (_pubSignals[19] >= 256) { return true; }\\n if (_pubSignals[20] >= 256) { return true; }\\n return false;\\n }\\n\\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\\n // Check Argument\\n require(_proofs.length == proofLength, \\\"Invalid proof\\\");\\n require(_pubSignals.length == pubSignalLength, \\\"Invalid public signal\\\");\\n if (isAliased(_pubSignals)) { return false; }\\n assembly {\\n // G1 function to multiply a G1 value(x,y) to value in an address\\n function g1_mulAccC(pR, x, y, s) {\\n let success\\n let mIn := mload(0x40)\\n mstore(mIn, x)\\n mstore(add(mIn, 32), y)\\n mstore(add(mIn, 64), s)\\n\\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n\\n mstore(add(mIn, 64), mload(pR))\\n mstore(add(mIn, 96), mload(add(pR, 32)))\\n\\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n }\\n\\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\\n let _pPairing := add(pMem, pPairing)\\n let _pVk := add(pMem, pVk)\\n\\n mstore(_pVk, IC0x)\\n mstore(add(_pVk, 32), IC0y)\\n\\n // Compute the linear combination it.vkey.vk_x\\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\\n g1_mulAccC(_pVk, IC10x, IC10y, calldataload(add(pubSignals, 288)))\\n g1_mulAccC(_pVk, IC11x, IC11y, calldataload(add(pubSignals, 320)))\\n g1_mulAccC(_pVk, IC12x, IC12y, calldataload(add(pubSignals, 352)))\\n g1_mulAccC(_pVk, IC13x, IC13y, calldataload(add(pubSignals, 384)))\\n g1_mulAccC(_pVk, IC14x, IC14y, calldataload(add(pubSignals, 416)))\\n g1_mulAccC(_pVk, IC15x, IC15y, calldataload(add(pubSignals, 448)))\\n g1_mulAccC(_pVk, IC16x, IC16y, calldataload(add(pubSignals, 480)))\\n g1_mulAccC(_pVk, IC17x, IC17y, calldataload(add(pubSignals, 512)))\\n g1_mulAccC(_pVk, IC18x, IC18y, calldataload(add(pubSignals, 544)))\\n g1_mulAccC(_pVk, IC19x, IC19y, calldataload(add(pubSignals, 576)))\\n g1_mulAccC(_pVk, IC20x, IC20y, calldataload(add(pubSignals, 608)))\\n g1_mulAccC(_pVk, IC21x, IC21y, calldataload(add(pubSignals, 640)))\\n // -A\\n mstore(_pPairing, calldataload(pA))\\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\\n\\n // B\\n mstore(add(_pPairing, 64), calldataload(pB))\\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\\n\\n // alpha1\\n mstore(add(_pPairing, 192), alphax)\\n mstore(add(_pPairing, 224), alphay)\\n\\n // beta2\\n mstore(add(_pPairing, 256), betax1)\\n mstore(add(_pPairing, 288), betax2)\\n mstore(add(_pPairing, 320), betay1)\\n mstore(add(_pPairing, 352), betay2)\\n\\n // it.vkey.vk_x\\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\\n\\n // gamma2\\n mstore(add(_pPairing, 448), gammax1)\\n mstore(add(_pPairing, 480), gammax2)\\n mstore(add(_pPairing, 512), gammay1)\\n mstore(add(_pPairing, 544), gammay2)\\n\\n // C\\n mstore(add(_pPairing, 576), calldataload(pC))\\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\\n\\n // delta2\\n mstore(add(_pPairing, 640), deltax1)\\n mstore(add(_pPairing, 672), deltax2)\\n mstore(add(_pPairing, 704), deltay1)\\n mstore(add(_pPairing, 736), deltay2)\\n\\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\\n\\n isOk := and(success, mload(_pPairing))\\n }\\n\\n let pMem := mload(0x40)\\n mstore(0x40, add(pMem, pLastMem))\\n\\n // Validate all evaluations\\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\\n\\n mstore(0, isValid)\\n return(0, 0x20)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a4e5ed71be34f89afe3d48fe0bcb6a0c4d6fb0d46c19d2ed1f7925626ee936c\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50612055806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b610059610054366004611ec8565b610096565b60405190151581526020015b60405180910390f35b61005961007c366004611f0a565b61046d565b610089610f95565b6040516100659190611f76565b6000600160a01b838360008181106100b0576100b0611fba565b90506020020135106100c457506001610467565b600160a01b838360018181106100dc576100dc611fba565b90506020020135106100f057506001610467565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000018383600281811061012457610124611fba565b905060200201351061013857506001610467565b600160a01b8383600381811061015057610150611fba565b905060200201351061016457506001610467565b600160f81b8383600481811061017c5761017c611fba565b905060200201351061019057506001610467565b600160401b838360058181106101a8576101a8611fba565b90506020020135106101bc57506001610467565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f0576101f0611fba565b905060200201351061020457506001610467565b600160f91b8383600781811061021c5761021c611fba565b905060200201351061023057506001610467565b600160401b8383600881811061024857610248611fba565b905060200201351061025c57506001610467565b600160401b8383600981811061027457610274611fba565b905060200201351061028857506001610467565b6102008383600a81811061029e5761029e611fba565b90506020020135106102b257506001610467565b620200008383600b8181106102c9576102c9611fba565b90506020020135106102dd57506001610467565b6102008383600c8181106102f3576102f3611fba565b905060200201351061030757506001610467565b600160401b8383600d81811061031f5761031f611fba565b905060200201351061033357506001610467565b600160401b8383600e81811061034b5761034b611fba565b905060200201351061035f57506001610467565b600160401b8383600f81811061037757610377611fba565b905060200201351061038b57506001610467565b600160401b838360108181106103a3576103a3611fba565b90506020020135106103b757506001610467565b600160401b838360118181106103cf576103cf611fba565b90506020020135106103e357506001610467565b600160401b838360128181106103fb576103fb611fba565b905060200201351061040f57506001610467565b6101008383601381811061042557610425611fba565b905060200201351061043957506001610467565b6101008383601481811061044f5761044f611fba565b905060200201351061046357506001610467565b5060005b92915050565b6000600884146104c45760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b601582146105145760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c000000000000000000000060448201526064016104bb565b61051e8383610096565b1561052b57506000610f8d565b610f63565b600060405183815284602082015285604082015260408160608360076107d05a03fa915081610563576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa91505080610594576000805260206000f35b5050505050565b7f20ab7a1c4a992786d5b9a69f74df4ef247cabe14ccfbb92bea3f416d6cfc9ea485527f2719cb064d6a772f615affaf17fe27db8a4600d6a05cf67d925b99f42ef51b0960208601526000608086018661063887357f1c36135c257451fe3251d13a15bd16f71be3020f4fe8242769e61408897d4e617f0ebbb5aafe125824faf56bb34f720b3e026b4826897df819ebbd790c7e2346d984610530565b61068860208801357f25cabfc24ced2c19f1e3a9dd42817e12322c5a3403dfceec56507a45e6fa50f57f2ad0ed350f7636860adecec11f565410f9ebb75c3ed6e172c115576e54637ecc84610530565b6106d760408801357f2964c93d5fd40a9063bf7e9b6b25d128af1fde75f551fb510633e36b93354dbc7edaf34b2bc477e368ab501b071c4665216424cf9df8362f7c180540c83cb1f584610530565b61072760608801357f0cef8b9bcc0af3dd852d40c97afb9f29c1396c2d483c2c302bf6a01a1105dafa7f0a5a6b5420a5437a579946cd9c41d8b8c05fbf6cc318c5d561e76445631792b484610530565b61077760808801357f16ea756c68d336065c6ec5e7e0d54fc701ccdc01a4547c82f4f4688f5fb51cfc7f22a5ec6cb6b5132d04f6451eadcb87229bc1fdc4535ace17e75a3eb8246c196284610530565b6107c760a08801357f2a4550e0751c5cb5a4726e86135d61e6e31317420424a17d433e37fea6cae1da7f2a1b0f8d456ce71910fae94651061757288b595aa767c7fd9124991428535f2784610530565b61081760c08801357f2228cc121876ba710e5b792f2745618703adb095feb937a2579fff31601c586d7f07d2fced3f3b8ad4b5a5ccc6e9fdd034bc74620a687c0f30763ed46f1dd4f55984610530565b61086760e08801357f23ccfe45d048f80a9ef60941f8324181040128260c41396d98b6ed38bfb10e567f254fd3b0100dea0dd3523bdce92b03b5e8510e4d8043735a3aa0b8110fdad44584610530565b6108b86101008801357f1c7857e9a718cc87f942162233dc5d6b6f59d3f5982c108e1572f981fb6ffd807f1b12848a90f8f6f882d48e88b7390630534f169cadb14faaa4db5b49037e176784610530565b6109096101208801357f2257183af8db5615723f7882c25d00810abcd624737601dc8def4b8c16a3a77d7f03a1a1ead63a86a1d6d5c0b3d2610e7f62faad6e913274d24b25d86d372df23e84610530565b61095a6101408801357f2ae0196e33d5ed32deddec27af9952b9062f41a8d37fabb8dc0341f968c0871c7f03a8170be9eaa9379465565763eda336a0bc43d8abd9d1ca0ce158d7dfc52c6c84610530565b6109ab6101608801357f01aae6fb9cbac8b496ed016cc7a708ae6bdfb9078befad716246d39aff35206b7f1ee0b61289091d73b68fc020af70728687d49ed105ba70b22242ed2ab51ca12784610530565b6109fc6101808801357f1c3ca86dca425a59b142023a71672a05bf14e2edd16d39bc0f5a8f05ed7470337f231e7e131cfe4b7afc779e4910e352ab6f08bfbdf363b2040b5b874db07b830f84610530565b610a4d6101a08801357f19640ad2dbb4a4da72b018baca2969d97185cef37d6c754bc5b47a2695da6de77f128f45a1805009ba35b23ab9ad60a7734b7caafd832e70962f4328b985f7219184610530565b610a9e6101c08801357f0f62848fefce2f75d2671b021d81c288f2690f722de4a9a7c169b7ea72f382047f05c3be06573c9c66b733cf2b97f388284ce7070545095b019d77ddf20ec1b6f084610530565b610aef6101e08801357f2ba432fe1284570879b80f16aa6cca79a5b743d60a335fc134c1ee45ee8901147f2510c4fed0df6fc704577c2543cfbfa1a5e587d8bf504c37ccac1268ac05ac3a84610530565b610b406102008801357f176898a0401c122fcc8143328527d2945d01a361b2252f8a757e1e900a6de27c7f1f1dfc73ab33951f90ff3da22101680ae3a172381ab5b2bb67c7f3a2f4b78e9284610530565b610b916102208801357f122fe68d6f8e29468c0446953e1decd974276972f038a709791d43eeb0c75dc97f28bce06d57a4791073c572c9af291c7c7a5d94490425747c3763ab604024f4f584610530565b610be26102408801357f2bd101746e0ef0d00716567cb6fda4f4eb198497c4b6d12b869573759fc923647f1a922ff15cd43274cdf36ec871f8449963d80937d009d5e73908d7f830dfa8bb84610530565b610c326102608801357e4fe048f09a51a08793a769bdb60309c00247ed7ca574023a85d42e86e7dc5d7f04c3ec2bfab275d51e5ec572faac76613767be61880237d388711ccc638aea3684610530565b610c836102808801357f0327406867be8acaa0c27dcb538c8d26e27d06336fd28fa980f0788713fb5ab37f1e7d1295ce2b469e3d57f34e682932a22c508d51d2df492e804f0d8e88e97ad384610530565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f2b094a2349fa0c816828b92aaa638e678ad5348a8a4671e1a31a2b235ae755ad6102808201527f15bf4a8e8b30f866dc8d55e62253bdf465e84b6d12f89fd7c3b08908bde5f7596102a08201527f06926413176e6bce2e9885a0c1a42ec0e532202771da46e083ad7dafbefa60cc6102c08201527f1b7662abd10433044638b91851782196525ecad4dc3a4b7e8cdeaa06c3d1a0a46102e08201526020816103008360086107d05a03fa9051169695505050505050565b6040516103808101604052610f81818560c0890160408a018a61059b565b90508060005260206000f35b949350505050565b60606000610fa560156002611fe6565b610fb090601061200e565b63ffffffff1667ffffffffffffffff811115610fce57610fce612032565b604051908082528060200260200182016040528015610ff7578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e28160008151811061102e5761102e611fba565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d19268160018151811061106e5761106e611fba565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c816002815181106110ae576110ae611fba565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab816003815181106110ee576110ee611fba565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a78160048151811061112e5761112e611fba565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec88160058151811061116e5761116e611fba565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2816006815181106111ae576111ae611fba565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed816007815181106111ee576111ee611fba565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b8160088151811061122e5761122e611fba565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa8160098151811061126e5761126e611fba565b6020026020010181815250507f2b094a2349fa0c816828b92aaa638e678ad5348a8a4671e1a31a2b235ae755ad81600a815181106112ae576112ae611fba565b6020026020010181815250507f15bf4a8e8b30f866dc8d55e62253bdf465e84b6d12f89fd7c3b08908bde5f75981600b815181106112ee576112ee611fba565b6020026020010181815250507f06926413176e6bce2e9885a0c1a42ec0e532202771da46e083ad7dafbefa60cc81600c8151811061132e5761132e611fba565b6020026020010181815250507f1b7662abd10433044638b91851782196525ecad4dc3a4b7e8cdeaa06c3d1a0a481600d8151811061136e5761136e611fba565b6020026020010181815250507f20ab7a1c4a992786d5b9a69f74df4ef247cabe14ccfbb92bea3f416d6cfc9ea481600e815181106113ae576113ae611fba565b6020026020010181815250507f2719cb064d6a772f615affaf17fe27db8a4600d6a05cf67d925b99f42ef51b0981600f815181106113ee576113ee611fba565b6020026020010181815250507f0ebbb5aafe125824faf56bb34f720b3e026b4826897df819ebbd790c7e2346d98160108151811061142e5761142e611fba565b6020026020010181815250507f1c36135c257451fe3251d13a15bd16f71be3020f4fe8242769e61408897d4e618160118151811061146e5761146e611fba565b6020026020010181815250507f2ad0ed350f7636860adecec11f565410f9ebb75c3ed6e172c115576e54637ecc816012815181106114ae576114ae611fba565b6020026020010181815250507f25cabfc24ced2c19f1e3a9dd42817e12322c5a3403dfceec56507a45e6fa50f5816013815181106114ee576114ee611fba565b6020026020010181815250507edaf34b2bc477e368ab501b071c4665216424cf9df8362f7c180540c83cb1f58160148151811061152d5761152d611fba565b6020026020010181815250507f2964c93d5fd40a9063bf7e9b6b25d128af1fde75f551fb510633e36b93354dbc8160158151811061156d5761156d611fba565b6020026020010181815250507f0a5a6b5420a5437a579946cd9c41d8b8c05fbf6cc318c5d561e76445631792b4816016815181106115ad576115ad611fba565b6020026020010181815250507f0cef8b9bcc0af3dd852d40c97afb9f29c1396c2d483c2c302bf6a01a1105dafa816017815181106115ed576115ed611fba565b6020026020010181815250507f22a5ec6cb6b5132d04f6451eadcb87229bc1fdc4535ace17e75a3eb8246c19628160188151811061162d5761162d611fba565b6020026020010181815250507f16ea756c68d336065c6ec5e7e0d54fc701ccdc01a4547c82f4f4688f5fb51cfc8160198151811061166d5761166d611fba565b6020026020010181815250507f2a1b0f8d456ce71910fae94651061757288b595aa767c7fd9124991428535f2781601a815181106116ad576116ad611fba565b6020026020010181815250507f2a4550e0751c5cb5a4726e86135d61e6e31317420424a17d433e37fea6cae1da81601b815181106116ed576116ed611fba565b6020026020010181815250507f07d2fced3f3b8ad4b5a5ccc6e9fdd034bc74620a687c0f30763ed46f1dd4f55981601c8151811061172d5761172d611fba565b6020026020010181815250507f2228cc121876ba710e5b792f2745618703adb095feb937a2579fff31601c586d81601d8151811061176d5761176d611fba565b6020026020010181815250507f254fd3b0100dea0dd3523bdce92b03b5e8510e4d8043735a3aa0b8110fdad44581601e815181106117ad576117ad611fba565b6020026020010181815250507f23ccfe45d048f80a9ef60941f8324181040128260c41396d98b6ed38bfb10e5681601f815181106117ed576117ed611fba565b6020026020010181815250507f1b12848a90f8f6f882d48e88b7390630534f169cadb14faaa4db5b49037e17678160208151811061182d5761182d611fba565b6020026020010181815250507f1c7857e9a718cc87f942162233dc5d6b6f59d3f5982c108e1572f981fb6ffd808160218151811061186d5761186d611fba565b6020026020010181815250507f03a1a1ead63a86a1d6d5c0b3d2610e7f62faad6e913274d24b25d86d372df23e816022815181106118ad576118ad611fba565b6020026020010181815250507f2257183af8db5615723f7882c25d00810abcd624737601dc8def4b8c16a3a77d816023815181106118ed576118ed611fba565b6020026020010181815250507f03a8170be9eaa9379465565763eda336a0bc43d8abd9d1ca0ce158d7dfc52c6c8160248151811061192d5761192d611fba565b6020026020010181815250507f2ae0196e33d5ed32deddec27af9952b9062f41a8d37fabb8dc0341f968c0871c8160258151811061196d5761196d611fba565b6020026020010181815250507f1ee0b61289091d73b68fc020af70728687d49ed105ba70b22242ed2ab51ca127816026815181106119ad576119ad611fba565b6020026020010181815250507f01aae6fb9cbac8b496ed016cc7a708ae6bdfb9078befad716246d39aff35206b816027815181106119ed576119ed611fba565b6020026020010181815250507f231e7e131cfe4b7afc779e4910e352ab6f08bfbdf363b2040b5b874db07b830f81602881518110611a2d57611a2d611fba565b6020026020010181815250507f1c3ca86dca425a59b142023a71672a05bf14e2edd16d39bc0f5a8f05ed74703381602981518110611a6d57611a6d611fba565b6020026020010181815250507f128f45a1805009ba35b23ab9ad60a7734b7caafd832e70962f4328b985f7219181602a81518110611aad57611aad611fba565b6020026020010181815250507f19640ad2dbb4a4da72b018baca2969d97185cef37d6c754bc5b47a2695da6de781602b81518110611aed57611aed611fba565b6020026020010181815250507f05c3be06573c9c66b733cf2b97f388284ce7070545095b019d77ddf20ec1b6f081602c81518110611b2d57611b2d611fba565b6020026020010181815250507f0f62848fefce2f75d2671b021d81c288f2690f722de4a9a7c169b7ea72f3820481602d81518110611b6d57611b6d611fba565b6020026020010181815250507f2510c4fed0df6fc704577c2543cfbfa1a5e587d8bf504c37ccac1268ac05ac3a81602e81518110611bad57611bad611fba565b6020026020010181815250507f2ba432fe1284570879b80f16aa6cca79a5b743d60a335fc134c1ee45ee89011481602f81518110611bed57611bed611fba565b6020026020010181815250507f1f1dfc73ab33951f90ff3da22101680ae3a172381ab5b2bb67c7f3a2f4b78e9281603081518110611c2d57611c2d611fba565b6020026020010181815250507f176898a0401c122fcc8143328527d2945d01a361b2252f8a757e1e900a6de27c81603181518110611c6d57611c6d611fba565b6020026020010181815250507f28bce06d57a4791073c572c9af291c7c7a5d94490425747c3763ab604024f4f581603281518110611cad57611cad611fba565b6020026020010181815250507f122fe68d6f8e29468c0446953e1decd974276972f038a709791d43eeb0c75dc981603381518110611ced57611ced611fba565b6020026020010181815250507f1a922ff15cd43274cdf36ec871f8449963d80937d009d5e73908d7f830dfa8bb81603481518110611d2d57611d2d611fba565b6020026020010181815250507f2bd101746e0ef0d00716567cb6fda4f4eb198497c4b6d12b869573759fc9236481603581518110611d6d57611d6d611fba565b6020026020010181815250507f04c3ec2bfab275d51e5ec572faac76613767be61880237d388711ccc638aea3681603681518110611dad57611dad611fba565b6020026020010181815250507e4fe048f09a51a08793a769bdb60309c00247ed7ca574023a85d42e86e7dc5d81603781518110611dec57611dec611fba565b6020026020010181815250507f1e7d1295ce2b469e3d57f34e682932a22c508d51d2df492e804f0d8e88e97ad381603881518110611e2c57611e2c611fba565b6020026020010181815250507f0327406867be8acaa0c27dcb538c8d26e27d06336fd28fa980f0788713fb5ab381603981518110611e6c57611e6c611fba565b6020908102919091010152919050565b60008083601f840112611e8e57600080fd5b50813567ffffffffffffffff811115611ea657600080fd5b6020830191508360208260051b8501011115611ec157600080fd5b9250929050565b60008060208385031215611edb57600080fd5b823567ffffffffffffffff811115611ef257600080fd5b611efe85828601611e7c565b90969095509350505050565b60008060008060408587031215611f2057600080fd5b843567ffffffffffffffff80821115611f3857600080fd5b611f4488838901611e7c565b90965094506020870135915080821115611f5d57600080fd5b50611f6a87828801611e7c565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b81811015611fae57835183529284019291840191600101611f92565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461200657612006611fd0565b505092915050565b63ffffffff81811683821601908082111561202b5761202b611fd0565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b610059610054366004611ec8565b610096565b60405190151581526020015b60405180910390f35b61005961007c366004611f0a565b61046d565b610089610f95565b6040516100659190611f76565b6000600160a01b838360008181106100b0576100b0611fba565b90506020020135106100c457506001610467565b600160a01b838360018181106100dc576100dc611fba565b90506020020135106100f057506001610467565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000018383600281811061012457610124611fba565b905060200201351061013857506001610467565b600160a01b8383600381811061015057610150611fba565b905060200201351061016457506001610467565b600160f81b8383600481811061017c5761017c611fba565b905060200201351061019057506001610467565b600160401b838360058181106101a8576101a8611fba565b90506020020135106101bc57506001610467565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f0576101f0611fba565b905060200201351061020457506001610467565b600160f91b8383600781811061021c5761021c611fba565b905060200201351061023057506001610467565b600160401b8383600881811061024857610248611fba565b905060200201351061025c57506001610467565b600160401b8383600981811061027457610274611fba565b905060200201351061028857506001610467565b6102008383600a81811061029e5761029e611fba565b90506020020135106102b257506001610467565b620200008383600b8181106102c9576102c9611fba565b90506020020135106102dd57506001610467565b6102008383600c8181106102f3576102f3611fba565b905060200201351061030757506001610467565b600160401b8383600d81811061031f5761031f611fba565b905060200201351061033357506001610467565b600160401b8383600e81811061034b5761034b611fba565b905060200201351061035f57506001610467565b600160401b8383600f81811061037757610377611fba565b905060200201351061038b57506001610467565b600160401b838360108181106103a3576103a3611fba565b90506020020135106103b757506001610467565b600160401b838360118181106103cf576103cf611fba565b90506020020135106103e357506001610467565b600160401b838360128181106103fb576103fb611fba565b905060200201351061040f57506001610467565b6101008383601381811061042557610425611fba565b905060200201351061043957506001610467565b6101008383601481811061044f5761044f611fba565b905060200201351061046357506001610467565b5060005b92915050565b6000600884146104c45760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b601582146105145760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c000000000000000000000060448201526064016104bb565b61051e8383610096565b1561052b57506000610f8d565b610f63565b600060405183815284602082015285604082015260408160608360076107d05a03fa915081610563576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa91505080610594576000805260206000f35b5050505050565b7f20ab7a1c4a992786d5b9a69f74df4ef247cabe14ccfbb92bea3f416d6cfc9ea485527f2719cb064d6a772f615affaf17fe27db8a4600d6a05cf67d925b99f42ef51b0960208601526000608086018661063887357f1c36135c257451fe3251d13a15bd16f71be3020f4fe8242769e61408897d4e617f0ebbb5aafe125824faf56bb34f720b3e026b4826897df819ebbd790c7e2346d984610530565b61068860208801357f25cabfc24ced2c19f1e3a9dd42817e12322c5a3403dfceec56507a45e6fa50f57f2ad0ed350f7636860adecec11f565410f9ebb75c3ed6e172c115576e54637ecc84610530565b6106d760408801357f2964c93d5fd40a9063bf7e9b6b25d128af1fde75f551fb510633e36b93354dbc7edaf34b2bc477e368ab501b071c4665216424cf9df8362f7c180540c83cb1f584610530565b61072760608801357f0cef8b9bcc0af3dd852d40c97afb9f29c1396c2d483c2c302bf6a01a1105dafa7f0a5a6b5420a5437a579946cd9c41d8b8c05fbf6cc318c5d561e76445631792b484610530565b61077760808801357f16ea756c68d336065c6ec5e7e0d54fc701ccdc01a4547c82f4f4688f5fb51cfc7f22a5ec6cb6b5132d04f6451eadcb87229bc1fdc4535ace17e75a3eb8246c196284610530565b6107c760a08801357f2a4550e0751c5cb5a4726e86135d61e6e31317420424a17d433e37fea6cae1da7f2a1b0f8d456ce71910fae94651061757288b595aa767c7fd9124991428535f2784610530565b61081760c08801357f2228cc121876ba710e5b792f2745618703adb095feb937a2579fff31601c586d7f07d2fced3f3b8ad4b5a5ccc6e9fdd034bc74620a687c0f30763ed46f1dd4f55984610530565b61086760e08801357f23ccfe45d048f80a9ef60941f8324181040128260c41396d98b6ed38bfb10e567f254fd3b0100dea0dd3523bdce92b03b5e8510e4d8043735a3aa0b8110fdad44584610530565b6108b86101008801357f1c7857e9a718cc87f942162233dc5d6b6f59d3f5982c108e1572f981fb6ffd807f1b12848a90f8f6f882d48e88b7390630534f169cadb14faaa4db5b49037e176784610530565b6109096101208801357f2257183af8db5615723f7882c25d00810abcd624737601dc8def4b8c16a3a77d7f03a1a1ead63a86a1d6d5c0b3d2610e7f62faad6e913274d24b25d86d372df23e84610530565b61095a6101408801357f2ae0196e33d5ed32deddec27af9952b9062f41a8d37fabb8dc0341f968c0871c7f03a8170be9eaa9379465565763eda336a0bc43d8abd9d1ca0ce158d7dfc52c6c84610530565b6109ab6101608801357f01aae6fb9cbac8b496ed016cc7a708ae6bdfb9078befad716246d39aff35206b7f1ee0b61289091d73b68fc020af70728687d49ed105ba70b22242ed2ab51ca12784610530565b6109fc6101808801357f1c3ca86dca425a59b142023a71672a05bf14e2edd16d39bc0f5a8f05ed7470337f231e7e131cfe4b7afc779e4910e352ab6f08bfbdf363b2040b5b874db07b830f84610530565b610a4d6101a08801357f19640ad2dbb4a4da72b018baca2969d97185cef37d6c754bc5b47a2695da6de77f128f45a1805009ba35b23ab9ad60a7734b7caafd832e70962f4328b985f7219184610530565b610a9e6101c08801357f0f62848fefce2f75d2671b021d81c288f2690f722de4a9a7c169b7ea72f382047f05c3be06573c9c66b733cf2b97f388284ce7070545095b019d77ddf20ec1b6f084610530565b610aef6101e08801357f2ba432fe1284570879b80f16aa6cca79a5b743d60a335fc134c1ee45ee8901147f2510c4fed0df6fc704577c2543cfbfa1a5e587d8bf504c37ccac1268ac05ac3a84610530565b610b406102008801357f176898a0401c122fcc8143328527d2945d01a361b2252f8a757e1e900a6de27c7f1f1dfc73ab33951f90ff3da22101680ae3a172381ab5b2bb67c7f3a2f4b78e9284610530565b610b916102208801357f122fe68d6f8e29468c0446953e1decd974276972f038a709791d43eeb0c75dc97f28bce06d57a4791073c572c9af291c7c7a5d94490425747c3763ab604024f4f584610530565b610be26102408801357f2bd101746e0ef0d00716567cb6fda4f4eb198497c4b6d12b869573759fc923647f1a922ff15cd43274cdf36ec871f8449963d80937d009d5e73908d7f830dfa8bb84610530565b610c326102608801357e4fe048f09a51a08793a769bdb60309c00247ed7ca574023a85d42e86e7dc5d7f04c3ec2bfab275d51e5ec572faac76613767be61880237d388711ccc638aea3684610530565b610c836102808801357f0327406867be8acaa0c27dcb538c8d26e27d06336fd28fa980f0788713fb5ab37f1e7d1295ce2b469e3d57f34e682932a22c508d51d2df492e804f0d8e88e97ad384610530565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f2b094a2349fa0c816828b92aaa638e678ad5348a8a4671e1a31a2b235ae755ad6102808201527f15bf4a8e8b30f866dc8d55e62253bdf465e84b6d12f89fd7c3b08908bde5f7596102a08201527f06926413176e6bce2e9885a0c1a42ec0e532202771da46e083ad7dafbefa60cc6102c08201527f1b7662abd10433044638b91851782196525ecad4dc3a4b7e8cdeaa06c3d1a0a46102e08201526020816103008360086107d05a03fa9051169695505050505050565b6040516103808101604052610f81818560c0890160408a018a61059b565b90508060005260206000f35b949350505050565b60606000610fa560156002611fe6565b610fb090601061200e565b63ffffffff1667ffffffffffffffff811115610fce57610fce612032565b604051908082528060200260200182016040528015610ff7578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e28160008151811061102e5761102e611fba565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d19268160018151811061106e5761106e611fba565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c816002815181106110ae576110ae611fba565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab816003815181106110ee576110ee611fba565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a78160048151811061112e5761112e611fba565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec88160058151811061116e5761116e611fba565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2816006815181106111ae576111ae611fba565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed816007815181106111ee576111ee611fba565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b8160088151811061122e5761122e611fba565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa8160098151811061126e5761126e611fba565b6020026020010181815250507f2b094a2349fa0c816828b92aaa638e678ad5348a8a4671e1a31a2b235ae755ad81600a815181106112ae576112ae611fba565b6020026020010181815250507f15bf4a8e8b30f866dc8d55e62253bdf465e84b6d12f89fd7c3b08908bde5f75981600b815181106112ee576112ee611fba565b6020026020010181815250507f06926413176e6bce2e9885a0c1a42ec0e532202771da46e083ad7dafbefa60cc81600c8151811061132e5761132e611fba565b6020026020010181815250507f1b7662abd10433044638b91851782196525ecad4dc3a4b7e8cdeaa06c3d1a0a481600d8151811061136e5761136e611fba565b6020026020010181815250507f20ab7a1c4a992786d5b9a69f74df4ef247cabe14ccfbb92bea3f416d6cfc9ea481600e815181106113ae576113ae611fba565b6020026020010181815250507f2719cb064d6a772f615affaf17fe27db8a4600d6a05cf67d925b99f42ef51b0981600f815181106113ee576113ee611fba565b6020026020010181815250507f0ebbb5aafe125824faf56bb34f720b3e026b4826897df819ebbd790c7e2346d98160108151811061142e5761142e611fba565b6020026020010181815250507f1c36135c257451fe3251d13a15bd16f71be3020f4fe8242769e61408897d4e618160118151811061146e5761146e611fba565b6020026020010181815250507f2ad0ed350f7636860adecec11f565410f9ebb75c3ed6e172c115576e54637ecc816012815181106114ae576114ae611fba565b6020026020010181815250507f25cabfc24ced2c19f1e3a9dd42817e12322c5a3403dfceec56507a45e6fa50f5816013815181106114ee576114ee611fba565b6020026020010181815250507edaf34b2bc477e368ab501b071c4665216424cf9df8362f7c180540c83cb1f58160148151811061152d5761152d611fba565b6020026020010181815250507f2964c93d5fd40a9063bf7e9b6b25d128af1fde75f551fb510633e36b93354dbc8160158151811061156d5761156d611fba565b6020026020010181815250507f0a5a6b5420a5437a579946cd9c41d8b8c05fbf6cc318c5d561e76445631792b4816016815181106115ad576115ad611fba565b6020026020010181815250507f0cef8b9bcc0af3dd852d40c97afb9f29c1396c2d483c2c302bf6a01a1105dafa816017815181106115ed576115ed611fba565b6020026020010181815250507f22a5ec6cb6b5132d04f6451eadcb87229bc1fdc4535ace17e75a3eb8246c19628160188151811061162d5761162d611fba565b6020026020010181815250507f16ea756c68d336065c6ec5e7e0d54fc701ccdc01a4547c82f4f4688f5fb51cfc8160198151811061166d5761166d611fba565b6020026020010181815250507f2a1b0f8d456ce71910fae94651061757288b595aa767c7fd9124991428535f2781601a815181106116ad576116ad611fba565b6020026020010181815250507f2a4550e0751c5cb5a4726e86135d61e6e31317420424a17d433e37fea6cae1da81601b815181106116ed576116ed611fba565b6020026020010181815250507f07d2fced3f3b8ad4b5a5ccc6e9fdd034bc74620a687c0f30763ed46f1dd4f55981601c8151811061172d5761172d611fba565b6020026020010181815250507f2228cc121876ba710e5b792f2745618703adb095feb937a2579fff31601c586d81601d8151811061176d5761176d611fba565b6020026020010181815250507f254fd3b0100dea0dd3523bdce92b03b5e8510e4d8043735a3aa0b8110fdad44581601e815181106117ad576117ad611fba565b6020026020010181815250507f23ccfe45d048f80a9ef60941f8324181040128260c41396d98b6ed38bfb10e5681601f815181106117ed576117ed611fba565b6020026020010181815250507f1b12848a90f8f6f882d48e88b7390630534f169cadb14faaa4db5b49037e17678160208151811061182d5761182d611fba565b6020026020010181815250507f1c7857e9a718cc87f942162233dc5d6b6f59d3f5982c108e1572f981fb6ffd808160218151811061186d5761186d611fba565b6020026020010181815250507f03a1a1ead63a86a1d6d5c0b3d2610e7f62faad6e913274d24b25d86d372df23e816022815181106118ad576118ad611fba565b6020026020010181815250507f2257183af8db5615723f7882c25d00810abcd624737601dc8def4b8c16a3a77d816023815181106118ed576118ed611fba565b6020026020010181815250507f03a8170be9eaa9379465565763eda336a0bc43d8abd9d1ca0ce158d7dfc52c6c8160248151811061192d5761192d611fba565b6020026020010181815250507f2ae0196e33d5ed32deddec27af9952b9062f41a8d37fabb8dc0341f968c0871c8160258151811061196d5761196d611fba565b6020026020010181815250507f1ee0b61289091d73b68fc020af70728687d49ed105ba70b22242ed2ab51ca127816026815181106119ad576119ad611fba565b6020026020010181815250507f01aae6fb9cbac8b496ed016cc7a708ae6bdfb9078befad716246d39aff35206b816027815181106119ed576119ed611fba565b6020026020010181815250507f231e7e131cfe4b7afc779e4910e352ab6f08bfbdf363b2040b5b874db07b830f81602881518110611a2d57611a2d611fba565b6020026020010181815250507f1c3ca86dca425a59b142023a71672a05bf14e2edd16d39bc0f5a8f05ed74703381602981518110611a6d57611a6d611fba565b6020026020010181815250507f128f45a1805009ba35b23ab9ad60a7734b7caafd832e70962f4328b985f7219181602a81518110611aad57611aad611fba565b6020026020010181815250507f19640ad2dbb4a4da72b018baca2969d97185cef37d6c754bc5b47a2695da6de781602b81518110611aed57611aed611fba565b6020026020010181815250507f05c3be06573c9c66b733cf2b97f388284ce7070545095b019d77ddf20ec1b6f081602c81518110611b2d57611b2d611fba565b6020026020010181815250507f0f62848fefce2f75d2671b021d81c288f2690f722de4a9a7c169b7ea72f3820481602d81518110611b6d57611b6d611fba565b6020026020010181815250507f2510c4fed0df6fc704577c2543cfbfa1a5e587d8bf504c37ccac1268ac05ac3a81602e81518110611bad57611bad611fba565b6020026020010181815250507f2ba432fe1284570879b80f16aa6cca79a5b743d60a335fc134c1ee45ee89011481602f81518110611bed57611bed611fba565b6020026020010181815250507f1f1dfc73ab33951f90ff3da22101680ae3a172381ab5b2bb67c7f3a2f4b78e9281603081518110611c2d57611c2d611fba565b6020026020010181815250507f176898a0401c122fcc8143328527d2945d01a361b2252f8a757e1e900a6de27c81603181518110611c6d57611c6d611fba565b6020026020010181815250507f28bce06d57a4791073c572c9af291c7c7a5d94490425747c3763ab604024f4f581603281518110611cad57611cad611fba565b6020026020010181815250507f122fe68d6f8e29468c0446953e1decd974276972f038a709791d43eeb0c75dc981603381518110611ced57611ced611fba565b6020026020010181815250507f1a922ff15cd43274cdf36ec871f8449963d80937d009d5e73908d7f830dfa8bb81603481518110611d2d57611d2d611fba565b6020026020010181815250507f2bd101746e0ef0d00716567cb6fda4f4eb198497c4b6d12b869573759fc9236481603581518110611d6d57611d6d611fba565b6020026020010181815250507f04c3ec2bfab275d51e5ec572faac76613767be61880237d388711ccc638aea3681603681518110611dad57611dad611fba565b6020026020010181815250507e4fe048f09a51a08793a769bdb60309c00247ed7ca574023a85d42e86e7dc5d81603781518110611dec57611dec611fba565b6020026020010181815250507f1e7d1295ce2b469e3d57f34e682932a22c508d51d2df492e804f0d8e88e97ad381603881518110611e2c57611e2c611fba565b6020026020010181815250507f0327406867be8acaa0c27dcb538c8d26e27d06336fd28fa980f0788713fb5ab381603981518110611e6c57611e6c611fba565b6020908102919091010152919050565b60008083601f840112611e8e57600080fd5b50813567ffffffffffffffff811115611ea657600080fd5b6020830191508360208260051b8501011115611ec157600080fd5b9250929050565b60008060208385031215611edb57600080fd5b823567ffffffffffffffff811115611ef257600080fd5b611efe85828601611e7c565b90969095509350505050565b60008060008060408587031215611f2057600080fd5b843567ffffffffffffffff80821115611f3857600080fd5b611f4488838901611e7c565b90965094506020870135915080821115611f5d57600080fd5b50611f6a87828801611e7c565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b81811015611fae57835183529284019291840191600101611f92565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461200657612006611fd0565b505092915050565b63ffffffff81811683821601908082111561202b5761202b611fd0565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "devdoc": { + "kind": "dev", + "methods": { + "getVerificationKeys()": { + "details": "returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs.." + }, + "isAliased(uint256[])": { + "details": "return true if the public signal is aliased" + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/BabyZKGroth16PropertyVerifier.json b/packages/evm-contracts/deployments/gravity/BabyZKGroth16PropertyVerifier.json new file mode 100644 index 0000000..a583105 --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/BabyZKGroth16PropertyVerifier.json @@ -0,0 +1,109 @@ +{ + "address": "0x97194020ac576aA8a08c954DebFe14Ca583415AC", + "abi": [ + { + "inputs": [], + "name": "AliasedPublicSignal", + "type": "error" + }, + { + "inputs": [], + "name": "getVerificationKeys", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "isAliased", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_proofs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "verifyProof", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x686fd4b0a91fdc98b20f443d2dd947fed1b7776b841431f550c7879f06eaa48a", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0xb85b3D61439a3d70D3DF7913a3A764F352b32C55", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "1192044", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3b2586376f674d62c21aa653c2e559691de10fb50d1ca3a3bf34efdab0676c04", + "transactionHash": "0x686fd4b0a91fdc98b20f443d2dd947fed1b7776b841431f550c7879f06eaa48a", + "logs": [], + "blockNumber": 34, + "cumulativeGasUsed": "1192044", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e08d6b930820ab219ef1afbfaba72b7a", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AliasedPublicSignal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"getVerificationKeys\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"isAliased\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_proofs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"verifyProof\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getVerificationKeys()\":{\"details\":\"returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs..\"},\"isAliased(uint256[])\":{\"details\":\"return true if the public signal is aliased\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/primitive/property_verifier.sol\":\"BabyZKGroth16PropertyVerifier\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"contracts/primitive/property_verifier.sol\":{\"content\":\"\\n// SPDX-License-Identifier: GPL-3.0\\n/*\\n Copyright (c) 2021 0KIMS association.\\n Copyright (c) [2024] Galxe.com.\\n\\n Modifications to this file are part of the Galxe Identity Protocol SDK,\\n which is built using the snarkJS template and is subject to the GNU\\n General Public License v3.0.\\n\\n snarkJS is free software: you can redistribute it and/or modify it\\n under the terms of the GNU General Public License as published by\\n the Free Software Foundation, either version 3 of the License, or\\n (at your option) any later version.\\n\\n This program is distributed in the hope that it will be useful,\\n but WITHOUT ANY WARRANTY; without even the implied warranty of\\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n GNU General Public License for more details.\\n\\n You should have received a copy of the GNU General Public License\\n along with this program. If not, see .\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ncontract BabyZKGroth16PropertyVerifier {\\n error AliasedPublicSignal();\\n\\n // Scalar field size\\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\\n // Base field size\\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\\n\\n // Verification Key data\\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n uint256 constant deltax1 = 11414308741845866070085426566452317103435919953372480741769117942559358064929;\\n uint256 constant deltax2 = 17374122188591355265489391850630525848516844913531328314518114624786540918774;\\n uint256 constant deltay1 = 4805943426435892795193533207491585471028169447506182975505804821707709387402;\\n uint256 constant deltay2 = 3779852072385966186983736777112504712320379578988346798663720253445993794904;\\n\\n uint256 constant IC0x = 21282914606544504841446672183548976667336734118384326986872441490213100233198;\\n uint256 constant IC0y = 7244048437405094008788643878823791229689413336569675755260786565615017673008;\\n uint256 constant IC1x = 21763052119897271951546724350030855801695388906317992478303308144361455108360;\\n uint256 constant IC1y = 1608872978305347168059657251469436932629356088876393997410585169556277214185;\\n uint256 constant IC2x = 8003254435902758560853985611657072128887881951452160772919242672441473611036;\\n uint256 constant IC2y = 15242606809601150172252505741824596697604315081038945113202486841786263119977;\\n uint256 constant IC3x = 18715776049104124383839709405670487216213184446656248593352020123074988458716;\\n uint256 constant IC3y = 7887753228505704161087653224279922305694581204716337599935911852199096742082;\\n uint256 constant IC4x = 7028110773054326845365750137080078100350298258694196533394851493040606284105;\\n uint256 constant IC4y = 8877289167867341027725747071299324574174288751192044206896596093060066561123;\\n uint256 constant IC5x = 18260458696454177334207880249354179258160632746613408803694682950372458468206;\\n uint256 constant IC5y = 10126634442774700961252304838128483126544953720700398087547427995192566709086;\\n uint256 constant IC6x = 9841956294051706864891709641279649298130727235403428423642298228287728688465;\\n uint256 constant IC6y = 17527792556901344875361897616626915647320681218054984845236097073487992050734;\\n uint256 constant IC7x = 5534428345459510038894105382957122802917358379136265058504320326972661342047;\\n uint256 constant IC7y = 6766275239836979735121846401420445341184822174372517830008145522949992864758;\\n uint256 constant IC8x = 11113242123452701361566984741890081046161278831617575462222796064073948004605;\\n uint256 constant IC8y = 642831114213191244891766047504367930246914717751276308143851811549806736860;\\n uint256 constant IC9x = 18527281753934920101755634341734088616055121926321307995214486570920284521957;\\n uint256 constant IC9y = 1195297180455881505551214113785314370379730340976398177208182758359244249907;\\n // Memory data\\n uint16 constant pVk = 0;\\n uint16 constant pPairing = 128;\\n\\n uint16 constant pLastMem = 896;\\n\\n uint16 constant proofLength = 8;\\n uint32 constant pubSignalLength = 9;\\n\\n /// @dev returns the verification keys in the order that the verifier expects them:\\n /// alpha, beta, gamma, delta, ICs..\\n function getVerificationKeys() public pure returns (uint[] memory) {\\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n vks[10] = 11414308741845866070085426566452317103435919953372480741769117942559358064929;\\n vks[11] = 17374122188591355265489391850630525848516844913531328314518114624786540918774;\\n vks[12] = 4805943426435892795193533207491585471028169447506182975505804821707709387402;\\n vks[13] = 3779852072385966186983736777112504712320379578988346798663720253445993794904;\\n vks[14] = 21282914606544504841446672183548976667336734118384326986872441490213100233198;\\n vks[15] = 7244048437405094008788643878823791229689413336569675755260786565615017673008;\\n vks[16] = 21763052119897271951546724350030855801695388906317992478303308144361455108360;\\n vks[17] = 1608872978305347168059657251469436932629356088876393997410585169556277214185;\\n vks[18] = 8003254435902758560853985611657072128887881951452160772919242672441473611036;\\n vks[19] = 15242606809601150172252505741824596697604315081038945113202486841786263119977;\\n vks[20] = 18715776049104124383839709405670487216213184446656248593352020123074988458716;\\n vks[21] = 7887753228505704161087653224279922305694581204716337599935911852199096742082;\\n vks[22] = 7028110773054326845365750137080078100350298258694196533394851493040606284105;\\n vks[23] = 8877289167867341027725747071299324574174288751192044206896596093060066561123;\\n vks[24] = 18260458696454177334207880249354179258160632746613408803694682950372458468206;\\n vks[25] = 10126634442774700961252304838128483126544953720700398087547427995192566709086;\\n vks[26] = 9841956294051706864891709641279649298130727235403428423642298228287728688465;\\n vks[27] = 17527792556901344875361897616626915647320681218054984845236097073487992050734;\\n vks[28] = 5534428345459510038894105382957122802917358379136265058504320326972661342047;\\n vks[29] = 6766275239836979735121846401420445341184822174372517830008145522949992864758;\\n vks[30] = 11113242123452701361566984741890081046161278831617575462222796064073948004605;\\n vks[31] = 642831114213191244891766047504367930246914717751276308143851811549806736860;\\n vks[32] = 18527281753934920101755634341734088616055121926321307995214486570920284521957;\\n vks[33] = 1195297180455881505551214113785314370379730340976398177208182758359244249907;\\n return vks;\\n }\\n\\n /// @dev return true if the public signal is aliased\\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\\n // Alias check\\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\\n if (_pubSignals[8] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\\n return false;\\n }\\n\\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\\n // Check Argument\\n require(_proofs.length == proofLength, \\\"Invalid proof\\\");\\n require(_pubSignals.length == pubSignalLength, \\\"Invalid public signal\\\");\\n if (isAliased(_pubSignals)) { return false; }\\n assembly {\\n // G1 function to multiply a G1 value(x,y) to value in an address\\n function g1_mulAccC(pR, x, y, s) {\\n let success\\n let mIn := mload(0x40)\\n mstore(mIn, x)\\n mstore(add(mIn, 32), y)\\n mstore(add(mIn, 64), s)\\n\\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n\\n mstore(add(mIn, 64), mload(pR))\\n mstore(add(mIn, 96), mload(add(pR, 32)))\\n\\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n }\\n\\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\\n let _pPairing := add(pMem, pPairing)\\n let _pVk := add(pMem, pVk)\\n\\n mstore(_pVk, IC0x)\\n mstore(add(_pVk, 32), IC0y)\\n\\n // Compute the linear combination it.vkey.vk_x\\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\\n // -A\\n mstore(_pPairing, calldataload(pA))\\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\\n\\n // B\\n mstore(add(_pPairing, 64), calldataload(pB))\\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\\n\\n // alpha1\\n mstore(add(_pPairing, 192), alphax)\\n mstore(add(_pPairing, 224), alphay)\\n\\n // beta2\\n mstore(add(_pPairing, 256), betax1)\\n mstore(add(_pPairing, 288), betax2)\\n mstore(add(_pPairing, 320), betay1)\\n mstore(add(_pPairing, 352), betay2)\\n\\n // it.vkey.vk_x\\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\\n\\n // gamma2\\n mstore(add(_pPairing, 448), gammax1)\\n mstore(add(_pPairing, 480), gammax2)\\n mstore(add(_pPairing, 512), gammay1)\\n mstore(add(_pPairing, 544), gammay2)\\n\\n // C\\n mstore(add(_pPairing, 576), calldataload(pC))\\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\\n\\n // delta2\\n mstore(add(_pPairing, 640), deltax1)\\n mstore(add(_pPairing, 672), deltax2)\\n mstore(add(_pPairing, 704), deltay1)\\n mstore(add(_pPairing, 736), deltay2)\\n\\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\\n\\n isOk := and(success, mload(_pPairing))\\n }\\n\\n let pMem := mload(0x40)\\n mstore(0x40, add(pMem, pLastMem))\\n\\n // Validate all evaluations\\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\\n\\n mstore(0, isValid)\\n return(0, 0x20)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb5804029987bf967c48c979a220b9f3aefd9d63fce8f23535cb4e075b2cd0002\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061148b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b6100596100543660046112fe565b610096565b60405190151581526020015b60405180910390f35b61005961007c366004611340565b61026b565b6100896109c9565b60405161006591906113ac565b6000600160a01b838360008181106100b0576100b06113f0565b90506020020135106100c457506001610265565b600160a01b838360018181106100dc576100dc6113f0565b90506020020135106100f057506001610265565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000183836002818110610124576101246113f0565b905060200201351061013857506001610265565b600160a01b83836003818110610150576101506113f0565b905060200201351061016457506001610265565b600160f81b8383600481811061017c5761017c6113f0565b905060200201351061019057506001610265565b68010000000000000000838360058181106101ad576101ad6113f0565b90506020020135106101c157506001610265565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f5576101f56113f0565b905060200201351061020957506001610265565b600160f91b83836007818110610221576102216113f0565b905060200201351061023557506001610265565b600160f91b8383600881811061024d5761024d6113f0565b905060200201351061026157506001610265565b5060005b92915050565b6000600884146102c25760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b600982146103125760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c000000000000000000000060448201526064016102b9565b61031c8383610096565b15610329575060006109c1565b610997565b600060405183815284602082015285604082015260408160608360076107d05a03fa915081610361576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa91505080610392576000805260206000f35b5050505050565b7f2f0db3e9a1aa025295f0e2d7190e8b25e8ebd7977f4c53c30fcc042ca286a1ee85527f1003fc7232f20b0c9a8fbf63a1079d0928f2c072f4fafc08a16e555d2a1a413060208601526000608086018661043687357f038e96ff77d21d431747b1de491d8fa7d27d6e5a6bd320602ca047e6938ebbe97f301d7373cefc67168915a7a8d0b5121498db605c6411b268dfe00b1c7a2e41088461032e565b61048660208801357f21b3027d4e8c1f398cc84db5a17e6b0b0bfbe66568062f356531e505ce8fa8697f11b1ae75caaad1fff4b7c9ba8059577f4fdccf294a050116cc49cc0a014bb51c8461032e565b6104d660408801357f11704f63e71c8a3736eb34bca495571ee07d11ab9d0547ed114ce049866df0c27f2960c0fc5cbca45aab80b11c6423e856e1b981f3054771d0f5661c155299c2dc8461032e565b61052660608801357f13a05e1bd42f1877a5ca2722ede2fb76140eee641189c0aa39994d554917cc637f0f89c50d123ddb8599b794eca99fc33ec83ca07c667dab263bf51e858d1609498461032e565b61057660808801357f166378d39be9655cbd6dcecb375e95d61b913f941f19d89d5c2d07822b8f7b5e7f285f0da91cd44d62b8ea9546e1035d899f2128ae5c6b4fa7ea4eaf4e8693936e8461032e565b6105c660a08801357f26c0610799ae5b6a242449b866b65134fab3f6bf4085dabc20aa06611f2fd42e7f15c2599034f99b8260761c570b440009be50b15edf9618c8efda1d41f7329d518461032e565b61061660c08801357f0ef593795e544491b8ae2e4fa4b15acf95ab53fba40eb786df85b939e7dddbf67f0c3c601c985d3529bd4e77ff310a939c01fcfc0a3358fb4baa296da4df949f5f8461032e565b61066660e08801357f016bd45b3a17f6f6a7d30e394191f6a96192fff61933f67cdaa6d6892f2a35dc7f1891df446246cfaf76ac1075558396934642dd02a228780ba3e9b7cb2e9700fd8461032e565b6106b76101008801357f02a483a48955a1ab36ee3598049e1016186387894dbbd2cda7dec27f265c9b337f28f611e25f44b9c500106e3c92655573517d3d0c0cba84c6336a62bf3e1005e58461032e565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f193c4511e937391adc6e604adc76f616cd05483894cc2dad9acad1367af419216102808201527f26696798d8e0b20452d30affa9f2d04a7da381cc0b9f5fa40528bb4c58d1f7f66102a08201527f0aa0114d2c02d07c380c8619fd0baa08d3e912a2a2cbf3ac2565a847192e928a6102c08201527f085b52098e4aa0919f5016f8ebb9d46457564922c293eda4719dd3b161720d586102e08201526020816103008360086107d05a03fa9051169695505050505050565b60405161038081016040526109b5818560c0890160408a018a610399565b90508060005260206000f35b949350505050565b606060006109d96009600261141c565b6109e4906010611444565b63ffffffff1667ffffffffffffffff811115610a0257610a02611468565b604051908082528060200260200182016040528015610a2b578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e281600081518110610a6257610a626113f0565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192681600181518110610aa257610aa26113f0565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c81600281518110610ae257610ae26113f0565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab81600381518110610b2257610b226113f0565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a781600481518110610b6257610b626113f0565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec881600581518110610ba257610ba26113f0565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c281600681518110610be257610be26113f0565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed81600781518110610c2257610c226113f0565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81600881518110610c6257610c626113f0565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa81600981518110610ca257610ca26113f0565b6020026020010181815250507f193c4511e937391adc6e604adc76f616cd05483894cc2dad9acad1367af4192181600a81518110610ce257610ce26113f0565b6020026020010181815250507f26696798d8e0b20452d30affa9f2d04a7da381cc0b9f5fa40528bb4c58d1f7f681600b81518110610d2257610d226113f0565b6020026020010181815250507f0aa0114d2c02d07c380c8619fd0baa08d3e912a2a2cbf3ac2565a847192e928a81600c81518110610d6257610d626113f0565b6020026020010181815250507f085b52098e4aa0919f5016f8ebb9d46457564922c293eda4719dd3b161720d5881600d81518110610da257610da26113f0565b6020026020010181815250507f2f0db3e9a1aa025295f0e2d7190e8b25e8ebd7977f4c53c30fcc042ca286a1ee81600e81518110610de257610de26113f0565b6020026020010181815250507f1003fc7232f20b0c9a8fbf63a1079d0928f2c072f4fafc08a16e555d2a1a413081600f81518110610e2257610e226113f0565b6020026020010181815250507f301d7373cefc67168915a7a8d0b5121498db605c6411b268dfe00b1c7a2e410881601081518110610e6257610e626113f0565b6020026020010181815250507f038e96ff77d21d431747b1de491d8fa7d27d6e5a6bd320602ca047e6938ebbe981601181518110610ea257610ea26113f0565b6020026020010181815250507f11b1ae75caaad1fff4b7c9ba8059577f4fdccf294a050116cc49cc0a014bb51c81601281518110610ee257610ee26113f0565b6020026020010181815250507f21b3027d4e8c1f398cc84db5a17e6b0b0bfbe66568062f356531e505ce8fa86981601381518110610f2257610f226113f0565b6020026020010181815250507f2960c0fc5cbca45aab80b11c6423e856e1b981f3054771d0f5661c155299c2dc81601481518110610f6257610f626113f0565b6020026020010181815250507f11704f63e71c8a3736eb34bca495571ee07d11ab9d0547ed114ce049866df0c281601581518110610fa257610fa26113f0565b6020026020010181815250507f0f89c50d123ddb8599b794eca99fc33ec83ca07c667dab263bf51e858d16094981601681518110610fe257610fe26113f0565b6020026020010181815250507f13a05e1bd42f1877a5ca2722ede2fb76140eee641189c0aa39994d554917cc6381601781518110611022576110226113f0565b6020026020010181815250507f285f0da91cd44d62b8ea9546e1035d899f2128ae5c6b4fa7ea4eaf4e8693936e81601881518110611062576110626113f0565b6020026020010181815250507f166378d39be9655cbd6dcecb375e95d61b913f941f19d89d5c2d07822b8f7b5e816019815181106110a2576110a26113f0565b6020026020010181815250507f15c2599034f99b8260761c570b440009be50b15edf9618c8efda1d41f7329d5181601a815181106110e2576110e26113f0565b6020026020010181815250507f26c0610799ae5b6a242449b866b65134fab3f6bf4085dabc20aa06611f2fd42e81601b81518110611122576111226113f0565b6020026020010181815250507f0c3c601c985d3529bd4e77ff310a939c01fcfc0a3358fb4baa296da4df949f5f81601c81518110611162576111626113f0565b6020026020010181815250507f0ef593795e544491b8ae2e4fa4b15acf95ab53fba40eb786df85b939e7dddbf681601d815181106111a2576111a26113f0565b6020026020010181815250507f1891df446246cfaf76ac1075558396934642dd02a228780ba3e9b7cb2e9700fd81601e815181106111e2576111e26113f0565b6020026020010181815250507f016bd45b3a17f6f6a7d30e394191f6a96192fff61933f67cdaa6d6892f2a35dc81601f81518110611222576112226113f0565b6020026020010181815250507f28f611e25f44b9c500106e3c92655573517d3d0c0cba84c6336a62bf3e1005e581602081518110611262576112626113f0565b6020026020010181815250507f02a483a48955a1ab36ee3598049e1016186387894dbbd2cda7dec27f265c9b33816021815181106112a2576112a26113f0565b6020908102919091010152919050565b60008083601f8401126112c457600080fd5b50813567ffffffffffffffff8111156112dc57600080fd5b6020830191508360208260051b85010111156112f757600080fd5b9250929050565b6000806020838503121561131157600080fd5b823567ffffffffffffffff81111561132857600080fd5b611334858286016112b2565b90969095509350505050565b6000806000806040858703121561135657600080fd5b843567ffffffffffffffff8082111561136e57600080fd5b61137a888389016112b2565b9096509450602087013591508082111561139357600080fd5b506113a0878288016112b2565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156113e4578351835292840192918401916001016113c8565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461143c5761143c611406565b505092915050565b63ffffffff81811683821601908082111561146157611461611406565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b6100596100543660046112fe565b610096565b60405190151581526020015b60405180910390f35b61005961007c366004611340565b61026b565b6100896109c9565b60405161006591906113ac565b6000600160a01b838360008181106100b0576100b06113f0565b90506020020135106100c457506001610265565b600160a01b838360018181106100dc576100dc6113f0565b90506020020135106100f057506001610265565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000183836002818110610124576101246113f0565b905060200201351061013857506001610265565b600160a01b83836003818110610150576101506113f0565b905060200201351061016457506001610265565b600160f81b8383600481811061017c5761017c6113f0565b905060200201351061019057506001610265565b68010000000000000000838360058181106101ad576101ad6113f0565b90506020020135106101c157506001610265565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f5576101f56113f0565b905060200201351061020957506001610265565b600160f91b83836007818110610221576102216113f0565b905060200201351061023557506001610265565b600160f91b8383600881811061024d5761024d6113f0565b905060200201351061026157506001610265565b5060005b92915050565b6000600884146102c25760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b600982146103125760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c000000000000000000000060448201526064016102b9565b61031c8383610096565b15610329575060006109c1565b610997565b600060405183815284602082015285604082015260408160608360076107d05a03fa915081610361576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa91505080610392576000805260206000f35b5050505050565b7f2f0db3e9a1aa025295f0e2d7190e8b25e8ebd7977f4c53c30fcc042ca286a1ee85527f1003fc7232f20b0c9a8fbf63a1079d0928f2c072f4fafc08a16e555d2a1a413060208601526000608086018661043687357f038e96ff77d21d431747b1de491d8fa7d27d6e5a6bd320602ca047e6938ebbe97f301d7373cefc67168915a7a8d0b5121498db605c6411b268dfe00b1c7a2e41088461032e565b61048660208801357f21b3027d4e8c1f398cc84db5a17e6b0b0bfbe66568062f356531e505ce8fa8697f11b1ae75caaad1fff4b7c9ba8059577f4fdccf294a050116cc49cc0a014bb51c8461032e565b6104d660408801357f11704f63e71c8a3736eb34bca495571ee07d11ab9d0547ed114ce049866df0c27f2960c0fc5cbca45aab80b11c6423e856e1b981f3054771d0f5661c155299c2dc8461032e565b61052660608801357f13a05e1bd42f1877a5ca2722ede2fb76140eee641189c0aa39994d554917cc637f0f89c50d123ddb8599b794eca99fc33ec83ca07c667dab263bf51e858d1609498461032e565b61057660808801357f166378d39be9655cbd6dcecb375e95d61b913f941f19d89d5c2d07822b8f7b5e7f285f0da91cd44d62b8ea9546e1035d899f2128ae5c6b4fa7ea4eaf4e8693936e8461032e565b6105c660a08801357f26c0610799ae5b6a242449b866b65134fab3f6bf4085dabc20aa06611f2fd42e7f15c2599034f99b8260761c570b440009be50b15edf9618c8efda1d41f7329d518461032e565b61061660c08801357f0ef593795e544491b8ae2e4fa4b15acf95ab53fba40eb786df85b939e7dddbf67f0c3c601c985d3529bd4e77ff310a939c01fcfc0a3358fb4baa296da4df949f5f8461032e565b61066660e08801357f016bd45b3a17f6f6a7d30e394191f6a96192fff61933f67cdaa6d6892f2a35dc7f1891df446246cfaf76ac1075558396934642dd02a228780ba3e9b7cb2e9700fd8461032e565b6106b76101008801357f02a483a48955a1ab36ee3598049e1016186387894dbbd2cda7dec27f265c9b337f28f611e25f44b9c500106e3c92655573517d3d0c0cba84c6336a62bf3e1005e58461032e565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f193c4511e937391adc6e604adc76f616cd05483894cc2dad9acad1367af419216102808201527f26696798d8e0b20452d30affa9f2d04a7da381cc0b9f5fa40528bb4c58d1f7f66102a08201527f0aa0114d2c02d07c380c8619fd0baa08d3e912a2a2cbf3ac2565a847192e928a6102c08201527f085b52098e4aa0919f5016f8ebb9d46457564922c293eda4719dd3b161720d586102e08201526020816103008360086107d05a03fa9051169695505050505050565b60405161038081016040526109b5818560c0890160408a018a610399565b90508060005260206000f35b949350505050565b606060006109d96009600261141c565b6109e4906010611444565b63ffffffff1667ffffffffffffffff811115610a0257610a02611468565b604051908082528060200260200182016040528015610a2b578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e281600081518110610a6257610a626113f0565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192681600181518110610aa257610aa26113f0565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c81600281518110610ae257610ae26113f0565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab81600381518110610b2257610b226113f0565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a781600481518110610b6257610b626113f0565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec881600581518110610ba257610ba26113f0565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c281600681518110610be257610be26113f0565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed81600781518110610c2257610c226113f0565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81600881518110610c6257610c626113f0565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa81600981518110610ca257610ca26113f0565b6020026020010181815250507f193c4511e937391adc6e604adc76f616cd05483894cc2dad9acad1367af4192181600a81518110610ce257610ce26113f0565b6020026020010181815250507f26696798d8e0b20452d30affa9f2d04a7da381cc0b9f5fa40528bb4c58d1f7f681600b81518110610d2257610d226113f0565b6020026020010181815250507f0aa0114d2c02d07c380c8619fd0baa08d3e912a2a2cbf3ac2565a847192e928a81600c81518110610d6257610d626113f0565b6020026020010181815250507f085b52098e4aa0919f5016f8ebb9d46457564922c293eda4719dd3b161720d5881600d81518110610da257610da26113f0565b6020026020010181815250507f2f0db3e9a1aa025295f0e2d7190e8b25e8ebd7977f4c53c30fcc042ca286a1ee81600e81518110610de257610de26113f0565b6020026020010181815250507f1003fc7232f20b0c9a8fbf63a1079d0928f2c072f4fafc08a16e555d2a1a413081600f81518110610e2257610e226113f0565b6020026020010181815250507f301d7373cefc67168915a7a8d0b5121498db605c6411b268dfe00b1c7a2e410881601081518110610e6257610e626113f0565b6020026020010181815250507f038e96ff77d21d431747b1de491d8fa7d27d6e5a6bd320602ca047e6938ebbe981601181518110610ea257610ea26113f0565b6020026020010181815250507f11b1ae75caaad1fff4b7c9ba8059577f4fdccf294a050116cc49cc0a014bb51c81601281518110610ee257610ee26113f0565b6020026020010181815250507f21b3027d4e8c1f398cc84db5a17e6b0b0bfbe66568062f356531e505ce8fa86981601381518110610f2257610f226113f0565b6020026020010181815250507f2960c0fc5cbca45aab80b11c6423e856e1b981f3054771d0f5661c155299c2dc81601481518110610f6257610f626113f0565b6020026020010181815250507f11704f63e71c8a3736eb34bca495571ee07d11ab9d0547ed114ce049866df0c281601581518110610fa257610fa26113f0565b6020026020010181815250507f0f89c50d123ddb8599b794eca99fc33ec83ca07c667dab263bf51e858d16094981601681518110610fe257610fe26113f0565b6020026020010181815250507f13a05e1bd42f1877a5ca2722ede2fb76140eee641189c0aa39994d554917cc6381601781518110611022576110226113f0565b6020026020010181815250507f285f0da91cd44d62b8ea9546e1035d899f2128ae5c6b4fa7ea4eaf4e8693936e81601881518110611062576110626113f0565b6020026020010181815250507f166378d39be9655cbd6dcecb375e95d61b913f941f19d89d5c2d07822b8f7b5e816019815181106110a2576110a26113f0565b6020026020010181815250507f15c2599034f99b8260761c570b440009be50b15edf9618c8efda1d41f7329d5181601a815181106110e2576110e26113f0565b6020026020010181815250507f26c0610799ae5b6a242449b866b65134fab3f6bf4085dabc20aa06611f2fd42e81601b81518110611122576111226113f0565b6020026020010181815250507f0c3c601c985d3529bd4e77ff310a939c01fcfc0a3358fb4baa296da4df949f5f81601c81518110611162576111626113f0565b6020026020010181815250507f0ef593795e544491b8ae2e4fa4b15acf95ab53fba40eb786df85b939e7dddbf681601d815181106111a2576111a26113f0565b6020026020010181815250507f1891df446246cfaf76ac1075558396934642dd02a228780ba3e9b7cb2e9700fd81601e815181106111e2576111e26113f0565b6020026020010181815250507f016bd45b3a17f6f6a7d30e394191f6a96192fff61933f67cdaa6d6892f2a35dc81601f81518110611222576112226113f0565b6020026020010181815250507f28f611e25f44b9c500106e3c92655573517d3d0c0cba84c6336a62bf3e1005e581602081518110611262576112626113f0565b6020026020010181815250507f02a483a48955a1ab36ee3598049e1016186387894dbbd2cda7dec27f265c9b33816021815181106112a2576112a26113f0565b6020908102919091010152919050565b60008083601f8401126112c457600080fd5b50813567ffffffffffffffff8111156112dc57600080fd5b6020830191508360208260051b85010111156112f757600080fd5b9250929050565b6000806020838503121561131157600080fd5b823567ffffffffffffffff81111561132857600080fd5b611334858286016112b2565b90969095509350505050565b6000806000806040858703121561135657600080fd5b843567ffffffffffffffff8082111561136e57600080fd5b61137a888389016112b2565b9096509450602087013591508082111561139357600080fd5b506113a0878288016112b2565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156113e4578351835292840192918401916001016113c8565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461143c5761143c611406565b505092915050565b63ffffffff81811683821601908082111561146157611461611406565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "devdoc": { + "kind": "dev", + "methods": { + "getVerificationKeys()": { + "details": "returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs.." + }, + "isAliased(uint256[])": { + "details": "return true if the public signal is aliased" + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/BabyZKGroth16Scalar256Verifier.json b/packages/evm-contracts/deployments/gravity/BabyZKGroth16Scalar256Verifier.json new file mode 100644 index 0000000..5989e7d --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/BabyZKGroth16Scalar256Verifier.json @@ -0,0 +1,109 @@ +{ + "address": "0x5F6CFf23e9A4f63e934891eE8eb6071423385aD0", + "abi": [ + { + "inputs": [], + "name": "AliasedPublicSignal", + "type": "error" + }, + { + "inputs": [], + "name": "getVerificationKeys", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "isAliased", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_proofs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "verifyProof", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x3b1a164daae238e8847c7119f93edc05e9da9acc84661a26120453e065b67ad2", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0xb85b3D61439a3d70D3DF7913a3A764F352b32C55", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "1356501", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x39815594bbfd1e663ba99b376578dc812c43f74e8ed017595bb4c949a5faf508", + "transactionHash": "0x3b1a164daae238e8847c7119f93edc05e9da9acc84661a26120453e065b67ad2", + "logs": [], + "blockNumber": 36, + "cumulativeGasUsed": "1356501", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e08d6b930820ab219ef1afbfaba72b7a", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AliasedPublicSignal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"getVerificationKeys\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"isAliased\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_proofs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"verifyProof\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getVerificationKeys()\":{\"details\":\"returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs..\"},\"isAliased(uint256[])\":{\"details\":\"return true if the public signal is aliased\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/primitive/scalar256_verifier.sol\":\"BabyZKGroth16Scalar256Verifier\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"contracts/primitive/scalar256_verifier.sol\":{\"content\":\"\\n// SPDX-License-Identifier: GPL-3.0\\n/*\\n Copyright (c) 2021 0KIMS association.\\n Copyright (c) [2024] Galxe.com.\\n\\n Modifications to this file are part of the Galxe Identity Protocol SDK,\\n which is built using the snarkJS template and is subject to the GNU\\n General Public License v3.0.\\n\\n snarkJS is free software: you can redistribute it and/or modify it\\n under the terms of the GNU General Public License as published by\\n the Free Software Foundation, either version 3 of the License, or\\n (at your option) any later version.\\n\\n This program is distributed in the hope that it will be useful,\\n but WITHOUT ANY WARRANTY; without even the implied warranty of\\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n GNU General Public License for more details.\\n\\n You should have received a copy of the GNU General Public License\\n along with this program. If not, see .\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ncontract BabyZKGroth16Scalar256Verifier {\\n error AliasedPublicSignal();\\n\\n // Scalar field size\\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\\n // Base field size\\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\\n\\n // Verification Key data\\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n uint256 constant deltax1 = 9002726567792901338145770338648851440665823341997621957553321445773518291201;\\n uint256 constant deltax2 = 8048387181119775934407874257556010377368046340138774947391638565383453457854;\\n uint256 constant deltay1 = 2718645317831892489973703729635262538568144422731125202585769031798053045300;\\n uint256 constant deltay2 = 8957442281714910990845537002241963810890562605622744722122848529914409256547;\\n\\n uint256 constant IC0x = 11479251601148187970310415309010146480899682740703523247990590200202053807124;\\n uint256 constant IC0y = 21083168692728939898991139059058064552332968885842672334904791808186019136560;\\n uint256 constant IC1x = 17139656022314565899947223226238212498153791883758684666359146887235985027355;\\n uint256 constant IC1y = 5759831185708410406027533711712631497041173639600475498340532362099836591454;\\n uint256 constant IC2x = 3840892930183184286382169754048061207708010033264629551235506756284868765597;\\n uint256 constant IC2y = 13292935637386979710163367957575589475676317839630145123575964867360518760078;\\n uint256 constant IC3x = 14425896658876322153841736821227659462338658563206356116834179948859021927820;\\n uint256 constant IC3y = 11998837696571103490805989765147144523338663550360011135029236260560590145167;\\n uint256 constant IC4x = 15838157656396283205758658870397744925938821754679242646369185562562468458734;\\n uint256 constant IC4y = 12586452593690608472550984698912707597984671686143445239302138098157518018732;\\n uint256 constant IC5x = 14656106878490889611505265823914944212494806408313040095736331493814099525095;\\n uint256 constant IC5y = 12013065347588874809825301263760346302728620767901113064623351697573528443070;\\n uint256 constant IC6x = 19034340618162277641950528462193750482846207017748396234762342999785567728268;\\n uint256 constant IC6y = 15683528069115324522560017126210462968459896549455082442918093229099690097179;\\n uint256 constant IC7x = 18200465409922896053135045999544076760811890024681939696983399445993694455931;\\n uint256 constant IC7y = 10708753298528809752558899093280528895981363761543638893574652765326674760686;\\n uint256 constant IC8x = 5222312593979339166706479205702886433485592614970797473745807179984592999446;\\n uint256 constant IC8y = 20999559870318689626143767431956003169444715876689551820757291506975530922585;\\n uint256 constant IC9x = 3589838198546727926920845044363223471614991762538708293653429894967180730196;\\n uint256 constant IC9y = 819276690311245205150423144210659610500241984162727857374977686978219357658;\\n uint256 constant IC10x = 1452880846127336750523534286062738236740957577253439876227021057199618563670;\\n uint256 constant IC10y = 21143486064061152869147893343070572783058213567010851666764323467996393626269;\\n uint256 constant IC11x = 18823881327175454868891113067085648636669687864583281765945646841861181353658;\\n uint256 constant IC11y = 16865319818275834632795027598001079767321134040468678707665858147692037386957;\\n uint256 constant IC12x = 17758171080275092220228017196714472086483239056016118195876589472141758971515;\\n uint256 constant IC12y = 14894516246997233613141689717875005468127476778596469201935650082217142575778;\\n // Memory data\\n uint16 constant pVk = 0;\\n uint16 constant pPairing = 128;\\n\\n uint16 constant pLastMem = 896;\\n\\n uint16 constant proofLength = 8;\\n uint32 constant pubSignalLength = 12;\\n\\n /// @dev returns the verification keys in the order that the verifier expects them:\\n /// alpha, beta, gamma, delta, ICs..\\n function getVerificationKeys() public pure returns (uint[] memory) {\\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n vks[10] = 9002726567792901338145770338648851440665823341997621957553321445773518291201;\\n vks[11] = 8048387181119775934407874257556010377368046340138774947391638565383453457854;\\n vks[12] = 2718645317831892489973703729635262538568144422731125202585769031798053045300;\\n vks[13] = 8957442281714910990845537002241963810890562605622744722122848529914409256547;\\n vks[14] = 11479251601148187970310415309010146480899682740703523247990590200202053807124;\\n vks[15] = 21083168692728939898991139059058064552332968885842672334904791808186019136560;\\n vks[16] = 17139656022314565899947223226238212498153791883758684666359146887235985027355;\\n vks[17] = 5759831185708410406027533711712631497041173639600475498340532362099836591454;\\n vks[18] = 3840892930183184286382169754048061207708010033264629551235506756284868765597;\\n vks[19] = 13292935637386979710163367957575589475676317839630145123575964867360518760078;\\n vks[20] = 14425896658876322153841736821227659462338658563206356116834179948859021927820;\\n vks[21] = 11998837696571103490805989765147144523338663550360011135029236260560590145167;\\n vks[22] = 15838157656396283205758658870397744925938821754679242646369185562562468458734;\\n vks[23] = 12586452593690608472550984698912707597984671686143445239302138098157518018732;\\n vks[24] = 14656106878490889611505265823914944212494806408313040095736331493814099525095;\\n vks[25] = 12013065347588874809825301263760346302728620767901113064623351697573528443070;\\n vks[26] = 19034340618162277641950528462193750482846207017748396234762342999785567728268;\\n vks[27] = 15683528069115324522560017126210462968459896549455082442918093229099690097179;\\n vks[28] = 18200465409922896053135045999544076760811890024681939696983399445993694455931;\\n vks[29] = 10708753298528809752558899093280528895981363761543638893574652765326674760686;\\n vks[30] = 5222312593979339166706479205702886433485592614970797473745807179984592999446;\\n vks[31] = 20999559870318689626143767431956003169444715876689551820757291506975530922585;\\n vks[32] = 3589838198546727926920845044363223471614991762538708293653429894967180730196;\\n vks[33] = 819276690311245205150423144210659610500241984162727857374977686978219357658;\\n vks[34] = 1452880846127336750523534286062738236740957577253439876227021057199618563670;\\n vks[35] = 21143486064061152869147893343070572783058213567010851666764323467996393626269;\\n vks[36] = 18823881327175454868891113067085648636669687864583281765945646841861181353658;\\n vks[37] = 16865319818275834632795027598001079767321134040468678707665858147692037386957;\\n vks[38] = 17758171080275092220228017196714472086483239056016118195876589472141758971515;\\n vks[39] = 14894516246997233613141689717875005468127476778596469201935650082217142575778;\\n return vks;\\n }\\n\\n /// @dev return true if the public signal is aliased\\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\\n // Alias check\\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\\n if (_pubSignals[8] >= 340282366920938463463374607431768211456) { return true; }\\n if (_pubSignals[9] >= 340282366920938463463374607431768211456) { return true; }\\n if (_pubSignals[10] >= 340282366920938463463374607431768211456) { return true; }\\n if (_pubSignals[11] >= 340282366920938463463374607431768211456) { return true; }\\n return false;\\n }\\n\\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\\n // Check Argument\\n require(_proofs.length == proofLength, \\\"Invalid proof\\\");\\n require(_pubSignals.length == pubSignalLength, \\\"Invalid public signal\\\");\\n if (isAliased(_pubSignals)) { return false; }\\n assembly {\\n // G1 function to multiply a G1 value(x,y) to value in an address\\n function g1_mulAccC(pR, x, y, s) {\\n let success\\n let mIn := mload(0x40)\\n mstore(mIn, x)\\n mstore(add(mIn, 32), y)\\n mstore(add(mIn, 64), s)\\n\\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n\\n mstore(add(mIn, 64), mload(pR))\\n mstore(add(mIn, 96), mload(add(pR, 32)))\\n\\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n }\\n\\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\\n let _pPairing := add(pMem, pPairing)\\n let _pVk := add(pMem, pVk)\\n\\n mstore(_pVk, IC0x)\\n mstore(add(_pVk, 32), IC0y)\\n\\n // Compute the linear combination it.vkey.vk_x\\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\\n g1_mulAccC(_pVk, IC10x, IC10y, calldataload(add(pubSignals, 288)))\\n g1_mulAccC(_pVk, IC11x, IC11y, calldataload(add(pubSignals, 320)))\\n g1_mulAccC(_pVk, IC12x, IC12y, calldataload(add(pubSignals, 352)))\\n // -A\\n mstore(_pPairing, calldataload(pA))\\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\\n\\n // B\\n mstore(add(_pPairing, 64), calldataload(pB))\\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\\n\\n // alpha1\\n mstore(add(_pPairing, 192), alphax)\\n mstore(add(_pPairing, 224), alphay)\\n\\n // beta2\\n mstore(add(_pPairing, 256), betax1)\\n mstore(add(_pPairing, 288), betax2)\\n mstore(add(_pPairing, 320), betay1)\\n mstore(add(_pPairing, 352), betay2)\\n\\n // it.vkey.vk_x\\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\\n\\n // gamma2\\n mstore(add(_pPairing, 448), gammax1)\\n mstore(add(_pPairing, 480), gammax2)\\n mstore(add(_pPairing, 512), gammay1)\\n mstore(add(_pPairing, 544), gammay2)\\n\\n // C\\n mstore(add(_pPairing, 576), calldataload(pC))\\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\\n\\n // delta2\\n mstore(add(_pPairing, 640), deltax1)\\n mstore(add(_pPairing, 672), deltax2)\\n mstore(add(_pPairing, 704), deltay1)\\n mstore(add(_pPairing, 736), deltay2)\\n\\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\\n\\n isOk := and(success, mload(_pPairing))\\n }\\n\\n let pMem := mload(0x40)\\n mstore(0x40, add(pMem, pLastMem))\\n\\n // Validate all evaluations\\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\\n\\n mstore(0, isValid)\\n return(0, 0x20)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9b22bae7081270283dd8baf6980cf2a5873a9dec5b2a721893e49d8587952e96\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50611782806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b6100596100543660046115f5565b610096565b60405190151581526020015b60405180910390f35b61005961007c366004611637565b6102ef565b610089610b40565b60405161006591906116a3565b6000600160a01b838360008181106100b0576100b06116e7565b90506020020135106100c4575060016102e9565b600160a01b838360018181106100dc576100dc6116e7565b90506020020135106100f0575060016102e9565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000183836002818110610124576101246116e7565b9050602002013510610138575060016102e9565b600160a01b83836003818110610150576101506116e7565b9050602002013510610164575060016102e9565b600160f81b8383600481811061017c5761017c6116e7565b9050602002013510610190575060016102e9565b68010000000000000000838360058181106101ad576101ad6116e7565b90506020020135106101c1575060016102e9565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f5576101f56116e7565b9050602002013510610209575060016102e9565b600160f91b83836007818110610221576102216116e7565b9050602002013510610235575060016102e9565b600160801b8383600881811061024d5761024d6116e7565b9050602002013510610261575060016102e9565b600160801b83836009818110610279576102796116e7565b905060200201351061028d575060016102e9565b600160801b8383600a8181106102a5576102a56116e7565b90506020020135106102b9575060016102e9565b600160801b8383600b8181106102d1576102d16116e7565b90506020020135106102e5575060016102e9565b5060005b92915050565b6000600884146103465760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b600c82146103965760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c0000000000000000000000604482015260640161033d565b6103a08383610096565b156103ad57506000610b38565b610b0e565b600060405183815284602082015285604082015260408160608360076107d05a03fa9150816103e5576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa91505080610416576000805260206000f35b5050505050565b7f196106b2715302ae18cb5ac7d4865565b4abf004555c7090cf30244e11dfec1485527f2e9ca68de916f6c4e702fb3db6cc1ba930f324547804aebb6136716217cac4306020860152600060808601866104ba87357f0cbbf2ec9c08c149d6024a9591264ae829cc25d5616acd2aad9b9738fbb41d5e7f25e4b39762e86aea08709da0211464b5f73ea69dcf6dc4c4acb033907869311b846103b2565b61050a60208801357f1d6388f244d530d6a7bf66c54aab60a672cd08f406dc5b80690b59ac6892e68e7f087dde4ccec3a854edafc5fd13d9a1acdaef95dffbe2441b44bf41f6e378a79d846103b2565b61055a60408801357f1a8719f9da2ad8b6373caa082f7803b153d89c0a11bcf859c93e9e146c1d068f7f1fe4c4a629b0a72b563105ced217c237b577dc91ce36bc65227d90ee3405258c846103b2565b6105aa60608801357f1bd3ae01c22eecf6010254552f259faa973b5bd7b7e9f6c364f331392b5758ac7f2304145df255cc871bf0484a85801960de7c1530121307bc4d4bc4bef46f30ee846103b2565b6105fa60808801357f1a8f276ec2450777403c871a1d7649e5227490962c1460abbc932c8ec7e398be7f20671001c9ce715d925fb1077164b802690088de6e823290002aa617c7843de7846103b2565b61064a60a08801357f22ac8ff3c8cf57a6c35a6c4089238f4e0e47f71b123aa41f006ecfa51499fa1b7f2a150e14f3a09a3355ab3d8b6f5426918a240831fe65a227c0aa7529c2b4b28c846103b2565b61069a60c08801357f17acf08802cf1be1943a72838e6460316a5a9d6b9f12d6da8efe2863a67c13ee7f283d192e7047def03f4e992201deae45e9589b1c322bf086fdf11bdd8818687b846103b2565b6106ea60e08801357f2e6d546653bffe1fb21b1ac01d36d9dce3fa12239a84dc51f624433ac045b2597f0b8bb963f1aa57b43416d6cbfaee6d827b16531ee5272ad7b496feb0a01c9416846103b2565b61073b6101008801357f01cfb1b5635f4f032e5d1eaa74a9c585cc108d1529adcb22b395596c470235da7f07efc6c3429de4a5f221089e5172f29a16a675226d1440ac1c5130f504bd1f54846103b2565b61078c6101208801357f2ebec9fd8ed22543de64c34e20d6083aeac4f8276183cfb3f5c63def8aefda9d7f03364d29b4eb3feaf4905f9d94510b1e43bcc8cc918a7cd22b90bb192f669e56846103b2565b6107dd6101408801357f25496ec80857f14d4d93b6127c9429cbdaa34d1a56b60bdb76d4dc01a959b2cd7f299df073fc5660055e411c08fcd053cec333170fd40759a25716d57e1ed52eba846103b2565b61082e6101608801357f20edff58bfaea5ee102c58b6d395a013e12beeb3fa1f5ff06657f56bca70e2a27f2742c4c5f58b6b66a0a4b720d82c56aa2b996264ee83ba442964135e42983e7b846103b2565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f13e75cd795077273d6e0c0843d2c134991870f9eaab20b58914b3060813fc1016102808201527f11cb39c85a6d75592dbf65b5439dba703474785393d1a0f2fc8902e34836bdbe6102a08201527f0602b2df582a58a2a350a79ccbe5387b637767709e24f75eca40553b4ab284346102c08201527f13cdbb900ec1d5996ab97fdc36c202f987eaf028c3c4bdcc5346fee69e9006636102e08201526020816103008360086107d05a03fa9051169695505050505050565b6040516103808101604052610b2c818560c0890160408a018a61041d565b90508060005260206000f35b949350505050565b60606000610b50600c6002611713565b610b5b90601061173b565b63ffffffff1667ffffffffffffffff811115610b7957610b7961175f565b604051908082528060200260200182016040528015610ba2578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e281600081518110610bd957610bd96116e7565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192681600181518110610c1957610c196116e7565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c81600281518110610c5957610c596116e7565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab81600381518110610c9957610c996116e7565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a781600481518110610cd957610cd96116e7565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec881600581518110610d1957610d196116e7565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c281600681518110610d5957610d596116e7565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed81600781518110610d9957610d996116e7565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81600881518110610dd957610dd96116e7565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa81600981518110610e1957610e196116e7565b6020026020010181815250507f13e75cd795077273d6e0c0843d2c134991870f9eaab20b58914b3060813fc10181600a81518110610e5957610e596116e7565b6020026020010181815250507f11cb39c85a6d75592dbf65b5439dba703474785393d1a0f2fc8902e34836bdbe81600b81518110610e9957610e996116e7565b6020026020010181815250507f0602b2df582a58a2a350a79ccbe5387b637767709e24f75eca40553b4ab2843481600c81518110610ed957610ed96116e7565b6020026020010181815250507f13cdbb900ec1d5996ab97fdc36c202f987eaf028c3c4bdcc5346fee69e90066381600d81518110610f1957610f196116e7565b6020026020010181815250507f196106b2715302ae18cb5ac7d4865565b4abf004555c7090cf30244e11dfec1481600e81518110610f5957610f596116e7565b6020026020010181815250507f2e9ca68de916f6c4e702fb3db6cc1ba930f324547804aebb6136716217cac43081600f81518110610f9957610f996116e7565b6020026020010181815250507f25e4b39762e86aea08709da0211464b5f73ea69dcf6dc4c4acb033907869311b81601081518110610fd957610fd96116e7565b6020026020010181815250507f0cbbf2ec9c08c149d6024a9591264ae829cc25d5616acd2aad9b9738fbb41d5e81601181518110611019576110196116e7565b6020026020010181815250507f087dde4ccec3a854edafc5fd13d9a1acdaef95dffbe2441b44bf41f6e378a79d81601281518110611059576110596116e7565b6020026020010181815250507f1d6388f244d530d6a7bf66c54aab60a672cd08f406dc5b80690b59ac6892e68e81601381518110611099576110996116e7565b6020026020010181815250507f1fe4c4a629b0a72b563105ced217c237b577dc91ce36bc65227d90ee3405258c816014815181106110d9576110d96116e7565b6020026020010181815250507f1a8719f9da2ad8b6373caa082f7803b153d89c0a11bcf859c93e9e146c1d068f81601581518110611119576111196116e7565b6020026020010181815250507f2304145df255cc871bf0484a85801960de7c1530121307bc4d4bc4bef46f30ee81601681518110611159576111596116e7565b6020026020010181815250507f1bd3ae01c22eecf6010254552f259faa973b5bd7b7e9f6c364f331392b5758ac81601781518110611199576111996116e7565b6020026020010181815250507f20671001c9ce715d925fb1077164b802690088de6e823290002aa617c7843de7816018815181106111d9576111d96116e7565b6020026020010181815250507f1a8f276ec2450777403c871a1d7649e5227490962c1460abbc932c8ec7e398be81601981518110611219576112196116e7565b6020026020010181815250507f2a150e14f3a09a3355ab3d8b6f5426918a240831fe65a227c0aa7529c2b4b28c81601a81518110611259576112596116e7565b6020026020010181815250507f22ac8ff3c8cf57a6c35a6c4089238f4e0e47f71b123aa41f006ecfa51499fa1b81601b81518110611299576112996116e7565b6020026020010181815250507f283d192e7047def03f4e992201deae45e9589b1c322bf086fdf11bdd8818687b81601c815181106112d9576112d96116e7565b6020026020010181815250507f17acf08802cf1be1943a72838e6460316a5a9d6b9f12d6da8efe2863a67c13ee81601d81518110611319576113196116e7565b6020026020010181815250507f0b8bb963f1aa57b43416d6cbfaee6d827b16531ee5272ad7b496feb0a01c941681601e81518110611359576113596116e7565b6020026020010181815250507f2e6d546653bffe1fb21b1ac01d36d9dce3fa12239a84dc51f624433ac045b25981601f81518110611399576113996116e7565b6020026020010181815250507f07efc6c3429de4a5f221089e5172f29a16a675226d1440ac1c5130f504bd1f54816020815181106113d9576113d96116e7565b6020026020010181815250507f01cfb1b5635f4f032e5d1eaa74a9c585cc108d1529adcb22b395596c470235da81602181518110611419576114196116e7565b6020026020010181815250507f03364d29b4eb3feaf4905f9d94510b1e43bcc8cc918a7cd22b90bb192f669e5681602281518110611459576114596116e7565b6020026020010181815250507f2ebec9fd8ed22543de64c34e20d6083aeac4f8276183cfb3f5c63def8aefda9d81602381518110611499576114996116e7565b6020026020010181815250507f299df073fc5660055e411c08fcd053cec333170fd40759a25716d57e1ed52eba816024815181106114d9576114d96116e7565b6020026020010181815250507f25496ec80857f14d4d93b6127c9429cbdaa34d1a56b60bdb76d4dc01a959b2cd81602581518110611519576115196116e7565b6020026020010181815250507f2742c4c5f58b6b66a0a4b720d82c56aa2b996264ee83ba442964135e42983e7b81602681518110611559576115596116e7565b6020026020010181815250507f20edff58bfaea5ee102c58b6d395a013e12beeb3fa1f5ff06657f56bca70e2a281602781518110611599576115996116e7565b6020908102919091010152919050565b60008083601f8401126115bb57600080fd5b50813567ffffffffffffffff8111156115d357600080fd5b6020830191508360208260051b85010111156115ee57600080fd5b9250929050565b6000806020838503121561160857600080fd5b823567ffffffffffffffff81111561161f57600080fd5b61162b858286016115a9565b90969095509350505050565b6000806000806040858703121561164d57600080fd5b843567ffffffffffffffff8082111561166557600080fd5b611671888389016115a9565b9096509450602087013591508082111561168a57600080fd5b50611697878288016115a9565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156116db578351835292840192918401916001016116bf565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff818116838216028082169190828114611733576117336116fd565b505092915050565b63ffffffff818116838216019080821115611758576117586116fd565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b6100596100543660046115f5565b610096565b60405190151581526020015b60405180910390f35b61005961007c366004611637565b6102ef565b610089610b40565b60405161006591906116a3565b6000600160a01b838360008181106100b0576100b06116e7565b90506020020135106100c4575060016102e9565b600160a01b838360018181106100dc576100dc6116e7565b90506020020135106100f0575060016102e9565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000183836002818110610124576101246116e7565b9050602002013510610138575060016102e9565b600160a01b83836003818110610150576101506116e7565b9050602002013510610164575060016102e9565b600160f81b8383600481811061017c5761017c6116e7565b9050602002013510610190575060016102e9565b68010000000000000000838360058181106101ad576101ad6116e7565b90506020020135106101c1575060016102e9565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f5576101f56116e7565b9050602002013510610209575060016102e9565b600160f91b83836007818110610221576102216116e7565b9050602002013510610235575060016102e9565b600160801b8383600881811061024d5761024d6116e7565b9050602002013510610261575060016102e9565b600160801b83836009818110610279576102796116e7565b905060200201351061028d575060016102e9565b600160801b8383600a8181106102a5576102a56116e7565b90506020020135106102b9575060016102e9565b600160801b8383600b8181106102d1576102d16116e7565b90506020020135106102e5575060016102e9565b5060005b92915050565b6000600884146103465760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b600c82146103965760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c0000000000000000000000604482015260640161033d565b6103a08383610096565b156103ad57506000610b38565b610b0e565b600060405183815284602082015285604082015260408160608360076107d05a03fa9150816103e5576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa91505080610416576000805260206000f35b5050505050565b7f196106b2715302ae18cb5ac7d4865565b4abf004555c7090cf30244e11dfec1485527f2e9ca68de916f6c4e702fb3db6cc1ba930f324547804aebb6136716217cac4306020860152600060808601866104ba87357f0cbbf2ec9c08c149d6024a9591264ae829cc25d5616acd2aad9b9738fbb41d5e7f25e4b39762e86aea08709da0211464b5f73ea69dcf6dc4c4acb033907869311b846103b2565b61050a60208801357f1d6388f244d530d6a7bf66c54aab60a672cd08f406dc5b80690b59ac6892e68e7f087dde4ccec3a854edafc5fd13d9a1acdaef95dffbe2441b44bf41f6e378a79d846103b2565b61055a60408801357f1a8719f9da2ad8b6373caa082f7803b153d89c0a11bcf859c93e9e146c1d068f7f1fe4c4a629b0a72b563105ced217c237b577dc91ce36bc65227d90ee3405258c846103b2565b6105aa60608801357f1bd3ae01c22eecf6010254552f259faa973b5bd7b7e9f6c364f331392b5758ac7f2304145df255cc871bf0484a85801960de7c1530121307bc4d4bc4bef46f30ee846103b2565b6105fa60808801357f1a8f276ec2450777403c871a1d7649e5227490962c1460abbc932c8ec7e398be7f20671001c9ce715d925fb1077164b802690088de6e823290002aa617c7843de7846103b2565b61064a60a08801357f22ac8ff3c8cf57a6c35a6c4089238f4e0e47f71b123aa41f006ecfa51499fa1b7f2a150e14f3a09a3355ab3d8b6f5426918a240831fe65a227c0aa7529c2b4b28c846103b2565b61069a60c08801357f17acf08802cf1be1943a72838e6460316a5a9d6b9f12d6da8efe2863a67c13ee7f283d192e7047def03f4e992201deae45e9589b1c322bf086fdf11bdd8818687b846103b2565b6106ea60e08801357f2e6d546653bffe1fb21b1ac01d36d9dce3fa12239a84dc51f624433ac045b2597f0b8bb963f1aa57b43416d6cbfaee6d827b16531ee5272ad7b496feb0a01c9416846103b2565b61073b6101008801357f01cfb1b5635f4f032e5d1eaa74a9c585cc108d1529adcb22b395596c470235da7f07efc6c3429de4a5f221089e5172f29a16a675226d1440ac1c5130f504bd1f54846103b2565b61078c6101208801357f2ebec9fd8ed22543de64c34e20d6083aeac4f8276183cfb3f5c63def8aefda9d7f03364d29b4eb3feaf4905f9d94510b1e43bcc8cc918a7cd22b90bb192f669e56846103b2565b6107dd6101408801357f25496ec80857f14d4d93b6127c9429cbdaa34d1a56b60bdb76d4dc01a959b2cd7f299df073fc5660055e411c08fcd053cec333170fd40759a25716d57e1ed52eba846103b2565b61082e6101608801357f20edff58bfaea5ee102c58b6d395a013e12beeb3fa1f5ff06657f56bca70e2a27f2742c4c5f58b6b66a0a4b720d82c56aa2b996264ee83ba442964135e42983e7b846103b2565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f13e75cd795077273d6e0c0843d2c134991870f9eaab20b58914b3060813fc1016102808201527f11cb39c85a6d75592dbf65b5439dba703474785393d1a0f2fc8902e34836bdbe6102a08201527f0602b2df582a58a2a350a79ccbe5387b637767709e24f75eca40553b4ab284346102c08201527f13cdbb900ec1d5996ab97fdc36c202f987eaf028c3c4bdcc5346fee69e9006636102e08201526020816103008360086107d05a03fa9051169695505050505050565b6040516103808101604052610b2c818560c0890160408a018a61041d565b90508060005260206000f35b949350505050565b60606000610b50600c6002611713565b610b5b90601061173b565b63ffffffff1667ffffffffffffffff811115610b7957610b7961175f565b604051908082528060200260200182016040528015610ba2578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e281600081518110610bd957610bd96116e7565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192681600181518110610c1957610c196116e7565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c81600281518110610c5957610c596116e7565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab81600381518110610c9957610c996116e7565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a781600481518110610cd957610cd96116e7565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec881600581518110610d1957610d196116e7565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c281600681518110610d5957610d596116e7565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed81600781518110610d9957610d996116e7565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81600881518110610dd957610dd96116e7565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa81600981518110610e1957610e196116e7565b6020026020010181815250507f13e75cd795077273d6e0c0843d2c134991870f9eaab20b58914b3060813fc10181600a81518110610e5957610e596116e7565b6020026020010181815250507f11cb39c85a6d75592dbf65b5439dba703474785393d1a0f2fc8902e34836bdbe81600b81518110610e9957610e996116e7565b6020026020010181815250507f0602b2df582a58a2a350a79ccbe5387b637767709e24f75eca40553b4ab2843481600c81518110610ed957610ed96116e7565b6020026020010181815250507f13cdbb900ec1d5996ab97fdc36c202f987eaf028c3c4bdcc5346fee69e90066381600d81518110610f1957610f196116e7565b6020026020010181815250507f196106b2715302ae18cb5ac7d4865565b4abf004555c7090cf30244e11dfec1481600e81518110610f5957610f596116e7565b6020026020010181815250507f2e9ca68de916f6c4e702fb3db6cc1ba930f324547804aebb6136716217cac43081600f81518110610f9957610f996116e7565b6020026020010181815250507f25e4b39762e86aea08709da0211464b5f73ea69dcf6dc4c4acb033907869311b81601081518110610fd957610fd96116e7565b6020026020010181815250507f0cbbf2ec9c08c149d6024a9591264ae829cc25d5616acd2aad9b9738fbb41d5e81601181518110611019576110196116e7565b6020026020010181815250507f087dde4ccec3a854edafc5fd13d9a1acdaef95dffbe2441b44bf41f6e378a79d81601281518110611059576110596116e7565b6020026020010181815250507f1d6388f244d530d6a7bf66c54aab60a672cd08f406dc5b80690b59ac6892e68e81601381518110611099576110996116e7565b6020026020010181815250507f1fe4c4a629b0a72b563105ced217c237b577dc91ce36bc65227d90ee3405258c816014815181106110d9576110d96116e7565b6020026020010181815250507f1a8719f9da2ad8b6373caa082f7803b153d89c0a11bcf859c93e9e146c1d068f81601581518110611119576111196116e7565b6020026020010181815250507f2304145df255cc871bf0484a85801960de7c1530121307bc4d4bc4bef46f30ee81601681518110611159576111596116e7565b6020026020010181815250507f1bd3ae01c22eecf6010254552f259faa973b5bd7b7e9f6c364f331392b5758ac81601781518110611199576111996116e7565b6020026020010181815250507f20671001c9ce715d925fb1077164b802690088de6e823290002aa617c7843de7816018815181106111d9576111d96116e7565b6020026020010181815250507f1a8f276ec2450777403c871a1d7649e5227490962c1460abbc932c8ec7e398be81601981518110611219576112196116e7565b6020026020010181815250507f2a150e14f3a09a3355ab3d8b6f5426918a240831fe65a227c0aa7529c2b4b28c81601a81518110611259576112596116e7565b6020026020010181815250507f22ac8ff3c8cf57a6c35a6c4089238f4e0e47f71b123aa41f006ecfa51499fa1b81601b81518110611299576112996116e7565b6020026020010181815250507f283d192e7047def03f4e992201deae45e9589b1c322bf086fdf11bdd8818687b81601c815181106112d9576112d96116e7565b6020026020010181815250507f17acf08802cf1be1943a72838e6460316a5a9d6b9f12d6da8efe2863a67c13ee81601d81518110611319576113196116e7565b6020026020010181815250507f0b8bb963f1aa57b43416d6cbfaee6d827b16531ee5272ad7b496feb0a01c941681601e81518110611359576113596116e7565b6020026020010181815250507f2e6d546653bffe1fb21b1ac01d36d9dce3fa12239a84dc51f624433ac045b25981601f81518110611399576113996116e7565b6020026020010181815250507f07efc6c3429de4a5f221089e5172f29a16a675226d1440ac1c5130f504bd1f54816020815181106113d9576113d96116e7565b6020026020010181815250507f01cfb1b5635f4f032e5d1eaa74a9c585cc108d1529adcb22b395596c470235da81602181518110611419576114196116e7565b6020026020010181815250507f03364d29b4eb3feaf4905f9d94510b1e43bcc8cc918a7cd22b90bb192f669e5681602281518110611459576114596116e7565b6020026020010181815250507f2ebec9fd8ed22543de64c34e20d6083aeac4f8276183cfb3f5c63def8aefda9d81602381518110611499576114996116e7565b6020026020010181815250507f299df073fc5660055e411c08fcd053cec333170fd40759a25716d57e1ed52eba816024815181106114d9576114d96116e7565b6020026020010181815250507f25496ec80857f14d4d93b6127c9429cbdaa34d1a56b60bdb76d4dc01a959b2cd81602581518110611519576115196116e7565b6020026020010181815250507f2742c4c5f58b6b66a0a4b720d82c56aa2b996264ee83ba442964135e42983e7b81602681518110611559576115596116e7565b6020026020010181815250507f20edff58bfaea5ee102c58b6d395a013e12beeb3fa1f5ff06657f56bca70e2a281602781518110611599576115996116e7565b6020908102919091010152919050565b60008083601f8401126115bb57600080fd5b50813567ffffffffffffffff8111156115d357600080fd5b6020830191508360208260051b85010111156115ee57600080fd5b9250929050565b6000806020838503121561160857600080fd5b823567ffffffffffffffff81111561161f57600080fd5b61162b858286016115a9565b90969095509350505050565b6000806000806040858703121561164d57600080fd5b843567ffffffffffffffff8082111561166557600080fd5b611671888389016115a9565b9096509450602087013591508082111561168a57600080fd5b50611697878288016115a9565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156116db578351835292840192918401916001016116bf565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff818116838216028082169190828114611733576117336116fd565b505092915050565b63ffffffff818116838216019080821115611758576117586116fd565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "devdoc": { + "kind": "dev", + "methods": { + "getVerificationKeys()": { + "details": "returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs.." + }, + "isAliased(uint256[])": { + "details": "return true if the public signal is aliased" + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/BabyZKGroth16ScalarVerifier.json b/packages/evm-contracts/deployments/gravity/BabyZKGroth16ScalarVerifier.json new file mode 100644 index 0000000..451cffe --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/BabyZKGroth16ScalarVerifier.json @@ -0,0 +1,109 @@ +{ + "address": "0x1ec111fc8aEAcCD989d6F7c556b12575cAc3a7E0", + "abi": [ + { + "inputs": [], + "name": "AliasedPublicSignal", + "type": "error" + }, + { + "inputs": [], + "name": "getVerificationKeys", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "isAliased", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_proofs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "verifyProof", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x8906f3bfd5b3d81bb63b184e927f1301561ff35264dbdd373dd57b9cffd9d60a", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0xb85b3D61439a3d70D3DF7913a3A764F352b32C55", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "1246863", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4f96c40f81d6f99e9add50f42a08ce29521b0382a95607b039d342c987f52c8e", + "transactionHash": "0x8906f3bfd5b3d81bb63b184e927f1301561ff35264dbdd373dd57b9cffd9d60a", + "logs": [], + "blockNumber": 35, + "cumulativeGasUsed": "1246863", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e08d6b930820ab219ef1afbfaba72b7a", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AliasedPublicSignal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"getVerificationKeys\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"isAliased\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_proofs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"verifyProof\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getVerificationKeys()\":{\"details\":\"returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs..\"},\"isAliased(uint256[])\":{\"details\":\"return true if the public signal is aliased\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/primitive/scalar_verifier.sol\":\"BabyZKGroth16ScalarVerifier\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"contracts/primitive/scalar_verifier.sol\":{\"content\":\"\\n// SPDX-License-Identifier: GPL-3.0\\n/*\\n Copyright (c) 2021 0KIMS association.\\n Copyright (c) [2024] Galxe.com.\\n\\n Modifications to this file are part of the Galxe Identity Protocol SDK,\\n which is built using the snarkJS template and is subject to the GNU\\n General Public License v3.0.\\n\\n snarkJS is free software: you can redistribute it and/or modify it\\n under the terms of the GNU General Public License as published by\\n the Free Software Foundation, either version 3 of the License, or\\n (at your option) any later version.\\n\\n This program is distributed in the hope that it will be useful,\\n but WITHOUT ANY WARRANTY; without even the implied warranty of\\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n GNU General Public License for more details.\\n\\n You should have received a copy of the GNU General Public License\\n along with this program. If not, see .\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ncontract BabyZKGroth16ScalarVerifier {\\n error AliasedPublicSignal();\\n\\n // Scalar field size\\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\\n // Base field size\\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\\n\\n // Verification Key data\\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n uint256 constant deltax1 = 11386766365824379679527974311800739296620166334678560777819386094772738908117;\\n uint256 constant deltax2 = 5914602868708600112219413104636571687761738884936609474954954410582503098408;\\n uint256 constant deltay1 = 4651652966715538918037908003920688590707225453456401092100837651799858508873;\\n uint256 constant deltay2 = 5750097786758545771271419578462125638542345819747228567491655641926808625820;\\n\\n uint256 constant IC0x = 19718694483962552457546703022943755844960272065236852983483449121878944032229;\\n uint256 constant IC0y = 19277224091235934629720467697154129029409763052492419487195354501450906873293;\\n uint256 constant IC1x = 11524898445759539751988664644643984354080320377887036267619838360664088041388;\\n uint256 constant IC1y = 12052476618631930474450519376758323338799389525512264273381315623349871320459;\\n uint256 constant IC2x = 1796432713996171209429206469628339720979571370972673842341066237052302144708;\\n uint256 constant IC2y = 15910694945325453731816254570140821145883366324705775641131332163142393553430;\\n uint256 constant IC3x = 13301490279450482586102948347778809500550800419089382713271598741737846927098;\\n uint256 constant IC3y = 14259881931883214004278332811480412945774487191113970531745254373843301815030;\\n uint256 constant IC4x = 1207500870815263464967774976312359598755762009848827143199201686666476624758;\\n uint256 constant IC4y = 8435967651447070421240072360683620289857808299003263625530661340454266925495;\\n uint256 constant IC5x = 20596312126307507544254706071585116472086770107182790995667405884937786149072;\\n uint256 constant IC5y = 20101366561967269911230004725117599795346838430903241466492512719716156452494;\\n uint256 constant IC6x = 17526481656940755408681043575718606969101388584842965003168213187937318841363;\\n uint256 constant IC6y = 13265795018345573998790937061244260230280148075859101413091614551080502238943;\\n uint256 constant IC7x = 8797399508837900954995623995490844490558692290611898196384918943481136881246;\\n uint256 constant IC7y = 1189204587490882345729074991940308020536737538799963545904189346677112172621;\\n uint256 constant IC8x = 17425938981588937088170006395579119680236927961246903247977312401168286974480;\\n uint256 constant IC8y = 5313672417270749056228790951665922810430694276452143630621001803078527956704;\\n uint256 constant IC9x = 21558569413462776597053285568737324938159130522610738437830367783496513501490;\\n uint256 constant IC9y = 12326766729916800830567908978618969396776317942337594117075699985152575345284;\\n uint256 constant IC10x = 6395915430939619962955569365706969975441352219959453609660666075170686062244;\\n uint256 constant IC10y = 8282983962149557587079522102277232822891054043805116932692253318963003844810;\\n // Memory data\\n uint16 constant pVk = 0;\\n uint16 constant pPairing = 128;\\n\\n uint16 constant pLastMem = 896;\\n\\n uint16 constant proofLength = 8;\\n uint32 constant pubSignalLength = 10;\\n\\n /// @dev returns the verification keys in the order that the verifier expects them:\\n /// alpha, beta, gamma, delta, ICs..\\n function getVerificationKeys() public pure returns (uint[] memory) {\\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n vks[10] = 11386766365824379679527974311800739296620166334678560777819386094772738908117;\\n vks[11] = 5914602868708600112219413104636571687761738884936609474954954410582503098408;\\n vks[12] = 4651652966715538918037908003920688590707225453456401092100837651799858508873;\\n vks[13] = 5750097786758545771271419578462125638542345819747228567491655641926808625820;\\n vks[14] = 19718694483962552457546703022943755844960272065236852983483449121878944032229;\\n vks[15] = 19277224091235934629720467697154129029409763052492419487195354501450906873293;\\n vks[16] = 11524898445759539751988664644643984354080320377887036267619838360664088041388;\\n vks[17] = 12052476618631930474450519376758323338799389525512264273381315623349871320459;\\n vks[18] = 1796432713996171209429206469628339720979571370972673842341066237052302144708;\\n vks[19] = 15910694945325453731816254570140821145883366324705775641131332163142393553430;\\n vks[20] = 13301490279450482586102948347778809500550800419089382713271598741737846927098;\\n vks[21] = 14259881931883214004278332811480412945774487191113970531745254373843301815030;\\n vks[22] = 1207500870815263464967774976312359598755762009848827143199201686666476624758;\\n vks[23] = 8435967651447070421240072360683620289857808299003263625530661340454266925495;\\n vks[24] = 20596312126307507544254706071585116472086770107182790995667405884937786149072;\\n vks[25] = 20101366561967269911230004725117599795346838430903241466492512719716156452494;\\n vks[26] = 17526481656940755408681043575718606969101388584842965003168213187937318841363;\\n vks[27] = 13265795018345573998790937061244260230280148075859101413091614551080502238943;\\n vks[28] = 8797399508837900954995623995490844490558692290611898196384918943481136881246;\\n vks[29] = 1189204587490882345729074991940308020536737538799963545904189346677112172621;\\n vks[30] = 17425938981588937088170006395579119680236927961246903247977312401168286974480;\\n vks[31] = 5313672417270749056228790951665922810430694276452143630621001803078527956704;\\n vks[32] = 21558569413462776597053285568737324938159130522610738437830367783496513501490;\\n vks[33] = 12326766729916800830567908978618969396776317942337594117075699985152575345284;\\n vks[34] = 6395915430939619962955569365706969975441352219959453609660666075170686062244;\\n vks[35] = 8282983962149557587079522102277232822891054043805116932692253318963003844810;\\n return vks;\\n }\\n\\n /// @dev return true if the public signal is aliased\\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\\n // Alias check\\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\\n if (_pubSignals[8] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\\n if (_pubSignals[9] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\\n return false;\\n }\\n\\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\\n // Check Argument\\n require(_proofs.length == proofLength, \\\"Invalid proof\\\");\\n require(_pubSignals.length == pubSignalLength, \\\"Invalid public signal\\\");\\n if (isAliased(_pubSignals)) { return false; }\\n assembly {\\n // G1 function to multiply a G1 value(x,y) to value in an address\\n function g1_mulAccC(pR, x, y, s) {\\n let success\\n let mIn := mload(0x40)\\n mstore(mIn, x)\\n mstore(add(mIn, 32), y)\\n mstore(add(mIn, 64), s)\\n\\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n\\n mstore(add(mIn, 64), mload(pR))\\n mstore(add(mIn, 96), mload(add(pR, 32)))\\n\\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n }\\n\\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\\n let _pPairing := add(pMem, pPairing)\\n let _pVk := add(pMem, pVk)\\n\\n mstore(_pVk, IC0x)\\n mstore(add(_pVk, 32), IC0y)\\n\\n // Compute the linear combination it.vkey.vk_x\\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\\n g1_mulAccC(_pVk, IC10x, IC10y, calldataload(add(pubSignals, 288)))\\n // -A\\n mstore(_pPairing, calldataload(pA))\\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\\n\\n // B\\n mstore(add(_pPairing, 64), calldataload(pB))\\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\\n\\n // alpha1\\n mstore(add(_pPairing, 192), alphax)\\n mstore(add(_pPairing, 224), alphay)\\n\\n // beta2\\n mstore(add(_pPairing, 256), betax1)\\n mstore(add(_pPairing, 288), betax2)\\n mstore(add(_pPairing, 320), betay1)\\n mstore(add(_pPairing, 352), betay2)\\n\\n // it.vkey.vk_x\\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\\n\\n // gamma2\\n mstore(add(_pPairing, 448), gammax1)\\n mstore(add(_pPairing, 480), gammax2)\\n mstore(add(_pPairing, 512), gammay1)\\n mstore(add(_pPairing, 544), gammay2)\\n\\n // C\\n mstore(add(_pPairing, 576), calldataload(pC))\\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\\n\\n // delta2\\n mstore(add(_pPairing, 640), deltax1)\\n mstore(add(_pPairing, 672), deltax2)\\n mstore(add(_pPairing, 704), deltay1)\\n mstore(add(_pPairing, 736), deltay2)\\n\\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\\n\\n isOk := and(success, mload(_pPairing))\\n }\\n\\n let pMem := mload(0x40)\\n mstore(0x40, add(pMem, pLastMem))\\n\\n // Validate all evaluations\\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\\n\\n mstore(0, isValid)\\n return(0, 0x20)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf58d0b24d8547ae43cc02731699cd9a672be50e7e76f7d05ef6d894f0fc5f668\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50611588806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b6100596100543660046113fb565b610096565b60405190151581526020015b60405180910390f35b61005961007c36600461143d565b610297565b610089610a46565b60405161006591906114a9565b6000600160a01b838360008181106100b0576100b06114ed565b90506020020135106100c457506001610291565b600160a01b838360018181106100dc576100dc6114ed565b90506020020135106100f057506001610291565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000183836002818110610124576101246114ed565b905060200201351061013857506001610291565b600160a01b83836003818110610150576101506114ed565b905060200201351061016457506001610291565b600160f81b8383600481811061017c5761017c6114ed565b905060200201351061019057506001610291565b68010000000000000000838360058181106101ad576101ad6114ed565b90506020020135106101c157506001610291565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f5576101f56114ed565b905060200201351061020957506001610291565b600160f91b83836007818110610221576102216114ed565b905060200201351061023557506001610291565b600160f81b8383600881811061024d5761024d6114ed565b905060200201351061026157506001610291565b600160f81b83836009818110610279576102796114ed565b905060200201351061028d57506001610291565b5060005b92915050565b6000600884146102ee5760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b600a821461033e5760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c000000000000000000000060448201526064016102e5565b6103488383610096565b1561035557506000610a3e565b610a14565b600060405183815284602082015285604082015260408160608360076107d05a03fa91508161038d576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa915050806103be576000805260206000f35b5050505050565b7f2b9862b4a2680e912597e0d6fe983ee192013208eb39bd508c3a69d2c55ca5e585527f2a9e85adac861077ae675c20a51799937467a7dfbc5dfa860417c8e364362dcd60208601526000608086018661046287357f1aa575c40c67cda5b6b2c7c837977c43de1c6977240c3fec5c54ad8b845a1d8b7f197adc8202b6263f2a13206c13888fedd81226fc94682cab693d5744b44cd7ac8461035a565b6104b260208801357f232d225b8774b221b7d8a129fe5c819ec5379b19c4c74b1acd1fd591a3a462167f03f8beb0b87324d438982cd93e486786202d4f7fd1ce45a0ecdcca5f58e434c48461035a565b61050260408801357f1f86cea1b2bbb151e4d45b4bea5b0c28fbb93c0f4b17e9659e16cbdac40bd2f67f1d68606f94166608d5f50afd5a2dc52628b97ee7731c1140d2814481190ceefa8461035a565b61055260608801357f12a696a6ff5a9565b5c9866d3002f18a259f33eab9edeeae30d381b894d4f1b77f02ab6bd891e3e9bc1f6eb7e9852d73b3870bd818e6c847735400adbab4619b768461035a565b6105a260808801357f2c70f864e382cd4b7c63bfd82319c58d811082b915dbfc38775b1b30e3482e8e7f2d89197c342abfa4af6034d5b74f967fa0122f908ac34037e3481d513fd8c8d08461035a565b6105f260a08801357f1d542c84c2103129b0be2741cbf071da9347c646ae5aa37cdf37d91007571edf7f26bfa3179e4c21d52816ca0eb4c727a03210a5af5f0023288f6ef5f114c9ac138461035a565b61064260c08801357f02a110e1b41687c2ab8576e34853db4d917207914961a9ea8709a003fb6bf04d7f137326d3aeaf2c2dd9a066745a0fb5144aa7297ad7b58cc906d19264b4531e5e8461035a565b61069260e08801357f0bbf6e9820f8397ef1b755282715fefbb118b45391322a0630181672697d36e07f2686bb6085277e01f91209a31bf20e9f745079b91077b50d8e27e9cacf2d82108461035a565b6106e36101008801357f1b40b3e5ba1a5bbecbb3ef9a5de81fa93a3c5b8497b3f6faf4fe8440e2b912847f2fa9b7c6af336d26776616a00d233b1050b0e13ec54c6323b3043b37674839328461035a565b6107346101208801357f125000b695a20ef50efcf1f3d7017f13fc789cb575d8d512ac2ddb976986e8ca7f0e23f5b88ea33c4d7db70b1b61d88e6e2ef802640e80da1e0acd3c949be34ea48461035a565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f192cae6e67d3127cb845721f700789fda9b5d03743925565c7d16171cb48dfd56102808201527f0d138bed6516777f425dd3167de0924ae7d4edb83fa244d7e2bfbcff7be088286102a08201527f0a48be05f336425b92787170311b6e3598cf847016f07b97c85b955ccd9874496102c08201527f0cb670a4c6e8c4c45543bee20f508dfef387320fc94f583724c88fcf1073e29c6102e08201526020816103008360086107d05a03fa9051169695505050505050565b6040516103808101604052610a32818560c0890160408a018a6103c5565b90508060005260206000f35b949350505050565b60606000610a56600a6002611519565b610a61906010611541565b63ffffffff1667ffffffffffffffff811115610a7f57610a7f611565565b604051908082528060200260200182016040528015610aa8578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e281600081518110610adf57610adf6114ed565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192681600181518110610b1f57610b1f6114ed565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c81600281518110610b5f57610b5f6114ed565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab81600381518110610b9f57610b9f6114ed565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a781600481518110610bdf57610bdf6114ed565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec881600581518110610c1f57610c1f6114ed565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c281600681518110610c5f57610c5f6114ed565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed81600781518110610c9f57610c9f6114ed565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81600881518110610cdf57610cdf6114ed565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa81600981518110610d1f57610d1f6114ed565b6020026020010181815250507f192cae6e67d3127cb845721f700789fda9b5d03743925565c7d16171cb48dfd581600a81518110610d5f57610d5f6114ed565b6020026020010181815250507f0d138bed6516777f425dd3167de0924ae7d4edb83fa244d7e2bfbcff7be0882881600b81518110610d9f57610d9f6114ed565b6020026020010181815250507f0a48be05f336425b92787170311b6e3598cf847016f07b97c85b955ccd98744981600c81518110610ddf57610ddf6114ed565b6020026020010181815250507f0cb670a4c6e8c4c45543bee20f508dfef387320fc94f583724c88fcf1073e29c81600d81518110610e1f57610e1f6114ed565b6020026020010181815250507f2b9862b4a2680e912597e0d6fe983ee192013208eb39bd508c3a69d2c55ca5e581600e81518110610e5f57610e5f6114ed565b6020026020010181815250507f2a9e85adac861077ae675c20a51799937467a7dfbc5dfa860417c8e364362dcd81600f81518110610e9f57610e9f6114ed565b6020026020010181815250507f197adc8202b6263f2a13206c13888fedd81226fc94682cab693d5744b44cd7ac81601081518110610edf57610edf6114ed565b6020026020010181815250507f1aa575c40c67cda5b6b2c7c837977c43de1c6977240c3fec5c54ad8b845a1d8b81601181518110610f1f57610f1f6114ed565b6020026020010181815250507f03f8beb0b87324d438982cd93e486786202d4f7fd1ce45a0ecdcca5f58e434c481601281518110610f5f57610f5f6114ed565b6020026020010181815250507f232d225b8774b221b7d8a129fe5c819ec5379b19c4c74b1acd1fd591a3a4621681601381518110610f9f57610f9f6114ed565b6020026020010181815250507f1d68606f94166608d5f50afd5a2dc52628b97ee7731c1140d2814481190ceefa81601481518110610fdf57610fdf6114ed565b6020026020010181815250507f1f86cea1b2bbb151e4d45b4bea5b0c28fbb93c0f4b17e9659e16cbdac40bd2f68160158151811061101f5761101f6114ed565b6020026020010181815250507f02ab6bd891e3e9bc1f6eb7e9852d73b3870bd818e6c847735400adbab4619b768160168151811061105f5761105f6114ed565b6020026020010181815250507f12a696a6ff5a9565b5c9866d3002f18a259f33eab9edeeae30d381b894d4f1b78160178151811061109f5761109f6114ed565b6020026020010181815250507f2d89197c342abfa4af6034d5b74f967fa0122f908ac34037e3481d513fd8c8d0816018815181106110df576110df6114ed565b6020026020010181815250507f2c70f864e382cd4b7c63bfd82319c58d811082b915dbfc38775b1b30e3482e8e8160198151811061111f5761111f6114ed565b6020026020010181815250507f26bfa3179e4c21d52816ca0eb4c727a03210a5af5f0023288f6ef5f114c9ac1381601a8151811061115f5761115f6114ed565b6020026020010181815250507f1d542c84c2103129b0be2741cbf071da9347c646ae5aa37cdf37d91007571edf81601b8151811061119f5761119f6114ed565b6020026020010181815250507f137326d3aeaf2c2dd9a066745a0fb5144aa7297ad7b58cc906d19264b4531e5e81601c815181106111df576111df6114ed565b6020026020010181815250507f02a110e1b41687c2ab8576e34853db4d917207914961a9ea8709a003fb6bf04d81601d8151811061121f5761121f6114ed565b6020026020010181815250507f2686bb6085277e01f91209a31bf20e9f745079b91077b50d8e27e9cacf2d821081601e8151811061125f5761125f6114ed565b6020026020010181815250507f0bbf6e9820f8397ef1b755282715fefbb118b45391322a0630181672697d36e081601f8151811061129f5761129f6114ed565b6020026020010181815250507f2fa9b7c6af336d26776616a00d233b1050b0e13ec54c6323b3043b3767483932816020815181106112df576112df6114ed565b6020026020010181815250507f1b40b3e5ba1a5bbecbb3ef9a5de81fa93a3c5b8497b3f6faf4fe8440e2b912848160218151811061131f5761131f6114ed565b6020026020010181815250507f0e23f5b88ea33c4d7db70b1b61d88e6e2ef802640e80da1e0acd3c949be34ea48160228151811061135f5761135f6114ed565b6020026020010181815250507f125000b695a20ef50efcf1f3d7017f13fc789cb575d8d512ac2ddb976986e8ca8160238151811061139f5761139f6114ed565b6020908102919091010152919050565b60008083601f8401126113c157600080fd5b50813567ffffffffffffffff8111156113d957600080fd5b6020830191508360208260051b85010111156113f457600080fd5b9250929050565b6000806020838503121561140e57600080fd5b823567ffffffffffffffff81111561142557600080fd5b611431858286016113af565b90969095509350505050565b6000806000806040858703121561145357600080fd5b843567ffffffffffffffff8082111561146b57600080fd5b611477888389016113af565b9096509450602087013591508082111561149057600080fd5b5061149d878288016113af565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156114e1578351835292840192918401916001016114c5565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461153957611539611503565b505092915050565b63ffffffff81811683821601908082111561155e5761155e611503565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b6100596100543660046113fb565b610096565b60405190151581526020015b60405180910390f35b61005961007c36600461143d565b610297565b610089610a46565b60405161006591906114a9565b6000600160a01b838360008181106100b0576100b06114ed565b90506020020135106100c457506001610291565b600160a01b838360018181106100dc576100dc6114ed565b90506020020135106100f057506001610291565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000183836002818110610124576101246114ed565b905060200201351061013857506001610291565b600160a01b83836003818110610150576101506114ed565b905060200201351061016457506001610291565b600160f81b8383600481811061017c5761017c6114ed565b905060200201351061019057506001610291565b68010000000000000000838360058181106101ad576101ad6114ed565b90506020020135106101c157506001610291565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f5576101f56114ed565b905060200201351061020957506001610291565b600160f91b83836007818110610221576102216114ed565b905060200201351061023557506001610291565b600160f81b8383600881811061024d5761024d6114ed565b905060200201351061026157506001610291565b600160f81b83836009818110610279576102796114ed565b905060200201351061028d57506001610291565b5060005b92915050565b6000600884146102ee5760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b600a821461033e5760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c000000000000000000000060448201526064016102e5565b6103488383610096565b1561035557506000610a3e565b610a14565b600060405183815284602082015285604082015260408160608360076107d05a03fa91508161038d576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa915050806103be576000805260206000f35b5050505050565b7f2b9862b4a2680e912597e0d6fe983ee192013208eb39bd508c3a69d2c55ca5e585527f2a9e85adac861077ae675c20a51799937467a7dfbc5dfa860417c8e364362dcd60208601526000608086018661046287357f1aa575c40c67cda5b6b2c7c837977c43de1c6977240c3fec5c54ad8b845a1d8b7f197adc8202b6263f2a13206c13888fedd81226fc94682cab693d5744b44cd7ac8461035a565b6104b260208801357f232d225b8774b221b7d8a129fe5c819ec5379b19c4c74b1acd1fd591a3a462167f03f8beb0b87324d438982cd93e486786202d4f7fd1ce45a0ecdcca5f58e434c48461035a565b61050260408801357f1f86cea1b2bbb151e4d45b4bea5b0c28fbb93c0f4b17e9659e16cbdac40bd2f67f1d68606f94166608d5f50afd5a2dc52628b97ee7731c1140d2814481190ceefa8461035a565b61055260608801357f12a696a6ff5a9565b5c9866d3002f18a259f33eab9edeeae30d381b894d4f1b77f02ab6bd891e3e9bc1f6eb7e9852d73b3870bd818e6c847735400adbab4619b768461035a565b6105a260808801357f2c70f864e382cd4b7c63bfd82319c58d811082b915dbfc38775b1b30e3482e8e7f2d89197c342abfa4af6034d5b74f967fa0122f908ac34037e3481d513fd8c8d08461035a565b6105f260a08801357f1d542c84c2103129b0be2741cbf071da9347c646ae5aa37cdf37d91007571edf7f26bfa3179e4c21d52816ca0eb4c727a03210a5af5f0023288f6ef5f114c9ac138461035a565b61064260c08801357f02a110e1b41687c2ab8576e34853db4d917207914961a9ea8709a003fb6bf04d7f137326d3aeaf2c2dd9a066745a0fb5144aa7297ad7b58cc906d19264b4531e5e8461035a565b61069260e08801357f0bbf6e9820f8397ef1b755282715fefbb118b45391322a0630181672697d36e07f2686bb6085277e01f91209a31bf20e9f745079b91077b50d8e27e9cacf2d82108461035a565b6106e36101008801357f1b40b3e5ba1a5bbecbb3ef9a5de81fa93a3c5b8497b3f6faf4fe8440e2b912847f2fa9b7c6af336d26776616a00d233b1050b0e13ec54c6323b3043b37674839328461035a565b6107346101208801357f125000b695a20ef50efcf1f3d7017f13fc789cb575d8d512ac2ddb976986e8ca7f0e23f5b88ea33c4d7db70b1b61d88e6e2ef802640e80da1e0acd3c949be34ea48461035a565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f192cae6e67d3127cb845721f700789fda9b5d03743925565c7d16171cb48dfd56102808201527f0d138bed6516777f425dd3167de0924ae7d4edb83fa244d7e2bfbcff7be088286102a08201527f0a48be05f336425b92787170311b6e3598cf847016f07b97c85b955ccd9874496102c08201527f0cb670a4c6e8c4c45543bee20f508dfef387320fc94f583724c88fcf1073e29c6102e08201526020816103008360086107d05a03fa9051169695505050505050565b6040516103808101604052610a32818560c0890160408a018a6103c5565b90508060005260206000f35b949350505050565b60606000610a56600a6002611519565b610a61906010611541565b63ffffffff1667ffffffffffffffff811115610a7f57610a7f611565565b604051908082528060200260200182016040528015610aa8578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e281600081518110610adf57610adf6114ed565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192681600181518110610b1f57610b1f6114ed565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c81600281518110610b5f57610b5f6114ed565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab81600381518110610b9f57610b9f6114ed565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a781600481518110610bdf57610bdf6114ed565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec881600581518110610c1f57610c1f6114ed565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c281600681518110610c5f57610c5f6114ed565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed81600781518110610c9f57610c9f6114ed565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81600881518110610cdf57610cdf6114ed565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa81600981518110610d1f57610d1f6114ed565b6020026020010181815250507f192cae6e67d3127cb845721f700789fda9b5d03743925565c7d16171cb48dfd581600a81518110610d5f57610d5f6114ed565b6020026020010181815250507f0d138bed6516777f425dd3167de0924ae7d4edb83fa244d7e2bfbcff7be0882881600b81518110610d9f57610d9f6114ed565b6020026020010181815250507f0a48be05f336425b92787170311b6e3598cf847016f07b97c85b955ccd98744981600c81518110610ddf57610ddf6114ed565b6020026020010181815250507f0cb670a4c6e8c4c45543bee20f508dfef387320fc94f583724c88fcf1073e29c81600d81518110610e1f57610e1f6114ed565b6020026020010181815250507f2b9862b4a2680e912597e0d6fe983ee192013208eb39bd508c3a69d2c55ca5e581600e81518110610e5f57610e5f6114ed565b6020026020010181815250507f2a9e85adac861077ae675c20a51799937467a7dfbc5dfa860417c8e364362dcd81600f81518110610e9f57610e9f6114ed565b6020026020010181815250507f197adc8202b6263f2a13206c13888fedd81226fc94682cab693d5744b44cd7ac81601081518110610edf57610edf6114ed565b6020026020010181815250507f1aa575c40c67cda5b6b2c7c837977c43de1c6977240c3fec5c54ad8b845a1d8b81601181518110610f1f57610f1f6114ed565b6020026020010181815250507f03f8beb0b87324d438982cd93e486786202d4f7fd1ce45a0ecdcca5f58e434c481601281518110610f5f57610f5f6114ed565b6020026020010181815250507f232d225b8774b221b7d8a129fe5c819ec5379b19c4c74b1acd1fd591a3a4621681601381518110610f9f57610f9f6114ed565b6020026020010181815250507f1d68606f94166608d5f50afd5a2dc52628b97ee7731c1140d2814481190ceefa81601481518110610fdf57610fdf6114ed565b6020026020010181815250507f1f86cea1b2bbb151e4d45b4bea5b0c28fbb93c0f4b17e9659e16cbdac40bd2f68160158151811061101f5761101f6114ed565b6020026020010181815250507f02ab6bd891e3e9bc1f6eb7e9852d73b3870bd818e6c847735400adbab4619b768160168151811061105f5761105f6114ed565b6020026020010181815250507f12a696a6ff5a9565b5c9866d3002f18a259f33eab9edeeae30d381b894d4f1b78160178151811061109f5761109f6114ed565b6020026020010181815250507f2d89197c342abfa4af6034d5b74f967fa0122f908ac34037e3481d513fd8c8d0816018815181106110df576110df6114ed565b6020026020010181815250507f2c70f864e382cd4b7c63bfd82319c58d811082b915dbfc38775b1b30e3482e8e8160198151811061111f5761111f6114ed565b6020026020010181815250507f26bfa3179e4c21d52816ca0eb4c727a03210a5af5f0023288f6ef5f114c9ac1381601a8151811061115f5761115f6114ed565b6020026020010181815250507f1d542c84c2103129b0be2741cbf071da9347c646ae5aa37cdf37d91007571edf81601b8151811061119f5761119f6114ed565b6020026020010181815250507f137326d3aeaf2c2dd9a066745a0fb5144aa7297ad7b58cc906d19264b4531e5e81601c815181106111df576111df6114ed565b6020026020010181815250507f02a110e1b41687c2ab8576e34853db4d917207914961a9ea8709a003fb6bf04d81601d8151811061121f5761121f6114ed565b6020026020010181815250507f2686bb6085277e01f91209a31bf20e9f745079b91077b50d8e27e9cacf2d821081601e8151811061125f5761125f6114ed565b6020026020010181815250507f0bbf6e9820f8397ef1b755282715fefbb118b45391322a0630181672697d36e081601f8151811061129f5761129f6114ed565b6020026020010181815250507f2fa9b7c6af336d26776616a00d233b1050b0e13ec54c6323b3043b3767483932816020815181106112df576112df6114ed565b6020026020010181815250507f1b40b3e5ba1a5bbecbb3ef9a5de81fa93a3c5b8497b3f6faf4fe8440e2b912848160218151811061131f5761131f6114ed565b6020026020010181815250507f0e23f5b88ea33c4d7db70b1b61d88e6e2ef802640e80da1e0acd3c949be34ea48160228151811061135f5761135f6114ed565b6020026020010181815250507f125000b695a20ef50efcf1f3d7017f13fc789cb575d8d512ac2ddb976986e8ca8160238151811061139f5761139f6114ed565b6020908102919091010152919050565b60008083601f8401126113c157600080fd5b50813567ffffffffffffffff8111156113d957600080fd5b6020830191508360208260051b85010111156113f457600080fd5b9250929050565b6000806020838503121561140e57600080fd5b823567ffffffffffffffff81111561142557600080fd5b611431858286016113af565b90969095509350505050565b6000806000806040858703121561145357600080fd5b843567ffffffffffffffff8082111561146b57600080fd5b611477888389016113af565b9096509450602087013591508082111561149057600080fd5b5061149d878288016113af565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156114e1578351835292840192918401916001016114c5565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461153957611539611503565b505092915050565b63ffffffff81811683821601908082111561155e5761155e611503565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "devdoc": { + "kind": "dev", + "methods": { + "getVerificationKeys()": { + "details": "returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs.." + }, + "isAliased(uint256[])": { + "details": "return true if the public signal is aliased" + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/BabyZKGroth16UnitVerifier.json b/packages/evm-contracts/deployments/gravity/BabyZKGroth16UnitVerifier.json new file mode 100644 index 0000000..5cd8eb6 --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/BabyZKGroth16UnitVerifier.json @@ -0,0 +1,109 @@ +{ + "address": "0x4B8794e78E27B8eb9d57E7566E657C23C747f3b4", + "abi": [ + { + "inputs": [], + "name": "AliasedPublicSignal", + "type": "error" + }, + { + "inputs": [], + "name": "getVerificationKeys", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "isAliased", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_proofs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_pubSignals", + "type": "uint256[]" + } + ], + "name": "verifyProof", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x9f49cc09484b905ae2292b2858dd75cb51dcdd314c2f388837ede8c9849bb3c0", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0xb85b3D61439a3d70D3DF7913a3A764F352b32C55", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "1137310", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4490b67d06826efb5b01b9a47b031491a9636702bf0ecba08f3d1e5331bd8a04", + "transactionHash": "0x9f49cc09484b905ae2292b2858dd75cb51dcdd314c2f388837ede8c9849bb3c0", + "logs": [], + "blockNumber": 37, + "cumulativeGasUsed": "1137310", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e08d6b930820ab219ef1afbfaba72b7a", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AliasedPublicSignal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"getVerificationKeys\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"isAliased\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_proofs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_pubSignals\",\"type\":\"uint256[]\"}],\"name\":\"verifyProof\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getVerificationKeys()\":{\"details\":\"returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs..\"},\"isAliased(uint256[])\":{\"details\":\"return true if the public signal is aliased\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/primitive/unit_verifier.sol\":\"BabyZKGroth16UnitVerifier\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"contracts/primitive/unit_verifier.sol\":{\"content\":\"\\n// SPDX-License-Identifier: GPL-3.0\\n/*\\n Copyright (c) 2021 0KIMS association.\\n Copyright (c) [2024] Galxe.com.\\n\\n Modifications to this file are part of the Galxe Identity Protocol SDK,\\n which is built using the snarkJS template and is subject to the GNU\\n General Public License v3.0.\\n\\n snarkJS is free software: you can redistribute it and/or modify it\\n under the terms of the GNU General Public License as published by\\n the Free Software Foundation, either version 3 of the License, or\\n (at your option) any later version.\\n\\n This program is distributed in the hope that it will be useful,\\n but WITHOUT ANY WARRANTY; without even the implied warranty of\\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n GNU General Public License for more details.\\n\\n You should have received a copy of the GNU General Public License\\n along with this program. If not, see .\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ncontract BabyZKGroth16UnitVerifier {\\n error AliasedPublicSignal();\\n\\n // Scalar field size\\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\\n // Base field size\\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\\n\\n // Verification Key data\\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n uint256 constant deltax1 = 15637418380756236601718213192255613136045919407816081601661261207618084073597;\\n uint256 constant deltax2 = 16569784677986731884848814767977081422246581497389376666284070100669021849313;\\n uint256 constant deltay1 = 17775141888156869748745527945157624548875521553021038167785799262294965116348;\\n uint256 constant deltay2 = 3246184716089128973746765775249737516048676435198106546989660202706440984521;\\n\\n uint256 constant IC0x = 4990317659614575818156037472214188417509096922233331003555642014823238651184;\\n uint256 constant IC0y = 14469248329543848838153834859360699519345616103861941229956057140145693492508;\\n uint256 constant IC1x = 10837138624576207424789978193086542153499320344753530437477168438248082178960;\\n uint256 constant IC1y = 917015773848957701033958467874666708682927187095469719889324478895656869516;\\n uint256 constant IC2x = 5037499117481750214477112555364145021274012966256645948893036512248435385840;\\n uint256 constant IC2y = 19826826480151452757007846213434794238926452546710485787711011712233552633495;\\n uint256 constant IC3x = 20945528997632428738612501906743782336475532295455403104686278305604488099835;\\n uint256 constant IC3y = 20744191411948171901695905522237963923426425453283062602166914445806285227301;\\n uint256 constant IC4x = 8513991002836348269358097045344942553237626798000929884704947463798784967405;\\n uint256 constant IC4y = 19338209321160679542018365847622795887832971526814598737666811533118912666856;\\n uint256 constant IC5x = 3569844613050455610552335538126280293963365442570334539158228936972825900539;\\n uint256 constant IC5y = 16528366039144804325194354617729911304908458001966274902042903564466963990992;\\n uint256 constant IC6x = 1570945769731720797444624982944778925162368447218125765326050361254312822358;\\n uint256 constant IC6y = 2602548857774106882745290052940216670975889108043343483573122286840504404756;\\n uint256 constant IC7x = 21301906662599840990524780602285271554623267433315428422652065889924533228332;\\n uint256 constant IC7y = 11716127211538228300463074562279867241595264693476507064906125029152968407192;\\n uint256 constant IC8x = 11201724637271039764798623441350903487110912630994328063735802041659149290802;\\n uint256 constant IC8y = 9584899601398928135093189759789914293671858783478336033800854558608680407297;\\n // Memory data\\n uint16 constant pVk = 0;\\n uint16 constant pPairing = 128;\\n\\n uint16 constant pLastMem = 896;\\n\\n uint16 constant proofLength = 8;\\n uint32 constant pubSignalLength = 8;\\n\\n /// @dev returns the verification keys in the order that the verifier expects them:\\n /// alpha, beta, gamma, delta, ICs..\\n function getVerificationKeys() public pure returns (uint[] memory) {\\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\\n vks[10] = 15637418380756236601718213192255613136045919407816081601661261207618084073597;\\n vks[11] = 16569784677986731884848814767977081422246581497389376666284070100669021849313;\\n vks[12] = 17775141888156869748745527945157624548875521553021038167785799262294965116348;\\n vks[13] = 3246184716089128973746765775249737516048676435198106546989660202706440984521;\\n vks[14] = 4990317659614575818156037472214188417509096922233331003555642014823238651184;\\n vks[15] = 14469248329543848838153834859360699519345616103861941229956057140145693492508;\\n vks[16] = 10837138624576207424789978193086542153499320344753530437477168438248082178960;\\n vks[17] = 917015773848957701033958467874666708682927187095469719889324478895656869516;\\n vks[18] = 5037499117481750214477112555364145021274012966256645948893036512248435385840;\\n vks[19] = 19826826480151452757007846213434794238926452546710485787711011712233552633495;\\n vks[20] = 20945528997632428738612501906743782336475532295455403104686278305604488099835;\\n vks[21] = 20744191411948171901695905522237963923426425453283062602166914445806285227301;\\n vks[22] = 8513991002836348269358097045344942553237626798000929884704947463798784967405;\\n vks[23] = 19338209321160679542018365847622795887832971526814598737666811533118912666856;\\n vks[24] = 3569844613050455610552335538126280293963365442570334539158228936972825900539;\\n vks[25] = 16528366039144804325194354617729911304908458001966274902042903564466963990992;\\n vks[26] = 1570945769731720797444624982944778925162368447218125765326050361254312822358;\\n vks[27] = 2602548857774106882745290052940216670975889108043343483573122286840504404756;\\n vks[28] = 21301906662599840990524780602285271554623267433315428422652065889924533228332;\\n vks[29] = 11716127211538228300463074562279867241595264693476507064906125029152968407192;\\n vks[30] = 11201724637271039764798623441350903487110912630994328063735802041659149290802;\\n vks[31] = 9584899601398928135093189759789914293671858783478336033800854558608680407297;\\n return vks;\\n }\\n\\n /// @dev return true if the public signal is aliased\\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\\n // Alias check\\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\\n return false;\\n }\\n\\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\\n // Check Argument\\n require(_proofs.length == proofLength, \\\"Invalid proof\\\");\\n require(_pubSignals.length == pubSignalLength, \\\"Invalid public signal\\\");\\n if (isAliased(_pubSignals)) { return false; }\\n assembly {\\n // G1 function to multiply a G1 value(x,y) to value in an address\\n function g1_mulAccC(pR, x, y, s) {\\n let success\\n let mIn := mload(0x40)\\n mstore(mIn, x)\\n mstore(add(mIn, 32), y)\\n mstore(add(mIn, 64), s)\\n\\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n\\n mstore(add(mIn, 64), mload(pR))\\n mstore(add(mIn, 96), mload(add(pR, 32)))\\n\\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\\n\\n if iszero(success) {\\n mstore(0, 0)\\n return(0, 0x20)\\n }\\n }\\n\\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\\n let _pPairing := add(pMem, pPairing)\\n let _pVk := add(pMem, pVk)\\n\\n mstore(_pVk, IC0x)\\n mstore(add(_pVk, 32), IC0y)\\n\\n // Compute the linear combination it.vkey.vk_x\\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\\n // -A\\n mstore(_pPairing, calldataload(pA))\\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\\n\\n // B\\n mstore(add(_pPairing, 64), calldataload(pB))\\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\\n\\n // alpha1\\n mstore(add(_pPairing, 192), alphax)\\n mstore(add(_pPairing, 224), alphay)\\n\\n // beta2\\n mstore(add(_pPairing, 256), betax1)\\n mstore(add(_pPairing, 288), betax2)\\n mstore(add(_pPairing, 320), betay1)\\n mstore(add(_pPairing, 352), betay2)\\n\\n // it.vkey.vk_x\\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\\n\\n // gamma2\\n mstore(add(_pPairing, 448), gammax1)\\n mstore(add(_pPairing, 480), gammax2)\\n mstore(add(_pPairing, 512), gammay1)\\n mstore(add(_pPairing, 544), gammay2)\\n\\n // C\\n mstore(add(_pPairing, 576), calldataload(pC))\\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\\n\\n // delta2\\n mstore(add(_pPairing, 640), deltax1)\\n mstore(add(_pPairing, 672), deltax2)\\n mstore(add(_pPairing, 704), deltay1)\\n mstore(add(_pPairing, 736), deltay2)\\n\\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\\n\\n isOk := and(success, mload(_pPairing))\\n }\\n\\n let pMem := mload(0x40)\\n mstore(0x40, add(pMem, pLastMem))\\n\\n // Validate all evaluations\\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\\n\\n mstore(0, isValid)\\n return(0, 0x20)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x02b6b3e171d7bd45d2911a3190a44543956a36b43fe29f442e804549de2572c4\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061138e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b610059610054366004611201565b610096565b60405190151581526020015b60405180910390f35b61005961007c366004611243565b61023f565b61008961094c565b60405161006591906112af565b6000600160a01b838360008181106100b0576100b06112f3565b90506020020135106100c457506001610239565b600160a01b838360018181106100dc576100dc6112f3565b90506020020135106100f057506001610239565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000183836002818110610124576101246112f3565b905060200201351061013857506001610239565b600160a01b83836003818110610150576101506112f3565b905060200201351061016457506001610239565b600160f81b8383600481811061017c5761017c6112f3565b905060200201351061019057506001610239565b68010000000000000000838360058181106101ad576101ad6112f3565b90506020020135106101c157506001610239565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f5576101f56112f3565b905060200201351061020957506001610239565b600160f91b83836007818110610221576102216112f3565b905060200201351061023557506001610239565b5060005b92915050565b6000600884146102965760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b600882146102e65760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c0000000000000000000000604482015260640161028d565b6102f08383610096565b156102fd57506000610944565b61091a565b600060405183815284602082015285604082015260408160608360076107d05a03fa915081610335576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa91505080610366576000805260206000f35b5050505050565b7f0b086b7191bb5031124719c586d207d098e3e1dd505e970a04ff0f4adc58cd3085527f1ffd4de8ff67c97f338f246f4ef6222e34d9c3bed445e87c283c5b3efa09851c60208601526000608086018661040a87357f020703357c835c23a95ef36c638417312bf1ed213675d662b1e728577b611e8c7f17f59a646bda81d9e11f10f8e4a0e50eeda09c36ed10b2b3f90aa6495dfb039084610302565b61045a60208801357f2bd5960b49b3d17f9064fe10c41c28ae6e65144703826d5271e181ba220a5e977f0b231f9b1b40cefe8b7451b9627e97fb5c50674f4eaf379d919c1ac1c34525f084610302565b6104aa60408801357f2ddccbd7c329983f8be58ea21e70562e6556d52760844796e980c3886f1205257f2e4ebfd1dfcb88f26867fe58e25ccf2271e5d7fdb5cc2529aa1d4e02907b77fb84610302565b6104fa60608801357f2ac109e192c3ccacca473c593e04fc9238d3a41241621176f12dcb9717091ce87f12d2bf85f238d1d5f654c3503cac758f17f86bfa370e9abfea578bebf09ec2ed84610302565b61054a60808801357f248ab941bb6a40448f45219b5273df8fdc4fc55e2ff5496e800346784d35c9d07f07e475dff50e6817913c962b918fadf24ae78a8c5c964970101eee7ce5d5b5fb84610302565b61059a60a08801357f05c0fd8e4ea4d1123e842619b3e2bff35b6679e7424edd20fd8cf1c72aac4b147f03791fb11d66fef6ae51ca3f6e3d229833b51655d2cbd526ece487479c3a465684610302565b6105ea60c08801357f19e717cf2719e11dfc9a1f1647333770a7671b8d80098a81cdf1209cb427f8987f2f1873b024919d8770e0ad0f527158e10dcbe5a166939cdfa8b06613bc84932c84610302565b61063a60e08801357f1530dc658d63bdb756acfec32cf2b8bd39886b860d8b34e70899a47df145d1017f18c3f3933a8dc3a1df284efc4031d82c01f0aff237f6b9f0c24eef8fb6248d3284610302565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f229277146342a5a27039f85236674a9e12408ad7249998200d0199cde45af07d6102808201527f24a22a706e79c91427d59385d8694fbcdff001aa95b7317d16935fac02c086e16102a08201527f274c5fb0357c7e2f572a6fdcae7c8e64286ab638652a508edc24021e47c65dbc6102c08201527f072d468326dfd63c0a999336359ba2892ad2637c27673d352a8edce26dbe97c96102e08201526020816103008360086107d05a03fa9051169695505050505050565b6040516103808101604052610938818560c0890160408a018a61036d565b90508060005260206000f35b949350505050565b6060600061095c6008600261131f565b610967906010611347565b63ffffffff1667ffffffffffffffff8111156109855761098561136b565b6040519080825280602002602001820160405280156109ae578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e2816000815181106109e5576109e56112f3565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192681600181518110610a2557610a256112f3565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c81600281518110610a6557610a656112f3565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab81600381518110610aa557610aa56112f3565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a781600481518110610ae557610ae56112f3565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec881600581518110610b2557610b256112f3565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c281600681518110610b6557610b656112f3565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed81600781518110610ba557610ba56112f3565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81600881518110610be557610be56112f3565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa81600981518110610c2557610c256112f3565b6020026020010181815250507f229277146342a5a27039f85236674a9e12408ad7249998200d0199cde45af07d81600a81518110610c6557610c656112f3565b6020026020010181815250507f24a22a706e79c91427d59385d8694fbcdff001aa95b7317d16935fac02c086e181600b81518110610ca557610ca56112f3565b6020026020010181815250507f274c5fb0357c7e2f572a6fdcae7c8e64286ab638652a508edc24021e47c65dbc81600c81518110610ce557610ce56112f3565b6020026020010181815250507f072d468326dfd63c0a999336359ba2892ad2637c27673d352a8edce26dbe97c981600d81518110610d2557610d256112f3565b6020026020010181815250507f0b086b7191bb5031124719c586d207d098e3e1dd505e970a04ff0f4adc58cd3081600e81518110610d6557610d656112f3565b6020026020010181815250507f1ffd4de8ff67c97f338f246f4ef6222e34d9c3bed445e87c283c5b3efa09851c81600f81518110610da557610da56112f3565b6020026020010181815250507f17f59a646bda81d9e11f10f8e4a0e50eeda09c36ed10b2b3f90aa6495dfb039081601081518110610de557610de56112f3565b6020026020010181815250507f020703357c835c23a95ef36c638417312bf1ed213675d662b1e728577b611e8c81601181518110610e2557610e256112f3565b6020026020010181815250507f0b231f9b1b40cefe8b7451b9627e97fb5c50674f4eaf379d919c1ac1c34525f081601281518110610e6557610e656112f3565b6020026020010181815250507f2bd5960b49b3d17f9064fe10c41c28ae6e65144703826d5271e181ba220a5e9781601381518110610ea557610ea56112f3565b6020026020010181815250507f2e4ebfd1dfcb88f26867fe58e25ccf2271e5d7fdb5cc2529aa1d4e02907b77fb81601481518110610ee557610ee56112f3565b6020026020010181815250507f2ddccbd7c329983f8be58ea21e70562e6556d52760844796e980c3886f12052581601581518110610f2557610f256112f3565b6020026020010181815250507f12d2bf85f238d1d5f654c3503cac758f17f86bfa370e9abfea578bebf09ec2ed81601681518110610f6557610f656112f3565b6020026020010181815250507f2ac109e192c3ccacca473c593e04fc9238d3a41241621176f12dcb9717091ce881601781518110610fa557610fa56112f3565b6020026020010181815250507f07e475dff50e6817913c962b918fadf24ae78a8c5c964970101eee7ce5d5b5fb81601881518110610fe557610fe56112f3565b6020026020010181815250507f248ab941bb6a40448f45219b5273df8fdc4fc55e2ff5496e800346784d35c9d081601981518110611025576110256112f3565b6020026020010181815250507f03791fb11d66fef6ae51ca3f6e3d229833b51655d2cbd526ece487479c3a465681601a81518110611065576110656112f3565b6020026020010181815250507f05c0fd8e4ea4d1123e842619b3e2bff35b6679e7424edd20fd8cf1c72aac4b1481601b815181106110a5576110a56112f3565b6020026020010181815250507f2f1873b024919d8770e0ad0f527158e10dcbe5a166939cdfa8b06613bc84932c81601c815181106110e5576110e56112f3565b6020026020010181815250507f19e717cf2719e11dfc9a1f1647333770a7671b8d80098a81cdf1209cb427f89881601d81518110611125576111256112f3565b6020026020010181815250507f18c3f3933a8dc3a1df284efc4031d82c01f0aff237f6b9f0c24eef8fb6248d3281601e81518110611165576111656112f3565b6020026020010181815250507f1530dc658d63bdb756acfec32cf2b8bd39886b860d8b34e70899a47df145d10181601f815181106111a5576111a56112f3565b6020908102919091010152919050565b60008083601f8401126111c757600080fd5b50813567ffffffffffffffff8111156111df57600080fd5b6020830191508360208260051b85010111156111fa57600080fd5b9250929050565b6000806020838503121561121457600080fd5b823567ffffffffffffffff81111561122b57600080fd5b611237858286016111b5565b90969095509350505050565b6000806000806040858703121561125957600080fd5b843567ffffffffffffffff8082111561127157600080fd5b61127d888389016111b5565b9096509450602087013591508082111561129657600080fd5b506112a3878288016111b5565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156112e7578351835292840192918401916001016112cb565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461133f5761133f611309565b505092915050565b63ffffffff81811683821601908082111561136457611364611309565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80636450764e14610046578063721ea4ac1461006e578063ae440fb014610081575b600080fd5b610059610054366004611201565b610096565b60405190151581526020015b60405180910390f35b61005961007c366004611243565b61023f565b61008961094c565b60405161006591906112af565b6000600160a01b838360008181106100b0576100b06112f3565b90506020020135106100c457506001610239565b600160a01b838360018181106100dc576100dc6112f3565b90506020020135106100f057506001610239565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000183836002818110610124576101246112f3565b905060200201351061013857506001610239565b600160a01b83836003818110610150576101506112f3565b905060200201351061016457506001610239565b600160f81b8383600481811061017c5761017c6112f3565b905060200201351061019057506001610239565b68010000000000000000838360058181106101ad576101ad6112f3565b90506020020135106101c157506001610239565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001838360068181106101f5576101f56112f3565b905060200201351061020957506001610239565b600160f91b83836007818110610221576102216112f3565b905060200201351061023557506001610239565b5060005b92915050565b6000600884146102965760405162461bcd60e51b815260206004820152600d60248201527f496e76616c69642070726f6f660000000000000000000000000000000000000060448201526064015b60405180910390fd5b600882146102e65760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964207075626c6963207369676e616c0000000000000000000000604482015260640161028d565b6102f08383610096565b156102fd57506000610944565b61091a565b600060405183815284602082015285604082015260408160608360076107d05a03fa915081610335576000805260206000f35b825160408201526020830151606082015260408360808360066107d05a03fa91505080610366576000805260206000f35b5050505050565b7f0b086b7191bb5031124719c586d207d098e3e1dd505e970a04ff0f4adc58cd3085527f1ffd4de8ff67c97f338f246f4ef6222e34d9c3bed445e87c283c5b3efa09851c60208601526000608086018661040a87357f020703357c835c23a95ef36c638417312bf1ed213675d662b1e728577b611e8c7f17f59a646bda81d9e11f10f8e4a0e50eeda09c36ed10b2b3f90aa6495dfb039084610302565b61045a60208801357f2bd5960b49b3d17f9064fe10c41c28ae6e65144703826d5271e181ba220a5e977f0b231f9b1b40cefe8b7451b9627e97fb5c50674f4eaf379d919c1ac1c34525f084610302565b6104aa60408801357f2ddccbd7c329983f8be58ea21e70562e6556d52760844796e980c3886f1205257f2e4ebfd1dfcb88f26867fe58e25ccf2271e5d7fdb5cc2529aa1d4e02907b77fb84610302565b6104fa60608801357f2ac109e192c3ccacca473c593e04fc9238d3a41241621176f12dcb9717091ce87f12d2bf85f238d1d5f654c3503cac758f17f86bfa370e9abfea578bebf09ec2ed84610302565b61054a60808801357f248ab941bb6a40448f45219b5273df8fdc4fc55e2ff5496e800346784d35c9d07f07e475dff50e6817913c962b918fadf24ae78a8c5c964970101eee7ce5d5b5fb84610302565b61059a60a08801357f05c0fd8e4ea4d1123e842619b3e2bff35b6679e7424edd20fd8cf1c72aac4b147f03791fb11d66fef6ae51ca3f6e3d229833b51655d2cbd526ece487479c3a465684610302565b6105ea60c08801357f19e717cf2719e11dfc9a1f1647333770a7671b8d80098a81cdf1209cb427f8987f2f1873b024919d8770e0ad0f527158e10dcbe5a166939cdfa8b06613bc84932c84610302565b61063a60e08801357f1530dc658d63bdb756acfec32cf2b8bd39886b860d8b34e70899a47df145d1017f18c3f3933a8dc3a1df284efc4031d82c01f0aff237f6b9f0c24eef8fb6248d3284610302565b50823581527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4760208401357f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4703066020820152833560408201526020840135606082015260408401356080820152606084013560a08201527f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e260c08201527f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192660e08201527f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c6101008201527f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab6101208201527f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a76101408201527f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec8610160820152600087015161018082015260206000018701516101a08201527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101c08201527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101e08201527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6102008201527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610220820152843561024082015260208501356102608201527f229277146342a5a27039f85236674a9e12408ad7249998200d0199cde45af07d6102808201527f24a22a706e79c91427d59385d8694fbcdff001aa95b7317d16935fac02c086e16102a08201527f274c5fb0357c7e2f572a6fdcae7c8e64286ab638652a508edc24021e47c65dbc6102c08201527f072d468326dfd63c0a999336359ba2892ad2637c27673d352a8edce26dbe97c96102e08201526020816103008360086107d05a03fa9051169695505050505050565b6040516103808101604052610938818560c0890160408a018a61036d565b90508060005260206000f35b949350505050565b6060600061095c6008600261131f565b610967906010611347565b63ffffffff1667ffffffffffffffff8111156109855761098561136b565b6040519080825280602002602001820160405280156109ae578160200160208202803683370190505b5090507f2d4d9aa7e302d9df41749d5507949d05dbea33fbb16c643b22f599a2be6df2e2816000815181106109e5576109e56112f3565b6020026020010181815250507f14bedd503c37ceb061d8ec60209fe345ce89830a19230301f076caff004d192681600181518110610a2557610a256112f3565b6020026020010181815250507f0967032fcbf776d1afc985f88877f182d38480a653f2decaa9794cbc3bf3060c81600281518110610a6557610a656112f3565b6020026020010181815250507f0e187847ad4c798374d0d6732bf501847dd68bc0e071241e0213bc7fc13db7ab81600381518110610aa557610aa56112f3565b6020026020010181815250507f304cfbd1e08a704a99f5e847d93f8c3caafddec46b7a0d379da69a4d112346a781600481518110610ae557610ae56112f3565b6020026020010181815250507f1739c1b1a457a8c7313123d24d2f9192f896b7c63eea05a9d57f06547ad0cec881600581518110610b2557610b256112f3565b6020026020010181815250507f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c281600681518110610b6557610b656112f3565b6020026020010181815250507f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed81600781518110610ba557610ba56112f3565b6020026020010181815250507f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b81600881518110610be557610be56112f3565b6020026020010181815250507f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa81600981518110610c2557610c256112f3565b6020026020010181815250507f229277146342a5a27039f85236674a9e12408ad7249998200d0199cde45af07d81600a81518110610c6557610c656112f3565b6020026020010181815250507f24a22a706e79c91427d59385d8694fbcdff001aa95b7317d16935fac02c086e181600b81518110610ca557610ca56112f3565b6020026020010181815250507f274c5fb0357c7e2f572a6fdcae7c8e64286ab638652a508edc24021e47c65dbc81600c81518110610ce557610ce56112f3565b6020026020010181815250507f072d468326dfd63c0a999336359ba2892ad2637c27673d352a8edce26dbe97c981600d81518110610d2557610d256112f3565b6020026020010181815250507f0b086b7191bb5031124719c586d207d098e3e1dd505e970a04ff0f4adc58cd3081600e81518110610d6557610d656112f3565b6020026020010181815250507f1ffd4de8ff67c97f338f246f4ef6222e34d9c3bed445e87c283c5b3efa09851c81600f81518110610da557610da56112f3565b6020026020010181815250507f17f59a646bda81d9e11f10f8e4a0e50eeda09c36ed10b2b3f90aa6495dfb039081601081518110610de557610de56112f3565b6020026020010181815250507f020703357c835c23a95ef36c638417312bf1ed213675d662b1e728577b611e8c81601181518110610e2557610e256112f3565b6020026020010181815250507f0b231f9b1b40cefe8b7451b9627e97fb5c50674f4eaf379d919c1ac1c34525f081601281518110610e6557610e656112f3565b6020026020010181815250507f2bd5960b49b3d17f9064fe10c41c28ae6e65144703826d5271e181ba220a5e9781601381518110610ea557610ea56112f3565b6020026020010181815250507f2e4ebfd1dfcb88f26867fe58e25ccf2271e5d7fdb5cc2529aa1d4e02907b77fb81601481518110610ee557610ee56112f3565b6020026020010181815250507f2ddccbd7c329983f8be58ea21e70562e6556d52760844796e980c3886f12052581601581518110610f2557610f256112f3565b6020026020010181815250507f12d2bf85f238d1d5f654c3503cac758f17f86bfa370e9abfea578bebf09ec2ed81601681518110610f6557610f656112f3565b6020026020010181815250507f2ac109e192c3ccacca473c593e04fc9238d3a41241621176f12dcb9717091ce881601781518110610fa557610fa56112f3565b6020026020010181815250507f07e475dff50e6817913c962b918fadf24ae78a8c5c964970101eee7ce5d5b5fb81601881518110610fe557610fe56112f3565b6020026020010181815250507f248ab941bb6a40448f45219b5273df8fdc4fc55e2ff5496e800346784d35c9d081601981518110611025576110256112f3565b6020026020010181815250507f03791fb11d66fef6ae51ca3f6e3d229833b51655d2cbd526ece487479c3a465681601a81518110611065576110656112f3565b6020026020010181815250507f05c0fd8e4ea4d1123e842619b3e2bff35b6679e7424edd20fd8cf1c72aac4b1481601b815181106110a5576110a56112f3565b6020026020010181815250507f2f1873b024919d8770e0ad0f527158e10dcbe5a166939cdfa8b06613bc84932c81601c815181106110e5576110e56112f3565b6020026020010181815250507f19e717cf2719e11dfc9a1f1647333770a7671b8d80098a81cdf1209cb427f89881601d81518110611125576111256112f3565b6020026020010181815250507f18c3f3933a8dc3a1df284efc4031d82c01f0aff237f6b9f0c24eef8fb6248d3281601e81518110611165576111656112f3565b6020026020010181815250507f1530dc658d63bdb756acfec32cf2b8bd39886b860d8b34e70899a47df145d10181601f815181106111a5576111a56112f3565b6020908102919091010152919050565b60008083601f8401126111c757600080fd5b50813567ffffffffffffffff8111156111df57600080fd5b6020830191508360208260051b85010111156111fa57600080fd5b9250929050565b6000806020838503121561121457600080fd5b823567ffffffffffffffff81111561122b57600080fd5b611237858286016111b5565b90969095509350505050565b6000806000806040858703121561125957600080fd5b843567ffffffffffffffff8082111561127157600080fd5b61127d888389016111b5565b9096509450602087013591508082111561129657600080fd5b506112a3878288016111b5565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156112e7578351835292840192918401916001016112cb565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821602808216919082811461133f5761133f611309565b505092915050565b63ffffffff81811683821601908082111561136457611364611309565b5092915050565b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000817000a", + "devdoc": { + "kind": "dev", + "methods": { + "getVerificationKeys()": { + "details": "returns the verification keys in the order that the verifier expects them: alpha, beta, gamma, delta, ICs.." + }, + "isAliased(uint256[])": { + "details": "return true if the public signal is aliased" + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/BabyzkDefaultPsGetter.json b/packages/evm-contracts/deployments/gravity/BabyzkDefaultPsGetter.json new file mode 100644 index 0000000..660084e --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/BabyzkDefaultPsGetter.json @@ -0,0 +1,76 @@ +{ + "address": "0x1418b5e79eE53396dE4a454d78DF2ab522CE24CC", + "abi": [ + { + "inputs": [ + { + "internalType": "uint8", + "name": "name", + "type": "uint8" + }, + { + "internalType": "uint256[]", + "name": "publicSignals", + "type": "uint256[]" + } + ], + "name": "getPublicSignal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x0415be77bc383f3ce308b6122dba5e9fa1ea9b1fb0399e51f12967dabd5d72ff", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0xb85b3D61439a3d70D3DF7913a3A764F352b32C55", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "118954", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb4ec3b616b5929eaeee6c394d21929ba11c8ee03f5cbc1a4264ea288b45d6dfe", + "transactionHash": "0x0415be77bc383f3ce308b6122dba5e9fa1ea9b1fb0399e51f12967dabd5d72ff", + "logs": [], + "blockNumber": 30, + "cumulativeGasUsed": "118954", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e08d6b930820ab219ef1afbfaba72b7a", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"name\",\"type\":\"uint8\"},{\"internalType\":\"uint256[]\",\"name\":\"publicSignals\",\"type\":\"uint256[]\"}],\"name\":\"getPublicSignal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getPublicSignal(uint8,uint256[])\":{\"details\":\"Implements the getPublicSignal function from the IPublicSignalGetter interface.\",\"params\":{\"name\":\"The signal name, represented as the given enum (converted to uint8).\",\"publicSignals\":\"The public signals, as an array of uints.\"},\"returns\":{\"_0\":\"The public signal associated with the given name.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/babyzk/DefaultPublicSignalGetter.sol\":\"BabyzkDefaultPsGetter\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"contracts/babyzk/DefaultPublicSignalGetter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\nimport { IPublicSignalGetter } from \\\"../interfaces/IPublicSignalGetter.sol\\\";\\n\\ncontract BabyzkDefaultPsGetter is IPublicSignalGetter {\\n /// @dev Implements the getPublicSignal function from the IPublicSignalGetter interface.\\n /// @param name The signal name, represented as the given enum (converted to uint8).\\n /// @param publicSignals The public signals, as an array of uints.\\n /// @return The public signal associated with the given name.\\n function getPublicSignal(uint8 name, uint256[] calldata publicSignals) external pure override returns (uint256) {\\n // Because in babyzk's circom circuit, the index of the public signals is the same as the enum value of the signal name,\\n // we can simply return the public signal at the index of the signal name.\\n // This is deliberately done to make the circuit easier to understand and to avoid the need for a more complex getter.\\n // However, in a more complex circuit, the order of public signals can be different from the enum values.\\n // In those cases, type designers can use a custom public signal getter to return the correct public signal.\\n return publicSignals[name];\\n }\\n}\\n\",\"keccak256\":\"0xb36ea59fdf51e2b816d82747b62e3cfb109310dddbf41f23d85496a03f79ce52\",\"license\":\"MIT\"},\"contracts/interfaces/IPublicSignalGetter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\n/// @title Intrinsic Signal enum\\nenum IntrinsicSignalName {\\n TYPE,\\n CONTEXT,\\n NULLIFIER,\\n EXTERNAL_NULLIFIER,\\n REVEAL_IDENTITY,\\n EXPIRATION_LB,\\n KEY_ID,\\n ID_EQUALS_TO,\\n SIG_REVOCATION_SMT_ROOT\\n}\\n\\n/// @title Public Signal Getter Interface\\n/// @dev Public signals (inputs) are represented as an array of uints in galxe identity protocol.\\n/// To find the public signal for a given signal name, type designer should set a contract\\n/// in the type registry that implements this interface.\\ninterface IPublicSignalGetter {\\n /// @dev get the public signal for the signal name, represented as the given enum (represented as uint8), based on the public signals.\\n /// @notice Implementation must be able to handle intrinsic signals, defiend in IntrinsicSignalName enum.\\n /// Type-specific signals support is optional.\\n /// @param name The signal name, represented as the given enum (converted to uint8).\\n /// @param publicSignals The public signals.\\n function getPublicSignal(uint8 name, uint256[] calldata publicSignals) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xdfdfd996ad88b94d59f07e0ef67a2e6091ccd03a25c395fe53fb1e83770d99b2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061012d806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063c4eee2ea14610030575b600080fd5b61004361003e36600461007c565b610055565b60405190815260200160405180910390f35b600082828560ff1681811061006c5761006c61010a565b9050602002013590509392505050565b60008060006040848603121561009157600080fd5b833560ff811681146100a257600080fd5b9250602084013567ffffffffffffffff808211156100bf57600080fd5b818601915086601f8301126100d357600080fd5b8135818111156100e257600080fd5b8760208260051b85010111156100f757600080fd5b6020830194508093505050509250925092565b634e487b7160e01b600052603260045260246000fdfea164736f6c6343000817000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063c4eee2ea14610030575b600080fd5b61004361003e36600461007c565b610055565b60405190815260200160405180910390f35b600082828560ff1681811061006c5761006c61010a565b9050602002013590509392505050565b60008060006040848603121561009157600080fd5b833560ff811681146100a257600080fd5b9250602084013567ffffffffffffffff808211156100bf57600080fd5b818601915086601f8301126100d357600080fd5b8135818111156100e257600080fd5b8760208260051b85010111156100f757600080fd5b6020830194508093505050509250925092565b634e487b7160e01b600052603260045260246000fdfea164736f6c6343000817000a", + "devdoc": { + "kind": "dev", + "methods": { + "getPublicSignal(uint8,uint256[])": { + "details": "Implements the getPublicSignal function from the IPublicSignalGetter interface.", + "params": { + "name": "The signal name, represented as the given enum (converted to uint8).", + "publicSignals": "The public signals, as an array of uints." + }, + "returns": { + "_0": "The public signal associated with the given name." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/BabyzkStatefulVerifier.json b/packages/evm-contracts/deployments/gravity/BabyzkStatefulVerifier.json new file mode 100644 index 0000000..7843738 --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/BabyzkStatefulVerifier.json @@ -0,0 +1,447 @@ +{ + "address": "0xF3D3404eb75D076Ab8A0F728C7FAA3c0A5e6549F", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ITypeRegistry", + "name": "typeRegistry", + "type": "address" + }, + { + "internalType": "contract IIssuerRegistry", + "name": "issuerRegistry", + "type": "address" + }, + { + "internalType": "address", + "name": "admin", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "InvalidArgument", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract IIssuerRegistry", + "name": "oldIssuerRegistry", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IIssuerRegistry", + "name": "newIssuerRegistry", + "type": "address" + } + ], + "name": "IssuerRegistryUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract ITypeRegistry", + "name": "oldTypeRegistry", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract ITypeRegistry", + "name": "newTypeRegistry", + "type": "address" + } + ], + "name": "TypeRegistryUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "STACK_ID", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getIssuerRegistry", + "outputs": [ + { + "internalType": "contract IIssuerRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTypeRegistry", + "outputs": [ + { + "internalType": "contract ITypeRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IIssuerRegistry", + "name": "issuerRegistry", + "type": "address" + } + ], + "name": "updateIssuerRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ITypeRegistry", + "name": "typeRegistry", + "type": "address" + } + ], + "name": "updateTypeRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint160", + "name": "contextId", + "type": "uint160" + }, + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "proofs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "publicSignals", + "type": "uint256[]" + } + ], + "name": "verifyProofFull", + "outputs": [ + { + "internalType": "enum VerifyResult", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint160", + "name": "contextId", + "type": "uint160" + }, + { + "internalType": "uint256", + "name": "keyId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "proofs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "publicSignals", + "type": "uint256[]" + } + ], + "name": "verifyProofStatic", + "outputs": [ + { + "internalType": "enum VerifyResult", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x94fc5a881c69d316599318288667ed4a65d518733a9ebb06055683c1b00a91f2", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0xb85b3D61439a3d70D3DF7913a3A764F352b32C55", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "1051707", + "logsBloom": "0x00000000000000000000000000000000000000400000000000800000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000001000000009000000000000000000020001000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000080000000000000000000000000000000", + "blockHash": "0x22d40abfc12c43bb1778afdb211aaef6ae05d4593c60f52774032275c1704075", + "transactionHash": "0x94fc5a881c69d316599318288667ed4a65d518733a9ebb06055683c1b00a91f2", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 31, + "transactionHash": "0x94fc5a881c69d316599318288667ed4a65d518733a9ebb06055683c1b00a91f2", + "address": "0xF3D3404eb75D076Ab8A0F728C7FAA3c0A5e6549F", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004e59b44847b379578588920ca78fbf26c0b4956c" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x22d40abfc12c43bb1778afdb211aaef6ae05d4593c60f52774032275c1704075" + }, + { + "transactionIndex": 1, + "blockNumber": 31, + "transactionHash": "0x94fc5a881c69d316599318288667ed4a65d518733a9ebb06055683c1b00a91f2", + "address": "0xF3D3404eb75D076Ab8A0F728C7FAA3c0A5e6549F", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000004e59b44847b379578588920ca78fbf26c0b4956c", + "0x000000000000000000000000a5e5ea38cf3bd36475596858ac7546d17752e4a7" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0x22d40abfc12c43bb1778afdb211aaef6ae05d4593c60f52774032275c1704075" + } + ], + "blockNumber": 31, + "cumulativeGasUsed": "1051707", + "status": 1, + "byzantium": true + }, + "args": [ + "0x77dA3Cf4418009D171B4963db815Ca46d6F2E79D", + "0xc4525dA874A6A3877db65e37f21eEc0b41ef9877", + "0xa5E5EA38cF3bD36475596858AC7546d17752E4A7" + ], + "numDeployments": 1, + "solcInputHash": "e08d6b930820ab219ef1afbfaba72b7a", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ITypeRegistry\",\"name\":\"typeRegistry\",\"type\":\"address\"},{\"internalType\":\"contract IIssuerRegistry\",\"name\":\"issuerRegistry\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"InvalidArgument\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IIssuerRegistry\",\"name\":\"oldIssuerRegistry\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract IIssuerRegistry\",\"name\":\"newIssuerRegistry\",\"type\":\"address\"}],\"name\":\"IssuerRegistryUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract ITypeRegistry\",\"name\":\"oldTypeRegistry\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"contract ITypeRegistry\",\"name\":\"newTypeRegistry\",\"type\":\"address\"}],\"name\":\"TypeRegistryUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"STACK_ID\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getIssuerRegistry\",\"outputs\":[{\"internalType\":\"contract IIssuerRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTypeRegistry\",\"outputs\":[{\"internalType\":\"contract ITypeRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IIssuerRegistry\",\"name\":\"issuerRegistry\",\"type\":\"address\"}],\"name\":\"updateIssuerRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ITypeRegistry\",\"name\":\"typeRegistry\",\"type\":\"address\"}],\"name\":\"updateTypeRegistry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint160\",\"name\":\"contextId\",\"type\":\"uint160\"},{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"proofs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"publicSignals\",\"type\":\"uint256[]\"}],\"name\":\"verifyProofFull\",\"outputs\":[{\"internalType\":\"enum VerifyResult\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint160\",\"name\":\"contextId\",\"type\":\"uint160\"},{\"internalType\":\"uint256\",\"name\":\"keyId\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"proofs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"publicSignals\",\"type\":\"uint256[]\"}],\"name\":\"verifyProofStatic\",\"outputs\":[{\"internalType\":\"enum VerifyResult\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"IssuerRegistryUpdated(address,address)\":{\"params\":{\"newIssuerRegistry\":\"The address of the new IssuerRegistry.\",\"oldIssuerRegistry\":\"The address of the old IssuerRegistry.\"}},\"TypeRegistryUpdated(address,address)\":{\"params\":{\"newTypeRegistry\":\"The address of the new TypeRegistry.\",\"oldTypeRegistry\":\"The address of the old TypeRegistry.\"}}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"BabyzkVerifier constructor\",\"params\":{\"issuerRegistry\":\"issuer registry contract\",\"typeRegistry\":\"type registry contract\"}},\"getIssuerRegistry()\":{\"details\":\"return the issuer registry\"},\"getTypeRegistry()\":{\"details\":\"return the type registry\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"updateIssuerRegistry(address)\":{\"details\":\"update the issuer registry\"},\"updateTypeRegistry(address)\":{\"details\":\"update the type registry\"},\"verifyProofFull(uint160,uint160,uint256,uint256[],uint256[])\":{\"details\":\"Stateful verification of zero-knowledge proofs that checks if the proof is valid and the issuer public key is active, and for revocation checks if the the smt root matches.The trust relationship between the credential and issuer is binded by the public key ID: credential <--- signed by ---- publikc key <--- authroized by ---- issuer As long as the issuer set the public key ID to be active, the credential is trusted by the issuer, However, note that it does not mean that the credential is directly generated by the issuer.\"},\"verifyProofStatic(uint160,uint160,uint256,uint256[],uint256[])\":{\"details\":\"static verification of zero-knowledge proofs that only checks if the proof is valid.Code duplication is deliberate for clear separation of concerns.\"}},\"stateVariables\":{\"_issuerRegistry\":{\"details\":\"issuer registry\"},\"_typeRegistry\":{\"details\":\"type registry\"}},\"title\":\"BabyzkVerifier\",\"version\":1},\"userdoc\":{\"events\":{\"IssuerRegistryUpdated(address,address)\":{\"notice\":\"Emitted when the IssuerRegistry is updated.\"},\"TypeRegistryUpdated(address,address)\":{\"notice\":\"Emitted when the TypeRegistry is updated.\"}},\"kind\":\"user\",\"methods\":{},\"notice\":\"@dev BabyzkVerifier is a contract that does on-chain stateful verification of zero-knowledge proofs.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/babyzk/StatefulProofVerifier.sol\":\"BabyzkStatefulVerifier\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"contracts/babyzk/StatefulProofVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nimport { IPublicSignalGetter, IntrinsicSignalName } from \\\"../interfaces/IPublicSignalGetter.sol\\\";\\nimport { IProofVerifier } from \\\"../interfaces/IProofVerifier.sol\\\";\\nimport { IIssuerRegistry } from \\\"../interfaces/IIssuerRegistry.sol\\\";\\nimport { ITypeRegistry } from \\\"../interfaces/ITypeRegistry.sol\\\";\\nimport { IStatefulVerifier, VerifyResult } from \\\"../interfaces/IStatefulVerifier.sol\\\";\\n\\n/// @title BabyzkVerifier\\n/// @notice\\n/// @dev BabyzkVerifier is a contract that does on-chain stateful verification of zero-knowledge proofs.\\ncontract BabyzkStatefulVerifier is IStatefulVerifier, Ownable {\\n error InvalidArgument(string message);\\n\\n // constants\\n uint8 public constant STACK_ID = 1;\\n\\n /// @dev type registry\\n ITypeRegistry private _typeRegistry;\\n\\n /// @dev issuer registry\\n IIssuerRegistry private _issuerRegistry;\\n\\n /// @dev BabyzkVerifier constructor\\n /// @param typeRegistry type registry contract\\n /// @param issuerRegistry issuer registry contract\\n constructor(ITypeRegistry typeRegistry, IIssuerRegistry issuerRegistry, address admin) {\\n _typeRegistry = typeRegistry;\\n _issuerRegistry = issuerRegistry;\\n transferOwnership(admin);\\n }\\n\\n /// @dev static verification of zero-knowledge proofs that only checks if the proof is valid.\\n /// @dev Code duplication is deliberate for clear separation of concerns.\\n function verifyProofStatic(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 keyId,\\n uint256[] calldata proofs,\\n uint256[] calldata publicSignals\\n ) external view override returns (VerifyResult) {\\n if (!_typeRegistry.isTypeFullyInitializedForStack(typeId, STACK_ID)) {\\n return VerifyResult.TYPE_UNINITIALIZED;\\n }\\n\\n // static validation\\n {\\n IPublicSignalGetter psGetter = _typeRegistry.getPublicSignalGetter(typeId, STACK_ID);\\n\\n // type matches\\n if (typeId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.TYPE), publicSignals)) {\\n return VerifyResult.TYPE_ID_MISMATCH;\\n }\\n\\n // context matches\\n if (contextId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.CONTEXT), publicSignals)) {\\n return VerifyResult.CONTEXT_ID_MISMATCH;\\n }\\n\\n // keyID matches\\n if (keyId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.KEY_ID), publicSignals)) {\\n return VerifyResult.PUBKEY_INACTIVE;\\n }\\n\\n // proof is valid only if its expiration lower bound is not exceeded.\\n {\\n uint256 expiration = psGetter.getPublicSignal(uint8(IntrinsicSignalName.EXPIRATION_LB), publicSignals);\\n if (expiration < block.timestamp) {\\n return VerifyResult.EXPIRED;\\n }\\n }\\n }\\n\\n IProofVerifier verifier = _typeRegistry.getVerifier(typeId, STACK_ID);\\n // zk-SNARK proof verification\\n if (!verifier.verifyProof(proofs, publicSignals)) {\\n return VerifyResult.PROOF_INVALID;\\n }\\n // signal alias check must be done within the verifier.verifyProof.\\n // // signal alias check\\n // if (verifier.isAliased(publicSignals)) {\\n // return VerifyResult.ALIASED_SIGNAL;\\n // }\\n return VerifyResult.OK;\\n }\\n\\n /// @dev Stateful verification of zero-knowledge proofs that checks\\n /// if the proof is valid and the issuer public key is active, and\\n /// for revocation checks if the the smt root matches.\\n /// @dev The trust relationship between the credential and issuer is binded by\\n /// the public key ID:\\n /// credential <--- signed by ---- publikc key <--- authroized by ---- issuer\\n /// As long as the issuer set the public key ID to be active, the credential is trusted by the issuer,\\n /// However, note that it does not mean that the credential is directly generated by the issuer.\\n function verifyProofFull(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId,\\n uint256[] calldata proofs,\\n uint256[] calldata publicSignals\\n ) external view override returns (VerifyResult) {\\n if (!_typeRegistry.isTypeFullyInitializedForStack(typeId, STACK_ID)) {\\n return VerifyResult.TYPE_UNINITIALIZED;\\n }\\n\\n // full input validation\\n {\\n IPublicSignalGetter psGetter = _typeRegistry.getPublicSignalGetter(typeId, STACK_ID);\\n\\n // type matches\\n if (typeId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.TYPE), publicSignals)) {\\n return VerifyResult.TYPE_ID_MISMATCH;\\n }\\n\\n // context matches\\n if (contextId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.CONTEXT), publicSignals)) {\\n return VerifyResult.CONTEXT_ID_MISMATCH;\\n }\\n\\n // proof is valid only if the issuer public key is still active.\\n {\\n uint256 keyId = psGetter.getPublicSignal(uint8(IntrinsicSignalName.KEY_ID), publicSignals);\\n if (!_issuerRegistry.isPublicKeyActiveForStack(issuerId, keyId, STACK_ID)) {\\n return VerifyResult.PUBKEY_INACTIVE;\\n }\\n }\\n\\n // proof is valid only if its expiration lower bound is not exceeded.\\n {\\n uint256 expiration = psGetter.getPublicSignal(uint8(IntrinsicSignalName.EXPIRATION_LB), publicSignals);\\n if (expiration < block.timestamp) {\\n return VerifyResult.EXPIRED;\\n }\\n }\\n\\n // proof is valid only if the smt root matches for revocable credentials.\\n if (_typeRegistry.isRevocable(typeId)) {\\n uint256 root = psGetter.getPublicSignal(\\n uint8(IntrinsicSignalName.SIG_REVOCATION_SMT_ROOT),\\n publicSignals\\n );\\n uint256 currentRoot = uint256(_issuerRegistry.getSignatureStateRoot(typeId, contextId, issuerId));\\n if (currentRoot != root) {\\n return VerifyResult.SIG_REVOCATION_SMT_ROOT_MISMATCH;\\n }\\n }\\n }\\n\\n IProofVerifier verifier = _typeRegistry.getVerifier(typeId, STACK_ID);\\n // zk-SNARK proof verification\\n if (!verifier.verifyProof(proofs, publicSignals)) {\\n return VerifyResult.PROOF_INVALID;\\n }\\n // signal alias check must be done within the verifier.verifyProof.\\n // // signal alias check\\n // if (verifier.isAliased(publicSignals)) {\\n // return VerifyResult.ALIASED_SIGNAL;\\n // }\\n return VerifyResult.OK;\\n }\\n\\n /// @dev return the type registry\\n function getTypeRegistry() external view override returns (ITypeRegistry) {\\n return _typeRegistry;\\n }\\n\\n /// @dev update the type registry\\n function updateTypeRegistry(ITypeRegistry typeRegistry) external onlyOwner {\\n if (typeRegistry == ITypeRegistry(address(0))) {\\n revert InvalidArgument(\\\"typeRegistry is zero address\\\");\\n }\\n emit TypeRegistryUpdated(_typeRegistry, typeRegistry);\\n _typeRegistry = typeRegistry;\\n }\\n\\n /// @dev return the issuer registry\\n function getIssuerRegistry() external view override returns (IIssuerRegistry) {\\n return _issuerRegistry;\\n }\\n\\n /// @dev update the issuer registry\\n function updateIssuerRegistry(IIssuerRegistry issuerRegistry) external onlyOwner {\\n if (issuerRegistry == IIssuerRegistry(address(0))) {\\n revert InvalidArgument(\\\"issuerRegistry is zero address\\\");\\n }\\n emit IssuerRegistryUpdated(_issuerRegistry, issuerRegistry);\\n _issuerRegistry = issuerRegistry;\\n }\\n}\\n\",\"keccak256\":\"0x4690ac2f663ecddbe8dacb6ffbff44eab303c1e184d527d682737166e915cb07\",\"license\":\"MIT\"},\"contracts/interfaces/IIssuerRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\n/// @dev The status of the public key, only active public key can be used for verification.\\nenum PublicKeyStatus {\\n UNINITIALIZED,\\n REVOKED,\\n ACTIVE\\n}\\n\\n/// @dev The public key struct\\nstruct PublicKey {\\n /// @dev the verification stack id that the public key is enabled for.\\n mapping(uint8 => bool) enabledVerificationStacks;\\n /// @dev the status of the public key\\n PublicKeyStatus status;\\n /// @dev the raw bytes of the public key. Not used in the contract, only for off-chain usage.\\n /// The spec for marshalling the public key is defined by the issuer.\\n bytes raw;\\n}\\n\\n/// @dev The revoked signature ID in a sparsed merkle tree.\\nstruct SignatureState {\\n /// @dev the root hash of the sparsed merkle tree.\\n bytes32 root;\\n /// @dev uri to the sparsed merkle tree, representing the revoked signature ids.\\n string treeURI;\\n}\\n\\n/// @dev The issuer struct\\nstruct Issuer {\\n /// @dev the name of the issuer\\n string name;\\n /// @dev the admin of the issuer, who can add or revoke public keys.\\n address admin;\\n}\\n\\n/// @title IIssuerRegistry\\n/// @dev The interface for the issuer registry contract.\\ninterface IIssuerRegistry {\\n /// @notice Emitted when a new issuer is registered in the registry.\\n /// @param issuerId Unique identifier for the newly registered issuer.\\n /// @param name Name of the issuer registered.\\n event IssuerRegistered(uint256 indexed issuerId, string name);\\n\\n /// @notice Emitted when an issuer's administrative role is transferred to a new address.\\n /// @param issuerId ID of issuer whose admin is being transferred.\\n /// @param oldAdmin Address of the current admin being replaced.\\n /// @param newAdmin Address of the new admin taking over.\\n event IssuerAdminTransferred(uint256 indexed issuerId, address indexed oldAdmin, address indexed newAdmin);\\n\\n /// @notice Emitted when the status of a public key is updated.\\n /// @param issuerId ID for the issuer to whom the public key belongs.\\n /// @param publicKeyId ID for the public key being updated.\\n /// @param status New status of the public key.\\n event PublicKeyStatusUpdated(uint256 indexed issuerId, uint256 indexed publicKeyId, PublicKeyStatus status);\\n\\n /// @notice Emitted when the verification stack for a public key is updated.\\n /// @param issuerId Unique identifier for the issuer to whom the public key belongs.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @param verificationStackId Identifier for the verification stack being updated.\\n /// @param enabled Boolean indicating whether the stack is enabled or disabled for the public key.\\n event PublicKeyVerificationStackUpdated(\\n uint256 indexed issuerId,\\n uint256 indexed publicKeyId,\\n uint256 indexed verificationStackId,\\n bool enabled\\n );\\n\\n /// @notice Emitted when the signature state URI is updated for a specific type and context.\\n /// @param typeId Type identifier for the signature state being updated.\\n /// @param contextID Context identifier for the signature state being updated.\\n /// @param issuerId Issuer identifier related to the signature state.\\n /// @param newTreeURI New URI for the signature state tree.\\n event SignatureStateURIUpdated(\\n uint160 indexed typeId,\\n uint160 indexed contextID,\\n uint256 indexed issuerId,\\n string newTreeURI\\n );\\n\\n /// @notice Emitted when the signature state root is updated for a specific type and context.\\n /// @param typeId Type identifier for the signature state being updated.\\n /// @param contextID Context identifier for the signature state being updated.\\n /// @param issuerId Issuer identifier related to the signature state.\\n /// @param newRoot New root hash for the signature state tree.\\n event SignatureStateRootUpdated(\\n uint160 indexed typeId,\\n uint160 indexed contextID,\\n uint256 indexed issuerId,\\n bytes32 newRoot\\n );\\n\\n /// @dev Registers a new issuer along with their first public key and enabled verification stack.\\n /// @param name Name of the issuer to register.\\n /// @param verificationStackId Identifier for the verification stack.\\n /// @param publicKeyId Identifier for the issuer's public key.\\n /// @param publicKeyRaw The raw public key data.\\n /// @return The unique identifier for the newly registered issuer.\\n function registerIssuer(\\n string calldata name,\\n uint8 verificationStackId,\\n uint256 publicKeyId,\\n bytes calldata publicKeyRaw\\n ) external returns (uint256);\\n\\n /// @dev Transfers the administrative role of an issuer to a new owner.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param newOwner Address of the new administrator.\\n function transferIssuerAdmin(uint256 issuerId, address newOwner) external;\\n\\n /// @dev Adds a new public key for an issuer and enables it for a specified verification stack.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param verificationStackId Identifier for the verification stack.\\n /// @param publicKeyId Unique identifier for the new public key.\\n /// @param publicKeyRaw The raw public key data.\\n function addPublicKey(\\n uint256 issuerId,\\n uint8 verificationStackId,\\n uint256 publicKeyId,\\n bytes calldata publicKeyRaw\\n ) external;\\n\\n /// @dev Updates the status (active/revoked) of an issuer's public key.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @param status New status for the public key.\\n // only the issuer admin can call this function\\n function updatePublicKeyStatus(uint256 issuerId, uint256 publicKeyId, PublicKeyStatus status) external;\\n\\n /// @dev Updates the verification stack association for an issuer's public key.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @param verificationStackId New verification stack identifier for the public key.\\n /// @param enabled Boolean indicating whether the stack is enabled for the public key.\\n function updatePublicKeyVerificationStack(\\n uint256 issuerId,\\n uint256 publicKeyId,\\n uint8 verificationStackId,\\n bool enabled\\n ) external;\\n\\n /// @dev Updates the signature state URI for a given type and context.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param treeURI New URI for the signature state.\\n function updateSignatureStateURI(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId,\\n string calldata treeURI\\n ) external;\\n\\n /// @dev Updates the signature SMT root for a given type, context and issuer.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param root New root hash for the revoked SMT.\\n function updateSignatureState(uint160 typeId, uint160 contextId, uint256 issuerId, bytes32 root) external;\\n\\n /// @dev Sets both the signature SMT URI and root for a given type, context and issuer.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param treeURI New URI for the signature state.\\n /// @param root New root hash for the signature state.\\n function setSignatureState(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId,\\n string calldata treeURI,\\n bytes32 root\\n ) external;\\n\\n /// @dev Retrieves the issuer data, reverts if the issuer does not exist.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @return Issuer data structure containing issuer details.\\n function getIssuer(uint256 issuerId) external view returns (Issuer memory);\\n\\n /// @dev Retrieves the raw public key data for an issuer's public key.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @return The raw public key data.\\n function getPublicKeyRaw(uint256 issuerId, uint256 publicKeyId) external view returns (bytes memory);\\n\\n /// @dev Checks if an issuer's public key is active.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @return True if the public key is active, false otherwise.\\n function isPublicKeyActive(uint256 issuerId, uint256 publicKeyId) external view returns (bool);\\n\\n /// @dev Checks if an issuer's public key is active and enabled for a specific verification stack.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @param verificationStackId Identifier for the verification stack.\\n /// @return True if the public key is active and enabled for the stack, false otherwise.\\n function isPublicKeyActiveForStack(\\n uint256 issuerId,\\n uint256 publicKeyId,\\n uint8 verificationStackId\\n ) external view returns (bool);\\n\\n /// @dev Retrieves the signature state for a given type, context and issuer.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @return The signature state.\\n function getSignatureState(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId\\n ) external view returns (SignatureState memory);\\n\\n /// @dev Retrieves the signature state URI for a given type, context and issuer.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @return The URI of the signature state.\\n function getSignatureStateURI(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId\\n ) external view returns (string memory);\\n\\n /// @dev Retrieves the signature state root for a given type, context and issuer.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @return The root hash of the signature state.\\n function getSignatureStateRoot(uint160 typeId, uint160 contextId, uint256 issuerId) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xec472bdee80280b790f226a9526cdea5a618e65881858317b40fba1a9893932b\",\"license\":\"MIT\"},\"contracts/interfaces/IProofVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\n/// @title IProofVerifier\\n/// @dev Interface for static verification of zero-knowledge proofs.\\ninterface IProofVerifier {\\n /// @notice Retrieves the verification keys.\\n /// @dev This function is used to get the verification keys that are necessary for verifying proofs.\\n /// @return An array of `uint` representing the verification keys.\\n function getVerificationKeys() external view returns (uint256[] memory);\\n\\n /// @dev Checks if the public signals are aliased. Aliased signals should never be used in proofs.\\n /// This is useful when using proof aggregators that does not check for signal aliasing.\\n /// @param _pubSignals An array of `uint` representing the public signals.\\n /// @return A boolean value indicating if any public signal is aliased (`true`) or not (`false`).\\n function isAliased(uint256[] calldata _pubSignals) external view returns (bool);\\n\\n /// @dev This function takes a cryptographic proof and public signals to verify the proof's validity.\\n /// @notice It verifies the proof and check if public signals were aliased.\\n /// @param _proofs An array of `uint` representing the proof.\\n /// @param _pubSignals An array of `uint` representing the public signals.\\n /// @return A boolean value indicating whether the proof is valid (`true`) or not (`false`).\\n function verifyProof(uint256[] calldata _proofs, uint256[] calldata _pubSignals) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xcf34af8efbb65237c2a47fd421e615cec850b19f9647fc2087c2a034d319b7be\",\"license\":\"MIT\"},\"contracts/interfaces/IPublicSignalGetter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\n/// @title Intrinsic Signal enum\\nenum IntrinsicSignalName {\\n TYPE,\\n CONTEXT,\\n NULLIFIER,\\n EXTERNAL_NULLIFIER,\\n REVEAL_IDENTITY,\\n EXPIRATION_LB,\\n KEY_ID,\\n ID_EQUALS_TO,\\n SIG_REVOCATION_SMT_ROOT\\n}\\n\\n/// @title Public Signal Getter Interface\\n/// @dev Public signals (inputs) are represented as an array of uints in galxe identity protocol.\\n/// To find the public signal for a given signal name, type designer should set a contract\\n/// in the type registry that implements this interface.\\ninterface IPublicSignalGetter {\\n /// @dev get the public signal for the signal name, represented as the given enum (represented as uint8), based on the public signals.\\n /// @notice Implementation must be able to handle intrinsic signals, defiend in IntrinsicSignalName enum.\\n /// Type-specific signals support is optional.\\n /// @param name The signal name, represented as the given enum (converted to uint8).\\n /// @param publicSignals The public signals.\\n function getPublicSignal(uint8 name, uint256[] calldata publicSignals) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xdfdfd996ad88b94d59f07e0ef67a2e6091ccd03a25c395fe53fb1e83770d99b2\",\"license\":\"MIT\"},\"contracts/interfaces/IStatefulVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\nimport { IIssuerRegistry } from \\\"./IIssuerRegistry.sol\\\";\\nimport { ITypeRegistry } from \\\"./ITypeRegistry.sol\\\";\\n\\n/// @title VerifyResult\\n/// @notice Enum representing the possible results of a proof verification.\\n/// Only the OK result indicates a successful verification.\\nenum VerifyResult {\\n OK,\\n TYPE_UNINITIALIZED,\\n TYPE_ID_MISMATCH,\\n CONTEXT_ID_MISMATCH,\\n PUBKEY_INACTIVE,\\n SIG_REVOCATION_SMT_ROOT_MISMATCH,\\n PROOF_INVALID,\\n EXPIRED,\\n UNKNOWN_ERROR\\n}\\n\\n/// @title IBabyzkStatefulVerifier\\n/// @notice Interface for the BabyzkStatefulVerifier contract which handles on-chain stateful verification of zero-knowledge proofs.\\ninterface IStatefulVerifier {\\n /// @notice Emitted when the TypeRegistry is updated.\\n /// @param oldTypeRegistry The address of the old TypeRegistry.\\n /// @param newTypeRegistry The address of the new TypeRegistry.\\n event TypeRegistryUpdated(ITypeRegistry oldTypeRegistry, ITypeRegistry newTypeRegistry);\\n\\n /// @notice Emitted when the IssuerRegistry is updated.\\n /// @param oldIssuerRegistry The address of the old IssuerRegistry.\\n /// @param newIssuerRegistry The address of the new IssuerRegistry.\\n event IssuerRegistryUpdated(IIssuerRegistry oldIssuerRegistry, IIssuerRegistry newIssuerRegistry);\\n\\n /// @notice Performs static verification of zero-knowledge proofs.\\n /// @param typeId The type ID of the proof to verify.\\n /// @param contextId The context ID of the proof to verify.\\n /// @param keyId The key ID associated with the proof.\\n /// @param proofs An array containing the proof data.\\n /// @param publicSignals An array containing the public signals data.\\n /// @return A value from the VerifyResult enum representing the verification result.\\n function verifyProofStatic(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 keyId,\\n uint256[] calldata proofs,\\n uint256[] calldata publicSignals\\n ) external view returns (VerifyResult);\\n\\n /// @notice Performs full verification of zero-knowledge proofs, including issuer public key activity and revocation checks.\\n /// @param typeId The type ID of the proof to verify.\\n /// @param contextId The context ID of the proof to verify.\\n /// @param issuerId The issuer ID associated with the proof.\\n /// @param proofs An array containing the proof data.\\n /// @param publicSignals An array containing the public signals data.\\n /// @return A value from the VerifyResult enum representing the verification result.\\n function verifyProofFull(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId,\\n uint256[] calldata proofs,\\n uint256[] calldata publicSignals\\n ) external view returns (VerifyResult);\\n\\n /// @notice Returns the current TypeRegistry address.\\n /// @return The address of the TypeRegistry.\\n function getTypeRegistry() external view returns (ITypeRegistry);\\n\\n /// @notice Returns the current IssuerRegistry address.\\n /// @return The address of the IssuerRegistry.\\n function getIssuerRegistry() external view returns (IIssuerRegistry);\\n}\\n\",\"keccak256\":\"0xa0965e0e3fde206cf5af36d7f79c457d3c287ed0a7c6b52c736a87ba0c3264c1\",\"license\":\"MIT\"},\"contracts/interfaces/ITypeRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\nimport { IProofVerifier } from \\\"./IProofVerifier.sol\\\";\\nimport { IPublicSignalGetter } from \\\"./IPublicSignalGetter.sol\\\";\\n\\n/// @title Credential Type\\n/// @dev Defines the structure of a credential type.\\nstruct CredentialType {\\n // @dev This flag indicates if the credential type support revocation.\\n bool revocable;\\n // @dev The address of the admin of the credential type, initially set to the creator.\\n address admin;\\n // @dev Provides a human-readable identifier for the credential.\\n string name;\\n // @dev The type specification of Galxe Identity Credential Type Schema.\\n string definition;\\n // @dev Additional context or information about the type.\\n string description;\\n // @dev A URI to an external JSON file of more information about the credential.\\n // See whitepaper for the JSON schema specification.\\n string resourceURI;\\n}\\n\\n/// @title Credential Type Config, miscellanous.\\n/// @notice To save stack space, we use this struct to store the verifier and public signal getter.\\nstruct CredentialTypeMiscConfig {\\n bool revocable;\\n uint8 verificationStackId;\\n IProofVerifier verifier;\\n IPublicSignalGetter publicSignalGetter;\\n}\\n\\n/// @title Interface for Type Registration Contract\\n/// @notice This interface defines the functions for registering and managing types by users.\\ninterface ITypeRegistry {\\n /// @dev Emitted when a new type is registered\\n /// @param typeID Unique identifier for the registered type\\n /// @param admin Address of the admin of the type.\\n /// @param name Name of the type\\n /// @param definition Immutable definition of the type\\n /// @param description Immutable description of the type\\n /// @param resourceURI Mutable resource URI for the type\\n event TypeRegistered(\\n uint160 indexed typeID,\\n address indexed admin,\\n string name,\\n string definition,\\n string description,\\n string resourceURI\\n );\\n\\n /// @dev Emitted when the resource URI of a type is updated\\n /// @param typeID Unique identifier for the type being updated\\n /// @param oldResourceURI The previous resource URI\\n /// @param newResourceURI The new resource URI\\n event TypeResourceURIUpdated(uint160 indexed typeID, string oldResourceURI, string newResourceURI);\\n\\n /// @dev Emitted when a proof verifier is updated for a type\\n /// @param typeID type id\\n /// @param verificationStackID verification stack id\\n /// @param verifier address of the verifier\\n event TypeVerifierUpdated(uint160 indexed typeID, uint8 indexed verificationStackID, address indexed verifier);\\n\\n /// @dev Emitted when the intrinsic signal indexes are updated for a type\\n /// @param typeID type id\\n /// @param verificationStackID verification stack id\\n /// @param publicSignalGetter address of the public signal getter\\n event TypePublicSignalGetterUpdated(\\n uint160 indexed typeID,\\n uint8 indexed verificationStackID,\\n address indexed publicSignalGetter\\n );\\n\\n /// @dev Emitted when the admin of a type is transferred\\n /// @param typeID type id\\n /// @param oldAdmin address of the old admin\\n /// @param newAdmin address of the new admin\\n event TypeAdminTransferred(uint160 indexed typeID, address indexed oldAdmin, address indexed newAdmin);\\n\\n /// @dev transfer the ownership of a type.\\n /// @param typeId type id of the type\\n /// @param newAdmin address of the new admin\\n function transferTypeAdmin(uint160 typeId, address newAdmin) external;\\n\\n /// @notice set a primitive type, only callable by the admin.\\n /// @param typeId the type id of the primitive type\\n /// @param name name of the type\\n /// @param definition definition string\\n /// @param description Description of the type\\n /// @param resourceURI Mutable resource URI of the type\\n /// @param config revocable, verifier and public signal getter.\\n function setPrimitiveType(\\n uint160 typeId,\\n string calldata name,\\n string calldata definition,\\n string calldata description,\\n string calldata resourceURI,\\n CredentialTypeMiscConfig calldata config\\n ) external;\\n\\n /// @notice Register a new type by `msg.sender`\\n /// @param name Type name\\n /// @param definition Immutable type definition string\\n /// @param description Description of the type\\n /// @param resourceURI Mutable resource URI of the type\\n /// @return typeID Unique identifier of the registered type\\n function registerType(\\n bool revocable,\\n string calldata name,\\n string calldata definition,\\n string calldata description,\\n string calldata resourceURI\\n ) external returns (uint160);\\n\\n /// @notice Register a new type by `msg.sender` with verifier and public signal getter set for a specific verification stack.\\n /// @param name Type name\\n /// @param definition Immutable type definition string\\n /// @param description Description of the type\\n /// @param resourceURI Mutable resource URI of the type\\n /// @param verifier verifier for the type\\n /// @param publicSignalGetter public signal getter for the type\\n /// @return typeID Unique identifier of the registered type\\n function registerType1Step(\\n bool revocable,\\n string calldata name,\\n string calldata definition,\\n string calldata description,\\n string calldata resourceURI,\\n uint8 verificationStackId,\\n IProofVerifier verifier,\\n IPublicSignalGetter publicSignalGetter\\n ) external returns (uint160);\\n\\n /// @notice Update the resource URI of a type\\n /// @dev Can only be called by the type owner (`msg.sender`)\\n /// @param _id ID of the type to update\\n /// @param _resourceURI New resource URI for the type\\n function updateTypeResourceURI(uint160 _id, string calldata _resourceURI) external;\\n\\n /// @dev update the verifier for a type\\n function updateTypeVerifier(uint160 typeId, uint8 verificationStackId, IProofVerifier verifier) external;\\n\\n /// @dev update the verifier for a type\\n function updateTypePublicSignalGetter(\\n uint160 typeId,\\n uint8 verificationStackId,\\n IPublicSignalGetter getter\\n ) external;\\n\\n /// @param typeId type id of the type\\n /// @param verificationStackId verification stack id\\n function getVerifier(uint160 typeId, uint8 verificationStackId) external view returns (IProofVerifier);\\n\\n /// @param typeId type id of the type\\n /// @param verificationStackId verification stack id\\n function getPublicSignalGetter(\\n uint160 typeId,\\n uint8 verificationStackId\\n ) external view returns (IPublicSignalGetter);\\n\\n /// @dev check if the type is fully initialized for the given verification stack.\\n /// @param typeId id of the type\\n /// @param verificationStackId id the verification stack\\n function isTypeFullyInitializedForStack(uint160 typeId, uint8 verificationStackId) external view returns (bool);\\n\\n /// @dev Retrieve details of a type for the given typeID\\n /// @param _id ID of the type to retrieve\\n /// @return A `CredentialType` struct containing details of the type\\n function getType(uint160 _id) external view returns (CredentialType memory);\\n\\n /// @dev Retrieve the admin of a type\\n /// @param typeId type id of the type\\n /// @return address of the admin of the type\\n function getTypeAdmin(uint160 typeId) external view returns (address);\\n\\n /// @dev check if the type is revocable\\n function isRevocable(uint160 typeId) external view returns (bool);\\n\\n /// @notice Calculate the typeID of a type, typeID is keccak256(creator, name) in uint160.\\n /// @param creator Address of the type creator\\n /// @param name Name of the type\\n /// @return The calculated typeID based on the creator address and type name\\n function calcTypeID(address creator, string calldata name) external pure returns (uint160);\\n}\\n\",\"keccak256\":\"0x86d4db6288f762aecd0725e2d4c560b56e5792c0062d48f406e04807488d1878\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620012c2380380620012c28339810160408190526200003491620001ca565b6200003f3362000083565b600180546001600160a01b038086166001600160a01b03199283161790925560028054928516929091169190911790556200007a81620000d3565b5050506200021e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620000dd62000156565b6001600160a01b038116620001485760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b620001538162000083565b50565b6000546001600160a01b03163314620001b25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016200013f565b565b6001600160a01b03811681146200015357600080fd5b600080600060608486031215620001e057600080fd5b8351620001ed81620001b4565b60208501519093506200020081620001b4565b60408501519092506200021381620001b4565b809150509250925092565b611094806200022e6000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638cf8d66511610076578063aff16ba11161005b578063aff16ba114610163578063b29b86af14610176578063f2fde38b1461019057600080fd5b80638cf8d665146101415780638da5cb5b1461015257600080fd5b80634b718b8c116100a75780634b718b8c1461010157806354207d4c14610114578063715018a61461013957600080fd5b8063070ecf4d146100c35780631a7d10f1146100ec575b600080fd5b6100d66100d1366004610eac565b6101a3565b6040516100e39190610f4b565b60405180910390f35b6100ff6100fa366004610f73565b6107dc565b005b6100ff61010f366004610f73565b6108b6565b6001546001600160a01b03165b6040516001600160a01b0390911681526020016100e3565b6100ff61098b565b6002546001600160a01b0316610121565b6000546001600160a01b0316610121565b6100d6610171366004610eac565b61099f565b61017e600181565b60405160ff90911681526020016100e3565b6100ff61019e366004610f73565b610d04565b600180546040516373190ca560e01b81526001600160a01b038a811660048301526024820193909352600092909116906373190ca590604401602060405180830381865afa1580156101f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021d9190610f97565b610229575060016107d1565b60018054604051637b4ed18560e01b81526001600160a01b038b81166004830152602482019390935260009290911690637b4ed18590604401602060405180830381865afa15801561027f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a39190610fb9565b604051636277717560e11b81529091506001600160a01b0382169063c4eee2ea906102d79060009088908890600401611021565b602060405180830381865afa1580156102f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103189190611047565b896001600160a01b0316146103315760029150506107d1565b604051636277717560e11b81526001600160a01b0382169063c4eee2ea906103629060019088908890600401611021565b602060405180830381865afa15801561037f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a39190611047565b886001600160a01b0316146103bc5760039150506107d1565b604051636277717560e11b81526000906001600160a01b0383169063c4eee2ea906103f09060069089908990600401611021565b602060405180830381865afa15801561040d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104319190611047565b600254604051631f89dc0b60e11b8152600481018b905260248101839052600160448201529192506001600160a01b031690633f13b81690606401602060405180830381865afa158015610489573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ad9190610f97565b6104bc576004925050506107d1565b50604051636277717560e11b81526000906001600160a01b0383169063c4eee2ea906104f19060059089908990600401611021565b602060405180830381865afa15801561050e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105329190611047565b905042811015610547576007925050506107d1565b506001546040516392b0a57f60e01b81526001600160a01b038b81166004830152909116906392b0a57f90602401602060405180830381865afa158015610592573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b69190610f97565b156106cb57604051636277717560e11b81526000906001600160a01b0383169063c4eee2ea906105ef9060089089908990600401611021565b602060405180830381865afa15801561060c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106309190611047565b600254604051632deed10d60e21b81526001600160a01b038d811660048301528c81166024830152604482018c90529293506000929091169063b7bb443490606401602060405180830381865afa15801561068f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b39190611047565b90508181146106c857600593505050506107d1565b50505b5060018054604051631ef84f8560e31b81526001600160a01b038b8116600483015260248201939093526000929091169063f7c27c28906044015b602060405180830381865afa158015610723573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107479190610fb9565b604051631c87a92b60e21b81529091506001600160a01b0382169063721ea4ac9061077c908990899089908990600401611060565b602060405180830381865afa158015610799573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bd9190610f97565b6107cb5760069150506107d1565b60009150505b979650505050505050565b6107e4610d94565b6001600160a01b03811661084057604051631fff1b3b60e21b815260206004820152601e60248201527f6973737565725265676973747279206973207a65726f2061646472657373000060448201526064015b60405180910390fd5b600254604080516001600160a01b03928316815291831660208301527fe7afd721c46f8367e6fde893fc343404fb8c91b32fe8fc440035458e37ae4444910160405180910390a16002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6108be610d94565b6001600160a01b03811661091557604051631fff1b3b60e21b815260206004820152601c60248201527f747970655265676973747279206973207a65726f2061646472657373000000006044820152606401610837565b600154604080516001600160a01b03928316815291831660208301527f7eebb102f6399a39c5c44574c655f01fbeef3fcfc24732acbb2df1d608dee744910160405180910390a16001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610993610d94565b61099d6000610dee565b565b600180546040516373190ca560e01b81526001600160a01b038a811660048301526024820193909352600092909116906373190ca590604401602060405180830381865afa1580156109f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a199190610f97565b610a25575060016107d1565b60018054604051637b4ed18560e01b81526001600160a01b038b81166004830152602482019390935260009290911690637b4ed18590604401602060405180830381865afa158015610a7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9f9190610fb9565b604051636277717560e11b81529091506001600160a01b0382169063c4eee2ea90610ad39060009088908890600401611021565b602060405180830381865afa158015610af0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b149190611047565b896001600160a01b031614610b2d5760029150506107d1565b604051636277717560e11b81526001600160a01b0382169063c4eee2ea90610b5e9060019088908890600401611021565b602060405180830381865afa158015610b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9f9190611047565b886001600160a01b031614610bb85760039150506107d1565b604051636277717560e11b81526001600160a01b0382169063c4eee2ea90610be99060069088908890600401611021565b602060405180830381865afa158015610c06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2a9190611047565b8714610c3a5760049150506107d1565b604051636277717560e11b81526000906001600160a01b0383169063c4eee2ea90610c6e9060059089908990600401611021565b602060405180830381865afa158015610c8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610caf9190611047565b905042811015610cc4576007925050506107d1565b505060018054604051631ef84f8560e31b81526001600160a01b038b8116600483015260248201939093526000929091169063f7c27c2890604401610706565b610d0c610d94565b6001600160a01b038116610d885760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610837565b610d9181610dee565b50565b6000546001600160a01b0316331461099d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610837565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114610d9157600080fd5b60008083601f840112610e7257600080fd5b50813567ffffffffffffffff811115610e8a57600080fd5b6020830191508360208260051b8501011115610ea557600080fd5b9250929050565b600080600080600080600060a0888a031215610ec757600080fd5b8735610ed281610e4b565b96506020880135610ee281610e4b565b955060408801359450606088013567ffffffffffffffff80821115610f0657600080fd5b610f128b838c01610e60565b909650945060808a0135915080821115610f2b57600080fd5b50610f388a828b01610e60565b989b979a50959850939692959293505050565b6020810160098310610f6d57634e487b7160e01b600052602160045260246000fd5b91905290565b600060208284031215610f8557600080fd5b8135610f9081610e4b565b9392505050565b600060208284031215610fa957600080fd5b81518015158114610f9057600080fd5b600060208284031215610fcb57600080fd5b8151610f9081610e4b565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561100857600080fd5b8260051b80836020870137939093016020019392505050565b60ff8416815260406020820152600061103e604083018486610fd6565b95945050505050565b60006020828403121561105957600080fd5b5051919050565b604081526000611074604083018688610fd6565b82810360208401526107d1818587610fd656fea164736f6c6343000817000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c80638cf8d66511610076578063aff16ba11161005b578063aff16ba114610163578063b29b86af14610176578063f2fde38b1461019057600080fd5b80638cf8d665146101415780638da5cb5b1461015257600080fd5b80634b718b8c116100a75780634b718b8c1461010157806354207d4c14610114578063715018a61461013957600080fd5b8063070ecf4d146100c35780631a7d10f1146100ec575b600080fd5b6100d66100d1366004610eac565b6101a3565b6040516100e39190610f4b565b60405180910390f35b6100ff6100fa366004610f73565b6107dc565b005b6100ff61010f366004610f73565b6108b6565b6001546001600160a01b03165b6040516001600160a01b0390911681526020016100e3565b6100ff61098b565b6002546001600160a01b0316610121565b6000546001600160a01b0316610121565b6100d6610171366004610eac565b61099f565b61017e600181565b60405160ff90911681526020016100e3565b6100ff61019e366004610f73565b610d04565b600180546040516373190ca560e01b81526001600160a01b038a811660048301526024820193909352600092909116906373190ca590604401602060405180830381865afa1580156101f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021d9190610f97565b610229575060016107d1565b60018054604051637b4ed18560e01b81526001600160a01b038b81166004830152602482019390935260009290911690637b4ed18590604401602060405180830381865afa15801561027f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a39190610fb9565b604051636277717560e11b81529091506001600160a01b0382169063c4eee2ea906102d79060009088908890600401611021565b602060405180830381865afa1580156102f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103189190611047565b896001600160a01b0316146103315760029150506107d1565b604051636277717560e11b81526001600160a01b0382169063c4eee2ea906103629060019088908890600401611021565b602060405180830381865afa15801561037f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a39190611047565b886001600160a01b0316146103bc5760039150506107d1565b604051636277717560e11b81526000906001600160a01b0383169063c4eee2ea906103f09060069089908990600401611021565b602060405180830381865afa15801561040d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104319190611047565b600254604051631f89dc0b60e11b8152600481018b905260248101839052600160448201529192506001600160a01b031690633f13b81690606401602060405180830381865afa158015610489573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ad9190610f97565b6104bc576004925050506107d1565b50604051636277717560e11b81526000906001600160a01b0383169063c4eee2ea906104f19060059089908990600401611021565b602060405180830381865afa15801561050e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105329190611047565b905042811015610547576007925050506107d1565b506001546040516392b0a57f60e01b81526001600160a01b038b81166004830152909116906392b0a57f90602401602060405180830381865afa158015610592573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b69190610f97565b156106cb57604051636277717560e11b81526000906001600160a01b0383169063c4eee2ea906105ef9060089089908990600401611021565b602060405180830381865afa15801561060c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106309190611047565b600254604051632deed10d60e21b81526001600160a01b038d811660048301528c81166024830152604482018c90529293506000929091169063b7bb443490606401602060405180830381865afa15801561068f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b39190611047565b90508181146106c857600593505050506107d1565b50505b5060018054604051631ef84f8560e31b81526001600160a01b038b8116600483015260248201939093526000929091169063f7c27c28906044015b602060405180830381865afa158015610723573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107479190610fb9565b604051631c87a92b60e21b81529091506001600160a01b0382169063721ea4ac9061077c908990899089908990600401611060565b602060405180830381865afa158015610799573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bd9190610f97565b6107cb5760069150506107d1565b60009150505b979650505050505050565b6107e4610d94565b6001600160a01b03811661084057604051631fff1b3b60e21b815260206004820152601e60248201527f6973737565725265676973747279206973207a65726f2061646472657373000060448201526064015b60405180910390fd5b600254604080516001600160a01b03928316815291831660208301527fe7afd721c46f8367e6fde893fc343404fb8c91b32fe8fc440035458e37ae4444910160405180910390a16002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6108be610d94565b6001600160a01b03811661091557604051631fff1b3b60e21b815260206004820152601c60248201527f747970655265676973747279206973207a65726f2061646472657373000000006044820152606401610837565b600154604080516001600160a01b03928316815291831660208301527f7eebb102f6399a39c5c44574c655f01fbeef3fcfc24732acbb2df1d608dee744910160405180910390a16001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610993610d94565b61099d6000610dee565b565b600180546040516373190ca560e01b81526001600160a01b038a811660048301526024820193909352600092909116906373190ca590604401602060405180830381865afa1580156109f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a199190610f97565b610a25575060016107d1565b60018054604051637b4ed18560e01b81526001600160a01b038b81166004830152602482019390935260009290911690637b4ed18590604401602060405180830381865afa158015610a7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9f9190610fb9565b604051636277717560e11b81529091506001600160a01b0382169063c4eee2ea90610ad39060009088908890600401611021565b602060405180830381865afa158015610af0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b149190611047565b896001600160a01b031614610b2d5760029150506107d1565b604051636277717560e11b81526001600160a01b0382169063c4eee2ea90610b5e9060019088908890600401611021565b602060405180830381865afa158015610b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9f9190611047565b886001600160a01b031614610bb85760039150506107d1565b604051636277717560e11b81526001600160a01b0382169063c4eee2ea90610be99060069088908890600401611021565b602060405180830381865afa158015610c06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2a9190611047565b8714610c3a5760049150506107d1565b604051636277717560e11b81526000906001600160a01b0383169063c4eee2ea90610c6e9060059089908990600401611021565b602060405180830381865afa158015610c8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610caf9190611047565b905042811015610cc4576007925050506107d1565b505060018054604051631ef84f8560e31b81526001600160a01b038b8116600483015260248201939093526000929091169063f7c27c2890604401610706565b610d0c610d94565b6001600160a01b038116610d885760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610837565b610d9181610dee565b50565b6000546001600160a01b0316331461099d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610837565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114610d9157600080fd5b60008083601f840112610e7257600080fd5b50813567ffffffffffffffff811115610e8a57600080fd5b6020830191508360208260051b8501011115610ea557600080fd5b9250929050565b600080600080600080600060a0888a031215610ec757600080fd5b8735610ed281610e4b565b96506020880135610ee281610e4b565b955060408801359450606088013567ffffffffffffffff80821115610f0657600080fd5b610f128b838c01610e60565b909650945060808a0135915080821115610f2b57600080fd5b50610f388a828b01610e60565b989b979a50959850939692959293505050565b6020810160098310610f6d57634e487b7160e01b600052602160045260246000fd5b91905290565b600060208284031215610f8557600080fd5b8135610f9081610e4b565b9392505050565b600060208284031215610fa957600080fd5b81518015158114610f9057600080fd5b600060208284031215610fcb57600080fd5b8151610f9081610e4b565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561100857600080fd5b8260051b80836020870137939093016020019392505050565b60ff8416815260406020820152600061103e604083018486610fd6565b95945050505050565b60006020828403121561105957600080fd5b5051919050565b604081526000611074604083018688610fd6565b82810360208401526107d1818587610fd656fea164736f6c6343000817000a", + "devdoc": { + "events": { + "IssuerRegistryUpdated(address,address)": { + "params": { + "newIssuerRegistry": "The address of the new IssuerRegistry.", + "oldIssuerRegistry": "The address of the old IssuerRegistry." + } + }, + "TypeRegistryUpdated(address,address)": { + "params": { + "newTypeRegistry": "The address of the new TypeRegistry.", + "oldTypeRegistry": "The address of the old TypeRegistry." + } + } + }, + "kind": "dev", + "methods": { + "constructor": { + "details": "BabyzkVerifier constructor", + "params": { + "issuerRegistry": "issuer registry contract", + "typeRegistry": "type registry contract" + } + }, + "getIssuerRegistry()": { + "details": "return the issuer registry" + }, + "getTypeRegistry()": { + "details": "return the type registry" + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "updateIssuerRegistry(address)": { + "details": "update the issuer registry" + }, + "updateTypeRegistry(address)": { + "details": "update the type registry" + }, + "verifyProofFull(uint160,uint160,uint256,uint256[],uint256[])": { + "details": "Stateful verification of zero-knowledge proofs that checks if the proof is valid and the issuer public key is active, and for revocation checks if the the smt root matches.The trust relationship between the credential and issuer is binded by the public key ID: credential <--- signed by ---- publikc key <--- authroized by ---- issuer As long as the issuer set the public key ID to be active, the credential is trusted by the issuer, However, note that it does not mean that the credential is directly generated by the issuer." + }, + "verifyProofStatic(uint160,uint160,uint256,uint256[],uint256[])": { + "details": "static verification of zero-knowledge proofs that only checks if the proof is valid.Code duplication is deliberate for clear separation of concerns." + } + }, + "stateVariables": { + "_issuerRegistry": { + "details": "issuer registry" + }, + "_typeRegistry": { + "details": "type registry" + } + }, + "title": "BabyzkVerifier", + "version": 1 + }, + "userdoc": { + "events": { + "IssuerRegistryUpdated(address,address)": { + "notice": "Emitted when the IssuerRegistry is updated." + }, + "TypeRegistryUpdated(address,address)": { + "notice": "Emitted when the TypeRegistry is updated." + } + }, + "kind": "user", + "methods": {}, + "notice": "@dev BabyzkVerifier is a contract that does on-chain stateful verification of zero-knowledge proofs.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7, + "contract": "contracts/babyzk/StatefulProofVerifier.sol:BabyzkStatefulVerifier", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 2629, + "contract": "contracts/babyzk/StatefulProofVerifier.sol:BabyzkStatefulVerifier", + "label": "_typeRegistry", + "offset": 0, + "slot": "1", + "type": "t_contract(ITypeRegistry)5343" + }, + { + "astId": 2633, + "contract": "contracts/babyzk/StatefulProofVerifier.sol:BabyzkStatefulVerifier", + "label": "_issuerRegistry", + "offset": 0, + "slot": "2", + "type": "t_contract(IIssuerRegistry)4949" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_contract(IIssuerRegistry)4949": { + "encoding": "inplace", + "label": "contract IIssuerRegistry", + "numberOfBytes": "20" + }, + "t_contract(ITypeRegistry)5343": { + "encoding": "inplace", + "label": "contract ITypeRegistry", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/ContextRegistry.json b/packages/evm-contracts/deployments/gravity/ContextRegistry.json new file mode 100644 index 0000000..18ec5b0 --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/ContextRegistry.json @@ -0,0 +1,160 @@ +{ + "address": "0x42D6444840842F0484C1624899c9a3E835738592", + "abi": [ + { + "inputs": [], + "name": "AlreadyExists", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint160", + "name": "contextId", + "type": "uint160" + }, + { + "indexed": false, + "internalType": "string", + "name": "context", + "type": "string" + } + ], + "name": "ContextRegistered", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "context", + "type": "string" + } + ], + "name": "calculateContextID", + "outputs": [ + { + "internalType": "uint160", + "name": "", + "type": "uint160" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "contextId", + "type": "uint160" + } + ], + "name": "getContext", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "context", + "type": "string" + } + ], + "name": "registerContext", + "outputs": [ + { + "internalType": "uint160", + "name": "", + "type": "uint160" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x535e5c594ad9608e18c0338f2f04b28bdad7919d97cc4da054e3095a06a3da89", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0xb85b3D61439a3d70D3DF7913a3A764F352b32C55", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "328564", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x93e3bcb9bab59e04f4bfec87dadf8deb6e69e42ce785a4c0b99a402b40259be3", + "transactionHash": "0x535e5c594ad9608e18c0338f2f04b28bdad7919d97cc4da054e3095a06a3da89", + "logs": [], + "blockNumber": 28, + "cumulativeGasUsed": "328564", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e08d6b930820ab219ef1afbfaba72b7a", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AlreadyExists\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint160\",\"name\":\"contextId\",\"type\":\"uint160\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"context\",\"type\":\"string\"}],\"name\":\"ContextRegistered\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"context\",\"type\":\"string\"}],\"name\":\"calculateContextID\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"\",\"type\":\"uint160\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"contextId\",\"type\":\"uint160\"}],\"name\":\"getContext\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"context\",\"type\":\"string\"}],\"name\":\"registerContext\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"\",\"type\":\"uint160\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"calculateContextID(string)\":{\"details\":\"calculate the contextID for a given context string\"},\"getContext(uint160)\":{\"details\":\"get the context for the given contextID\"},\"registerContext(string)\":{\"details\":\"register a new context\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"ContextRegistry is a contract that allows the registration of contexts. Contexts are strings that represent a specific context for credentials. They are ownerless and can be registered and used by anyone.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ContextRegistry.sol\":\"ContextRegistry\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"contracts/ContextRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\nimport { IContextRegistry } from \\\"./interfaces/IContextRegistry.sol\\\";\\n\\n/// @notice ContextRegistry is a contract that allows the registration of contexts.\\n/// Contexts are strings that represent a specific context for credentials. They\\n/// are ownerless and can be registered and used by anyone.\\ncontract ContextRegistry is IContextRegistry {\\n error AlreadyExists();\\n\\n // The global mapping between contexts and their contextID.\\n mapping(uint160 contextId => string context) private _registry;\\n\\n /// @dev register a new context\\n function registerContext(string calldata context) external override returns (uint160) {\\n uint160 contextID = _getContextID(context);\\n if (bytes(_registry[contextID]).length != 0) {\\n revert AlreadyExists();\\n }\\n _registry[contextID] = context;\\n emit ContextRegistered(contextID, context);\\n return contextID;\\n }\\n\\n /// @dev get the context for the given contextID\\n function getContext(uint160 contextId) external view override returns (string memory) {\\n return _registry[contextId];\\n }\\n\\n /// @dev calculate the contextID for a given context string\\n function calculateContextID(string calldata context) external pure override returns (uint160) {\\n return _getContextID(context);\\n }\\n\\n /**\\n * ContextID is the lower 160 bits of the keccak256 hash of the context string.\\n * @param context The context string to get the contextID for.\\n */\\n function _getContextID(string calldata context) private pure returns (uint160) {\\n return uint160(uint256(keccak256(abi.encodePacked(context))));\\n }\\n}\\n\",\"keccak256\":\"0xbb5c1e9a65be057609359d10b24753c455488d0585522185b8baf0593256be82\",\"license\":\"MIT\"},\"contracts/interfaces/IContextRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\n/// @title Context Registry Interface\\ninterface IContextRegistry {\\n // Events\\n event ContextRegistered(uint160 indexed contextId, string context);\\n\\n /// @dev registerContext registers a new context and returns the contextId\\n function registerContext(string calldata context) external returns (uint160);\\n\\n /// @dev getContext returns the context for the given contextId\\n function getContext(uint160 contextId) external returns (string memory);\\n\\n /// @dev calculate the contextID for a given context string\\n function calculateContextID(string calldata context) external pure returns (uint160);\\n}\\n\",\"keccak256\":\"0x1adddabc089a8ba41ee9be17dd65cd05274c4bc82a9a7c6263890e553c88af3f\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506104f6806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80633af6bf3814610046578063424f5bf514610076578063f94ea22214610096575b600080fd5b61005961005436600461025e565b6100a9565b6040516001600160a01b0390911681526020015b60405180910390f35b6100896100843660046102d0565b61016b565b60405161006d91906102f9565b6100596100a436600461025e565b610217565b6000806100b6848461022a565b6001600160a01b03811660009081526020819052604090208054919250906100dd90610348565b1590506100fd5760405163119b4fd360e11b815260040160405180910390fd5b6001600160a01b03811660009081526020819052604090206101208486836103e9565b50806001600160a01b03167fca702642220323c022e777423c5022781e7d240bbaf55c6b5c2a9d3203415dea858560405161015c9291906104aa565b60405180910390a29392505050565b6001600160a01b038116600090815260208190526040902080546060919061019290610348565b80601f01602080910402602001604051908101604052809291908181526020018280546101be90610348565b801561020b5780601f106101e05761010080835404028352916020019161020b565b820191906000526020600020905b8154815290600101906020018083116101ee57829003601f168201915b50505050509050919050565b6000610223838361022a565b9392505050565b6000828260405160200161023f9291906104d9565b60408051601f1981840301815291905280516020909101209392505050565b6000806020838503121561027157600080fd5b823567ffffffffffffffff8082111561028957600080fd5b818501915085601f83011261029d57600080fd5b8135818111156102ac57600080fd5b8660208285010111156102be57600080fd5b60209290920196919550909350505050565b6000602082840312156102e257600080fd5b81356001600160a01b038116811461022357600080fd5b60006020808352835180602085015260005b818110156103275785810183015185820160400152820161030b565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061035c57607f821691505b60208210810361037c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b601f8211156103e4576000816000526020600020601f850160051c810160208610156103c15750805b601f850160051c820191505b818110156103e0578281556001016103cd565b5050505b505050565b67ffffffffffffffff83111561040157610401610382565b6104158361040f8354610348565b83610398565b6000601f84116001811461044957600085156104315750838201355b600019600387901b1c1916600186901b1783556104a3565b600083815260209020601f19861690835b8281101561047a578685013582556020948501946001909201910161045a565b50868210156104975760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b818382376000910190815291905056fea164736f6c6343000817000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80633af6bf3814610046578063424f5bf514610076578063f94ea22214610096575b600080fd5b61005961005436600461025e565b6100a9565b6040516001600160a01b0390911681526020015b60405180910390f35b6100896100843660046102d0565b61016b565b60405161006d91906102f9565b6100596100a436600461025e565b610217565b6000806100b6848461022a565b6001600160a01b03811660009081526020819052604090208054919250906100dd90610348565b1590506100fd5760405163119b4fd360e11b815260040160405180910390fd5b6001600160a01b03811660009081526020819052604090206101208486836103e9565b50806001600160a01b03167fca702642220323c022e777423c5022781e7d240bbaf55c6b5c2a9d3203415dea858560405161015c9291906104aa565b60405180910390a29392505050565b6001600160a01b038116600090815260208190526040902080546060919061019290610348565b80601f01602080910402602001604051908101604052809291908181526020018280546101be90610348565b801561020b5780601f106101e05761010080835404028352916020019161020b565b820191906000526020600020905b8154815290600101906020018083116101ee57829003601f168201915b50505050509050919050565b6000610223838361022a565b9392505050565b6000828260405160200161023f9291906104d9565b60408051601f1981840301815291905280516020909101209392505050565b6000806020838503121561027157600080fd5b823567ffffffffffffffff8082111561028957600080fd5b818501915085601f83011261029d57600080fd5b8135818111156102ac57600080fd5b8660208285010111156102be57600080fd5b60209290920196919550909350505050565b6000602082840312156102e257600080fd5b81356001600160a01b038116811461022357600080fd5b60006020808352835180602085015260005b818110156103275785810183015185820160400152820161030b565b506000604082860101526040601f19601f8301168501019250505092915050565b600181811c9082168061035c57607f821691505b60208210810361037c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b601f8211156103e4576000816000526020600020601f850160051c810160208610156103c15750805b601f850160051c820191505b818110156103e0578281556001016103cd565b5050505b505050565b67ffffffffffffffff83111561040157610401610382565b6104158361040f8354610348565b83610398565b6000601f84116001811461044957600085156104315750838201355b600019600387901b1c1916600186901b1783556104a3565b600083815260209020601f19861690835b8281101561047a578685013582556020948501946001909201910161045a565b50868210156104975760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b818382376000910190815291905056fea164736f6c6343000817000a", + "devdoc": { + "kind": "dev", + "methods": { + "calculateContextID(string)": { + "details": "calculate the contextID for a given context string" + }, + "getContext(uint160)": { + "details": "get the context for the given contextID" + }, + "registerContext(string)": { + "details": "register a new context" + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "ContextRegistry is a contract that allows the registration of contexts. Contexts are strings that represent a specific context for credentials. They are ownerless and can be registered and used by anyone.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 155, + "contract": "contracts/ContextRegistry.sol:ContextRegistry", + "label": "_registry", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_uint160,t_string_storage)" + } + ], + "types": { + "t_mapping(t_uint160,t_string_storage)": { + "encoding": "mapping", + "key": "t_uint160", + "label": "mapping(uint160 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint160": { + "encoding": "inplace", + "label": "uint160", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/IssuerRegistry.json b/packages/evm-contracts/deployments/gravity/IssuerRegistry.json new file mode 100644 index 0000000..7b36438 --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/IssuerRegistry.json @@ -0,0 +1,966 @@ +{ + "address": "0xc4525dA874A6A3877db65e37f21eEc0b41ef9877", + "abi": [ + { + "inputs": [], + "name": "InvalidName", + "type": "error" + }, + { + "inputs": [], + "name": "IssuerAlreadyExists", + "type": "error" + }, + { + "inputs": [], + "name": "IssuerNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "NotIssuerOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotOwner", + "type": "error" + }, + { + "inputs": [], + "name": "PublicKeyAlreadyExists", + "type": "error" + }, + { + "inputs": [], + "name": "PublicKeyNotExists", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "IssuerAdminTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "IssuerRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "publicKeyId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "enum PublicKeyStatus", + "name": "status", + "type": "uint8" + } + ], + "name": "PublicKeyStatusUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "publicKeyId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "verificationStackId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "PublicKeyVerificationStackUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "indexed": true, + "internalType": "uint160", + "name": "contextID", + "type": "uint160" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "newRoot", + "type": "bytes32" + } + ], + "name": "SignatureStateRootUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "indexed": true, + "internalType": "uint160", + "name": "contextID", + "type": "uint160" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "newTreeURI", + "type": "string" + } + ], + "name": "SignatureStateURIUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "verificationStackId", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "publicKeyId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "publicKeyRaw", + "type": "bytes" + } + ], + "name": "addPublicKey", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + } + ], + "name": "getIssuer", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "admin", + "type": "address" + } + ], + "internalType": "struct Issuer", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "publicKeyId", + "type": "uint256" + } + ], + "name": "getPublicKeyRaw", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint160", + "name": "contextId", + "type": "uint160" + }, + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + } + ], + "name": "getSignatureState", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "treeURI", + "type": "string" + } + ], + "internalType": "struct SignatureState", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint160", + "name": "contextId", + "type": "uint160" + }, + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + } + ], + "name": "getSignatureStateRoot", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint160", + "name": "contextId", + "type": "uint160" + }, + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + } + ], + "name": "getSignatureStateURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "publicKeyId", + "type": "uint256" + } + ], + "name": "isPublicKeyActive", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "publicKeyId", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "verificationStackId", + "type": "uint8" + } + ], + "name": "isPublicKeyActiveForStack", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "uint8", + "name": "verificationStackId", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "publicKeyId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "publicKeyRaw", + "type": "bytes" + } + ], + "name": "registerIssuer", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint160", + "name": "contextId", + "type": "uint160" + }, + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "treeURI", + "type": "string" + }, + { + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "setSignatureState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferIssuerAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "publicKeyId", + "type": "uint256" + }, + { + "internalType": "enum PublicKeyStatus", + "name": "status", + "type": "uint8" + } + ], + "name": "updatePublicKeyStatus", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "publicKeyId", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "verificationStackId", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "enabled", + "type": "bool" + } + ], + "name": "updatePublicKeyVerificationStack", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint160", + "name": "contextId", + "type": "uint160" + }, + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "updateSignatureState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint160", + "name": "contextId", + "type": "uint160" + }, + { + "internalType": "uint256", + "name": "issuerId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "treeURI", + "type": "string" + } + ], + "name": "updateSignatureStateURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x310f5740eae819670101af12c5022e24cd3df1217266c4cb724132dc8da12df4", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0xb85b3D61439a3d70D3DF7913a3A764F352b32C55", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "1255248", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc080e0e801800e4e23e7670ffb31b5d3009c5cf5df7b4dba7c45946cc21695df", + "transactionHash": "0x310f5740eae819670101af12c5022e24cd3df1217266c4cb724132dc8da12df4", + "logs": [], + "blockNumber": 29, + "cumulativeGasUsed": "1255248", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "e08d6b930820ab219ef1afbfaba72b7a", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidName\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IssuerAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IssuerNotExists\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"NotIssuerOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PublicKeyAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PublicKeyNotExists\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldAdmin\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"IssuerAdminTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"IssuerRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"publicKeyId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum PublicKeyStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"PublicKeyStatusUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"publicKeyId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"verificationStackId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"PublicKeyVerificationStackUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"indexed\":true,\"internalType\":\"uint160\",\"name\":\"contextID\",\"type\":\"uint160\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"newRoot\",\"type\":\"bytes32\"}],\"name\":\"SignatureStateRootUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"indexed\":true,\"internalType\":\"uint160\",\"name\":\"contextID\",\"type\":\"uint160\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"newTreeURI\",\"type\":\"string\"}],\"name\":\"SignatureStateURIUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"verificationStackId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"publicKeyId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"publicKeyRaw\",\"type\":\"bytes\"}],\"name\":\"addPublicKey\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"}],\"name\":\"getIssuer\",\"outputs\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"internalType\":\"struct Issuer\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"publicKeyId\",\"type\":\"uint256\"}],\"name\":\"getPublicKeyRaw\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint160\",\"name\":\"contextId\",\"type\":\"uint160\"},{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"}],\"name\":\"getSignatureState\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"root\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"treeURI\",\"type\":\"string\"}],\"internalType\":\"struct SignatureState\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint160\",\"name\":\"contextId\",\"type\":\"uint160\"},{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"}],\"name\":\"getSignatureStateRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint160\",\"name\":\"contextId\",\"type\":\"uint160\"},{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"}],\"name\":\"getSignatureStateURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"publicKeyId\",\"type\":\"uint256\"}],\"name\":\"isPublicKeyActive\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"publicKeyId\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"verificationStackId\",\"type\":\"uint8\"}],\"name\":\"isPublicKeyActiveForStack\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"verificationStackId\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"publicKeyId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"publicKeyRaw\",\"type\":\"bytes\"}],\"name\":\"registerIssuer\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint160\",\"name\":\"contextId\",\"type\":\"uint160\"},{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"treeURI\",\"type\":\"string\"},{\"internalType\":\"bytes32\",\"name\":\"root\",\"type\":\"bytes32\"}],\"name\":\"setSignatureState\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferIssuerAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"publicKeyId\",\"type\":\"uint256\"},{\"internalType\":\"enum PublicKeyStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"updatePublicKeyStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"publicKeyId\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"verificationStackId\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"updatePublicKeyVerificationStack\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint160\",\"name\":\"contextId\",\"type\":\"uint160\"},{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"root\",\"type\":\"bytes32\"}],\"name\":\"updateSignatureState\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint160\",\"name\":\"contextId\",\"type\":\"uint160\"},{\"internalType\":\"uint256\",\"name\":\"issuerId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"treeURI\",\"type\":\"string\"}],\"name\":\"updateSignatureStateURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"IssuerAdminTransferred(uint256,address,address)\":{\"params\":{\"issuerId\":\"ID of issuer whose admin is being transferred.\",\"newAdmin\":\"Address of the new admin taking over.\",\"oldAdmin\":\"Address of the current admin being replaced.\"}},\"IssuerRegistered(uint256,string)\":{\"params\":{\"issuerId\":\"Unique identifier for the newly registered issuer.\",\"name\":\"Name of the issuer registered.\"}},\"PublicKeyStatusUpdated(uint256,uint256,uint8)\":{\"params\":{\"issuerId\":\"ID for the issuer to whom the public key belongs.\",\"publicKeyId\":\"ID for the public key being updated.\",\"status\":\"New status of the public key.\"}},\"PublicKeyVerificationStackUpdated(uint256,uint256,uint256,bool)\":{\"params\":{\"enabled\":\"Boolean indicating whether the stack is enabled or disabled for the public key.\",\"issuerId\":\"Unique identifier for the issuer to whom the public key belongs.\",\"publicKeyId\":\"Unique identifier for the public key.\",\"verificationStackId\":\"Identifier for the verification stack being updated.\"}},\"SignatureStateRootUpdated(uint160,uint160,uint256,bytes32)\":{\"params\":{\"contextID\":\"Context identifier for the signature state being updated.\",\"issuerId\":\"Issuer identifier related to the signature state.\",\"newRoot\":\"New root hash for the signature state tree.\",\"typeId\":\"Type identifier for the signature state being updated.\"}},\"SignatureStateURIUpdated(uint160,uint160,uint256,string)\":{\"params\":{\"contextID\":\"Context identifier for the signature state being updated.\",\"issuerId\":\"Issuer identifier related to the signature state.\",\"newTreeURI\":\"New URI for the signature state tree.\",\"typeId\":\"Type identifier for the signature state being updated.\"}}},\"kind\":\"dev\",\"methods\":{\"addPublicKey(uint256,uint8,uint256,bytes)\":{\"details\":\"add a new public key to the issuer.\"},\"getIssuer(uint256)\":{\"details\":\"return the issuer, if not exists, revert.\"},\"getPublicKeyRaw(uint256,uint256)\":{\"details\":\"return the public key, if not exists, revert.\"},\"getSignatureState(uint160,uint160,uint256)\":{\"details\":\"return the status of the public key, if not exists, returns UNINITIALIZED.\"},\"getSignatureStateRoot(uint160,uint160,uint256)\":{\"details\":\"return the root of the signature state, if not exists, returns empty bytes.\"},\"getSignatureStateURI(uint160,uint160,uint256)\":{\"details\":\"return the status of the public key, if not exists, returns empty string.\"},\"isPublicKeyActive(uint256,uint256)\":{\"details\":\"return if public key is active. If public key is not exists, return false.\"},\"isPublicKeyActiveForStack(uint256,uint256,uint8)\":{\"details\":\"return if public key is active for the verification stack. If public key is not exists, return false.\"},\"registerIssuer(string,uint8,uint256,bytes)\":{\"details\":\"register a new issuer\"},\"setSignatureState(uint160,uint160,uint256,string,bytes32)\":{\"details\":\"set both the signature state URI and root.\"},\"transferIssuerAdmin(uint256,address)\":{\"details\":\"transfer the admin of the issuer\"},\"updatePublicKeyStatus(uint256,uint256,uint8)\":{\"details\":\"update the status of the public key.\"},\"updatePublicKeyVerificationStack(uint256,uint256,uint8,bool)\":{\"details\":\"update the status of the public key.\"},\"updateSignatureState(uint160,uint160,uint256,bytes32)\":{\"details\":\"set the signature state root\"},\"updateSignatureStateURI(uint160,uint160,uint256,string)\":{\"details\":\"set the signature state URI\"}},\"stateVariables\":{\"_issuers\":{\"details\":\"all issuers, isser id = uint256(caller)\"}},\"version\":1},\"userdoc\":{\"events\":{\"IssuerAdminTransferred(uint256,address,address)\":{\"notice\":\"Emitted when an issuer's administrative role is transferred to a new address.\"},\"IssuerRegistered(uint256,string)\":{\"notice\":\"Emitted when a new issuer is registered in the registry.\"},\"PublicKeyStatusUpdated(uint256,uint256,uint8)\":{\"notice\":\"Emitted when the status of a public key is updated.\"},\"PublicKeyVerificationStackUpdated(uint256,uint256,uint256,bool)\":{\"notice\":\"Emitted when the verification stack for a public key is updated.\"},\"SignatureStateRootUpdated(uint160,uint160,uint256,bytes32)\":{\"notice\":\"Emitted when the signature state root is updated for a specific type and context.\"},\"SignatureStateURIUpdated(uint160,uint160,uint256,string)\":{\"notice\":\"Emitted when the signature state URI is updated for a specific type and context.\"}},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/IssuerRegistry.sol\":\"IssuerRegistry\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"contracts/IssuerRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\nimport { IIssuerRegistry, Issuer, PublicKey, PublicKeyStatus, SignatureState } from \\\"./interfaces/IIssuerRegistry.sol\\\";\\n\\n// IssuerRegistry is a contract that manages the issuers and their public keys and signature state.\\ncontract IssuerRegistry is IIssuerRegistry {\\n error IssuerAlreadyExists();\\n error IssuerNotExists();\\n error PublicKeyNotExists();\\n error PublicKeyAlreadyExists();\\n error NotIssuerOwner(address owner);\\n error NotOwner();\\n error InvalidName();\\n\\n /// @dev all issuers, isser id = uint256(caller)\\n // mapping issuer id to issuer.\\n mapping(uint256 isserId => Issuer issuer) private _issuers;\\n\\n // (issuerId, publickeyId) => PublicKey\\n mapping(uint256 issuerId => mapping(uint256 publicKeyId => PublicKey publicKey)) private _issuerPublicKeys;\\n\\n // mapping of hash(credentialType, contextId, issuerId) => SignatureState.\\n mapping(uint256 credHashValue => SignatureState sigStatus) private _revocableSigStates;\\n\\n /// @dev only issuer owner can call this function\\n modifier onlyIssuerAdmin(uint256 issuerId) {\\n _onlyIssuerAdmin(issuerId);\\n _;\\n }\\n\\n /// @dev only issuer owner can call this function\\n function _onlyIssuerAdmin(uint256 issuerId) private view {\\n if (!_issuerExists(issuerId)) {\\n revert IssuerNotExists();\\n }\\n if (msg.sender != _issuers[issuerId].admin) {\\n revert NotIssuerOwner(_issuers[issuerId].admin);\\n }\\n }\\n\\n /// @dev register a new issuer\\n // @notice the issuerId is the address of the caller, so 1 address can only have 1 issuer.\\n function registerIssuer(\\n string calldata name,\\n uint8 verificationStackId,\\n uint256 publicKeyId,\\n bytes calldata publicKeyRaw\\n ) external override returns (uint256) {\\n uint256 issuerId = uint256(uint160(msg.sender));\\n // register new issuer\\n _registerNewIssuer(issuerId, name);\\n // add public key\\n _setPublicKey(issuerId, verificationStackId, publicKeyId, publicKeyRaw);\\n // transfer ownership\\n return issuerId;\\n }\\n\\n /// @dev transfer the admin of the issuer\\n function transferIssuerAdmin(uint256 issuerId, address newOwner) external override onlyIssuerAdmin(issuerId) {\\n _issuers[issuerId].admin = newOwner;\\n emit IssuerAdminTransferred(issuerId, msg.sender, newOwner);\\n }\\n\\n /// @dev add a new public key to the issuer.\\n // @param issuerId the id of the issuer\\n // @param verificationStackId the id of the verification stack\\n // @param publicKeyId the id of the public key\\n // @param publicKeyRaw the raw public key\\n // @notice only the issuer admin can call this function\\n // @notice the public key can only be added once, if incorrect, use a new key.\\n function addPublicKey(\\n uint256 issuerId,\\n uint8 verificationStackId,\\n uint256 publicKeyId,\\n bytes calldata publicKeyRaw\\n ) external override onlyIssuerAdmin(issuerId) {\\n if (_publicKeyExists(issuerId, publicKeyId)) {\\n revert PublicKeyAlreadyExists();\\n }\\n _setPublicKey(issuerId, verificationStackId, publicKeyId, publicKeyRaw);\\n }\\n\\n /// @dev update the status of the public key.\\n function updatePublicKeyStatus(\\n uint256 issuerId,\\n uint256 publicKeyId,\\n PublicKeyStatus status\\n ) external override onlyIssuerAdmin(issuerId) {\\n if (!_publicKeyExists(issuerId, publicKeyId)) {\\n revert PublicKeyNotExists();\\n }\\n\\n _issuerPublicKeys[issuerId][publicKeyId].status = status;\\n emit PublicKeyStatusUpdated(issuerId, publicKeyId, status);\\n }\\n\\n /// @dev update the status of the public key.\\n function updatePublicKeyVerificationStack(\\n uint256 issuerId,\\n uint256 publicKeyId,\\n uint8 verificationStackId,\\n bool enabled\\n ) external override onlyIssuerAdmin(issuerId) {\\n if (!_publicKeyExists(issuerId, publicKeyId)) {\\n revert PublicKeyNotExists();\\n }\\n\\n _issuerPublicKeys[issuerId][publicKeyId].enabledVerificationStacks[verificationStackId] = enabled;\\n emit PublicKeyVerificationStackUpdated(issuerId, publicKeyId, verificationStackId, enabled);\\n }\\n\\n /// @dev set the signature state URI\\n function updateSignatureStateURI(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId,\\n string calldata treeURI\\n ) external override onlyIssuerAdmin(issuerId) {\\n uint256 key = _calculateCredentialHash(typeId, contextId, issuerId);\\n _revocableSigStates[key].treeURI = treeURI;\\n emit SignatureStateURIUpdated(typeId, contextId, issuerId, treeURI);\\n }\\n\\n /// @dev set the signature state root\\n function updateSignatureState(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId,\\n bytes32 root\\n ) external override onlyIssuerAdmin(issuerId) {\\n uint256 key = _calculateCredentialHash(typeId, contextId, issuerId);\\n _revocableSigStates[key].root = root;\\n emit SignatureStateRootUpdated(typeId, contextId, issuerId, root);\\n }\\n\\n /// @dev set both the signature state URI and root.\\n function setSignatureState(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId,\\n string calldata treeURI,\\n bytes32 root\\n ) external override onlyIssuerAdmin(issuerId) {\\n uint256 key = _calculateCredentialHash(typeId, contextId, issuerId);\\n _revocableSigStates[key] = SignatureState({ treeURI: treeURI, root: root });\\n emit SignatureStateURIUpdated(typeId, contextId, issuerId, treeURI);\\n emit SignatureStateRootUpdated(typeId, contextId, issuerId, root);\\n }\\n\\n /// @dev calculate the hash of the credential, which is the key of the revocableSigStates.\\n function _calculateCredentialHash(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId\\n ) private pure returns (uint256) {\\n return uint256(keccak256(abi.encodePacked(typeId, contextId, issuerId)));\\n }\\n\\n /// @dev register a new issuer\\n // @param issuerId the id of the issuer\\n // @param name the name of the issuer\\n function _registerNewIssuer(uint256 issuerId, string calldata name) private {\\n if (bytes(name).length == 0) {\\n revert InvalidName();\\n }\\n if (_issuerExists(issuerId)) {\\n revert IssuerAlreadyExists();\\n }\\n\\n _issuers[issuerId] = Issuer({ name: name, admin: msg.sender });\\n emit IssuerRegistered(issuerId, name);\\n emit IssuerAdminTransferred(issuerId, address(0), msg.sender);\\n }\\n\\n /// @dev add a new public key to the issuer\\n // @param issuerId the id of the issuer\\n // @param verificationStackId the id of the verification stack\\n // @param publicKeyId the id of the public key\\n // @param publicKeyRaw the raw public key\\n function _setPublicKey(\\n uint256 issuerId,\\n uint8 verificationStackId,\\n uint256 publicKeyId,\\n bytes calldata publicKeyRaw\\n ) private {\\n mapping(uint256 => PublicKey) storage keys = _issuerPublicKeys[issuerId];\\n keys[publicKeyId].enabledVerificationStacks[verificationStackId] = true;\\n keys[publicKeyId].status = PublicKeyStatus.ACTIVE;\\n keys[publicKeyId].raw = publicKeyRaw;\\n\\n emit PublicKeyStatusUpdated(issuerId, publicKeyId, PublicKeyStatus.ACTIVE);\\n emit PublicKeyVerificationStackUpdated(issuerId, publicKeyId, verificationStackId, true);\\n }\\n\\n /// @dev return the issuer, if not exists, revert.\\n function getIssuer(uint256 issuerId) external view override returns (Issuer memory) {\\n if (!_issuerExists(issuerId)) {\\n revert IssuerNotExists();\\n }\\n return _issuers[issuerId];\\n }\\n\\n /// @dev return the public key, if not exists, revert.\\n function getPublicKeyRaw(uint256 issuerId, uint256 publicKeyId) external view override returns (bytes memory) {\\n if (!_publicKeyExists(issuerId, publicKeyId)) {\\n revert PublicKeyNotExists();\\n }\\n return _issuerPublicKeys[issuerId][publicKeyId].raw;\\n }\\n\\n /// @dev return if public key is active. If public key is not exists, return false.\\n function isPublicKeyActive(uint256 issuerId, uint256 publicKeyId) external view override returns (bool) {\\n if (!_publicKeyExists(issuerId, publicKeyId)) {\\n return false;\\n }\\n return _issuerPublicKeys[issuerId][publicKeyId].status == PublicKeyStatus.ACTIVE;\\n }\\n\\n /// @dev return if public key is active for the verification stack. If public key is not exists, return false.\\n function isPublicKeyActiveForStack(\\n uint256 issuerId,\\n uint256 publicKeyId,\\n uint8 verificationStackId\\n ) external view override returns (bool) {\\n if (!_publicKeyExists(issuerId, publicKeyId)) {\\n return false;\\n }\\n return\\n _issuerPublicKeys[issuerId][publicKeyId].enabledVerificationStacks[verificationStackId] &&\\n _issuerPublicKeys[issuerId][publicKeyId].status == PublicKeyStatus.ACTIVE;\\n }\\n\\n /// @dev return the status of the public key, if not exists, returns UNINITIALIZED.\\n function getSignatureState(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId\\n ) external view override returns (SignatureState memory) {\\n return _revocableSigStates[_calculateCredentialHash(typeId, contextId, issuerId)];\\n }\\n\\n /// @dev return the status of the public key, if not exists, returns empty string.\\n function getSignatureStateURI(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId\\n ) external view override returns (string memory) {\\n return _revocableSigStates[_calculateCredentialHash(typeId, contextId, issuerId)].treeURI;\\n }\\n\\n /// @dev return the root of the signature state, if not exists, returns empty bytes.\\n function getSignatureStateRoot(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId\\n ) external view override returns (bytes32) {\\n return _revocableSigStates[_calculateCredentialHash(typeId, contextId, issuerId)].root;\\n }\\n\\n /// @dev internal function to check if the public key exists.\\n function _publicKeyExists(uint256 issuerId, uint256 publicKeyId) internal view returns (bool) {\\n return _issuerPublicKeys[issuerId][publicKeyId].status != PublicKeyStatus.UNINITIALIZED;\\n }\\n\\n /// @dev internal function to check if the issuer exists.\\n function _issuerExists(uint256 issuerId) internal view returns (bool) {\\n return bytes(_issuers[issuerId].name).length != 0;\\n }\\n}\\n\",\"keccak256\":\"0x95c04fe80eb693dbb6682a7a0dafe8e2a7e3b1f20126841e7869d58c7be7e92a\",\"license\":\"MIT\"},\"contracts/interfaces/IIssuerRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\n/// @dev The status of the public key, only active public key can be used for verification.\\nenum PublicKeyStatus {\\n UNINITIALIZED,\\n REVOKED,\\n ACTIVE\\n}\\n\\n/// @dev The public key struct\\nstruct PublicKey {\\n /// @dev the verification stack id that the public key is enabled for.\\n mapping(uint8 => bool) enabledVerificationStacks;\\n /// @dev the status of the public key\\n PublicKeyStatus status;\\n /// @dev the raw bytes of the public key. Not used in the contract, only for off-chain usage.\\n /// The spec for marshalling the public key is defined by the issuer.\\n bytes raw;\\n}\\n\\n/// @dev The revoked signature ID in a sparsed merkle tree.\\nstruct SignatureState {\\n /// @dev the root hash of the sparsed merkle tree.\\n bytes32 root;\\n /// @dev uri to the sparsed merkle tree, representing the revoked signature ids.\\n string treeURI;\\n}\\n\\n/// @dev The issuer struct\\nstruct Issuer {\\n /// @dev the name of the issuer\\n string name;\\n /// @dev the admin of the issuer, who can add or revoke public keys.\\n address admin;\\n}\\n\\n/// @title IIssuerRegistry\\n/// @dev The interface for the issuer registry contract.\\ninterface IIssuerRegistry {\\n /// @notice Emitted when a new issuer is registered in the registry.\\n /// @param issuerId Unique identifier for the newly registered issuer.\\n /// @param name Name of the issuer registered.\\n event IssuerRegistered(uint256 indexed issuerId, string name);\\n\\n /// @notice Emitted when an issuer's administrative role is transferred to a new address.\\n /// @param issuerId ID of issuer whose admin is being transferred.\\n /// @param oldAdmin Address of the current admin being replaced.\\n /// @param newAdmin Address of the new admin taking over.\\n event IssuerAdminTransferred(uint256 indexed issuerId, address indexed oldAdmin, address indexed newAdmin);\\n\\n /// @notice Emitted when the status of a public key is updated.\\n /// @param issuerId ID for the issuer to whom the public key belongs.\\n /// @param publicKeyId ID for the public key being updated.\\n /// @param status New status of the public key.\\n event PublicKeyStatusUpdated(uint256 indexed issuerId, uint256 indexed publicKeyId, PublicKeyStatus status);\\n\\n /// @notice Emitted when the verification stack for a public key is updated.\\n /// @param issuerId Unique identifier for the issuer to whom the public key belongs.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @param verificationStackId Identifier for the verification stack being updated.\\n /// @param enabled Boolean indicating whether the stack is enabled or disabled for the public key.\\n event PublicKeyVerificationStackUpdated(\\n uint256 indexed issuerId,\\n uint256 indexed publicKeyId,\\n uint256 indexed verificationStackId,\\n bool enabled\\n );\\n\\n /// @notice Emitted when the signature state URI is updated for a specific type and context.\\n /// @param typeId Type identifier for the signature state being updated.\\n /// @param contextID Context identifier for the signature state being updated.\\n /// @param issuerId Issuer identifier related to the signature state.\\n /// @param newTreeURI New URI for the signature state tree.\\n event SignatureStateURIUpdated(\\n uint160 indexed typeId,\\n uint160 indexed contextID,\\n uint256 indexed issuerId,\\n string newTreeURI\\n );\\n\\n /// @notice Emitted when the signature state root is updated for a specific type and context.\\n /// @param typeId Type identifier for the signature state being updated.\\n /// @param contextID Context identifier for the signature state being updated.\\n /// @param issuerId Issuer identifier related to the signature state.\\n /// @param newRoot New root hash for the signature state tree.\\n event SignatureStateRootUpdated(\\n uint160 indexed typeId,\\n uint160 indexed contextID,\\n uint256 indexed issuerId,\\n bytes32 newRoot\\n );\\n\\n /// @dev Registers a new issuer along with their first public key and enabled verification stack.\\n /// @param name Name of the issuer to register.\\n /// @param verificationStackId Identifier for the verification stack.\\n /// @param publicKeyId Identifier for the issuer's public key.\\n /// @param publicKeyRaw The raw public key data.\\n /// @return The unique identifier for the newly registered issuer.\\n function registerIssuer(\\n string calldata name,\\n uint8 verificationStackId,\\n uint256 publicKeyId,\\n bytes calldata publicKeyRaw\\n ) external returns (uint256);\\n\\n /// @dev Transfers the administrative role of an issuer to a new owner.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param newOwner Address of the new administrator.\\n function transferIssuerAdmin(uint256 issuerId, address newOwner) external;\\n\\n /// @dev Adds a new public key for an issuer and enables it for a specified verification stack.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param verificationStackId Identifier for the verification stack.\\n /// @param publicKeyId Unique identifier for the new public key.\\n /// @param publicKeyRaw The raw public key data.\\n function addPublicKey(\\n uint256 issuerId,\\n uint8 verificationStackId,\\n uint256 publicKeyId,\\n bytes calldata publicKeyRaw\\n ) external;\\n\\n /// @dev Updates the status (active/revoked) of an issuer's public key.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @param status New status for the public key.\\n // only the issuer admin can call this function\\n function updatePublicKeyStatus(uint256 issuerId, uint256 publicKeyId, PublicKeyStatus status) external;\\n\\n /// @dev Updates the verification stack association for an issuer's public key.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @param verificationStackId New verification stack identifier for the public key.\\n /// @param enabled Boolean indicating whether the stack is enabled for the public key.\\n function updatePublicKeyVerificationStack(\\n uint256 issuerId,\\n uint256 publicKeyId,\\n uint8 verificationStackId,\\n bool enabled\\n ) external;\\n\\n /// @dev Updates the signature state URI for a given type and context.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param treeURI New URI for the signature state.\\n function updateSignatureStateURI(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId,\\n string calldata treeURI\\n ) external;\\n\\n /// @dev Updates the signature SMT root for a given type, context and issuer.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param root New root hash for the revoked SMT.\\n function updateSignatureState(uint160 typeId, uint160 contextId, uint256 issuerId, bytes32 root) external;\\n\\n /// @dev Sets both the signature SMT URI and root for a given type, context and issuer.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param treeURI New URI for the signature state.\\n /// @param root New root hash for the signature state.\\n function setSignatureState(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId,\\n string calldata treeURI,\\n bytes32 root\\n ) external;\\n\\n /// @dev Retrieves the issuer data, reverts if the issuer does not exist.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @return Issuer data structure containing issuer details.\\n function getIssuer(uint256 issuerId) external view returns (Issuer memory);\\n\\n /// @dev Retrieves the raw public key data for an issuer's public key.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @return The raw public key data.\\n function getPublicKeyRaw(uint256 issuerId, uint256 publicKeyId) external view returns (bytes memory);\\n\\n /// @dev Checks if an issuer's public key is active.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @return True if the public key is active, false otherwise.\\n function isPublicKeyActive(uint256 issuerId, uint256 publicKeyId) external view returns (bool);\\n\\n /// @dev Checks if an issuer's public key is active and enabled for a specific verification stack.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @param publicKeyId Unique identifier for the public key.\\n /// @param verificationStackId Identifier for the verification stack.\\n /// @return True if the public key is active and enabled for the stack, false otherwise.\\n function isPublicKeyActiveForStack(\\n uint256 issuerId,\\n uint256 publicKeyId,\\n uint8 verificationStackId\\n ) external view returns (bool);\\n\\n /// @dev Retrieves the signature state for a given type, context and issuer.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @return The signature state.\\n function getSignatureState(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId\\n ) external view returns (SignatureState memory);\\n\\n /// @dev Retrieves the signature state URI for a given type, context and issuer.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @return The URI of the signature state.\\n function getSignatureStateURI(\\n uint160 typeId,\\n uint160 contextId,\\n uint256 issuerId\\n ) external view returns (string memory);\\n\\n /// @dev Retrieves the signature state root for a given type, context and issuer.\\n /// @param typeId Type identifier.\\n /// @param contextId Context identifier.\\n /// @param issuerId Unique identifier for the issuer.\\n /// @return The root hash of the signature state.\\n function getSignatureStateRoot(uint160 typeId, uint160 contextId, uint256 issuerId) external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xec472bdee80280b790f226a9526cdea5a618e65881858317b40fba1a9893932b\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506115b0806100206000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806392089c4611610097578063b050d66c11610066578063b050d66c1461020a578063b7bb44341461022a578063cc46e8d61461023d578063e8a123b31461025057600080fd5b806392089c46146101b1578063a2211ed7146101d1578063a498ea23146101e4578063a9d3e1fb146101f757600080fd5b80634a4721a6116100d35780634a4721a61461014a5780635c5bccf51461016a5780635da034861461017d5780638fe3ee4f1461019e57600080fd5b80630d590dc5146100fa5780633f13b8161461010f578063446ac6e514610137575b600080fd5b61010d610108366004610ea5565b610263565b005b61012261011d366004610ef2565b610305565b60405190151581526020015b60405180910390f35b61010d610145366004610f70565b610389565b61015d610158366004610fed565b6103d0565b60405161012e9190611074565b61010d6101783660046110a1565b6104b2565b61019061018b3660046110de565b610560565b60405190815260200161012e565b61010d6101ac36600461116b565b610586565b6101c46101bf36600461119e565b610614565b60405161012e91906111b7565b61010d6101df3660046111f2565b610713565b61010d6101f2366004611222565b610788565b61010d610205366004611268565b610807565b61021d6102183660046112e3565b61093c565b60405161012e9190611305565b610190610238366004610fed565b610a13565b61012261024b3660046112e3565b610a3d565b61021d61025e366004610fed565b610a8f565b8361026d81610b43565b6102778585610bc9565b610294576040516322389ec360e11b815260040160405180910390fd5b6000858152600160209081526040808320878452825280832060ff871680855290835292819020805460ff19168615159081179091559051908152869188917f1af2113c69242d6336219e3a8f9dafec6c4210ae8a92cb93495c8df77467094a910160405180910390a45050505050565b60006103118484610bc9565b61031d57506000610382565b6000848152600160209081526040808320868452825280832060ff808716855292529091205416801561037f575060026000858152600160208181526040808420888552909152909120015460ff16600281111561037d5761037d611318565b145b90505b9392505050565b8461039381610b43565b61039d8685610bc9565b156103bb57604051632fea582560e21b815260040160405180910390fd5b6103c88686868686610c03565b505050505050565b604080518082019091526000815260606020820152600260006103f4868686610ccd565b8152602001908152602001600020604051806040016040529081600082015481526020016001820180546104279061132e565b80601f01602080910402602001604051908101604052809291908181526020018280546104539061132e565b80156104a05780601f10610475576101008083540402835291602001916104a0565b820191906000526020600020905b81548152906001019060200180831161048357829003601f168201915b50505050508152505090509392505050565b826104bc81610b43565b6104c68484610bc9565b6104e3576040516322389ec360e11b815260040160405180910390fd5b600084815260016020818152604080842087855290915290912081018054849260ff199091169083600281111561051c5761051c611318565b021790555082847f55b271602137c928f8160ab64285e1b4d3380b30db931853c27defe706d8a54f846040516105529190611368565b60405180910390a350505050565b60003361056e818989610d20565b61057b8187878787610c03565b979650505050505050565b8261059081610b43565b600061059d878787610ccd565b60008181526002602052604090209091506001016105bc8486836113f3565b5084866001600160a01b0316886001600160a01b03167fee844470b75deb2a75b4e8badf84facf9768a7073b8bae933df304067c78dc4c87876040516106039291906114b4565b60405180910390a450505050505050565b60408051808201909152606081526000602082015261063282610e6d565b61064f57604051630f202d6560e31b815260040160405180910390fd5b6000828152602081905260409081902081518083019092528054829082906106769061132e565b80601f01602080910402602001604051908101604052809291908181526020018280546106a29061132e565b80156106ef5780601f106106c4576101008083540402835291602001916106ef565b820191906000526020600020905b8154815290600101906020018083116106d257829003601f168201915b5050509183525050600191909101546001600160a01b031660209091015292915050565b8161071d81610b43565b600083815260208190526040808220600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915590519091339186917fce632a60fd89eafb0e01f64196fd7ded7cb05ca669f84f40c523ddaba217c29191a4505050565b8161079281610b43565b600061079f868686610ccd565b600081815260026020526040908190208590555190915084906001600160a01b0380881691908916907fef413e36f587b9e4a0e3b07db68cbdbcdbdd9b1a9a2be22db42e3bcf440677f5906107f79088815260200190565b60405180910390a4505050505050565b8361081181610b43565b600061081e888888610ccd565b9050604051806040016040528084815260200186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509390945250508381526002602090815260409091208351815590830151909150600182019061089290826114e3565b5090505085876001600160a01b0316896001600160a01b03167fee844470b75deb2a75b4e8badf84facf9768a7073b8bae933df304067c78dc4c88886040516108dc9291906114b4565b60405180910390a485876001600160a01b0316896001600160a01b03167fef413e36f587b9e4a0e3b07db68cbdbcdbdd9b1a9a2be22db42e3bcf440677f58660405161092a91815260200190565b60405180910390a45050505050505050565b60606109488383610bc9565b610965576040516322389ec360e11b815260040160405180910390fd5b60008381526001602090815260408083208584529091529020600201805461098c9061132e565b80601f01602080910402602001604051908101604052809291908181526020018280546109b89061132e565b8015610a055780601f106109da57610100808354040283529160200191610a05565b820191906000526020600020905b8154815290600101906020018083116109e857829003601f168201915b505050505090505b92915050565b600060026000610a24868686610ccd565b8152602081019190915260400160002054949350505050565b6000610a498383610bc9565b610a5557506000610a0d565b60026000848152600160208181526040808420878552909152909120015460ff166002811115610a8757610a87611318565b149392505050565b606060026000610aa0868686610ccd565b81526020019081526020016000206001018054610abc9061132e565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae89061132e565b8015610b355780601f10610b0a57610100808354040283529160200191610b35565b820191906000526020600020905b815481529060010190602001808311610b1857829003601f168201915b505050505090509392505050565b610b4c81610e6d565b610b6957604051630f202d6560e31b815260040160405180910390fd5b6000818152602081905260409020600101546001600160a01b03163314610bc65760008181526020819052604090819020600101549051635d882f0760e01b81526001600160a01b03909116600482015260240160405180910390fd5b50565b600082815260016020818152604080842085855290915282200154819060ff166002811115610bfa57610bfa611318565b14159392505050565b600085815260016020818152604080842087855280835281852060ff8a168652808452918520805460ff1990811686179091559488905291829052918201805460029416841790559101610c588385836113f3565b5083867f55b271602137c928f8160ab64285e1b4d3380b30db931853c27defe706d8a54f6002604051610c8b9190611368565b60405180910390a38460ff1684877f1af2113c69242d6336219e3a8f9dafec6c4210ae8a92cb93495c8df77467094a60016040516107f7911515815260200190565b6040516bffffffffffffffffffffffff19606085811b8216602084015284901b1660348201526048810182905260009060680160408051601f198184030181529190528051602090910120949350505050565b6000819003610d425760405163430f13b360e01b815260040160405180910390fd5b610d4b83610e6d565b15610d6957604051630eeb1b5960e21b815260040160405180910390fd5b6040805160606020601f85018190040282018101835291810183815290918291908590859081908501838280828437600092018290525093855250503360209384015250858152908190526040902081518190610dc690826114e3565b50602091909101516001909101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0390921691909117905560405183907f187f5f8f3e3c2abebb6a11ffa01f399d9ffb676743796efd35b9c57370d7a28090610e3190859085906114b4565b60405180910390a2604051339060009085907fce632a60fd89eafb0e01f64196fd7ded7cb05ca669f84f40c523ddaba217c291908390a4505050565b60008181526020819052604081208054610e869061132e565b15159392505050565b803560ff81168114610ea057600080fd5b919050565b60008060008060808587031215610ebb57600080fd5b8435935060208501359250610ed260408601610e8f565b915060608501358015158114610ee757600080fd5b939692955090935050565b600080600060608486031215610f0757600080fd5b8335925060208401359150610f1e60408501610e8f565b90509250925092565b60008083601f840112610f3957600080fd5b50813567ffffffffffffffff811115610f5157600080fd5b602083019150836020828501011115610f6957600080fd5b9250929050565b600080600080600060808688031215610f8857600080fd5b85359450610f9860208701610e8f565b935060408601359250606086013567ffffffffffffffff811115610fbb57600080fd5b610fc788828901610f27565b969995985093965092949392505050565b6001600160a01b0381168114610bc657600080fd5b60008060006060848603121561100257600080fd5b833561100d81610fd8565b9250602084013561101d81610fd8565b929592945050506040919091013590565b6000815180845260005b8181101561105457602081850181015186830182015201611038565b506000602082860101526020601f19601f83011685010191505092915050565b602081528151602082015260006020830151604080840152611099606084018261102e565b949350505050565b6000806000606084860312156110b657600080fd5b83359250602084013591506040840135600381106110d357600080fd5b809150509250925092565b600080600080600080608087890312156110f757600080fd5b863567ffffffffffffffff8082111561110f57600080fd5b61111b8a838b01610f27565b909850965086915061112f60208a01610e8f565b955060408901359450606089013591508082111561114c57600080fd5b5061115989828a01610f27565b979a9699509497509295939492505050565b60008060008060006080868803121561118357600080fd5b853561118e81610fd8565b94506020860135610f9881610fd8565b6000602082840312156111b057600080fd5b5035919050565b6020815260008251604060208401526111d3606084018261102e565b90506001600160a01b0360208501511660408401528091505092915050565b6000806040838503121561120557600080fd5b82359150602083013561121781610fd8565b809150509250929050565b6000806000806080858703121561123857600080fd5b843561124381610fd8565b9350602085013561125381610fd8565b93969395505050506040820135916060013590565b60008060008060008060a0878903121561128157600080fd5b863561128c81610fd8565b9550602087013561129c81610fd8565b945060408701359350606087013567ffffffffffffffff8111156112bf57600080fd5b6112cb89828a01610f27565b979a9699509497949695608090950135949350505050565b600080604083850312156112f657600080fd5b50508035926020909101359150565b602081526000610382602083018461102e565b634e487b7160e01b600052602160045260246000fd5b600181811c9082168061134257607f821691505b60208210810361136257634e487b7160e01b600052602260045260246000fd5b50919050565b602081016003831061138a57634e487b7160e01b600052602160045260246000fd5b91905290565b634e487b7160e01b600052604160045260246000fd5b601f8211156113ee576000816000526020600020601f850160051c810160208610156113cf5750805b601f850160051c820191505b818110156103c8578281556001016113db565b505050565b67ffffffffffffffff83111561140b5761140b611390565b61141f83611419835461132e565b836113a6565b6000601f841160018114611453576000851561143b5750838201355b600019600387901b1c1916600186901b1783556114ad565b600083815260209020601f19861690835b828110156114845786850135825560209485019460019092019101611464565b50868210156114a15760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b815167ffffffffffffffff8111156114fd576114fd611390565b6115118161150b845461132e565b846113a6565b602080601f831160018114611546576000841561152e5750858301515b600019600386901b1c1916600185901b1785556103c8565b600085815260208120601f198616915b8281101561157557888601518255948401946001909101908401611556565b50858210156115935787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea164736f6c6343000817000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806392089c4611610097578063b050d66c11610066578063b050d66c1461020a578063b7bb44341461022a578063cc46e8d61461023d578063e8a123b31461025057600080fd5b806392089c46146101b1578063a2211ed7146101d1578063a498ea23146101e4578063a9d3e1fb146101f757600080fd5b80634a4721a6116100d35780634a4721a61461014a5780635c5bccf51461016a5780635da034861461017d5780638fe3ee4f1461019e57600080fd5b80630d590dc5146100fa5780633f13b8161461010f578063446ac6e514610137575b600080fd5b61010d610108366004610ea5565b610263565b005b61012261011d366004610ef2565b610305565b60405190151581526020015b60405180910390f35b61010d610145366004610f70565b610389565b61015d610158366004610fed565b6103d0565b60405161012e9190611074565b61010d6101783660046110a1565b6104b2565b61019061018b3660046110de565b610560565b60405190815260200161012e565b61010d6101ac36600461116b565b610586565b6101c46101bf36600461119e565b610614565b60405161012e91906111b7565b61010d6101df3660046111f2565b610713565b61010d6101f2366004611222565b610788565b61010d610205366004611268565b610807565b61021d6102183660046112e3565b61093c565b60405161012e9190611305565b610190610238366004610fed565b610a13565b61012261024b3660046112e3565b610a3d565b61021d61025e366004610fed565b610a8f565b8361026d81610b43565b6102778585610bc9565b610294576040516322389ec360e11b815260040160405180910390fd5b6000858152600160209081526040808320878452825280832060ff871680855290835292819020805460ff19168615159081179091559051908152869188917f1af2113c69242d6336219e3a8f9dafec6c4210ae8a92cb93495c8df77467094a910160405180910390a45050505050565b60006103118484610bc9565b61031d57506000610382565b6000848152600160209081526040808320868452825280832060ff808716855292529091205416801561037f575060026000858152600160208181526040808420888552909152909120015460ff16600281111561037d5761037d611318565b145b90505b9392505050565b8461039381610b43565b61039d8685610bc9565b156103bb57604051632fea582560e21b815260040160405180910390fd5b6103c88686868686610c03565b505050505050565b604080518082019091526000815260606020820152600260006103f4868686610ccd565b8152602001908152602001600020604051806040016040529081600082015481526020016001820180546104279061132e565b80601f01602080910402602001604051908101604052809291908181526020018280546104539061132e565b80156104a05780601f10610475576101008083540402835291602001916104a0565b820191906000526020600020905b81548152906001019060200180831161048357829003601f168201915b50505050508152505090509392505050565b826104bc81610b43565b6104c68484610bc9565b6104e3576040516322389ec360e11b815260040160405180910390fd5b600084815260016020818152604080842087855290915290912081018054849260ff199091169083600281111561051c5761051c611318565b021790555082847f55b271602137c928f8160ab64285e1b4d3380b30db931853c27defe706d8a54f846040516105529190611368565b60405180910390a350505050565b60003361056e818989610d20565b61057b8187878787610c03565b979650505050505050565b8261059081610b43565b600061059d878787610ccd565b60008181526002602052604090209091506001016105bc8486836113f3565b5084866001600160a01b0316886001600160a01b03167fee844470b75deb2a75b4e8badf84facf9768a7073b8bae933df304067c78dc4c87876040516106039291906114b4565b60405180910390a450505050505050565b60408051808201909152606081526000602082015261063282610e6d565b61064f57604051630f202d6560e31b815260040160405180910390fd5b6000828152602081905260409081902081518083019092528054829082906106769061132e565b80601f01602080910402602001604051908101604052809291908181526020018280546106a29061132e565b80156106ef5780601f106106c4576101008083540402835291602001916106ef565b820191906000526020600020905b8154815290600101906020018083116106d257829003601f168201915b5050509183525050600191909101546001600160a01b031660209091015292915050565b8161071d81610b43565b600083815260208190526040808220600101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915590519091339186917fce632a60fd89eafb0e01f64196fd7ded7cb05ca669f84f40c523ddaba217c29191a4505050565b8161079281610b43565b600061079f868686610ccd565b600081815260026020526040908190208590555190915084906001600160a01b0380881691908916907fef413e36f587b9e4a0e3b07db68cbdbcdbdd9b1a9a2be22db42e3bcf440677f5906107f79088815260200190565b60405180910390a4505050505050565b8361081181610b43565b600061081e888888610ccd565b9050604051806040016040528084815260200186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509390945250508381526002602090815260409091208351815590830151909150600182019061089290826114e3565b5090505085876001600160a01b0316896001600160a01b03167fee844470b75deb2a75b4e8badf84facf9768a7073b8bae933df304067c78dc4c88886040516108dc9291906114b4565b60405180910390a485876001600160a01b0316896001600160a01b03167fef413e36f587b9e4a0e3b07db68cbdbcdbdd9b1a9a2be22db42e3bcf440677f58660405161092a91815260200190565b60405180910390a45050505050505050565b60606109488383610bc9565b610965576040516322389ec360e11b815260040160405180910390fd5b60008381526001602090815260408083208584529091529020600201805461098c9061132e565b80601f01602080910402602001604051908101604052809291908181526020018280546109b89061132e565b8015610a055780601f106109da57610100808354040283529160200191610a05565b820191906000526020600020905b8154815290600101906020018083116109e857829003601f168201915b505050505090505b92915050565b600060026000610a24868686610ccd565b8152602081019190915260400160002054949350505050565b6000610a498383610bc9565b610a5557506000610a0d565b60026000848152600160208181526040808420878552909152909120015460ff166002811115610a8757610a87611318565b149392505050565b606060026000610aa0868686610ccd565b81526020019081526020016000206001018054610abc9061132e565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae89061132e565b8015610b355780601f10610b0a57610100808354040283529160200191610b35565b820191906000526020600020905b815481529060010190602001808311610b1857829003601f168201915b505050505090509392505050565b610b4c81610e6d565b610b6957604051630f202d6560e31b815260040160405180910390fd5b6000818152602081905260409020600101546001600160a01b03163314610bc65760008181526020819052604090819020600101549051635d882f0760e01b81526001600160a01b03909116600482015260240160405180910390fd5b50565b600082815260016020818152604080842085855290915282200154819060ff166002811115610bfa57610bfa611318565b14159392505050565b600085815260016020818152604080842087855280835281852060ff8a168652808452918520805460ff1990811686179091559488905291829052918201805460029416841790559101610c588385836113f3565b5083867f55b271602137c928f8160ab64285e1b4d3380b30db931853c27defe706d8a54f6002604051610c8b9190611368565b60405180910390a38460ff1684877f1af2113c69242d6336219e3a8f9dafec6c4210ae8a92cb93495c8df77467094a60016040516107f7911515815260200190565b6040516bffffffffffffffffffffffff19606085811b8216602084015284901b1660348201526048810182905260009060680160408051601f198184030181529190528051602090910120949350505050565b6000819003610d425760405163430f13b360e01b815260040160405180910390fd5b610d4b83610e6d565b15610d6957604051630eeb1b5960e21b815260040160405180910390fd5b6040805160606020601f85018190040282018101835291810183815290918291908590859081908501838280828437600092018290525093855250503360209384015250858152908190526040902081518190610dc690826114e3565b50602091909101516001909101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0390921691909117905560405183907f187f5f8f3e3c2abebb6a11ffa01f399d9ffb676743796efd35b9c57370d7a28090610e3190859085906114b4565b60405180910390a2604051339060009085907fce632a60fd89eafb0e01f64196fd7ded7cb05ca669f84f40c523ddaba217c291908390a4505050565b60008181526020819052604081208054610e869061132e565b15159392505050565b803560ff81168114610ea057600080fd5b919050565b60008060008060808587031215610ebb57600080fd5b8435935060208501359250610ed260408601610e8f565b915060608501358015158114610ee757600080fd5b939692955090935050565b600080600060608486031215610f0757600080fd5b8335925060208401359150610f1e60408501610e8f565b90509250925092565b60008083601f840112610f3957600080fd5b50813567ffffffffffffffff811115610f5157600080fd5b602083019150836020828501011115610f6957600080fd5b9250929050565b600080600080600060808688031215610f8857600080fd5b85359450610f9860208701610e8f565b935060408601359250606086013567ffffffffffffffff811115610fbb57600080fd5b610fc788828901610f27565b969995985093965092949392505050565b6001600160a01b0381168114610bc657600080fd5b60008060006060848603121561100257600080fd5b833561100d81610fd8565b9250602084013561101d81610fd8565b929592945050506040919091013590565b6000815180845260005b8181101561105457602081850181015186830182015201611038565b506000602082860101526020601f19601f83011685010191505092915050565b602081528151602082015260006020830151604080840152611099606084018261102e565b949350505050565b6000806000606084860312156110b657600080fd5b83359250602084013591506040840135600381106110d357600080fd5b809150509250925092565b600080600080600080608087890312156110f757600080fd5b863567ffffffffffffffff8082111561110f57600080fd5b61111b8a838b01610f27565b909850965086915061112f60208a01610e8f565b955060408901359450606089013591508082111561114c57600080fd5b5061115989828a01610f27565b979a9699509497509295939492505050565b60008060008060006080868803121561118357600080fd5b853561118e81610fd8565b94506020860135610f9881610fd8565b6000602082840312156111b057600080fd5b5035919050565b6020815260008251604060208401526111d3606084018261102e565b90506001600160a01b0360208501511660408401528091505092915050565b6000806040838503121561120557600080fd5b82359150602083013561121781610fd8565b809150509250929050565b6000806000806080858703121561123857600080fd5b843561124381610fd8565b9350602085013561125381610fd8565b93969395505050506040820135916060013590565b60008060008060008060a0878903121561128157600080fd5b863561128c81610fd8565b9550602087013561129c81610fd8565b945060408701359350606087013567ffffffffffffffff8111156112bf57600080fd5b6112cb89828a01610f27565b979a9699509497949695608090950135949350505050565b600080604083850312156112f657600080fd5b50508035926020909101359150565b602081526000610382602083018461102e565b634e487b7160e01b600052602160045260246000fd5b600181811c9082168061134257607f821691505b60208210810361136257634e487b7160e01b600052602260045260246000fd5b50919050565b602081016003831061138a57634e487b7160e01b600052602160045260246000fd5b91905290565b634e487b7160e01b600052604160045260246000fd5b601f8211156113ee576000816000526020600020601f850160051c810160208610156113cf5750805b601f850160051c820191505b818110156103c8578281556001016113db565b505050565b67ffffffffffffffff83111561140b5761140b611390565b61141f83611419835461132e565b836113a6565b6000601f841160018114611453576000851561143b5750838201355b600019600387901b1c1916600186901b1783556114ad565b600083815260209020601f19861690835b828110156114845786850135825560209485019460019092019101611464565b50868210156114a15760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b815167ffffffffffffffff8111156114fd576114fd611390565b6115118161150b845461132e565b846113a6565b602080601f831160018114611546576000841561152e5750858301515b600019600386901b1c1916600185901b1785556103c8565b600085815260208120601f198616915b8281101561157557888601518255948401946001909101908401611556565b50858210156115935787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea164736f6c6343000817000a", + "devdoc": { + "events": { + "IssuerAdminTransferred(uint256,address,address)": { + "params": { + "issuerId": "ID of issuer whose admin is being transferred.", + "newAdmin": "Address of the new admin taking over.", + "oldAdmin": "Address of the current admin being replaced." + } + }, + "IssuerRegistered(uint256,string)": { + "params": { + "issuerId": "Unique identifier for the newly registered issuer.", + "name": "Name of the issuer registered." + } + }, + "PublicKeyStatusUpdated(uint256,uint256,uint8)": { + "params": { + "issuerId": "ID for the issuer to whom the public key belongs.", + "publicKeyId": "ID for the public key being updated.", + "status": "New status of the public key." + } + }, + "PublicKeyVerificationStackUpdated(uint256,uint256,uint256,bool)": { + "params": { + "enabled": "Boolean indicating whether the stack is enabled or disabled for the public key.", + "issuerId": "Unique identifier for the issuer to whom the public key belongs.", + "publicKeyId": "Unique identifier for the public key.", + "verificationStackId": "Identifier for the verification stack being updated." + } + }, + "SignatureStateRootUpdated(uint160,uint160,uint256,bytes32)": { + "params": { + "contextID": "Context identifier for the signature state being updated.", + "issuerId": "Issuer identifier related to the signature state.", + "newRoot": "New root hash for the signature state tree.", + "typeId": "Type identifier for the signature state being updated." + } + }, + "SignatureStateURIUpdated(uint160,uint160,uint256,string)": { + "params": { + "contextID": "Context identifier for the signature state being updated.", + "issuerId": "Issuer identifier related to the signature state.", + "newTreeURI": "New URI for the signature state tree.", + "typeId": "Type identifier for the signature state being updated." + } + } + }, + "kind": "dev", + "methods": { + "addPublicKey(uint256,uint8,uint256,bytes)": { + "details": "add a new public key to the issuer." + }, + "getIssuer(uint256)": { + "details": "return the issuer, if not exists, revert." + }, + "getPublicKeyRaw(uint256,uint256)": { + "details": "return the public key, if not exists, revert." + }, + "getSignatureState(uint160,uint160,uint256)": { + "details": "return the status of the public key, if not exists, returns UNINITIALIZED." + }, + "getSignatureStateRoot(uint160,uint160,uint256)": { + "details": "return the root of the signature state, if not exists, returns empty bytes." + }, + "getSignatureStateURI(uint160,uint160,uint256)": { + "details": "return the status of the public key, if not exists, returns empty string." + }, + "isPublicKeyActive(uint256,uint256)": { + "details": "return if public key is active. If public key is not exists, return false." + }, + "isPublicKeyActiveForStack(uint256,uint256,uint8)": { + "details": "return if public key is active for the verification stack. If public key is not exists, return false." + }, + "registerIssuer(string,uint8,uint256,bytes)": { + "details": "register a new issuer" + }, + "setSignatureState(uint160,uint160,uint256,string,bytes32)": { + "details": "set both the signature state URI and root." + }, + "transferIssuerAdmin(uint256,address)": { + "details": "transfer the admin of the issuer" + }, + "updatePublicKeyStatus(uint256,uint256,uint8)": { + "details": "update the status of the public key." + }, + "updatePublicKeyVerificationStack(uint256,uint256,uint8,bool)": { + "details": "update the status of the public key." + }, + "updateSignatureState(uint160,uint160,uint256,bytes32)": { + "details": "set the signature state root" + }, + "updateSignatureStateURI(uint160,uint160,uint256,string)": { + "details": "set the signature state URI" + } + }, + "stateVariables": { + "_issuers": { + "details": "all issuers, isser id = uint256(caller)" + } + }, + "version": 1 + }, + "userdoc": { + "events": { + "IssuerAdminTransferred(uint256,address,address)": { + "notice": "Emitted when an issuer's administrative role is transferred to a new address." + }, + "IssuerRegistered(uint256,string)": { + "notice": "Emitted when a new issuer is registered in the registry." + }, + "PublicKeyStatusUpdated(uint256,uint256,uint8)": { + "notice": "Emitted when the status of a public key is updated." + }, + "PublicKeyVerificationStackUpdated(uint256,uint256,uint256,bool)": { + "notice": "Emitted when the verification stack for a public key is updated." + }, + "SignatureStateRootUpdated(uint160,uint160,uint256,bytes32)": { + "notice": "Emitted when the signature state root is updated for a specific type and context." + }, + "SignatureStateURIUpdated(uint160,uint160,uint256,string)": { + "notice": "Emitted when the signature state URI is updated for a specific type and context." + } + }, + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 281, + "contract": "contracts/IssuerRegistry.sol:IssuerRegistry", + "label": "_issuers", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_uint256,t_struct(Issuer)4715_storage)" + }, + { + "astId": 288, + "contract": "contracts/IssuerRegistry.sol:IssuerRegistry", + "label": "_issuerPublicKeys", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(PublicKey)4699_storage))" + }, + { + "astId": 293, + "contract": "contracts/IssuerRegistry.sol:IssuerRegistry", + "label": "_revocableSigStates", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_struct(SignatureState)4707_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_enum(PublicKeyStatus)4685": { + "encoding": "inplace", + "label": "enum PublicKeyStatus", + "numberOfBytes": "1" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(PublicKey)4699_storage))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(uint256 => struct PublicKey))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_struct(PublicKey)4699_storage)" + }, + "t_mapping(t_uint256,t_struct(Issuer)4715_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct Issuer)", + "numberOfBytes": "32", + "value": "t_struct(Issuer)4715_storage" + }, + "t_mapping(t_uint256,t_struct(PublicKey)4699_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct PublicKey)", + "numberOfBytes": "32", + "value": "t_struct(PublicKey)4699_storage" + }, + "t_mapping(t_uint256,t_struct(SignatureState)4707_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct SignatureState)", + "numberOfBytes": "32", + "value": "t_struct(SignatureState)4707_storage" + }, + "t_mapping(t_uint8,t_bool)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Issuer)4715_storage": { + "encoding": "inplace", + "label": "struct Issuer", + "members": [ + { + "astId": 4711, + "contract": "contracts/IssuerRegistry.sol:IssuerRegistry", + "label": "name", + "offset": 0, + "slot": "0", + "type": "t_string_storage" + }, + { + "astId": 4714, + "contract": "contracts/IssuerRegistry.sol:IssuerRegistry", + "label": "admin", + "offset": 0, + "slot": "1", + "type": "t_address" + } + ], + "numberOfBytes": "64" + }, + "t_struct(PublicKey)4699_storage": { + "encoding": "inplace", + "label": "struct PublicKey", + "members": [ + { + "astId": 4691, + "contract": "contracts/IssuerRegistry.sol:IssuerRegistry", + "label": "enabledVerificationStacks", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_uint8,t_bool)" + }, + { + "astId": 4695, + "contract": "contracts/IssuerRegistry.sol:IssuerRegistry", + "label": "status", + "offset": 0, + "slot": "1", + "type": "t_enum(PublicKeyStatus)4685" + }, + { + "astId": 4698, + "contract": "contracts/IssuerRegistry.sol:IssuerRegistry", + "label": "raw", + "offset": 0, + "slot": "2", + "type": "t_bytes_storage" + } + ], + "numberOfBytes": "96" + }, + "t_struct(SignatureState)4707_storage": { + "encoding": "inplace", + "label": "struct SignatureState", + "members": [ + { + "astId": 4703, + "contract": "contracts/IssuerRegistry.sol:IssuerRegistry", + "label": "root", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 4706, + "contract": "contracts/IssuerRegistry.sol:IssuerRegistry", + "label": "treeURI", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/TypeRegistry.json b/packages/evm-contracts/deployments/gravity/TypeRegistry.json new file mode 100644 index 0000000..e233cf6 --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/TypeRegistry.json @@ -0,0 +1,1052 @@ +{ + "address": "0x77dA3Cf4418009D171B4963db815Ca46d6F2E79D", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "admin", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidTypeName", + "type": "error" + }, + { + "inputs": [], + "name": "NotTypeOwner", + "type": "error" + }, + { + "inputs": [], + "name": "TypeAlreadyExists", + "type": "error" + }, + { + "inputs": [], + "name": "TypeDoesNotExist", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint160", + "name": "typeID", + "type": "uint160" + }, + { + "indexed": true, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "TypeAdminTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint160", + "name": "typeID", + "type": "uint160" + }, + { + "indexed": true, + "internalType": "uint8", + "name": "verificationStackID", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "publicSignalGetter", + "type": "address" + } + ], + "name": "TypePublicSignalGetterUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint160", + "name": "typeID", + "type": "uint160" + }, + { + "indexed": true, + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "definition", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "resourceURI", + "type": "string" + } + ], + "name": "TypeRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint160", + "name": "typeID", + "type": "uint160" + }, + { + "indexed": false, + "internalType": "string", + "name": "oldResourceURI", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "newResourceURI", + "type": "string" + } + ], + "name": "TypeResourceURIUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint160", + "name": "typeID", + "type": "uint160" + }, + { + "indexed": true, + "internalType": "uint8", + "name": "verificationStackID", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "TypeVerifierUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "creator", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "calcTypeID", + "outputs": [ + { + "internalType": "uint160", + "name": "", + "type": "uint160" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint8", + "name": "verificationStackId", + "type": "uint8" + } + ], + "name": "getPublicSignalGetter", + "outputs": [ + { + "internalType": "contract IPublicSignalGetter", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "_id", + "type": "uint160" + } + ], + "name": "getType", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "revocable", + "type": "bool" + }, + { + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "definition", + "type": "string" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "string", + "name": "resourceURI", + "type": "string" + } + ], + "internalType": "struct CredentialType", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + } + ], + "name": "getTypeAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint8", + "name": "verificationStackId", + "type": "uint8" + } + ], + "name": "getVerifier", + "outputs": [ + { + "internalType": "contract IProofVerifier", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + } + ], + "name": "isRevocable", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint8", + "name": "verificationStackId", + "type": "uint8" + } + ], + "name": "isTypeFullyInitializedForStack", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "revocable", + "type": "bool" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "definition", + "type": "string" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "string", + "name": "resourceURI", + "type": "string" + } + ], + "name": "registerType", + "outputs": [ + { + "internalType": "uint160", + "name": "", + "type": "uint160" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "revocable", + "type": "bool" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "definition", + "type": "string" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "string", + "name": "resourceURI", + "type": "string" + }, + { + "internalType": "uint8", + "name": "verificationStackId", + "type": "uint8" + }, + { + "internalType": "contract IProofVerifier", + "name": "verifier", + "type": "address" + }, + { + "internalType": "contract IPublicSignalGetter", + "name": "publicSignalGetter", + "type": "address" + } + ], + "name": "registerType1Step", + "outputs": [ + { + "internalType": "uint160", + "name": "", + "type": "uint160" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "definition", + "type": "string" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "string", + "name": "resourceURI", + "type": "string" + }, + { + "components": [ + { + "internalType": "bool", + "name": "revocable", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "verificationStackId", + "type": "uint8" + }, + { + "internalType": "contract IProofVerifier", + "name": "verifier", + "type": "address" + }, + { + "internalType": "contract IPublicSignalGetter", + "name": "publicSignalGetter", + "type": "address" + } + ], + "internalType": "struct CredentialTypeMiscConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "setPrimitiveType", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "transferTypeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint8", + "name": "verificationStackId", + "type": "uint8" + }, + { + "internalType": "contract IPublicSignalGetter", + "name": "getter", + "type": "address" + } + ], + "name": "updateTypePublicSignalGetter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "string", + "name": "uri", + "type": "string" + } + ], + "name": "updateTypeResourceURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "typeId", + "type": "uint160" + }, + { + "internalType": "uint8", + "name": "verificationStackId", + "type": "uint8" + }, + { + "internalType": "contract IProofVerifier", + "name": "verifier", + "type": "address" + } + ], + "name": "updateTypeVerifier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xad0bdf87d3f2939d9fbe6861988e138343393af6da87bc904bae59bb999ffd2a", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0xb85b3D61439a3d70D3DF7913a3A764F352b32C55", + "contractAddress": null, + "transactionIndex": 1, + "gasUsed": "1694717", + "logsBloom": "0x00000000000000000000000000000000000000400000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000010001000000001000000000000000000020001000000000000000000000000000000000000000000000000000000000000000200080000000000000000000000000000000000000000000020000000000000000000000000000000000080000000000000000000000000000000", + "blockHash": "0xb861c38db6774e85ac0ebe7c9b3e2c3813739c158c6cc54b510db6baa0da72ec", + "transactionHash": "0xad0bdf87d3f2939d9fbe6861988e138343393af6da87bc904bae59bb999ffd2a", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 27, + "transactionHash": "0xad0bdf87d3f2939d9fbe6861988e138343393af6da87bc904bae59bb999ffd2a", + "address": "0x77dA3Cf4418009D171B4963db815Ca46d6F2E79D", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000004e59b44847b379578588920ca78fbf26c0b4956c" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xb861c38db6774e85ac0ebe7c9b3e2c3813739c158c6cc54b510db6baa0da72ec" + }, + { + "transactionIndex": 1, + "blockNumber": 27, + "transactionHash": "0xad0bdf87d3f2939d9fbe6861988e138343393af6da87bc904bae59bb999ffd2a", + "address": "0x77dA3Cf4418009D171B4963db815Ca46d6F2E79D", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000004e59b44847b379578588920ca78fbf26c0b4956c", + "0x000000000000000000000000a5e5ea38cf3bd36475596858ac7546d17752e4a7" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0xb861c38db6774e85ac0ebe7c9b3e2c3813739c158c6cc54b510db6baa0da72ec" + } + ], + "blockNumber": 27, + "cumulativeGasUsed": "1694717", + "status": 1, + "byzantium": true + }, + "args": [ + "0xa5E5EA38cF3bD36475596858AC7546d17752E4A7" + ], + "numDeployments": 1, + "solcInputHash": "e08d6b930820ab219ef1afbfaba72b7a", + "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidTypeName\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTypeOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TypeAlreadyExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TypeDoesNotExist\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint160\",\"name\":\"typeID\",\"type\":\"uint160\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldAdmin\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"TypeAdminTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint160\",\"name\":\"typeID\",\"type\":\"uint160\"},{\"indexed\":true,\"internalType\":\"uint8\",\"name\":\"verificationStackID\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"publicSignalGetter\",\"type\":\"address\"}],\"name\":\"TypePublicSignalGetterUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint160\",\"name\":\"typeID\",\"type\":\"uint160\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"definition\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"resourceURI\",\"type\":\"string\"}],\"name\":\"TypeRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint160\",\"name\":\"typeID\",\"type\":\"uint160\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"oldResourceURI\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"newResourceURI\",\"type\":\"string\"}],\"name\":\"TypeResourceURIUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint160\",\"name\":\"typeID\",\"type\":\"uint160\"},{\"indexed\":true,\"internalType\":\"uint8\",\"name\":\"verificationStackID\",\"type\":\"uint8\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"verifier\",\"type\":\"address\"}],\"name\":\"TypeVerifierUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"calcTypeID\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"\",\"type\":\"uint160\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint8\",\"name\":\"verificationStackId\",\"type\":\"uint8\"}],\"name\":\"getPublicSignalGetter\",\"outputs\":[{\"internalType\":\"contract IPublicSignalGetter\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"_id\",\"type\":\"uint160\"}],\"name\":\"getType\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"revocable\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"definition\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"resourceURI\",\"type\":\"string\"}],\"internalType\":\"struct CredentialType\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"}],\"name\":\"getTypeAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint8\",\"name\":\"verificationStackId\",\"type\":\"uint8\"}],\"name\":\"getVerifier\",\"outputs\":[{\"internalType\":\"contract IProofVerifier\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"}],\"name\":\"isRevocable\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint8\",\"name\":\"verificationStackId\",\"type\":\"uint8\"}],\"name\":\"isTypeFullyInitializedForStack\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"revocable\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"definition\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"resourceURI\",\"type\":\"string\"}],\"name\":\"registerType\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"\",\"type\":\"uint160\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"revocable\",\"type\":\"bool\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"definition\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"resourceURI\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"verificationStackId\",\"type\":\"uint8\"},{\"internalType\":\"contract IProofVerifier\",\"name\":\"verifier\",\"type\":\"address\"},{\"internalType\":\"contract IPublicSignalGetter\",\"name\":\"publicSignalGetter\",\"type\":\"address\"}],\"name\":\"registerType1Step\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"\",\"type\":\"uint160\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"definition\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"resourceURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"revocable\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"verificationStackId\",\"type\":\"uint8\"},{\"internalType\":\"contract IProofVerifier\",\"name\":\"verifier\",\"type\":\"address\"},{\"internalType\":\"contract IPublicSignalGetter\",\"name\":\"publicSignalGetter\",\"type\":\"address\"}],\"internalType\":\"struct CredentialTypeMiscConfig\",\"name\":\"config\",\"type\":\"tuple\"}],\"name\":\"setPrimitiveType\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"transferTypeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint8\",\"name\":\"verificationStackId\",\"type\":\"uint8\"},{\"internalType\":\"contract IPublicSignalGetter\",\"name\":\"getter\",\"type\":\"address\"}],\"name\":\"updateTypePublicSignalGetter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"string\",\"name\":\"uri\",\"type\":\"string\"}],\"name\":\"updateTypeResourceURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"typeId\",\"type\":\"uint160\"},{\"internalType\":\"uint8\",\"name\":\"verificationStackId\",\"type\":\"uint8\"},{\"internalType\":\"contract IProofVerifier\",\"name\":\"verifier\",\"type\":\"address\"}],\"name\":\"updateTypeVerifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"A contract that allows the registration of credential types. Credential types are unique per creator and type name.\",\"events\":{\"TypeAdminTransferred(uint160,address,address)\":{\"details\":\"Emitted when the admin of a type is transferred\",\"params\":{\"newAdmin\":\"address of the new admin\",\"oldAdmin\":\"address of the old admin\",\"typeID\":\"type id\"}},\"TypePublicSignalGetterUpdated(uint160,uint8,address)\":{\"details\":\"Emitted when the intrinsic signal indexes are updated for a type\",\"params\":{\"publicSignalGetter\":\"address of the public signal getter\",\"typeID\":\"type id\",\"verificationStackID\":\"verification stack id\"}},\"TypeRegistered(uint160,address,string,string,string,string)\":{\"details\":\"Emitted when a new type is registered\",\"params\":{\"admin\":\"Address of the admin of the type.\",\"definition\":\"Immutable definition of the type\",\"description\":\"Immutable description of the type\",\"name\":\"Name of the type\",\"resourceURI\":\"Mutable resource URI for the type\",\"typeID\":\"Unique identifier for the registered type\"}},\"TypeResourceURIUpdated(uint160,string,string)\":{\"details\":\"Emitted when the resource URI of a type is updated\",\"params\":{\"newResourceURI\":\"The new resource URI\",\"oldResourceURI\":\"The previous resource URI\",\"typeID\":\"Unique identifier for the type being updated\"}},\"TypeVerifierUpdated(uint160,uint8,address)\":{\"details\":\"Emitted when a proof verifier is updated for a type\",\"params\":{\"typeID\":\"type id\",\"verificationStackID\":\"verification stack id\",\"verifier\":\"address of the verifier\"}}},\"kind\":\"dev\",\"methods\":{\"calcTypeID(address,string)\":{\"details\":\"calculate the typeID of a type\"},\"constructor\":{\"params\":{\"admin\":\"admin of the contract\"}},\"getPublicSignalGetter(uint160,uint8)\":{\"params\":{\"typeId\":\"type id of the type\",\"verificationStackId\":\"verification stack id\"}},\"getType(uint160)\":{\"details\":\"get the type for the given typeID\"},\"getTypeAdmin(uint160)\":{\"details\":\"Retrieve the admin of a type\",\"params\":{\"typeId\":\"type id of the type\"},\"returns\":{\"_0\":\"address of the admin of the type\"}},\"getVerifier(uint160,uint8)\":{\"details\":\"get the verifier for the given typeID and verificationStackID.\"},\"isRevocable(uint160)\":{\"details\":\"check if the type is revocable\"},\"isTypeFullyInitializedForStack(uint160,uint8)\":{\"details\":\"check if the type is fully initialized for the given verification stack.\",\"params\":{\"typeId\":\"id of the type\",\"verificationStackId\":\"id the verification stack\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"registerType(bool,string,string,string,string)\":{\"details\":\"register a new type by msg.sender\",\"params\":{\"definition\":\"type definition string, immutable\",\"description\":\"description of the type, immutable\",\"name\":\"type name\",\"resourceURI\":\"resource URI of the type, mutable\"},\"returns\":{\"_0\":\"typeID of the registered type\"}},\"registerType1Step(bool,string,string,string,string,uint8,address,address)\":{\"params\":{\"definition\":\"Immutable type definition string\",\"description\":\"Description of the type\",\"name\":\"Type name\",\"publicSignalGetter\":\"public signal getter for the type\",\"resourceURI\":\"Mutable resource URI of the type\",\"verifier\":\"verifier for the type\"},\"returns\":{\"_0\":\"typeID Unique identifier of the registered type\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"setPrimitiveType(uint160,string,string,string,string,(bool,uint8,address,address))\":{\"params\":{\"config\":\"misc config for the type\",\"definition\":\"definition string\",\"description\":\"description of the type\",\"name\":\"name of the type\",\"resourceURI\":\"mutable resource URI of the type\",\"typeId\":\"the type id of the primitive type\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"transferTypeAdmin(uint160,address)\":{\"details\":\"transfer the ownership of a type.\",\"params\":{\"newAdmin\":\"address of the new admin\",\"typeId\":\"type id of the type\"}},\"updateTypePublicSignalGetter(uint160,uint8,address)\":{\"details\":\"update the public signal getter for a type\",\"params\":{\"getter\":\"the address of the public signal getter\",\"typeId\":\"id of the type\",\"verificationStackId\":\"id of the verification stack\"}},\"updateTypeResourceURI(uint160,string)\":{\"details\":\"update the resource URI of a type\",\"params\":{\"typeId\":\"of the type\",\"uri\":\"new resource URI TODO: resource URI specifcation: support multiple verification stack.\"}},\"updateTypeVerifier(uint160,uint8,address)\":{\"details\":\"update the verifier for a type\"}},\"stateVariables\":{\"_credTypes\":{\"details\":\"mapping from typeID to CredentialType.\"},\"_psGetters\":{\"details\":\"mapping from typeID to its verification stack's intrinsic value .verifier typeID => verificationStackID => verifier\"},\"_verifiers\":{\"details\":\"mapping from typeID to its verification stack's verifier.verifier typeID => verificationStackID => verifier\"}},\"title\":\"TypeRegistry\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"registerType1Step(bool,string,string,string,string,uint8,address,address)\":{\"notice\":\"Register a new type by `msg.sender` with verifier and public signal getter set for a specific verification stack.\"},\"setPrimitiveType(uint160,string,string,string,string,(bool,uint8,address,address))\":{\"notice\":\"set a primitive type, only callable by the admin.\"}},\"notice\":\"Getters in this contract does not do any parameter validation, so callers should validate the inputs and outputs and uninitialized values will be zero.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/TypeRegistry.sol\":\"TypeRegistry\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"contracts/TypeRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\nimport { Ownable } from \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nimport { ITypeRegistry, CredentialType, CredentialTypeMiscConfig } from \\\"./interfaces/ITypeRegistry.sol\\\";\\nimport { IProofVerifier } from \\\"./interfaces/IProofVerifier.sol\\\";\\nimport { IPublicSignalGetter } from \\\"./interfaces/IPublicSignalGetter.sol\\\";\\n\\n/**\\n * @title TypeRegistry\\n * @dev A contract that allows the registration of credential types.\\n * Credential types are unique per creator and type name.\\n * @notice Getters in this contract does not do any parameter validation,\\n * so callers should validate the inputs and outputs and uninitialized values will be zero.\\n */\\ncontract TypeRegistry is ITypeRegistry, Ownable {\\n error TypeAlreadyExists();\\n error TypeDoesNotExist();\\n error InvalidTypeName();\\n error NotTypeOwner();\\n\\n /// @dev mapping from typeID to CredentialType.\\n mapping(uint160 typeId => CredentialType credType) private _credTypes;\\n\\n /// @dev mapping from typeID to its verification stack's verifier.\\n /// @dev verifier typeID => verificationStackID => verifier\\n mapping(uint160 typeId => mapping(uint8 veriStackId => IProofVerifier verifier)) private _verifiers;\\n\\n /// @dev mapping from typeID to its verification stack's intrinsic value .\\n /// @dev verifier typeID => verificationStackID => verifier\\n mapping(uint160 typeId => mapping(uint8 veriStackId => IPublicSignalGetter psGetter)) private _psGetters;\\n\\n /// @param admin admin of the contract\\n constructor(address admin) {\\n transferOwnership(admin);\\n }\\n\\n /// @notice set a primitive type, only callable by the admin.\\n /// @param typeId the type id of the primitive type\\n /// @param name name of the type\\n /// @param definition definition string\\n /// @param description description of the type\\n /// @param resourceURI mutable resource URI of the type\\n /// @param config misc config for the type\\n function setPrimitiveType(\\n uint160 typeId,\\n string calldata name,\\n string calldata definition,\\n string calldata description,\\n string calldata resourceURI,\\n CredentialTypeMiscConfig calldata config\\n ) external override onlyOwner {\\n // check if the type is already set by others.\\n // primitive type will have its creator as 0x0.\\n if (bytes(_credTypes[typeId].name).length != 0) {\\n revert TypeAlreadyExists();\\n }\\n if (bytes(name).length == 0) {\\n revert InvalidTypeName();\\n }\\n // save type info\\n _credTypes[typeId] = CredentialType({\\n revocable: config.revocable,\\n admin: address(0),\\n name: name,\\n definition: definition,\\n description: description,\\n resourceURI: resourceURI\\n });\\n emit TypeRegistered(typeId, address(0), name, definition, description, resourceURI);\\n // add verifier and public signal getter\\n _verifiers[typeId][config.verificationStackId] = config.verifier;\\n emit TypeVerifierUpdated(typeId, config.verificationStackId, address(config.verifier));\\n _psGetters[typeId][config.verificationStackId] = config.publicSignalGetter;\\n emit TypePublicSignalGetterUpdated(typeId, config.verificationStackId, address(config.publicSignalGetter));\\n }\\n\\n /// @dev register a new type by msg.sender\\n /// @param name type name\\n /// @param definition type definition string, immutable\\n /// @param description description of the type, immutable\\n /// @param resourceURI resource URI of the type, mutable\\n /// @return typeID of the registered type\\n function registerType(\\n bool revocable,\\n string calldata name,\\n string calldata definition,\\n string calldata description,\\n string calldata resourceURI\\n ) external override returns (uint160) {\\n return _registerType(revocable, name, definition, description, resourceURI);\\n }\\n\\n /// @notice Register a new type by `msg.sender` with verifier and public signal getter set for a specific verification stack.\\n /// @param name Type name\\n /// @param definition Immutable type definition string\\n /// @param description Description of the type\\n /// @param resourceURI Mutable resource URI of the type\\n /// @param verifier verifier for the type\\n /// @param publicSignalGetter public signal getter for the type\\n /// @return typeID Unique identifier of the registered type\\n function registerType1Step(\\n bool revocable,\\n string calldata name,\\n string calldata definition,\\n string calldata description,\\n string calldata resourceURI,\\n uint8 verificationStackId,\\n IProofVerifier verifier,\\n IPublicSignalGetter publicSignalGetter\\n ) external override returns (uint160) {\\n uint160 typeId = _registerType(revocable, name, definition, description, resourceURI);\\n // add verifier and public signal getter\\n _verifiers[typeId][verificationStackId] = verifier;\\n emit TypeVerifierUpdated(typeId, verificationStackId, address(verifier));\\n _psGetters[typeId][verificationStackId] = publicSignalGetter;\\n emit TypePublicSignalGetterUpdated(typeId, verificationStackId, address(publicSignalGetter));\\n return typeId;\\n }\\n\\n /// @dev register a new type by msg.sender\\n /// @param name type name\\n /// @param definition type definition string, immutable\\n /// @param description description of the type, immutable\\n /// @param resourceURI resource URI of the type, mutable\\n /// @return typeID of the registered type\\n function _registerType(\\n bool revocable,\\n string calldata name,\\n string calldata definition,\\n string calldata description,\\n string calldata resourceURI\\n ) internal returns (uint160) {\\n uint160 credTypeID = _calcTypeID(msg.sender, name);\\n if (bytes(_credTypes[credTypeID].name).length != 0) {\\n revert TypeAlreadyExists();\\n }\\n if (bytes(name).length == 0) {\\n revert InvalidTypeName();\\n }\\n CredentialType memory credType = CredentialType({\\n revocable: revocable,\\n admin: msg.sender,\\n name: name,\\n definition: definition,\\n description: description,\\n resourceURI: resourceURI\\n });\\n _credTypes[credTypeID] = credType;\\n emit TypeRegistered(\\n credTypeID,\\n credType.admin,\\n credType.name,\\n credType.definition,\\n credType.description,\\n credType.resourceURI\\n );\\n return credTypeID;\\n }\\n\\n /// @dev check if the type is fully initialized for the given verification stack.\\n /// @param typeId id of the type\\n /// @param verificationStackId id the verification stack\\n function isTypeFullyInitializedForStack(\\n uint160 typeId,\\n uint8 verificationStackId\\n ) external view override returns (bool) {\\n return\\n _typeExists(typeId) &&\\n _verifiers[typeId][verificationStackId] != IProofVerifier(address(0)) &&\\n _psGetters[typeId][verificationStackId] != IPublicSignalGetter(address(0));\\n }\\n\\n /// @dev transfer the ownership of a type.\\n /// @param typeId type id of the type\\n /// @param newAdmin address of the new admin\\n function transferTypeAdmin(uint160 typeId, address newAdmin) external override onlyTypeOwner(typeId) {\\n if (_credTypes[typeId].admin == address(0)) {\\n // primitive type doesn't have an admin, so the owner can't transfer it.\\n return;\\n }\\n _credTypes[typeId].admin = newAdmin;\\n emit TypeAdminTransferred(typeId, msg.sender, newAdmin);\\n }\\n\\n /// @dev update the resource URI of a type\\n /// @param typeId of the type\\n /// @param uri new resource URI\\n /// TODO: resource URI specifcation: support multiple verification stack.\\n function updateTypeResourceURI(uint160 typeId, string calldata uri) external override onlyTypeOwner(typeId) {\\n emit TypeResourceURIUpdated(typeId, _credTypes[typeId].resourceURI, uri);\\n _credTypes[typeId].resourceURI = uri;\\n }\\n\\n /// @dev update the verifier for a type\\n function updateTypeVerifier(\\n uint160 typeId,\\n uint8 verificationStackId,\\n IProofVerifier verifier\\n ) external override onlyTypeOwner(typeId) {\\n _verifiers[typeId][verificationStackId] = verifier;\\n emit TypeVerifierUpdated(typeId, verificationStackId, address(verifier));\\n }\\n\\n /// @dev update the public signal getter for a type\\n /// @param typeId id of the type\\n /// @param verificationStackId id of the verification stack\\n /// @param getter the address of the public signal getter\\n function updateTypePublicSignalGetter(\\n uint160 typeId,\\n uint8 verificationStackId,\\n IPublicSignalGetter getter\\n ) external override onlyTypeOwner(typeId) {\\n _psGetters[typeId][verificationStackId] = getter;\\n emit TypePublicSignalGetterUpdated(typeId, verificationStackId, address(getter));\\n }\\n\\n /// @dev get the type for the given typeID\\n function getType(uint160 _id) external view override returns (CredentialType memory) {\\n return _credTypes[_id];\\n }\\n\\n /// @dev Retrieve the admin of a type\\n /// @param typeId type id of the type\\n /// @return address of the admin of the type\\n function getTypeAdmin(uint160 typeId) external view override returns (address) {\\n /// uninitialized type, return 0x0\\n if (!_typeExists(typeId)) {\\n return address(0);\\n }\\n if (_credTypes[typeId].admin != address(0)) {\\n return _credTypes[typeId].admin;\\n }\\n return owner();\\n }\\n\\n /// @dev check if the type is revocable\\n function isRevocable(uint160 typeId) external view override returns (bool) {\\n return _credTypes[typeId].revocable;\\n }\\n\\n /// @dev get the verifier for the given typeID and verificationStackID.\\n function getVerifier(uint160 typeId, uint8 verificationStackId) external view override returns (IProofVerifier) {\\n return _verifiers[typeId][verificationStackId];\\n }\\n\\n /// @param typeId type id of the type\\n /// @param verificationStackId verification stack id\\n function getPublicSignalGetter(\\n uint160 typeId,\\n uint8 verificationStackId\\n ) external view override returns (IPublicSignalGetter) {\\n return _psGetters[typeId][verificationStackId];\\n }\\n\\n /// @dev calculate the typeID of a type\\n function calcTypeID(address creator, string calldata name) external pure override returns (uint160) {\\n return _calcTypeID(creator, name);\\n }\\n\\n /// @dev calculate the typeID of a type\\n function _calcTypeID(address creator, string calldata name) private pure returns (uint160) {\\n return uint160(uint256(keccak256(abi.encodePacked(creator, name))));\\n }\\n\\n /// @dev check if the type exists\\n function _typeExists(uint160 typeId) private view returns (bool) {\\n return bytes(_credTypes[typeId].name).length != 0;\\n }\\n\\n /// @dev check if the caller is the owner of the type\\n function _onlyTypeOwner(uint160 typeId) private view {\\n if (!_typeExists(typeId)) {\\n revert TypeDoesNotExist();\\n }\\n // primitive type will have its creator as 0x0, so only the admin can update it.\\n if (_credTypes[typeId].admin == address(0)) {\\n if (msg.sender != owner()) {\\n revert NotTypeOwner();\\n }\\n return;\\n }\\n if (_credTypes[typeId].admin != msg.sender) {\\n revert NotTypeOwner();\\n }\\n }\\n\\n modifier onlyTypeOwner(uint160 typeId) {\\n _onlyTypeOwner(typeId);\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x177787f1c6aa16f4084d7510c672dbfad00c74641a37eda0d9d659df119d8a06\",\"license\":\"MIT\"},\"contracts/interfaces/IProofVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\n/// @title IProofVerifier\\n/// @dev Interface for static verification of zero-knowledge proofs.\\ninterface IProofVerifier {\\n /// @notice Retrieves the verification keys.\\n /// @dev This function is used to get the verification keys that are necessary for verifying proofs.\\n /// @return An array of `uint` representing the verification keys.\\n function getVerificationKeys() external view returns (uint256[] memory);\\n\\n /// @dev Checks if the public signals are aliased. Aliased signals should never be used in proofs.\\n /// This is useful when using proof aggregators that does not check for signal aliasing.\\n /// @param _pubSignals An array of `uint` representing the public signals.\\n /// @return A boolean value indicating if any public signal is aliased (`true`) or not (`false`).\\n function isAliased(uint256[] calldata _pubSignals) external view returns (bool);\\n\\n /// @dev This function takes a cryptographic proof and public signals to verify the proof's validity.\\n /// @notice It verifies the proof and check if public signals were aliased.\\n /// @param _proofs An array of `uint` representing the proof.\\n /// @param _pubSignals An array of `uint` representing the public signals.\\n /// @return A boolean value indicating whether the proof is valid (`true`) or not (`false`).\\n function verifyProof(uint256[] calldata _proofs, uint256[] calldata _pubSignals) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xcf34af8efbb65237c2a47fd421e615cec850b19f9647fc2087c2a034d319b7be\",\"license\":\"MIT\"},\"contracts/interfaces/IPublicSignalGetter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\n/// @title Intrinsic Signal enum\\nenum IntrinsicSignalName {\\n TYPE,\\n CONTEXT,\\n NULLIFIER,\\n EXTERNAL_NULLIFIER,\\n REVEAL_IDENTITY,\\n EXPIRATION_LB,\\n KEY_ID,\\n ID_EQUALS_TO,\\n SIG_REVOCATION_SMT_ROOT\\n}\\n\\n/// @title Public Signal Getter Interface\\n/// @dev Public signals (inputs) are represented as an array of uints in galxe identity protocol.\\n/// To find the public signal for a given signal name, type designer should set a contract\\n/// in the type registry that implements this interface.\\ninterface IPublicSignalGetter {\\n /// @dev get the public signal for the signal name, represented as the given enum (represented as uint8), based on the public signals.\\n /// @notice Implementation must be able to handle intrinsic signals, defiend in IntrinsicSignalName enum.\\n /// Type-specific signals support is optional.\\n /// @param name The signal name, represented as the given enum (converted to uint8).\\n /// @param publicSignals The public signals.\\n function getPublicSignal(uint8 name, uint256[] calldata publicSignals) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xdfdfd996ad88b94d59f07e0ef67a2e6091ccd03a25c395fe53fb1e83770d99b2\",\"license\":\"MIT\"},\"contracts/interfaces/ITypeRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.18;\\n\\nimport { IProofVerifier } from \\\"./IProofVerifier.sol\\\";\\nimport { IPublicSignalGetter } from \\\"./IPublicSignalGetter.sol\\\";\\n\\n/// @title Credential Type\\n/// @dev Defines the structure of a credential type.\\nstruct CredentialType {\\n // @dev This flag indicates if the credential type support revocation.\\n bool revocable;\\n // @dev The address of the admin of the credential type, initially set to the creator.\\n address admin;\\n // @dev Provides a human-readable identifier for the credential.\\n string name;\\n // @dev The type specification of Galxe Identity Credential Type Schema.\\n string definition;\\n // @dev Additional context or information about the type.\\n string description;\\n // @dev A URI to an external JSON file of more information about the credential.\\n // See whitepaper for the JSON schema specification.\\n string resourceURI;\\n}\\n\\n/// @title Credential Type Config, miscellanous.\\n/// @notice To save stack space, we use this struct to store the verifier and public signal getter.\\nstruct CredentialTypeMiscConfig {\\n bool revocable;\\n uint8 verificationStackId;\\n IProofVerifier verifier;\\n IPublicSignalGetter publicSignalGetter;\\n}\\n\\n/// @title Interface for Type Registration Contract\\n/// @notice This interface defines the functions for registering and managing types by users.\\ninterface ITypeRegistry {\\n /// @dev Emitted when a new type is registered\\n /// @param typeID Unique identifier for the registered type\\n /// @param admin Address of the admin of the type.\\n /// @param name Name of the type\\n /// @param definition Immutable definition of the type\\n /// @param description Immutable description of the type\\n /// @param resourceURI Mutable resource URI for the type\\n event TypeRegistered(\\n uint160 indexed typeID,\\n address indexed admin,\\n string name,\\n string definition,\\n string description,\\n string resourceURI\\n );\\n\\n /// @dev Emitted when the resource URI of a type is updated\\n /// @param typeID Unique identifier for the type being updated\\n /// @param oldResourceURI The previous resource URI\\n /// @param newResourceURI The new resource URI\\n event TypeResourceURIUpdated(uint160 indexed typeID, string oldResourceURI, string newResourceURI);\\n\\n /// @dev Emitted when a proof verifier is updated for a type\\n /// @param typeID type id\\n /// @param verificationStackID verification stack id\\n /// @param verifier address of the verifier\\n event TypeVerifierUpdated(uint160 indexed typeID, uint8 indexed verificationStackID, address indexed verifier);\\n\\n /// @dev Emitted when the intrinsic signal indexes are updated for a type\\n /// @param typeID type id\\n /// @param verificationStackID verification stack id\\n /// @param publicSignalGetter address of the public signal getter\\n event TypePublicSignalGetterUpdated(\\n uint160 indexed typeID,\\n uint8 indexed verificationStackID,\\n address indexed publicSignalGetter\\n );\\n\\n /// @dev Emitted when the admin of a type is transferred\\n /// @param typeID type id\\n /// @param oldAdmin address of the old admin\\n /// @param newAdmin address of the new admin\\n event TypeAdminTransferred(uint160 indexed typeID, address indexed oldAdmin, address indexed newAdmin);\\n\\n /// @dev transfer the ownership of a type.\\n /// @param typeId type id of the type\\n /// @param newAdmin address of the new admin\\n function transferTypeAdmin(uint160 typeId, address newAdmin) external;\\n\\n /// @notice set a primitive type, only callable by the admin.\\n /// @param typeId the type id of the primitive type\\n /// @param name name of the type\\n /// @param definition definition string\\n /// @param description Description of the type\\n /// @param resourceURI Mutable resource URI of the type\\n /// @param config revocable, verifier and public signal getter.\\n function setPrimitiveType(\\n uint160 typeId,\\n string calldata name,\\n string calldata definition,\\n string calldata description,\\n string calldata resourceURI,\\n CredentialTypeMiscConfig calldata config\\n ) external;\\n\\n /// @notice Register a new type by `msg.sender`\\n /// @param name Type name\\n /// @param definition Immutable type definition string\\n /// @param description Description of the type\\n /// @param resourceURI Mutable resource URI of the type\\n /// @return typeID Unique identifier of the registered type\\n function registerType(\\n bool revocable,\\n string calldata name,\\n string calldata definition,\\n string calldata description,\\n string calldata resourceURI\\n ) external returns (uint160);\\n\\n /// @notice Register a new type by `msg.sender` with verifier and public signal getter set for a specific verification stack.\\n /// @param name Type name\\n /// @param definition Immutable type definition string\\n /// @param description Description of the type\\n /// @param resourceURI Mutable resource URI of the type\\n /// @param verifier verifier for the type\\n /// @param publicSignalGetter public signal getter for the type\\n /// @return typeID Unique identifier of the registered type\\n function registerType1Step(\\n bool revocable,\\n string calldata name,\\n string calldata definition,\\n string calldata description,\\n string calldata resourceURI,\\n uint8 verificationStackId,\\n IProofVerifier verifier,\\n IPublicSignalGetter publicSignalGetter\\n ) external returns (uint160);\\n\\n /// @notice Update the resource URI of a type\\n /// @dev Can only be called by the type owner (`msg.sender`)\\n /// @param _id ID of the type to update\\n /// @param _resourceURI New resource URI for the type\\n function updateTypeResourceURI(uint160 _id, string calldata _resourceURI) external;\\n\\n /// @dev update the verifier for a type\\n function updateTypeVerifier(uint160 typeId, uint8 verificationStackId, IProofVerifier verifier) external;\\n\\n /// @dev update the verifier for a type\\n function updateTypePublicSignalGetter(\\n uint160 typeId,\\n uint8 verificationStackId,\\n IPublicSignalGetter getter\\n ) external;\\n\\n /// @param typeId type id of the type\\n /// @param verificationStackId verification stack id\\n function getVerifier(uint160 typeId, uint8 verificationStackId) external view returns (IProofVerifier);\\n\\n /// @param typeId type id of the type\\n /// @param verificationStackId verification stack id\\n function getPublicSignalGetter(\\n uint160 typeId,\\n uint8 verificationStackId\\n ) external view returns (IPublicSignalGetter);\\n\\n /// @dev check if the type is fully initialized for the given verification stack.\\n /// @param typeId id of the type\\n /// @param verificationStackId id the verification stack\\n function isTypeFullyInitializedForStack(uint160 typeId, uint8 verificationStackId) external view returns (bool);\\n\\n /// @dev Retrieve details of a type for the given typeID\\n /// @param _id ID of the type to retrieve\\n /// @return A `CredentialType` struct containing details of the type\\n function getType(uint160 _id) external view returns (CredentialType memory);\\n\\n /// @dev Retrieve the admin of a type\\n /// @param typeId type id of the type\\n /// @return address of the admin of the type\\n function getTypeAdmin(uint160 typeId) external view returns (address);\\n\\n /// @dev check if the type is revocable\\n function isRevocable(uint160 typeId) external view returns (bool);\\n\\n /// @notice Calculate the typeID of a type, typeID is keccak256(creator, name) in uint160.\\n /// @param creator Address of the type creator\\n /// @param name Name of the type\\n /// @return The calculated typeID based on the creator address and type name\\n function calcTypeID(address creator, string calldata name) external pure returns (uint160);\\n}\\n\",\"keccak256\":\"0x86d4db6288f762aecd0725e2d4c560b56e5792c0062d48f406e04807488d1878\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162001ecc38038062001ecc833981016040819052620000349162000182565b6200003f3362000051565b6200004a81620000a1565b50620001b4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620000ab62000124565b6001600160a01b038116620001165760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b620001218162000051565b50565b6000546001600160a01b03163314620001805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016200010d565b565b6000602082840312156200019557600080fd5b81516001600160a01b0381168114620001ad57600080fd5b9392505050565b611d0880620001c46000396000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c80638da5cb5b116100b2578063cc34e0fa11610081578063ead4d4c211610066578063ead4d4c21461029a578063f2fde38b146102ad578063f7c27c28146102c057600080fd5b8063cc34e0fa14610274578063cd149acb1461028757600080fd5b80638da5cb5b1461021157806392b0a57f14610222578063b9d36dde1461024e578063bc03b4ae1461026157600080fd5b8063516158b1116100ee578063516158b11461018b578063715018a6146101ab57806373190ca5146101b35780637b4ed185146101d657600080fd5b806304a1fc8c1461012057806307f28274146101505780632f6e029b146101635780634d65526414610178575b600080fd5b61013361012e3660046113c7565b6102fb565b6040516001600160a01b0390911681526020015b60405180910390f35b61013361015e36600461142c565b610310565b610176610171366004611461565b610381565b005b610176610186366004611559565b6107cf565b61019e61019936600461142c565b610842565b60405161014791906115e8565b610176610b16565b6101c66101c1366004611685565b610b2a565b6040519015158152602001610147565b6101336101e4366004611685565b6001600160a01b03918216600090815260036020908152604080832060ff94909416835292905220541690565b6000546001600160a01b0316610133565b6101c661023036600461142c565b6001600160a01b031660009081526001602052604090205460ff1690565b61017661025c3660046116ba565b610ba2565b61017661026f3660046113c7565b610c3e565b610133610282366004611703565b610cce565b610176610295366004611559565b610dbc565b6101336102a8366004611823565b610e2f565b6101766102bb36600461142c565b610e50565b6101336102ce366004611685565b6001600160a01b03918216600090815260026020908152604080832060ff94909416835292905220541690565b6000610308848484610ee5565b949350505050565b600061031b82610f1c565b61032757506000919050565b6001600160a01b038281166000908152600160205260409020546101009004161561037057506001600160a01b0390811660009081526001602052604090205461010090041690565b50506000546001600160a01b031690565b610389610f4b565b6001600160a01b038a1660009081526001602081905260409091200180546103b0906118fa565b1590506103cf5760405162a0b14560e31b815260040160405180910390fd5b60008890036103f0576040516228eb7360e41b815260040160405180910390fd5b6040805160c0810190915280610409602084018461192e565b1515815260200160006001600160a01b031681526020018a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250604080516020601f8b0181900481028201810190925289815291810191908a908a9081908401838280828437600092019190915250505090825250604080516020601f890181900481028201810190925287815291810191908890889081908401838280828437600092019190915250505090825250604080516020601f87018190048102820181019092528581529181019190869086908190840183828082843760009201829052509390945250506001600160a01b038d8116825260016020818152604093849020865181549288015174ffffffffffffffffffffffffffffffffffffffffff1990931690151574ffffffffffffffffffffffffffffffffffffffff001916176101009290941691909102929092178255918401519092509082019061058790826119af565b506060820151600282019061059c90826119af565b50608082015160038201906105b190826119af565b5060a082015160048201906105c690826119af565b5090505060006001600160a01b03168a6001600160a01b03167fb2bcfea53e9652103d965febf849a5cbfee6074470a6e9efb080cdfb4ff850868b8b8b8b8b8b8b8b60405161061c989796959493929190611a98565b60405180910390a3610634606082016040830161142c565b6001600160a01b038b166000908152600260209081526040808320929161065f918601908601611af8565b60ff1681526020810191909152604090810160002080546001600160a01b0319166001600160a01b0393909316929092179091556106a3906060830190830161142c565b6001600160a01b03166106bc6040830160208401611af8565b60ff168b6001600160a01b03167f4a8809aceedac9e9d8e5832664f874cd776affbc8e6dba254e807f6f986d43a260405160405180910390a4610705608082016060830161142c565b6001600160a01b038b1660009081526003602090815260408083209291610730918601908601611af8565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b0392909216919091179055610771608082016060830161142c565b6001600160a01b031661078a6040830160208401611af8565b60ff168b6001600160a01b03167f0c30e42aba76b189f0e851b79c24d77b67a0dbd8c3b18ae6da6fa3aae73eb97960405160405180910390a450505050505050505050565b826107d981610fa5565b6001600160a01b03848116600081815260036020908152604080832060ff8916808552925280832080546001600160a01b0319169588169586179055519092917f0c30e42aba76b189f0e851b79c24d77b67a0dbd8c3b18ae6da6fa3aae73eb97991a450505050565b6108866040518060c0016040528060001515815260200160006001600160a01b03168152602001606081526020016060815260200160608152602001606081525090565b6001600160a01b03808316600090815260016020818152604092839020835160c081018552815460ff811615158252610100900490951691850191909152908101805491928401916108d7906118fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610903906118fa565b80156109505780601f1061092557610100808354040283529160200191610950565b820191906000526020600020905b81548152906001019060200180831161093357829003601f168201915b50505050508152602001600282018054610969906118fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610995906118fa565b80156109e25780601f106109b7576101008083540402835291602001916109e2565b820191906000526020600020905b8154815290600101906020018083116109c557829003601f168201915b505050505081526020016003820180546109fb906118fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610a27906118fa565b8015610a745780601f10610a4957610100808354040283529160200191610a74565b820191906000526020600020905b815481529060010190602001808311610a5757829003601f168201915b50505050508152602001600482018054610a8d906118fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610ab9906118fa565b8015610b065780601f10610adb57610100808354040283529160200191610b06565b820191906000526020600020905b815481529060010190602001808311610ae957829003601f168201915b5050505050815250509050919050565b610b1e610f4b565b610b286000611059565b565b6000610b3583610f1c565b8015610b6857506001600160a01b03838116600090815260026020908152604080832060ff871684529091529020541615155b8015610b9b57506001600160a01b03838116600090815260036020908152604080832060ff871684529091529020541615155b9392505050565b81610bac81610fa5565b6001600160a01b0383811660009081526001602052604090205461010090041615610c39576001600160a01b03838116600081815260016020526040808220805474ffffffffffffffffffffffffffffffffffffffff001916610100958816958602179055513392917f17ae17210ed3ecea7d066711730c938a5c899e513e64d1a18fe2441bb0aaf6f691a45b505050565b82610c4881610fa5565b6001600160a01b0384166000818152600160205260409081902090517f6a9bcdc77ef7c5aa7f5712387612ce38f1d439e5ce38fa234f09a3a9edd313d791610c999160049091019087908790611b13565b60405180910390a26001600160a01b0384166000908152600160205260409020600401610cc7838583611bb7565b5050505050565b600080610ce28e8e8e8e8e8e8e8e8e6110a9565b6001600160a01b03818116600081815260026020908152604080832060ff8c16808552925280832080546001600160a01b031916958b1695861790555194955092937f4a8809aceedac9e9d8e5832664f874cd776affbc8e6dba254e807f6f986d43a29190a46001600160a01b03818116600081815260036020908152604080832060ff8b16808552925280832080546001600160a01b0319169589169586179055519092917f0c30e42aba76b189f0e851b79c24d77b67a0dbd8c3b18ae6da6fa3aae73eb97991a49d9c50505050505050505050505050565b82610dc681610fa5565b6001600160a01b03848116600081815260026020908152604080832060ff8916808552925280832080546001600160a01b0319169588169586179055519092917f4a8809aceedac9e9d8e5832664f874cd776affbc8e6dba254e807f6f986d43a291a450505050565b6000610e428a8a8a8a8a8a8a8a8a6110a9565b9a9950505050505050505050565b610e58610f4b565b6001600160a01b038116610ed95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610ee281611059565b50565b6000838383604051602001610efc93929190611c77565b60408051601f198184030181529190528051602090910120949350505050565b6001600160a01b03811660009081526001602081905260408220018054610f42906118fa565b15159392505050565b6000546001600160a01b03163314610b285760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ed0565b610fae81610f1c565b610fcb5760405163d565201560e01b815260040160405180910390fd5b6001600160a01b0381811660009081526001602052604090205461010090041661101a576000546001600160a01b03163314610ee25760405163bb7245e360e01b815260040160405180910390fd5b6001600160a01b038181166000908152600160205260409020546101009004163314610ee25760405163bb7245e360e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806110b7338b8b610ee5565b6001600160a01b0381166000908152600160208190526040909120018054919250906110e2906118fa565b1590506111015760405162a0b14560e31b815260040160405180910390fd5b6000899003611122576040516228eb7360e41b815260040160405180910390fd5b60006040518060c001604052808d15158152602001336001600160a01b031681526020018c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250604080516020601f8d018190048102820181019092528b815291810191908c908c9081908401838280828437600092019190915250505090825250604080516020601f8b0181900481028201810190925289815291810191908a908a9081908401838280828437600092019190915250505090825250604080516020601f89018190048102820181019092528781529181019190889088908190840183828082843760009201829052509390945250506001600160a01b03858116825260016020818152604093849020865181549288015174ffffffffffffffffffffffffffffffffffffffffff1990931690151574ffffffffffffffffffffffffffffffffffffffff001916176101009290941691909102929092178255918401519394508493909250908201906112b290826119af565b50606082015160028201906112c790826119af565b50608082015160038201906112dc90826119af565b5060a082015160048201906112f190826119af565b5090505080602001516001600160a01b0316826001600160a01b03167fb2bcfea53e9652103d965febf849a5cbfee6074470a6e9efb080cdfb4ff850868360400151846060015185608001518660a001516040516113529493929190611ca3565b60405180910390a3509a9950505050505050505050565b6001600160a01b0381168114610ee257600080fd5b60008083601f84011261139057600080fd5b50813567ffffffffffffffff8111156113a857600080fd5b6020830191508360208285010111156113c057600080fd5b9250929050565b6000806000604084860312156113dc57600080fd5b83356113e781611369565b9250602084013567ffffffffffffffff81111561140357600080fd5b61140f8682870161137e565b9497909650939450505050565b803561142781611369565b919050565b60006020828403121561143e57600080fd5b8135610b9b81611369565b60006080828403121561145b57600080fd5b50919050565b6000806000806000806000806000806101208b8d03121561148157600080fd5b61148a8b61141c565b995060208b013567ffffffffffffffff808211156114a757600080fd5b6114b38e838f0161137e565b909b50995060408d01359150808211156114cc57600080fd5b6114d88e838f0161137e565b909950975060608d01359150808211156114f157600080fd5b6114fd8e838f0161137e565b909750955060808d013591508082111561151657600080fd5b506115238d828e0161137e565b909450925061153790508c60a08d01611449565b90509295989b9194979a5092959850565b803560ff8116811461142757600080fd5b60008060006060848603121561156e57600080fd5b833561157981611369565b925061158760208501611548565b9150604084013561159781611369565b809150509250925092565b6000815180845260005b818110156115c8576020818501810151868301820152016115ac565b506000602082860101526020601f19601f83011685010191505092915050565b602081528151151560208201526001600160a01b0360208301511660408201526000604083015160c0606084015261162360e08401826115a2565b90506060840151601f198085840301608086015261164183836115a2565b925060808601519150808584030160a086015261165e83836115a2565b925060a08601519150808584030160c08601525061167c82826115a2565b95945050505050565b6000806040838503121561169857600080fd5b82356116a381611369565b91506116b160208401611548565b90509250929050565b600080604083850312156116cd57600080fd5b82356116d881611369565b915060208301356116e881611369565b809150509250929050565b8035801515811461142757600080fd5b6000806000806000806000806000806000806101008d8f03121561172657600080fd5b61172f8d6116f3565b9b5067ffffffffffffffff60208e0135111561174a57600080fd5b61175a8e60208f01358f0161137e565b909b50995067ffffffffffffffff60408e0135111561177857600080fd5b6117888e60408f01358f0161137e565b909950975067ffffffffffffffff60608e013511156117a657600080fd5b6117b68e60608f01358f0161137e565b909750955067ffffffffffffffff60808e013511156117d457600080fd5b6117e48e60808f01358f0161137e565b90955093506117f560a08e01611548565b925061180360c08e0161141c565b915061181160e08e0161141c565b90509295989b509295989b509295989b565b600080600080600080600080600060a08a8c03121561184157600080fd5b61184a8a6116f3565b985060208a013567ffffffffffffffff8082111561186757600080fd5b6118738d838e0161137e565b909a50985060408c013591508082111561188c57600080fd5b6118988d838e0161137e565b909850965060608c01359150808211156118b157600080fd5b6118bd8d838e0161137e565b909650945060808c01359150808211156118d657600080fd5b506118e38c828d0161137e565b915080935050809150509295985092959850929598565b600181811c9082168061190e57607f821691505b60208210810361145b57634e487b7160e01b600052602260045260246000fd5b60006020828403121561194057600080fd5b610b9b826116f3565b634e487b7160e01b600052604160045260246000fd5b601f821115610c39576000816000526020600020601f850160051c810160208610156119885750805b601f850160051c820191505b818110156119a757828155600101611994565b505050505050565b815167ffffffffffffffff8111156119c9576119c9611949565b6119dd816119d784546118fa565b8461195f565b602080601f831160018114611a1257600084156119fa5750858301515b600019600386901b1c1916600185901b1785556119a7565b600085815260208120601f198616915b82811015611a4157888601518255948401946001909101908401611a22565b5085821015611a5f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b608081526000611aac608083018a8c611a6f565b8281036020840152611abf81898b611a6f565b90508281036040840152611ad4818789611a6f565b90508281036060840152611ae9818587611a6f565b9b9a5050505050505050505050565b600060208284031215611b0a57600080fd5b610b9b82611548565b604081526000808554611b25816118fa565b8060408601526060600180841660008114611b475760018114611b6357611b95565b60ff1985166060890152606084151560051b8901019550611b95565b8a60005260208060002060005b86811015611b8b5781548b8201870152908401908201611b70565b8a01606001975050505b50505050508281036020840152611bad818587611a6f565b9695505050505050565b67ffffffffffffffff831115611bcf57611bcf611949565b611be383611bdd83546118fa565b8361195f565b6000601f841160018114611c175760008515611bff5750838201355b600019600387901b1c1916600186901b178355610cc7565b600083815260209020601f19861690835b82811015611c485786850135825560209485019460019092019101611c28565b5086821015611c655760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6bffffffffffffffffffffffff198460601b168152818360148301376000910160140190815292915050565b608081526000611cb660808301876115a2565b8281036020840152611cc881876115a2565b90508281036040840152611cdc81866115a2565b90508281036060840152611cf081856115a2565b97965050505050505056fea164736f6c6343000817000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061011b5760003560e01c80638da5cb5b116100b2578063cc34e0fa11610081578063ead4d4c211610066578063ead4d4c21461029a578063f2fde38b146102ad578063f7c27c28146102c057600080fd5b8063cc34e0fa14610274578063cd149acb1461028757600080fd5b80638da5cb5b1461021157806392b0a57f14610222578063b9d36dde1461024e578063bc03b4ae1461026157600080fd5b8063516158b1116100ee578063516158b11461018b578063715018a6146101ab57806373190ca5146101b35780637b4ed185146101d657600080fd5b806304a1fc8c1461012057806307f28274146101505780632f6e029b146101635780634d65526414610178575b600080fd5b61013361012e3660046113c7565b6102fb565b6040516001600160a01b0390911681526020015b60405180910390f35b61013361015e36600461142c565b610310565b610176610171366004611461565b610381565b005b610176610186366004611559565b6107cf565b61019e61019936600461142c565b610842565b60405161014791906115e8565b610176610b16565b6101c66101c1366004611685565b610b2a565b6040519015158152602001610147565b6101336101e4366004611685565b6001600160a01b03918216600090815260036020908152604080832060ff94909416835292905220541690565b6000546001600160a01b0316610133565b6101c661023036600461142c565b6001600160a01b031660009081526001602052604090205460ff1690565b61017661025c3660046116ba565b610ba2565b61017661026f3660046113c7565b610c3e565b610133610282366004611703565b610cce565b610176610295366004611559565b610dbc565b6101336102a8366004611823565b610e2f565b6101766102bb36600461142c565b610e50565b6101336102ce366004611685565b6001600160a01b03918216600090815260026020908152604080832060ff94909416835292905220541690565b6000610308848484610ee5565b949350505050565b600061031b82610f1c565b61032757506000919050565b6001600160a01b038281166000908152600160205260409020546101009004161561037057506001600160a01b0390811660009081526001602052604090205461010090041690565b50506000546001600160a01b031690565b610389610f4b565b6001600160a01b038a1660009081526001602081905260409091200180546103b0906118fa565b1590506103cf5760405162a0b14560e31b815260040160405180910390fd5b60008890036103f0576040516228eb7360e41b815260040160405180910390fd5b6040805160c0810190915280610409602084018461192e565b1515815260200160006001600160a01b031681526020018a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250604080516020601f8b0181900481028201810190925289815291810191908a908a9081908401838280828437600092019190915250505090825250604080516020601f890181900481028201810190925287815291810191908890889081908401838280828437600092019190915250505090825250604080516020601f87018190048102820181019092528581529181019190869086908190840183828082843760009201829052509390945250506001600160a01b038d8116825260016020818152604093849020865181549288015174ffffffffffffffffffffffffffffffffffffffffff1990931690151574ffffffffffffffffffffffffffffffffffffffff001916176101009290941691909102929092178255918401519092509082019061058790826119af565b506060820151600282019061059c90826119af565b50608082015160038201906105b190826119af565b5060a082015160048201906105c690826119af565b5090505060006001600160a01b03168a6001600160a01b03167fb2bcfea53e9652103d965febf849a5cbfee6074470a6e9efb080cdfb4ff850868b8b8b8b8b8b8b8b60405161061c989796959493929190611a98565b60405180910390a3610634606082016040830161142c565b6001600160a01b038b166000908152600260209081526040808320929161065f918601908601611af8565b60ff1681526020810191909152604090810160002080546001600160a01b0319166001600160a01b0393909316929092179091556106a3906060830190830161142c565b6001600160a01b03166106bc6040830160208401611af8565b60ff168b6001600160a01b03167f4a8809aceedac9e9d8e5832664f874cd776affbc8e6dba254e807f6f986d43a260405160405180910390a4610705608082016060830161142c565b6001600160a01b038b1660009081526003602090815260408083209291610730918601908601611af8565b60ff168152602081019190915260400160002080546001600160a01b0319166001600160a01b0392909216919091179055610771608082016060830161142c565b6001600160a01b031661078a6040830160208401611af8565b60ff168b6001600160a01b03167f0c30e42aba76b189f0e851b79c24d77b67a0dbd8c3b18ae6da6fa3aae73eb97960405160405180910390a450505050505050505050565b826107d981610fa5565b6001600160a01b03848116600081815260036020908152604080832060ff8916808552925280832080546001600160a01b0319169588169586179055519092917f0c30e42aba76b189f0e851b79c24d77b67a0dbd8c3b18ae6da6fa3aae73eb97991a450505050565b6108866040518060c0016040528060001515815260200160006001600160a01b03168152602001606081526020016060815260200160608152602001606081525090565b6001600160a01b03808316600090815260016020818152604092839020835160c081018552815460ff811615158252610100900490951691850191909152908101805491928401916108d7906118fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610903906118fa565b80156109505780601f1061092557610100808354040283529160200191610950565b820191906000526020600020905b81548152906001019060200180831161093357829003601f168201915b50505050508152602001600282018054610969906118fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610995906118fa565b80156109e25780601f106109b7576101008083540402835291602001916109e2565b820191906000526020600020905b8154815290600101906020018083116109c557829003601f168201915b505050505081526020016003820180546109fb906118fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610a27906118fa565b8015610a745780601f10610a4957610100808354040283529160200191610a74565b820191906000526020600020905b815481529060010190602001808311610a5757829003601f168201915b50505050508152602001600482018054610a8d906118fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610ab9906118fa565b8015610b065780601f10610adb57610100808354040283529160200191610b06565b820191906000526020600020905b815481529060010190602001808311610ae957829003601f168201915b5050505050815250509050919050565b610b1e610f4b565b610b286000611059565b565b6000610b3583610f1c565b8015610b6857506001600160a01b03838116600090815260026020908152604080832060ff871684529091529020541615155b8015610b9b57506001600160a01b03838116600090815260036020908152604080832060ff871684529091529020541615155b9392505050565b81610bac81610fa5565b6001600160a01b0383811660009081526001602052604090205461010090041615610c39576001600160a01b03838116600081815260016020526040808220805474ffffffffffffffffffffffffffffffffffffffff001916610100958816958602179055513392917f17ae17210ed3ecea7d066711730c938a5c899e513e64d1a18fe2441bb0aaf6f691a45b505050565b82610c4881610fa5565b6001600160a01b0384166000818152600160205260409081902090517f6a9bcdc77ef7c5aa7f5712387612ce38f1d439e5ce38fa234f09a3a9edd313d791610c999160049091019087908790611b13565b60405180910390a26001600160a01b0384166000908152600160205260409020600401610cc7838583611bb7565b5050505050565b600080610ce28e8e8e8e8e8e8e8e8e6110a9565b6001600160a01b03818116600081815260026020908152604080832060ff8c16808552925280832080546001600160a01b031916958b1695861790555194955092937f4a8809aceedac9e9d8e5832664f874cd776affbc8e6dba254e807f6f986d43a29190a46001600160a01b03818116600081815260036020908152604080832060ff8b16808552925280832080546001600160a01b0319169589169586179055519092917f0c30e42aba76b189f0e851b79c24d77b67a0dbd8c3b18ae6da6fa3aae73eb97991a49d9c50505050505050505050505050565b82610dc681610fa5565b6001600160a01b03848116600081815260026020908152604080832060ff8916808552925280832080546001600160a01b0319169588169586179055519092917f4a8809aceedac9e9d8e5832664f874cd776affbc8e6dba254e807f6f986d43a291a450505050565b6000610e428a8a8a8a8a8a8a8a8a6110a9565b9a9950505050505050505050565b610e58610f4b565b6001600160a01b038116610ed95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610ee281611059565b50565b6000838383604051602001610efc93929190611c77565b60408051601f198184030181529190528051602090910120949350505050565b6001600160a01b03811660009081526001602081905260408220018054610f42906118fa565b15159392505050565b6000546001600160a01b03163314610b285760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ed0565b610fae81610f1c565b610fcb5760405163d565201560e01b815260040160405180910390fd5b6001600160a01b0381811660009081526001602052604090205461010090041661101a576000546001600160a01b03163314610ee25760405163bb7245e360e01b815260040160405180910390fd5b6001600160a01b038181166000908152600160205260409020546101009004163314610ee25760405163bb7245e360e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806110b7338b8b610ee5565b6001600160a01b0381166000908152600160208190526040909120018054919250906110e2906118fa565b1590506111015760405162a0b14560e31b815260040160405180910390fd5b6000899003611122576040516228eb7360e41b815260040160405180910390fd5b60006040518060c001604052808d15158152602001336001600160a01b031681526020018c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250604080516020601f8d018190048102820181019092528b815291810191908c908c9081908401838280828437600092019190915250505090825250604080516020601f8b0181900481028201810190925289815291810191908a908a9081908401838280828437600092019190915250505090825250604080516020601f89018190048102820181019092528781529181019190889088908190840183828082843760009201829052509390945250506001600160a01b03858116825260016020818152604093849020865181549288015174ffffffffffffffffffffffffffffffffffffffffff1990931690151574ffffffffffffffffffffffffffffffffffffffff001916176101009290941691909102929092178255918401519394508493909250908201906112b290826119af565b50606082015160028201906112c790826119af565b50608082015160038201906112dc90826119af565b5060a082015160048201906112f190826119af565b5090505080602001516001600160a01b0316826001600160a01b03167fb2bcfea53e9652103d965febf849a5cbfee6074470a6e9efb080cdfb4ff850868360400151846060015185608001518660a001516040516113529493929190611ca3565b60405180910390a3509a9950505050505050505050565b6001600160a01b0381168114610ee257600080fd5b60008083601f84011261139057600080fd5b50813567ffffffffffffffff8111156113a857600080fd5b6020830191508360208285010111156113c057600080fd5b9250929050565b6000806000604084860312156113dc57600080fd5b83356113e781611369565b9250602084013567ffffffffffffffff81111561140357600080fd5b61140f8682870161137e565b9497909650939450505050565b803561142781611369565b919050565b60006020828403121561143e57600080fd5b8135610b9b81611369565b60006080828403121561145b57600080fd5b50919050565b6000806000806000806000806000806101208b8d03121561148157600080fd5b61148a8b61141c565b995060208b013567ffffffffffffffff808211156114a757600080fd5b6114b38e838f0161137e565b909b50995060408d01359150808211156114cc57600080fd5b6114d88e838f0161137e565b909950975060608d01359150808211156114f157600080fd5b6114fd8e838f0161137e565b909750955060808d013591508082111561151657600080fd5b506115238d828e0161137e565b909450925061153790508c60a08d01611449565b90509295989b9194979a5092959850565b803560ff8116811461142757600080fd5b60008060006060848603121561156e57600080fd5b833561157981611369565b925061158760208501611548565b9150604084013561159781611369565b809150509250925092565b6000815180845260005b818110156115c8576020818501810151868301820152016115ac565b506000602082860101526020601f19601f83011685010191505092915050565b602081528151151560208201526001600160a01b0360208301511660408201526000604083015160c0606084015261162360e08401826115a2565b90506060840151601f198085840301608086015261164183836115a2565b925060808601519150808584030160a086015261165e83836115a2565b925060a08601519150808584030160c08601525061167c82826115a2565b95945050505050565b6000806040838503121561169857600080fd5b82356116a381611369565b91506116b160208401611548565b90509250929050565b600080604083850312156116cd57600080fd5b82356116d881611369565b915060208301356116e881611369565b809150509250929050565b8035801515811461142757600080fd5b6000806000806000806000806000806000806101008d8f03121561172657600080fd5b61172f8d6116f3565b9b5067ffffffffffffffff60208e0135111561174a57600080fd5b61175a8e60208f01358f0161137e565b909b50995067ffffffffffffffff60408e0135111561177857600080fd5b6117888e60408f01358f0161137e565b909950975067ffffffffffffffff60608e013511156117a657600080fd5b6117b68e60608f01358f0161137e565b909750955067ffffffffffffffff60808e013511156117d457600080fd5b6117e48e60808f01358f0161137e565b90955093506117f560a08e01611548565b925061180360c08e0161141c565b915061181160e08e0161141c565b90509295989b509295989b509295989b565b600080600080600080600080600060a08a8c03121561184157600080fd5b61184a8a6116f3565b985060208a013567ffffffffffffffff8082111561186757600080fd5b6118738d838e0161137e565b909a50985060408c013591508082111561188c57600080fd5b6118988d838e0161137e565b909850965060608c01359150808211156118b157600080fd5b6118bd8d838e0161137e565b909650945060808c01359150808211156118d657600080fd5b506118e38c828d0161137e565b915080935050809150509295985092959850929598565b600181811c9082168061190e57607f821691505b60208210810361145b57634e487b7160e01b600052602260045260246000fd5b60006020828403121561194057600080fd5b610b9b826116f3565b634e487b7160e01b600052604160045260246000fd5b601f821115610c39576000816000526020600020601f850160051c810160208610156119885750805b601f850160051c820191505b818110156119a757828155600101611994565b505050505050565b815167ffffffffffffffff8111156119c9576119c9611949565b6119dd816119d784546118fa565b8461195f565b602080601f831160018114611a1257600084156119fa5750858301515b600019600386901b1c1916600185901b1785556119a7565b600085815260208120601f198616915b82811015611a4157888601518255948401946001909101908401611a22565b5085821015611a5f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b608081526000611aac608083018a8c611a6f565b8281036020840152611abf81898b611a6f565b90508281036040840152611ad4818789611a6f565b90508281036060840152611ae9818587611a6f565b9b9a5050505050505050505050565b600060208284031215611b0a57600080fd5b610b9b82611548565b604081526000808554611b25816118fa565b8060408601526060600180841660008114611b475760018114611b6357611b95565b60ff1985166060890152606084151560051b8901019550611b95565b8a60005260208060002060005b86811015611b8b5781548b8201870152908401908201611b70565b8a01606001975050505b50505050508281036020840152611bad818587611a6f565b9695505050505050565b67ffffffffffffffff831115611bcf57611bcf611949565b611be383611bdd83546118fa565b8361195f565b6000601f841160018114611c175760008515611bff5750838201355b600019600387901b1c1916600186901b178355610cc7565b600083815260209020601f19861690835b82811015611c485786850135825560209485019460019092019101611c28565b5086821015611c655760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6bffffffffffffffffffffffff198460601b168152818360148301376000910160140190815292915050565b608081526000611cb660808301876115a2565b8281036020840152611cc881876115a2565b90508281036040840152611cdc81866115a2565b90508281036060840152611cf081856115a2565b97965050505050505056fea164736f6c6343000817000a", + "devdoc": { + "details": "A contract that allows the registration of credential types. Credential types are unique per creator and type name.", + "events": { + "TypeAdminTransferred(uint160,address,address)": { + "details": "Emitted when the admin of a type is transferred", + "params": { + "newAdmin": "address of the new admin", + "oldAdmin": "address of the old admin", + "typeID": "type id" + } + }, + "TypePublicSignalGetterUpdated(uint160,uint8,address)": { + "details": "Emitted when the intrinsic signal indexes are updated for a type", + "params": { + "publicSignalGetter": "address of the public signal getter", + "typeID": "type id", + "verificationStackID": "verification stack id" + } + }, + "TypeRegistered(uint160,address,string,string,string,string)": { + "details": "Emitted when a new type is registered", + "params": { + "admin": "Address of the admin of the type.", + "definition": "Immutable definition of the type", + "description": "Immutable description of the type", + "name": "Name of the type", + "resourceURI": "Mutable resource URI for the type", + "typeID": "Unique identifier for the registered type" + } + }, + "TypeResourceURIUpdated(uint160,string,string)": { + "details": "Emitted when the resource URI of a type is updated", + "params": { + "newResourceURI": "The new resource URI", + "oldResourceURI": "The previous resource URI", + "typeID": "Unique identifier for the type being updated" + } + }, + "TypeVerifierUpdated(uint160,uint8,address)": { + "details": "Emitted when a proof verifier is updated for a type", + "params": { + "typeID": "type id", + "verificationStackID": "verification stack id", + "verifier": "address of the verifier" + } + } + }, + "kind": "dev", + "methods": { + "calcTypeID(address,string)": { + "details": "calculate the typeID of a type" + }, + "constructor": { + "params": { + "admin": "admin of the contract" + } + }, + "getPublicSignalGetter(uint160,uint8)": { + "params": { + "typeId": "type id of the type", + "verificationStackId": "verification stack id" + } + }, + "getType(uint160)": { + "details": "get the type for the given typeID" + }, + "getTypeAdmin(uint160)": { + "details": "Retrieve the admin of a type", + "params": { + "typeId": "type id of the type" + }, + "returns": { + "_0": "address of the admin of the type" + } + }, + "getVerifier(uint160,uint8)": { + "details": "get the verifier for the given typeID and verificationStackID." + }, + "isRevocable(uint160)": { + "details": "check if the type is revocable" + }, + "isTypeFullyInitializedForStack(uint160,uint8)": { + "details": "check if the type is fully initialized for the given verification stack.", + "params": { + "typeId": "id of the type", + "verificationStackId": "id the verification stack" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "registerType(bool,string,string,string,string)": { + "details": "register a new type by msg.sender", + "params": { + "definition": "type definition string, immutable", + "description": "description of the type, immutable", + "name": "type name", + "resourceURI": "resource URI of the type, mutable" + }, + "returns": { + "_0": "typeID of the registered type" + } + }, + "registerType1Step(bool,string,string,string,string,uint8,address,address)": { + "params": { + "definition": "Immutable type definition string", + "description": "Description of the type", + "name": "Type name", + "publicSignalGetter": "public signal getter for the type", + "resourceURI": "Mutable resource URI of the type", + "verifier": "verifier for the type" + }, + "returns": { + "_0": "typeID Unique identifier of the registered type" + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "setPrimitiveType(uint160,string,string,string,string,(bool,uint8,address,address))": { + "params": { + "config": "misc config for the type", + "definition": "definition string", + "description": "description of the type", + "name": "name of the type", + "resourceURI": "mutable resource URI of the type", + "typeId": "the type id of the primitive type" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "transferTypeAdmin(uint160,address)": { + "details": "transfer the ownership of a type.", + "params": { + "newAdmin": "address of the new admin", + "typeId": "type id of the type" + } + }, + "updateTypePublicSignalGetter(uint160,uint8,address)": { + "details": "update the public signal getter for a type", + "params": { + "getter": "the address of the public signal getter", + "typeId": "id of the type", + "verificationStackId": "id of the verification stack" + } + }, + "updateTypeResourceURI(uint160,string)": { + "details": "update the resource URI of a type", + "params": { + "typeId": "of the type", + "uri": "new resource URI TODO: resource URI specifcation: support multiple verification stack." + } + }, + "updateTypeVerifier(uint160,uint8,address)": { + "details": "update the verifier for a type" + } + }, + "stateVariables": { + "_credTypes": { + "details": "mapping from typeID to CredentialType." + }, + "_psGetters": { + "details": "mapping from typeID to its verification stack's intrinsic value .verifier typeID => verificationStackID => verifier" + }, + "_verifiers": { + "details": "mapping from typeID to its verification stack's verifier.verifier typeID => verificationStackID => verifier" + } + }, + "title": "TypeRegistry", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "registerType1Step(bool,string,string,string,string,uint8,address,address)": { + "notice": "Register a new type by `msg.sender` with verifier and public signal getter set for a specific verification stack." + }, + "setPrimitiveType(uint160,string,string,string,string,(bool,uint8,address,address))": { + "notice": "set a primitive type, only callable by the admin." + } + }, + "notice": "Getters in this contract does not do any parameter validation, so callers should validate the inputs and outputs and uninitialized values will be zero.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 7, + "contract": "contracts/TypeRegistry.sol:TypeRegistry", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 1058, + "contract": "contracts/TypeRegistry.sol:TypeRegistry", + "label": "_credTypes", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint160,t_struct(CredentialType)5116_storage)" + }, + { + "astId": 1066, + "contract": "contracts/TypeRegistry.sol:TypeRegistry", + "label": "_verifiers", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint160,t_mapping(t_uint8,t_contract(IProofVerifier)4981))" + }, + { + "astId": 1074, + "contract": "contracts/TypeRegistry.sol:TypeRegistry", + "label": "_psGetters", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint160,t_mapping(t_uint8,t_contract(IPublicSignalGetter)5007))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IProofVerifier)4981": { + "encoding": "inplace", + "label": "contract IProofVerifier", + "numberOfBytes": "20" + }, + "t_contract(IPublicSignalGetter)5007": { + "encoding": "inplace", + "label": "contract IPublicSignalGetter", + "numberOfBytes": "20" + }, + "t_mapping(t_uint160,t_mapping(t_uint8,t_contract(IProofVerifier)4981))": { + "encoding": "mapping", + "key": "t_uint160", + "label": "mapping(uint160 => mapping(uint8 => contract IProofVerifier))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint8,t_contract(IProofVerifier)4981)" + }, + "t_mapping(t_uint160,t_mapping(t_uint8,t_contract(IPublicSignalGetter)5007))": { + "encoding": "mapping", + "key": "t_uint160", + "label": "mapping(uint160 => mapping(uint8 => contract IPublicSignalGetter))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint8,t_contract(IPublicSignalGetter)5007)" + }, + "t_mapping(t_uint160,t_struct(CredentialType)5116_storage)": { + "encoding": "mapping", + "key": "t_uint160", + "label": "mapping(uint160 => struct CredentialType)", + "numberOfBytes": "32", + "value": "t_struct(CredentialType)5116_storage" + }, + "t_mapping(t_uint8,t_contract(IProofVerifier)4981)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract IProofVerifier)", + "numberOfBytes": "32", + "value": "t_contract(IProofVerifier)4981" + }, + "t_mapping(t_uint8,t_contract(IPublicSignalGetter)5007)": { + "encoding": "mapping", + "key": "t_uint8", + "label": "mapping(uint8 => contract IPublicSignalGetter)", + "numberOfBytes": "32", + "value": "t_contract(IPublicSignalGetter)5007" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(CredentialType)5116_storage": { + "encoding": "inplace", + "label": "struct CredentialType", + "members": [ + { + "astId": 5105, + "contract": "contracts/TypeRegistry.sol:TypeRegistry", + "label": "revocable", + "offset": 0, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 5107, + "contract": "contracts/TypeRegistry.sol:TypeRegistry", + "label": "admin", + "offset": 1, + "slot": "0", + "type": "t_address" + }, + { + "astId": 5109, + "contract": "contracts/TypeRegistry.sol:TypeRegistry", + "label": "name", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 5111, + "contract": "contracts/TypeRegistry.sol:TypeRegistry", + "label": "definition", + "offset": 0, + "slot": "2", + "type": "t_string_storage" + }, + { + "astId": 5113, + "contract": "contracts/TypeRegistry.sol:TypeRegistry", + "label": "description", + "offset": 0, + "slot": "3", + "type": "t_string_storage" + }, + { + "astId": 5115, + "contract": "contracts/TypeRegistry.sol:TypeRegistry", + "label": "resourceURI", + "offset": 0, + "slot": "4", + "type": "t_string_storage" + } + ], + "numberOfBytes": "160" + }, + "t_uint160": { + "encoding": "inplace", + "label": "uint160", + "numberOfBytes": "20" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/packages/evm-contracts/deployments/gravity/solcInputs/e08d6b930820ab219ef1afbfaba72b7a.json b/packages/evm-contracts/deployments/gravity/solcInputs/e08d6b930820ab219ef1afbfaba72b7a.json new file mode 100644 index 0000000..88edb63 --- /dev/null +++ b/packages/evm-contracts/deployments/gravity/solcInputs/e08d6b930820ab219ef1afbfaba72b7a.json @@ -0,0 +1,106 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "contracts/babyzk/AggregatedStatefulProofVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\nimport { IPublicSignalGetter, IntrinsicSignalName } from \"../interfaces/IPublicSignalGetter.sol\";\nimport { IProofVerifier } from \"../interfaces/IProofVerifier.sol\";\nimport { IIssuerRegistry } from \"../interfaces/IIssuerRegistry.sol\";\nimport { ITypeRegistry } from \"../interfaces/ITypeRegistry.sol\";\nimport { IAggregatedStatefulVerifier, VerifyResult } from \"../interfaces/IAggregatedStatefulVerifier.sol\";\nimport { IUpaVerifier, ProofReference } from \"../interfaces/IUpaVerifier.sol\";\n\n/// @title AggregatedBabyzkStatefulVerifier\n/// @notice\n/// @dev AggregatedBabyzkStatefulVerifier is a contract that does on-chain stateful verification of zero-knowledge proofs.\ncontract AggregatedBabyzkStatefulVerifier is IAggregatedStatefulVerifier, Ownable {\n error InvalidArgument(string message);\n\n // constants\n uint8 public constant STACK_ID = 1;\n\n /// @dev aggregated proof verifier\n IUpaVerifier private _upaVerifier;\n\n /// @dev type registry\n ITypeRegistry private _typeRegistry;\n\n /// @dev issuer registry\n IIssuerRegistry private _issuerRegistry;\n\n /// @dev BabyzkVerifier constructor\n /// @param typeRegistry type registry contract\n /// @param issuerRegistry issuer registry contract\n constructor(IUpaVerifier upaVerifier, ITypeRegistry typeRegistry, IIssuerRegistry issuerRegistry, address admin) {\n _upaVerifier = upaVerifier;\n _typeRegistry = typeRegistry;\n _issuerRegistry = issuerRegistry;\n transferOwnership(admin);\n }\n\n /// @dev static verification of zero-knowledge proofs that only checks if the proof is valid.\n /// @dev Code duplication is deliberate for clear separation of concerns.\n function verifyProofStatic(\n uint160 typeId,\n uint160 contextId,\n uint256 keyId,\n uint256 circuitId,\n uint256[] calldata publicSignals\n ) external view override returns (VerifyResult) {\n // static validation\n VerifyResult staticValidationResult = _staticValidation(typeId, contextId, keyId, publicSignals);\n if (staticValidationResult != VerifyResult.OK) {\n return staticValidationResult;\n }\n\n // verify public signals against circuit ID on upa verifier.\n bool verified = _upaVerifier.isVerified(circuitId, publicSignals);\n if (!verified) {\n return VerifyResult.PROOF_INVALID;\n }\n\n // checks if the public signals are aliased. Proof aggregators do not check for signal aliasing.\n IProofVerifier verifier = _typeRegistry.getVerifier(typeId, STACK_ID);\n if (verifier.isAliased(publicSignals)) {\n return VerifyResult.ALIASED_SIGNAL;\n }\n\n return VerifyResult.OK;\n }\n\n /// @dev static verification of zero-knowledge proofs that only checks if the proof is valid.\n /// @dev `proofReference` is needed to check proofs that were part of a multi-proof submission.\n /// @dev Code duplication is deliberate for clear separation of concerns.\n function verifyProofStaticFromMultiProof(\n uint160 typeId,\n uint160 contextId,\n uint256 keyId,\n uint256 circuitId,\n uint256[] calldata publicSignals,\n ProofReference calldata proofReference\n ) external view override returns (VerifyResult) {\n // static validation\n VerifyResult staticValidationResult = _staticValidation(typeId, contextId, keyId, publicSignals);\n if (staticValidationResult != VerifyResult.OK) {\n return staticValidationResult;\n }\n\n // verify public signals against circuit ID on upa verifier.\n bool verified = _upaVerifier.isVerified(circuitId, publicSignals, proofReference);\n if (!verified) {\n return VerifyResult.PROOF_INVALID;\n }\n\n // checks if the public signals are aliased. Proof aggregators do not check for signal aliasing.\n IProofVerifier verifier = _typeRegistry.getVerifier(typeId, STACK_ID);\n if (verifier.isAliased(publicSignals)) {\n return VerifyResult.ALIASED_SIGNAL;\n }\n\n return VerifyResult.OK;\n }\n\n function _staticValidation(\n uint160 typeId,\n uint160 contextId,\n uint256 keyId,\n uint256[] calldata publicSignals\n ) internal view returns (VerifyResult) {\n if (!_typeRegistry.isTypeFullyInitializedForStack(typeId, STACK_ID)) {\n return VerifyResult.TYPE_UNINITIALIZED;\n }\n\n IPublicSignalGetter psGetter = _typeRegistry.getPublicSignalGetter(typeId, STACK_ID);\n\n // type matches\n if (typeId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.TYPE), publicSignals)) {\n return VerifyResult.TYPE_ID_MISMATCH;\n }\n\n // context matches\n if (contextId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.CONTEXT), publicSignals)) {\n return VerifyResult.CONTEXT_ID_MISMATCH;\n }\n\n // keyID matches\n if (keyId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.KEY_ID), publicSignals)) {\n return VerifyResult.PUBKEY_INACTIVE;\n }\n\n // proof is valid only if its expiration lower bound is not exceeded.\n {\n uint256 expiration = psGetter.getPublicSignal(uint8(IntrinsicSignalName.EXPIRATION_LB), publicSignals);\n if (expiration < block.timestamp) {\n return VerifyResult.EXPIRED;\n }\n }\n\n return VerifyResult.OK;\n }\n\n /// @dev Stateful verification of zero-knowledge proofs that checks\n /// if the proof is valid and the issuer public key is active, and\n /// for revocation checks if the the smt root matches.\n /// @dev The trust relationship between the credential and issuer is binded by\n /// the public key ID:\n /// credential <--- signed by ---- publikc key <--- authroized by ---- issuer\n /// As long as the issuer set the public key ID to be active, the credential is trusted by the issuer,\n /// However, note that it does not mean that the credential is directly generated by the issuer.\n function verifyProofFull(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n uint256 circuitId,\n uint256[] calldata publicSignals\n ) external view override returns (VerifyResult) {\n VerifyResult fullValidationResult = _fullValidation(typeId, contextId, issuerId, publicSignals);\n if (fullValidationResult != VerifyResult.OK) {\n return fullValidationResult;\n }\n\n // verify public signals against circuit ID on upa verifier.\n bool verified = _upaVerifier.isVerified(circuitId, publicSignals);\n if (!verified) {\n return VerifyResult.PROOF_INVALID;\n }\n\n // checks if the public signals are aliased. Proof aggregators do not check for signal aliasing.\n IProofVerifier verifier = _typeRegistry.getVerifier(typeId, STACK_ID);\n if (verifier.isAliased(publicSignals)) {\n return VerifyResult.ALIASED_SIGNAL;\n }\n\n return VerifyResult.OK;\n }\n\n /// @dev Stateful verification of zero-knowledge proofs that checks\n /// if the proof is valid and the issuer public key is active, and\n /// for revocation checks if the the smt root matches.\n /// @dev `proofReference` is needed to check proofs that were part of a multi-proof submission.\n /// @dev The trust relationship between the credential and issuer is binded by\n /// the public key ID:\n /// credential <--- signed by ---- publikc key <--- authroized by ---- issuer\n /// As long as the issuer set the public key ID to be active, the credential is trusted by the issuer,\n /// However, note that it does not mean that the credential is directly generated by the issuer.\n function verifyProofFullFromMultiProof(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n uint256 circuitId,\n uint256[] calldata publicSignals,\n ProofReference calldata proofReference\n ) external view override returns (VerifyResult) {\n VerifyResult fullValidationResult = _fullValidation(typeId, contextId, issuerId, publicSignals);\n if (fullValidationResult != VerifyResult.OK) {\n return fullValidationResult;\n }\n\n // verify public signals against circuit ID on upa verifier.\n bool verified = _upaVerifier.isVerified(circuitId, publicSignals, proofReference);\n if (!verified) {\n return VerifyResult.PROOF_INVALID;\n }\n\n // checks if the public signals are aliased. Proof aggregators do not check for signal aliasing.\n IProofVerifier verifier = _typeRegistry.getVerifier(typeId, STACK_ID);\n if (verifier.isAliased(publicSignals)) {\n return VerifyResult.ALIASED_SIGNAL;\n }\n\n return VerifyResult.OK;\n }\n\n function _fullValidation(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n uint256[] calldata publicSignals\n ) internal view returns (VerifyResult) {\n if (!_typeRegistry.isTypeFullyInitializedForStack(typeId, STACK_ID)) {\n return VerifyResult.TYPE_UNINITIALIZED;\n }\n\n IPublicSignalGetter psGetter = _typeRegistry.getPublicSignalGetter(typeId, STACK_ID);\n\n // type matches\n if (typeId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.TYPE), publicSignals)) {\n return VerifyResult.TYPE_ID_MISMATCH;\n }\n\n // context matches\n if (contextId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.CONTEXT), publicSignals)) {\n return VerifyResult.CONTEXT_ID_MISMATCH;\n }\n\n // proof is valid only if the issuer public key is still active.\n {\n uint256 keyId = psGetter.getPublicSignal(uint8(IntrinsicSignalName.KEY_ID), publicSignals);\n if (!_issuerRegistry.isPublicKeyActiveForStack(issuerId, keyId, STACK_ID)) {\n return VerifyResult.PUBKEY_INACTIVE;\n }\n }\n\n // proof is valid only if its expiration lower bound is not exceeded.\n {\n uint256 expiration = psGetter.getPublicSignal(uint8(IntrinsicSignalName.EXPIRATION_LB), publicSignals);\n if (expiration < block.timestamp) {\n return VerifyResult.EXPIRED;\n }\n }\n\n // proof is valid only if the smt root matches for revocable credentials.\n if (_typeRegistry.isRevocable(typeId)) {\n uint256 root = psGetter.getPublicSignal(uint8(IntrinsicSignalName.SIG_REVOCATION_SMT_ROOT), publicSignals);\n uint256 currentRoot = uint256(_issuerRegistry.getSignatureStateRoot(typeId, contextId, issuerId));\n if (currentRoot != root) {\n return VerifyResult.SIG_REVOCATION_SMT_ROOT_MISMATCH;\n }\n }\n\n return VerifyResult.OK;\n }\n\n /// @dev return the type registry\n function getTypeRegistry() external view override returns (ITypeRegistry) {\n return _typeRegistry;\n }\n\n /// @dev update the type registry\n function updateTypeRegistry(ITypeRegistry typeRegistry) external onlyOwner {\n if (typeRegistry == ITypeRegistry(address(0))) {\n revert InvalidArgument(\"typeRegistry is zero address\");\n }\n emit TypeRegistryUpdated(_typeRegistry, typeRegistry);\n _typeRegistry = typeRegistry;\n }\n\n /// @dev return the issuer registry\n function getIssuerRegistry() external view override returns (IIssuerRegistry) {\n return _issuerRegistry;\n }\n\n /// @dev update the issuer registry\n function updateIssuerRegistry(IIssuerRegistry issuerRegistry) external onlyOwner {\n if (issuerRegistry == IIssuerRegistry(address(0))) {\n revert InvalidArgument(\"issuerRegistry is zero address\");\n }\n emit IssuerRegistryUpdated(_issuerRegistry, issuerRegistry);\n _issuerRegistry = issuerRegistry;\n }\n\n /// @dev return the upa verifier\n function getUpaVerifier() external view override returns (IUpaVerifier) {\n return _upaVerifier;\n }\n\n /// @dev update the upa verifier\n function updateUpaVerifier(IUpaVerifier upaVerifier) external onlyOwner {\n if (upaVerifier == IUpaVerifier(address(0))) {\n revert InvalidArgument(\"upaVerifier is zero address\");\n }\n emit UpaVerifierUpdated(_upaVerifier, upaVerifier);\n _upaVerifier = upaVerifier;\n }\n}\n" + }, + "contracts/babyzk/DefaultPublicSignalGetter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport { IPublicSignalGetter } from \"../interfaces/IPublicSignalGetter.sol\";\n\ncontract BabyzkDefaultPsGetter is IPublicSignalGetter {\n /// @dev Implements the getPublicSignal function from the IPublicSignalGetter interface.\n /// @param name The signal name, represented as the given enum (converted to uint8).\n /// @param publicSignals The public signals, as an array of uints.\n /// @return The public signal associated with the given name.\n function getPublicSignal(uint8 name, uint256[] calldata publicSignals) external pure override returns (uint256) {\n // Because in babyzk's circom circuit, the index of the public signals is the same as the enum value of the signal name,\n // we can simply return the public signal at the index of the signal name.\n // This is deliberately done to make the circuit easier to understand and to avoid the need for a more complex getter.\n // However, in a more complex circuit, the order of public signals can be different from the enum values.\n // In those cases, type designers can use a custom public signal getter to return the correct public signal.\n return publicSignals[name];\n }\n}\n" + }, + "contracts/babyzk/StatefulProofVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\nimport { IPublicSignalGetter, IntrinsicSignalName } from \"../interfaces/IPublicSignalGetter.sol\";\nimport { IProofVerifier } from \"../interfaces/IProofVerifier.sol\";\nimport { IIssuerRegistry } from \"../interfaces/IIssuerRegistry.sol\";\nimport { ITypeRegistry } from \"../interfaces/ITypeRegistry.sol\";\nimport { IStatefulVerifier, VerifyResult } from \"../interfaces/IStatefulVerifier.sol\";\n\n/// @title BabyzkVerifier\n/// @notice\n/// @dev BabyzkVerifier is a contract that does on-chain stateful verification of zero-knowledge proofs.\ncontract BabyzkStatefulVerifier is IStatefulVerifier, Ownable {\n error InvalidArgument(string message);\n\n // constants\n uint8 public constant STACK_ID = 1;\n\n /// @dev type registry\n ITypeRegistry private _typeRegistry;\n\n /// @dev issuer registry\n IIssuerRegistry private _issuerRegistry;\n\n /// @dev BabyzkVerifier constructor\n /// @param typeRegistry type registry contract\n /// @param issuerRegistry issuer registry contract\n constructor(ITypeRegistry typeRegistry, IIssuerRegistry issuerRegistry, address admin) {\n _typeRegistry = typeRegistry;\n _issuerRegistry = issuerRegistry;\n transferOwnership(admin);\n }\n\n /// @dev static verification of zero-knowledge proofs that only checks if the proof is valid.\n /// @dev Code duplication is deliberate for clear separation of concerns.\n function verifyProofStatic(\n uint160 typeId,\n uint160 contextId,\n uint256 keyId,\n uint256[] calldata proofs,\n uint256[] calldata publicSignals\n ) external view override returns (VerifyResult) {\n if (!_typeRegistry.isTypeFullyInitializedForStack(typeId, STACK_ID)) {\n return VerifyResult.TYPE_UNINITIALIZED;\n }\n\n // static validation\n {\n IPublicSignalGetter psGetter = _typeRegistry.getPublicSignalGetter(typeId, STACK_ID);\n\n // type matches\n if (typeId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.TYPE), publicSignals)) {\n return VerifyResult.TYPE_ID_MISMATCH;\n }\n\n // context matches\n if (contextId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.CONTEXT), publicSignals)) {\n return VerifyResult.CONTEXT_ID_MISMATCH;\n }\n\n // keyID matches\n if (keyId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.KEY_ID), publicSignals)) {\n return VerifyResult.PUBKEY_INACTIVE;\n }\n\n // proof is valid only if its expiration lower bound is not exceeded.\n {\n uint256 expiration = psGetter.getPublicSignal(uint8(IntrinsicSignalName.EXPIRATION_LB), publicSignals);\n if (expiration < block.timestamp) {\n return VerifyResult.EXPIRED;\n }\n }\n }\n\n IProofVerifier verifier = _typeRegistry.getVerifier(typeId, STACK_ID);\n // zk-SNARK proof verification\n if (!verifier.verifyProof(proofs, publicSignals)) {\n return VerifyResult.PROOF_INVALID;\n }\n // signal alias check must be done within the verifier.verifyProof.\n // // signal alias check\n // if (verifier.isAliased(publicSignals)) {\n // return VerifyResult.ALIASED_SIGNAL;\n // }\n return VerifyResult.OK;\n }\n\n /// @dev Stateful verification of zero-knowledge proofs that checks\n /// if the proof is valid and the issuer public key is active, and\n /// for revocation checks if the the smt root matches.\n /// @dev The trust relationship between the credential and issuer is binded by\n /// the public key ID:\n /// credential <--- signed by ---- publikc key <--- authroized by ---- issuer\n /// As long as the issuer set the public key ID to be active, the credential is trusted by the issuer,\n /// However, note that it does not mean that the credential is directly generated by the issuer.\n function verifyProofFull(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n uint256[] calldata proofs,\n uint256[] calldata publicSignals\n ) external view override returns (VerifyResult) {\n if (!_typeRegistry.isTypeFullyInitializedForStack(typeId, STACK_ID)) {\n return VerifyResult.TYPE_UNINITIALIZED;\n }\n\n // full input validation\n {\n IPublicSignalGetter psGetter = _typeRegistry.getPublicSignalGetter(typeId, STACK_ID);\n\n // type matches\n if (typeId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.TYPE), publicSignals)) {\n return VerifyResult.TYPE_ID_MISMATCH;\n }\n\n // context matches\n if (contextId != psGetter.getPublicSignal(uint8(IntrinsicSignalName.CONTEXT), publicSignals)) {\n return VerifyResult.CONTEXT_ID_MISMATCH;\n }\n\n // proof is valid only if the issuer public key is still active.\n {\n uint256 keyId = psGetter.getPublicSignal(uint8(IntrinsicSignalName.KEY_ID), publicSignals);\n if (!_issuerRegistry.isPublicKeyActiveForStack(issuerId, keyId, STACK_ID)) {\n return VerifyResult.PUBKEY_INACTIVE;\n }\n }\n\n // proof is valid only if its expiration lower bound is not exceeded.\n {\n uint256 expiration = psGetter.getPublicSignal(uint8(IntrinsicSignalName.EXPIRATION_LB), publicSignals);\n if (expiration < block.timestamp) {\n return VerifyResult.EXPIRED;\n }\n }\n\n // proof is valid only if the smt root matches for revocable credentials.\n if (_typeRegistry.isRevocable(typeId)) {\n uint256 root = psGetter.getPublicSignal(\n uint8(IntrinsicSignalName.SIG_REVOCATION_SMT_ROOT),\n publicSignals\n );\n uint256 currentRoot = uint256(_issuerRegistry.getSignatureStateRoot(typeId, contextId, issuerId));\n if (currentRoot != root) {\n return VerifyResult.SIG_REVOCATION_SMT_ROOT_MISMATCH;\n }\n }\n }\n\n IProofVerifier verifier = _typeRegistry.getVerifier(typeId, STACK_ID);\n // zk-SNARK proof verification\n if (!verifier.verifyProof(proofs, publicSignals)) {\n return VerifyResult.PROOF_INVALID;\n }\n // signal alias check must be done within the verifier.verifyProof.\n // // signal alias check\n // if (verifier.isAliased(publicSignals)) {\n // return VerifyResult.ALIASED_SIGNAL;\n // }\n return VerifyResult.OK;\n }\n\n /// @dev return the type registry\n function getTypeRegistry() external view override returns (ITypeRegistry) {\n return _typeRegistry;\n }\n\n /// @dev update the type registry\n function updateTypeRegistry(ITypeRegistry typeRegistry) external onlyOwner {\n if (typeRegistry == ITypeRegistry(address(0))) {\n revert InvalidArgument(\"typeRegistry is zero address\");\n }\n emit TypeRegistryUpdated(_typeRegistry, typeRegistry);\n _typeRegistry = typeRegistry;\n }\n\n /// @dev return the issuer registry\n function getIssuerRegistry() external view override returns (IIssuerRegistry) {\n return _issuerRegistry;\n }\n\n /// @dev update the issuer registry\n function updateIssuerRegistry(IIssuerRegistry issuerRegistry) external onlyOwner {\n if (issuerRegistry == IIssuerRegistry(address(0))) {\n revert InvalidArgument(\"issuerRegistry is zero address\");\n }\n emit IssuerRegistryUpdated(_issuerRegistry, issuerRegistry);\n _issuerRegistry = issuerRegistry;\n }\n}\n" + }, + "contracts/babyzk/test/ProofVerifier.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n/*\n Copyright (c) 2021 0KIMS association.\n Copyright (c) [2024] Galxe.com.\n\n Modifications to this file are part of the Galxe Identity Protocol SDK,\n which is built using the snarkJS template and is subject to the GNU\n General Public License v3.0.\n\n snarkJS is free software: you can redistribute it and/or modify it\n under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\ncontract BabyZKGroth16Verifier {\n error AliasedPublicSignal();\n\n // Scalar field size\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\n // Base field size\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\n\n // Verification Key data\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n uint256 constant deltax1 = 13382824629081054131218833335176402998433623280720282474363094935338262422270;\n uint256 constant deltax2 = 14992997694787798298970128428651735156878746405574581777463392851219891893781;\n uint256 constant deltay1 = 804122157291260134274964543508763620825033741658958140658682496549278923901;\n uint256 constant deltay2 = 20795590244823410398603606172994427921866842716949936464446009005497705344370;\n\n uint256 constant IC0x = 19764436097581810314981626268114476419304968023360522705050759260578697031462;\n uint256 constant IC0y = 8451221249198589510842464045063602196787955791157681746389594127570869984928;\n uint256 constant IC1x = 21274084361069811495645657261374711891271996424091601874260232553721691430414;\n uint256 constant IC1y = 18000760790522873766821443416445254770267418552173774295864206456854759299925;\n uint256 constant IC2x = 15406250183619285448547045124806907366410436301666555537778268068652090454826;\n uint256 constant IC2y = 16536866637232299722780757345722186540586417773472679268766516998907360267632;\n uint256 constant IC3x = 18374705184999687319171921539828416791438685495665607649793873489922597027600;\n uint256 constant IC3y = 1324933125121386374556026239019389403336018576970746564093745069887950534538;\n uint256 constant IC4x = 21457380141608127838031972036608507773411663714612203367705414415111561961277;\n uint256 constant IC4y = 16018892444415488221673569328605540820594796341281504466704561641863116563640;\n uint256 constant IC5x = 4410962418506163125770089415721869910260536222460700836340037001025748261657;\n uint256 constant IC5y = 12196544090537868588257394514303562289870399093465372249911888281222653317102;\n uint256 constant IC6x = 16355683075872354209267838353583450687199376651860741592253396291886816543862;\n uint256 constant IC6y = 8050682799666257391554605850006270160377444038524969785464126797015352749651;\n uint256 constant IC7x = 15130082049987335261186284021682267001157753150054785745432629861697791280041;\n uint256 constant IC7y = 11409658019373236419032912460491744865103271076229735296217123384950365303683;\n uint256 constant IC8x = 9239095888561578936225914783731536081988128122942802873108497080576303816484;\n uint256 constant IC8y = 19627935081539557575283341840595370652002756337934390012485590940687364697288;\n uint256 constant IC9x = 1544399278273077596304550000514283833778290595157696898003276405603026075525;\n uint256 constant IC9y = 12446151319216301189634940789701302821473889204933697496346243428390391624249;\n uint256 constant IC10x = 4936749834027810796851373254552130530859646770418885520111981651453231423245;\n uint256 constant IC10y = 4695807811926245815954974360257940071643216870360652435028803223339780553170;\n uint256 constant IC11x = 4386575281807163938236728588139510785832125338080551306676099982544329826031;\n uint256 constant IC11y = 21854523620979501974914214769323826893815395641321488249328265610525413876169;\n uint256 constant IC12x = 17087426415995636070231091668322859160271781381287693465566270886052258684849;\n uint256 constant IC12y = 21281749810427109997695417984136831170564875549572164580740725078883719443756;\n uint256 constant IC13x = 4694568533132038325785559030661195239336100288714016265423550859067921485661;\n uint256 constant IC13y = 13379560590872257908754863449011215932119472869546011755200122317649852454611;\n uint256 constant IC14x = 10550810178264882050197120045435651255510437946929704560960055862934233593614;\n uint256 constant IC14y = 9782748714520027917613119514237169222361657844606804275223173790586411176386;\n uint256 constant IC15x = 5914524855691587775724793258915080995144157669338156007826407442379152618637;\n uint256 constant IC15y = 12397453008182332797283780921871184363383883818158138717833932109963434050176;\n uint256 constant IC16x = 16837586497481772092479543877979949414951845091405932961149069997036601470834;\n uint256 constant IC16y = 16144891566083854639395947018697451368349959925473031654640966655021187669246;\n uint256 constant IC17x = 10567482486088980042721003523293196249588750547058227520825109679160089820321;\n uint256 constant IC17y = 18477812318770410046283056381658040574361828280620497289914213363727644682160;\n // Memory data\n uint16 constant pVk = 0;\n uint16 constant pPairing = 128;\n\n uint16 constant pLastMem = 896;\n\n uint16 constant proofLength = 8;\n uint32 constant pubSignalLength = 17;\n\n /// @dev returns the verification keys in the order that the verifier expects them:\n /// alpha, beta, gamma, delta, ICs..\n function getVerificationKeys() public pure returns (uint[] memory) {\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n vks[10] = 13382824629081054131218833335176402998433623280720282474363094935338262422270;\n vks[11] = 14992997694787798298970128428651735156878746405574581777463392851219891893781;\n vks[12] = 804122157291260134274964543508763620825033741658958140658682496549278923901;\n vks[13] = 20795590244823410398603606172994427921866842716949936464446009005497705344370;\n vks[14] = 19764436097581810314981626268114476419304968023360522705050759260578697031462;\n vks[15] = 8451221249198589510842464045063602196787955791157681746389594127570869984928;\n vks[16] = 21274084361069811495645657261374711891271996424091601874260232553721691430414;\n vks[17] = 18000760790522873766821443416445254770267418552173774295864206456854759299925;\n vks[18] = 15406250183619285448547045124806907366410436301666555537778268068652090454826;\n vks[19] = 16536866637232299722780757345722186540586417773472679268766516998907360267632;\n vks[20] = 18374705184999687319171921539828416791438685495665607649793873489922597027600;\n vks[21] = 1324933125121386374556026239019389403336018576970746564093745069887950534538;\n vks[22] = 21457380141608127838031972036608507773411663714612203367705414415111561961277;\n vks[23] = 16018892444415488221673569328605540820594796341281504466704561641863116563640;\n vks[24] = 4410962418506163125770089415721869910260536222460700836340037001025748261657;\n vks[25] = 12196544090537868588257394514303562289870399093465372249911888281222653317102;\n vks[26] = 16355683075872354209267838353583450687199376651860741592253396291886816543862;\n vks[27] = 8050682799666257391554605850006270160377444038524969785464126797015352749651;\n vks[28] = 15130082049987335261186284021682267001157753150054785745432629861697791280041;\n vks[29] = 11409658019373236419032912460491744865103271076229735296217123384950365303683;\n vks[30] = 9239095888561578936225914783731536081988128122942802873108497080576303816484;\n vks[31] = 19627935081539557575283341840595370652002756337934390012485590940687364697288;\n vks[32] = 1544399278273077596304550000514283833778290595157696898003276405603026075525;\n vks[33] = 12446151319216301189634940789701302821473889204933697496346243428390391624249;\n vks[34] = 4936749834027810796851373254552130530859646770418885520111981651453231423245;\n vks[35] = 4695807811926245815954974360257940071643216870360652435028803223339780553170;\n vks[36] = 4386575281807163938236728588139510785832125338080551306676099982544329826031;\n vks[37] = 21854523620979501974914214769323826893815395641321488249328265610525413876169;\n vks[38] = 17087426415995636070231091668322859160271781381287693465566270886052258684849;\n vks[39] = 21281749810427109997695417984136831170564875549572164580740725078883719443756;\n vks[40] = 4694568533132038325785559030661195239336100288714016265423550859067921485661;\n vks[41] = 13379560590872257908754863449011215932119472869546011755200122317649852454611;\n vks[42] = 10550810178264882050197120045435651255510437946929704560960055862934233593614;\n vks[43] = 9782748714520027917613119514237169222361657844606804275223173790586411176386;\n vks[44] = 5914524855691587775724793258915080995144157669338156007826407442379152618637;\n vks[45] = 12397453008182332797283780921871184363383883818158138717833932109963434050176;\n vks[46] = 16837586497481772092479543877979949414951845091405932961149069997036601470834;\n vks[47] = 16144891566083854639395947018697451368349959925473031654640966655021187669246;\n vks[48] = 10567482486088980042721003523293196249588750547058227520825109679160089820321;\n vks[49] = 18477812318770410046283056381658040574361828280620497289914213363727644682160;\n return vks;\n }\n\n /// @dev return true if the public signal is aliased\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\n // Alias check\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\n if (_pubSignals[8] >= 340282366920938463463374607431768211456) { return true; }\n if (_pubSignals[9] >= 340282366920938463463374607431768211456) { return true; }\n if (_pubSignals[10] >= 340282366920938463463374607431768211456) { return true; }\n if (_pubSignals[11] >= 340282366920938463463374607431768211456) { return true; }\n if (_pubSignals[12] >= 18446744073709551616) { return true; }\n if (_pubSignals[13] >= 18446744073709551616) { return true; }\n if (_pubSignals[14] >= 512) { return true; }\n if (_pubSignals[15] >= 512) { return true; }\n if (_pubSignals[16] >= 4) { return true; }\n return false;\n }\n\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\n // Check Argument\n require(_proofs.length == proofLength, \"Invalid proof\");\n require(_pubSignals.length == pubSignalLength, \"Invalid public signal\");\n if (isAliased(_pubSignals)) { return false; }\n assembly {\n // G1 function to multiply a G1 value(x,y) to value in an address\n function g1_mulAccC(pR, x, y, s) {\n let success\n let mIn := mload(0x40)\n mstore(mIn, x)\n mstore(add(mIn, 32), y)\n mstore(add(mIn, 64), s)\n\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n\n mstore(add(mIn, 64), mload(pR))\n mstore(add(mIn, 96), mload(add(pR, 32)))\n\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n }\n\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\n let _pPairing := add(pMem, pPairing)\n let _pVk := add(pMem, pVk)\n\n mstore(_pVk, IC0x)\n mstore(add(_pVk, 32), IC0y)\n\n // Compute the linear combination it.vkey.vk_x\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\n g1_mulAccC(_pVk, IC10x, IC10y, calldataload(add(pubSignals, 288)))\n g1_mulAccC(_pVk, IC11x, IC11y, calldataload(add(pubSignals, 320)))\n g1_mulAccC(_pVk, IC12x, IC12y, calldataload(add(pubSignals, 352)))\n g1_mulAccC(_pVk, IC13x, IC13y, calldataload(add(pubSignals, 384)))\n g1_mulAccC(_pVk, IC14x, IC14y, calldataload(add(pubSignals, 416)))\n g1_mulAccC(_pVk, IC15x, IC15y, calldataload(add(pubSignals, 448)))\n g1_mulAccC(_pVk, IC16x, IC16y, calldataload(add(pubSignals, 480)))\n g1_mulAccC(_pVk, IC17x, IC17y, calldataload(add(pubSignals, 512)))\n // -A\n mstore(_pPairing, calldataload(pA))\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\n\n // B\n mstore(add(_pPairing, 64), calldataload(pB))\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\n\n // alpha1\n mstore(add(_pPairing, 192), alphax)\n mstore(add(_pPairing, 224), alphay)\n\n // beta2\n mstore(add(_pPairing, 256), betax1)\n mstore(add(_pPairing, 288), betax2)\n mstore(add(_pPairing, 320), betay1)\n mstore(add(_pPairing, 352), betay2)\n\n // it.vkey.vk_x\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\n\n // gamma2\n mstore(add(_pPairing, 448), gammax1)\n mstore(add(_pPairing, 480), gammax2)\n mstore(add(_pPairing, 512), gammay1)\n mstore(add(_pPairing, 544), gammay2)\n\n // C\n mstore(add(_pPairing, 576), calldataload(pC))\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\n\n // delta2\n mstore(add(_pPairing, 640), deltax1)\n mstore(add(_pPairing, 672), deltax2)\n mstore(add(_pPairing, 704), deltay1)\n mstore(add(_pPairing, 736), deltay2)\n\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\n\n isOk := and(success, mload(_pPairing))\n }\n\n let pMem := mload(0x40)\n mstore(0x40, add(pMem, pLastMem))\n\n // Validate all evaluations\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\n\n mstore(0, isValid)\n return(0, 0x20)\n }\n }\n}" + }, + "contracts/babyzk/test/RevocableProofVerifier.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n/*\n Copyright (c) 2021 0KIMS association.\n Copyright (c) [2024] Galxe.com.\n\n Modifications to this file are part of the Galxe Identity Protocol SDK,\n which is built using the snarkJS template and is subject to the GNU\n General Public License v3.0.\n\n snarkJS is free software: you can redistribute it and/or modify it\n under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\ncontract BabyZKGroth16RevocableVerifier {\n error AliasedPublicSignal();\n\n // Scalar field size\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\n // Base field size\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\n\n // Verification Key data\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n uint256 constant deltax1 = 1882364706458503005232475951038199065763410901527756464187180105229112396841;\n uint256 constant deltax2 = 13982707264366558261146595797542785363281966817985917957620993113155283930842;\n uint256 constant deltay1 = 3160664283412126522362163156335042446690680033366115964460170810315877756859;\n uint256 constant deltay2 = 3361216318719617247167450609233098257971537409972105379556292018008174242993;\n\n uint256 constant IC0x = 16344271723525745330089406167718673831229607420873253431918787878218777643278;\n uint256 constant IC0y = 19068357211030992922788254345123980117959234850319825677618292842457691405030;\n uint256 constant IC1x = 6014118828353164019223759243643946490962455888512110113738628213575528401078;\n uint256 constant IC1y = 952560696260176513599650249066337469280887181447382521840961688826023614065;\n uint256 constant IC2x = 18014663056359008200385623839092936993447069832043874378189731939631495230189;\n uint256 constant IC2y = 16795844646742494465437498259853472142944507173403737817366815256427780734236;\n uint256 constant IC3x = 14373415734035609721810433489583741151275932240655064686290661196403337233503;\n uint256 constant IC3y = 1711037313693371500679228513798872233623076292082332844479396590369924301500;\n uint256 constant IC4x = 4377713024822627456391534429519105229432261544520581999724742076362647481991;\n uint256 constant IC4y = 3654939157182750025626238971442334937379360345622454301685395907715915786528;\n uint256 constant IC5x = 12434842560341427381091009848886966190317018431571186985212767913582793091033;\n uint256 constant IC5y = 960689068374467506525486367991002349267374064041230446260392423587028682797;\n uint256 constant IC6x = 16116740122579596964080959678026860764868509051069170613097150798900574800120;\n uint256 constant IC6y = 18625490230063446491898055124160076553956874307937109426236634069554743739504;\n uint256 constant IC7x = 3328183361741286394228024661246306080676729522823836540770459393800572206293;\n uint256 constant IC7y = 7727929394925246597242379189968256067843999732477725082090107983219972969086;\n uint256 constant IC8x = 13472499580349749560725914977774410001141081275760218439463081236979741688008;\n uint256 constant IC8y = 19530618553320463860467186577796936833360983842014858203085348959353732645230;\n uint256 constant IC9x = 17498277990495913709037423552919656338979160919293909339937141462684017956196;\n uint256 constant IC9y = 6257656821019173674606933263592807142929692127931766385726132437188595517970;\n uint256 constant IC10x = 9904744704295542451075353263976479631548333459739603579416762901546454395958;\n uint256 constant IC10y = 16865653462242999988333261656181644976255484812213305768443543308570775445853;\n uint256 constant IC11x = 17276930714424563938521830782032618868277725616148136077827171096394434413630;\n uint256 constant IC11y = 17596926818845562345130858017563587378698929254267990545207760627791567992437;\n uint256 constant IC12x = 10690041012906057134648963944616475397467203110933997351171385905107603786178;\n uint256 constant IC12y = 2426599412031276779556285272336062830283714413559998841981451603513647891427;\n uint256 constant IC13x = 14677712908659821988951510335729733019134170755054403947488039668179369204015;\n uint256 constant IC13y = 17861018456699773219339698494130023475752223596270757350019479155022095189599;\n uint256 constant IC14x = 4059590728914927822667888753564200978294911732087844349849756028359048383529;\n uint256 constant IC14y = 11851363417295131201057968329773341445724280888705510695977394342536126807843;\n uint256 constant IC15x = 7994873373382848775309022009493019090315919998684705676392084020203450953676;\n uint256 constant IC15y = 18423877133953363736951056196478183204211849265221023917424661421126345305172;\n uint256 constant IC16x = 19381774082078471354145054015992261706028134987966526644430415687337728636125;\n uint256 constant IC16y = 3041262511371001224328973897499583386865775708418990603668899165883122322535;\n uint256 constant IC17x = 15576831529985557090169220347479648025003475911133392527968808385164396707157;\n uint256 constant IC17y = 20786553444063989335647215616824231285883907234229069851003359096848464931780;\n uint256 constant IC18x = 10242101596772973919673378396182430798758626758072900422483984912622144535264;\n uint256 constant IC18y = 20964342351907694552983231154762237386081339332634359708567530724290111337773;\n // Memory data\n uint16 constant pVk = 0;\n uint16 constant pPairing = 128;\n\n uint16 constant pLastMem = 896;\n\n uint16 constant proofLength = 8;\n uint32 constant pubSignalLength = 18;\n\n /// @dev returns the verification keys in the order that the verifier expects them:\n /// alpha, beta, gamma, delta, ICs..\n function getVerificationKeys() public pure returns (uint[] memory) {\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n vks[10] = 1882364706458503005232475951038199065763410901527756464187180105229112396841;\n vks[11] = 13982707264366558261146595797542785363281966817985917957620993113155283930842;\n vks[12] = 3160664283412126522362163156335042446690680033366115964460170810315877756859;\n vks[13] = 3361216318719617247167450609233098257971537409972105379556292018008174242993;\n vks[14] = 16344271723525745330089406167718673831229607420873253431918787878218777643278;\n vks[15] = 19068357211030992922788254345123980117959234850319825677618292842457691405030;\n vks[16] = 6014118828353164019223759243643946490962455888512110113738628213575528401078;\n vks[17] = 952560696260176513599650249066337469280887181447382521840961688826023614065;\n vks[18] = 18014663056359008200385623839092936993447069832043874378189731939631495230189;\n vks[19] = 16795844646742494465437498259853472142944507173403737817366815256427780734236;\n vks[20] = 14373415734035609721810433489583741151275932240655064686290661196403337233503;\n vks[21] = 1711037313693371500679228513798872233623076292082332844479396590369924301500;\n vks[22] = 4377713024822627456391534429519105229432261544520581999724742076362647481991;\n vks[23] = 3654939157182750025626238971442334937379360345622454301685395907715915786528;\n vks[24] = 12434842560341427381091009848886966190317018431571186985212767913582793091033;\n vks[25] = 960689068374467506525486367991002349267374064041230446260392423587028682797;\n vks[26] = 16116740122579596964080959678026860764868509051069170613097150798900574800120;\n vks[27] = 18625490230063446491898055124160076553956874307937109426236634069554743739504;\n vks[28] = 3328183361741286394228024661246306080676729522823836540770459393800572206293;\n vks[29] = 7727929394925246597242379189968256067843999732477725082090107983219972969086;\n vks[30] = 13472499580349749560725914977774410001141081275760218439463081236979741688008;\n vks[31] = 19530618553320463860467186577796936833360983842014858203085348959353732645230;\n vks[32] = 17498277990495913709037423552919656338979160919293909339937141462684017956196;\n vks[33] = 6257656821019173674606933263592807142929692127931766385726132437188595517970;\n vks[34] = 9904744704295542451075353263976479631548333459739603579416762901546454395958;\n vks[35] = 16865653462242999988333261656181644976255484812213305768443543308570775445853;\n vks[36] = 17276930714424563938521830782032618868277725616148136077827171096394434413630;\n vks[37] = 17596926818845562345130858017563587378698929254267990545207760627791567992437;\n vks[38] = 10690041012906057134648963944616475397467203110933997351171385905107603786178;\n vks[39] = 2426599412031276779556285272336062830283714413559998841981451603513647891427;\n vks[40] = 14677712908659821988951510335729733019134170755054403947488039668179369204015;\n vks[41] = 17861018456699773219339698494130023475752223596270757350019479155022095189599;\n vks[42] = 4059590728914927822667888753564200978294911732087844349849756028359048383529;\n vks[43] = 11851363417295131201057968329773341445724280888705510695977394342536126807843;\n vks[44] = 7994873373382848775309022009493019090315919998684705676392084020203450953676;\n vks[45] = 18423877133953363736951056196478183204211849265221023917424661421126345305172;\n vks[46] = 19381774082078471354145054015992261706028134987966526644430415687337728636125;\n vks[47] = 3041262511371001224328973897499583386865775708418990603668899165883122322535;\n vks[48] = 15576831529985557090169220347479648025003475911133392527968808385164396707157;\n vks[49] = 20786553444063989335647215616824231285883907234229069851003359096848464931780;\n vks[50] = 10242101596772973919673378396182430798758626758072900422483984912622144535264;\n vks[51] = 20964342351907694552983231154762237386081339332634359708567530724290111337773;\n return vks;\n }\n\n /// @dev return true if the public signal is aliased\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\n // Alias check\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\n if (_pubSignals[8] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[9] >= 340282366920938463463374607431768211456) { return true; }\n if (_pubSignals[10] >= 340282366920938463463374607431768211456) { return true; }\n if (_pubSignals[11] >= 340282366920938463463374607431768211456) { return true; }\n if (_pubSignals[12] >= 340282366920938463463374607431768211456) { return true; }\n if (_pubSignals[13] >= 18446744073709551616) { return true; }\n if (_pubSignals[14] >= 18446744073709551616) { return true; }\n if (_pubSignals[15] >= 512) { return true; }\n if (_pubSignals[16] >= 512) { return true; }\n if (_pubSignals[17] >= 4) { return true; }\n return false;\n }\n\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\n // Check Argument\n require(_proofs.length == proofLength, \"Invalid proof\");\n require(_pubSignals.length == pubSignalLength, \"Invalid public signal\");\n if (isAliased(_pubSignals)) { return false; }\n assembly {\n // G1 function to multiply a G1 value(x,y) to value in an address\n function g1_mulAccC(pR, x, y, s) {\n let success\n let mIn := mload(0x40)\n mstore(mIn, x)\n mstore(add(mIn, 32), y)\n mstore(add(mIn, 64), s)\n\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n\n mstore(add(mIn, 64), mload(pR))\n mstore(add(mIn, 96), mload(add(pR, 32)))\n\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n }\n\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\n let _pPairing := add(pMem, pPairing)\n let _pVk := add(pMem, pVk)\n\n mstore(_pVk, IC0x)\n mstore(add(_pVk, 32), IC0y)\n\n // Compute the linear combination it.vkey.vk_x\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\n g1_mulAccC(_pVk, IC10x, IC10y, calldataload(add(pubSignals, 288)))\n g1_mulAccC(_pVk, IC11x, IC11y, calldataload(add(pubSignals, 320)))\n g1_mulAccC(_pVk, IC12x, IC12y, calldataload(add(pubSignals, 352)))\n g1_mulAccC(_pVk, IC13x, IC13y, calldataload(add(pubSignals, 384)))\n g1_mulAccC(_pVk, IC14x, IC14y, calldataload(add(pubSignals, 416)))\n g1_mulAccC(_pVk, IC15x, IC15y, calldataload(add(pubSignals, 448)))\n g1_mulAccC(_pVk, IC16x, IC16y, calldataload(add(pubSignals, 480)))\n g1_mulAccC(_pVk, IC17x, IC17y, calldataload(add(pubSignals, 512)))\n g1_mulAccC(_pVk, IC18x, IC18y, calldataload(add(pubSignals, 544)))\n // -A\n mstore(_pPairing, calldataload(pA))\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\n\n // B\n mstore(add(_pPairing, 64), calldataload(pB))\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\n\n // alpha1\n mstore(add(_pPairing, 192), alphax)\n mstore(add(_pPairing, 224), alphay)\n\n // beta2\n mstore(add(_pPairing, 256), betax1)\n mstore(add(_pPairing, 288), betax2)\n mstore(add(_pPairing, 320), betay1)\n mstore(add(_pPairing, 352), betay2)\n\n // it.vkey.vk_x\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\n\n // gamma2\n mstore(add(_pPairing, 448), gammax1)\n mstore(add(_pPairing, 480), gammax2)\n mstore(add(_pPairing, 512), gammay1)\n mstore(add(_pPairing, 544), gammay2)\n\n // C\n mstore(add(_pPairing, 576), calldataload(pC))\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\n\n // delta2\n mstore(add(_pPairing, 640), deltax1)\n mstore(add(_pPairing, 672), deltax2)\n mstore(add(_pPairing, 704), deltay1)\n mstore(add(_pPairing, 736), deltay2)\n\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\n\n isOk := and(success, mload(_pPairing))\n }\n\n let pMem := mload(0x40)\n mstore(0x40, add(pMem, pLastMem))\n\n // Validate all evaluations\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\n\n mstore(0, isValid)\n return(0, 0x20)\n }\n }\n}" + }, + "contracts/ContextRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport { IContextRegistry } from \"./interfaces/IContextRegistry.sol\";\n\n/// @notice ContextRegistry is a contract that allows the registration of contexts.\n/// Contexts are strings that represent a specific context for credentials. They\n/// are ownerless and can be registered and used by anyone.\ncontract ContextRegistry is IContextRegistry {\n error AlreadyExists();\n\n // The global mapping between contexts and their contextID.\n mapping(uint160 contextId => string context) private _registry;\n\n /// @dev register a new context\n function registerContext(string calldata context) external override returns (uint160) {\n uint160 contextID = _getContextID(context);\n if (bytes(_registry[contextID]).length != 0) {\n revert AlreadyExists();\n }\n _registry[contextID] = context;\n emit ContextRegistered(contextID, context);\n return contextID;\n }\n\n /// @dev get the context for the given contextID\n function getContext(uint160 contextId) external view override returns (string memory) {\n return _registry[contextId];\n }\n\n /// @dev calculate the contextID for a given context string\n function calculateContextID(string calldata context) external pure override returns (uint160) {\n return _getContextID(context);\n }\n\n /**\n * ContextID is the lower 160 bits of the keccak256 hash of the context string.\n * @param context The context string to get the contextID for.\n */\n function _getContextID(string calldata context) private pure returns (uint160) {\n return uint160(uint256(keccak256(abi.encodePacked(context))));\n }\n}\n" + }, + "contracts/interfaces/IAggregatedStatefulVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport { IIssuerRegistry } from \"./IIssuerRegistry.sol\";\nimport { ITypeRegistry } from \"./ITypeRegistry.sol\";\nimport { ProofReference, IUpaVerifier } from \"./IUpaVerifier.sol\";\n\n/// @title VerifyResult\n/// @notice Enum representing the possible results of a proof verification.\n/// Only the OK result indicates a successful verification.\nenum VerifyResult {\n OK,\n TYPE_UNINITIALIZED,\n TYPE_ID_MISMATCH,\n CONTEXT_ID_MISMATCH,\n PUBKEY_INACTIVE,\n SIG_REVOCATION_SMT_ROOT_MISMATCH,\n PROOF_INVALID,\n EXPIRED,\n ALIASED_SIGNAL,\n UNKNOWN_ERROR\n}\n\n/// @title IAggregatedStatefulVerifier\n/// @notice Interface for the AggregatedStatefulVerifier contract which handles on-chain stateful verification of zero-knowledge proofs\n/// with proof aggregator.\ninterface IAggregatedStatefulVerifier {\n /// @notice Emitted when the TypeRegistry is updated.\n /// @param oldTypeRegistry The address of the old TypeRegistry.\n /// @param newTypeRegistry The address of the new TypeRegistry.\n event TypeRegistryUpdated(ITypeRegistry oldTypeRegistry, ITypeRegistry newTypeRegistry);\n\n /// @notice Emitted when the IssuerRegistry is updated.\n /// @param oldIssuerRegistry The address of the old IssuerRegistry.\n /// @param newIssuerRegistry The address of the new IssuerRegistry.\n event IssuerRegistryUpdated(IIssuerRegistry oldIssuerRegistry, IIssuerRegistry newIssuerRegistry);\n\n /// @notice Emitted when the UpaVerifier is updated.\n /// @param oldUpaVerifier The address of the old UpaVerifier.\n /// @param newUpaVerifier The address of the new UpaVerifier.\n event UpaVerifierUpdated(IUpaVerifier oldUpaVerifier, IUpaVerifier newUpaVerifier);\n\n /// @notice Performs static verification of zero-knowledge proofs.\n /// @param typeId The type ID of the proof to verify.\n /// @param contextId The context ID of the proof to verify.\n /// @param keyId The key ID associated with the proof.\n /// @param circuitId The circuit ID for proof aggregator.\n /// @param publicSignals An array containing the public signals data.\n /// @return A value from the VerifyResult enum representing the verification result.\n function verifyProofStatic(\n uint160 typeId,\n uint160 contextId,\n uint256 keyId,\n uint256 circuitId,\n uint256[] calldata publicSignals\n ) external view returns (VerifyResult);\n\n /// @notice Performs static verification of zero-knowledge proofs.\n /// @param typeId The type ID of the proof to verify.\n /// @param contextId The context ID of the proof to verify.\n /// @param keyId The key ID associated with the proof.\n /// @param circuitId The circuit ID for proof aggregator.\n /// @param publicSignals An array containing the public signals data.\n /// @param proofReference Reference to proofs that were part of a multi-proof submission.\n /// @return A value from the VerifyResult enum representing the verification result.\n function verifyProofStaticFromMultiProof(\n uint160 typeId,\n uint160 contextId,\n uint256 keyId,\n uint256 circuitId,\n uint256[] calldata publicSignals,\n ProofReference calldata proofReference\n ) external view returns (VerifyResult);\n\n /// @notice Performs full verification of zero-knowledge proofs, including issuer public key activity and revocation checks.\n /// @param typeId The type ID of the proof to verify.\n /// @param contextId The context ID of the proof to verify.\n /// @param issuerId The issuer ID associated with the proof.\n /// @param circuitId The circuit ID for proof aggregator.\n /// @param publicSignals An array containing the public signals data.\n /// @return A value from the VerifyResult enum representing the verification result.\n function verifyProofFull(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n uint256 circuitId,\n uint256[] calldata publicSignals\n ) external view returns (VerifyResult);\n\n /// @notice Performs full verification of zero-knowledge proofs, including issuer public key activity and revocation checks.\n /// @param typeId The type ID of the proof to verify.\n /// @param contextId The context ID of the proof to verify.\n /// @param issuerId The issuer ID associated with the proof.\n /// @param circuitId The circuit ID for proof aggregator.\n /// @param publicSignals An array containing the public signals data.\n /// @param proofReference Reference to proofs that were part of a multi-proof submission.\n /// @return A value from the VerifyResult enum representing the verification result.\n function verifyProofFullFromMultiProof(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n uint256 circuitId,\n uint256[] calldata publicSignals,\n ProofReference calldata proofReference\n ) external view returns (VerifyResult);\n\n /// @notice Returns the current TypeRegistry address.\n /// @return The address of the TypeRegistry.\n function getTypeRegistry() external view returns (ITypeRegistry);\n\n /// @notice Returns the current IssuerRegistry address.\n /// @return The address of the IssuerRegistry.\n function getIssuerRegistry() external view returns (IIssuerRegistry);\n\n /// @notice Returns the current UpaVerifier address.\n /// @return The address of the UpaVerifier.\n function getUpaVerifier() external view returns (IUpaVerifier);\n}\n" + }, + "contracts/interfaces/IContextRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\n/// @title Context Registry Interface\ninterface IContextRegistry {\n // Events\n event ContextRegistered(uint160 indexed contextId, string context);\n\n /// @dev registerContext registers a new context and returns the contextId\n function registerContext(string calldata context) external returns (uint160);\n\n /// @dev getContext returns the context for the given contextId\n function getContext(uint160 contextId) external returns (string memory);\n\n /// @dev calculate the contextID for a given context string\n function calculateContextID(string calldata context) external pure returns (uint160);\n}\n" + }, + "contracts/interfaces/IIssuerRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\n/// @dev The status of the public key, only active public key can be used for verification.\nenum PublicKeyStatus {\n UNINITIALIZED,\n REVOKED,\n ACTIVE\n}\n\n/// @dev The public key struct\nstruct PublicKey {\n /// @dev the verification stack id that the public key is enabled for.\n mapping(uint8 => bool) enabledVerificationStacks;\n /// @dev the status of the public key\n PublicKeyStatus status;\n /// @dev the raw bytes of the public key. Not used in the contract, only for off-chain usage.\n /// The spec for marshalling the public key is defined by the issuer.\n bytes raw;\n}\n\n/// @dev The revoked signature ID in a sparsed merkle tree.\nstruct SignatureState {\n /// @dev the root hash of the sparsed merkle tree.\n bytes32 root;\n /// @dev uri to the sparsed merkle tree, representing the revoked signature ids.\n string treeURI;\n}\n\n/// @dev The issuer struct\nstruct Issuer {\n /// @dev the name of the issuer\n string name;\n /// @dev the admin of the issuer, who can add or revoke public keys.\n address admin;\n}\n\n/// @title IIssuerRegistry\n/// @dev The interface for the issuer registry contract.\ninterface IIssuerRegistry {\n /// @notice Emitted when a new issuer is registered in the registry.\n /// @param issuerId Unique identifier for the newly registered issuer.\n /// @param name Name of the issuer registered.\n event IssuerRegistered(uint256 indexed issuerId, string name);\n\n /// @notice Emitted when an issuer's administrative role is transferred to a new address.\n /// @param issuerId ID of issuer whose admin is being transferred.\n /// @param oldAdmin Address of the current admin being replaced.\n /// @param newAdmin Address of the new admin taking over.\n event IssuerAdminTransferred(uint256 indexed issuerId, address indexed oldAdmin, address indexed newAdmin);\n\n /// @notice Emitted when the status of a public key is updated.\n /// @param issuerId ID for the issuer to whom the public key belongs.\n /// @param publicKeyId ID for the public key being updated.\n /// @param status New status of the public key.\n event PublicKeyStatusUpdated(uint256 indexed issuerId, uint256 indexed publicKeyId, PublicKeyStatus status);\n\n /// @notice Emitted when the verification stack for a public key is updated.\n /// @param issuerId Unique identifier for the issuer to whom the public key belongs.\n /// @param publicKeyId Unique identifier for the public key.\n /// @param verificationStackId Identifier for the verification stack being updated.\n /// @param enabled Boolean indicating whether the stack is enabled or disabled for the public key.\n event PublicKeyVerificationStackUpdated(\n uint256 indexed issuerId,\n uint256 indexed publicKeyId,\n uint256 indexed verificationStackId,\n bool enabled\n );\n\n /// @notice Emitted when the signature state URI is updated for a specific type and context.\n /// @param typeId Type identifier for the signature state being updated.\n /// @param contextID Context identifier for the signature state being updated.\n /// @param issuerId Issuer identifier related to the signature state.\n /// @param newTreeURI New URI for the signature state tree.\n event SignatureStateURIUpdated(\n uint160 indexed typeId,\n uint160 indexed contextID,\n uint256 indexed issuerId,\n string newTreeURI\n );\n\n /// @notice Emitted when the signature state root is updated for a specific type and context.\n /// @param typeId Type identifier for the signature state being updated.\n /// @param contextID Context identifier for the signature state being updated.\n /// @param issuerId Issuer identifier related to the signature state.\n /// @param newRoot New root hash for the signature state tree.\n event SignatureStateRootUpdated(\n uint160 indexed typeId,\n uint160 indexed contextID,\n uint256 indexed issuerId,\n bytes32 newRoot\n );\n\n /// @dev Registers a new issuer along with their first public key and enabled verification stack.\n /// @param name Name of the issuer to register.\n /// @param verificationStackId Identifier for the verification stack.\n /// @param publicKeyId Identifier for the issuer's public key.\n /// @param publicKeyRaw The raw public key data.\n /// @return The unique identifier for the newly registered issuer.\n function registerIssuer(\n string calldata name,\n uint8 verificationStackId,\n uint256 publicKeyId,\n bytes calldata publicKeyRaw\n ) external returns (uint256);\n\n /// @dev Transfers the administrative role of an issuer to a new owner.\n /// @param issuerId Unique identifier for the issuer.\n /// @param newOwner Address of the new administrator.\n function transferIssuerAdmin(uint256 issuerId, address newOwner) external;\n\n /// @dev Adds a new public key for an issuer and enables it for a specified verification stack.\n /// @param issuerId Unique identifier for the issuer.\n /// @param verificationStackId Identifier for the verification stack.\n /// @param publicKeyId Unique identifier for the new public key.\n /// @param publicKeyRaw The raw public key data.\n function addPublicKey(\n uint256 issuerId,\n uint8 verificationStackId,\n uint256 publicKeyId,\n bytes calldata publicKeyRaw\n ) external;\n\n /// @dev Updates the status (active/revoked) of an issuer's public key.\n /// @param issuerId Unique identifier for the issuer.\n /// @param publicKeyId Unique identifier for the public key.\n /// @param status New status for the public key.\n // only the issuer admin can call this function\n function updatePublicKeyStatus(uint256 issuerId, uint256 publicKeyId, PublicKeyStatus status) external;\n\n /// @dev Updates the verification stack association for an issuer's public key.\n /// @param issuerId Unique identifier for the issuer.\n /// @param publicKeyId Unique identifier for the public key.\n /// @param verificationStackId New verification stack identifier for the public key.\n /// @param enabled Boolean indicating whether the stack is enabled for the public key.\n function updatePublicKeyVerificationStack(\n uint256 issuerId,\n uint256 publicKeyId,\n uint8 verificationStackId,\n bool enabled\n ) external;\n\n /// @dev Updates the signature state URI for a given type and context.\n /// @param typeId Type identifier.\n /// @param contextId Context identifier.\n /// @param issuerId Unique identifier for the issuer.\n /// @param treeURI New URI for the signature state.\n function updateSignatureStateURI(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n string calldata treeURI\n ) external;\n\n /// @dev Updates the signature SMT root for a given type, context and issuer.\n /// @param typeId Type identifier.\n /// @param contextId Context identifier.\n /// @param issuerId Unique identifier for the issuer.\n /// @param root New root hash for the revoked SMT.\n function updateSignatureState(uint160 typeId, uint160 contextId, uint256 issuerId, bytes32 root) external;\n\n /// @dev Sets both the signature SMT URI and root for a given type, context and issuer.\n /// @param typeId Type identifier.\n /// @param contextId Context identifier.\n /// @param issuerId Unique identifier for the issuer.\n /// @param treeURI New URI for the signature state.\n /// @param root New root hash for the signature state.\n function setSignatureState(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n string calldata treeURI,\n bytes32 root\n ) external;\n\n /// @dev Retrieves the issuer data, reverts if the issuer does not exist.\n /// @param issuerId Unique identifier for the issuer.\n /// @return Issuer data structure containing issuer details.\n function getIssuer(uint256 issuerId) external view returns (Issuer memory);\n\n /// @dev Retrieves the raw public key data for an issuer's public key.\n /// @param issuerId Unique identifier for the issuer.\n /// @param publicKeyId Unique identifier for the public key.\n /// @return The raw public key data.\n function getPublicKeyRaw(uint256 issuerId, uint256 publicKeyId) external view returns (bytes memory);\n\n /// @dev Checks if an issuer's public key is active.\n /// @param issuerId Unique identifier for the issuer.\n /// @param publicKeyId Unique identifier for the public key.\n /// @return True if the public key is active, false otherwise.\n function isPublicKeyActive(uint256 issuerId, uint256 publicKeyId) external view returns (bool);\n\n /// @dev Checks if an issuer's public key is active and enabled for a specific verification stack.\n /// @param issuerId Unique identifier for the issuer.\n /// @param publicKeyId Unique identifier for the public key.\n /// @param verificationStackId Identifier for the verification stack.\n /// @return True if the public key is active and enabled for the stack, false otherwise.\n function isPublicKeyActiveForStack(\n uint256 issuerId,\n uint256 publicKeyId,\n uint8 verificationStackId\n ) external view returns (bool);\n\n /// @dev Retrieves the signature state for a given type, context and issuer.\n /// @param typeId Type identifier.\n /// @param contextId Context identifier.\n /// @param issuerId Unique identifier for the issuer.\n /// @return The signature state.\n function getSignatureState(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId\n ) external view returns (SignatureState memory);\n\n /// @dev Retrieves the signature state URI for a given type, context and issuer.\n /// @param typeId Type identifier.\n /// @param contextId Context identifier.\n /// @param issuerId Unique identifier for the issuer.\n /// @return The URI of the signature state.\n function getSignatureStateURI(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId\n ) external view returns (string memory);\n\n /// @dev Retrieves the signature state root for a given type, context and issuer.\n /// @param typeId Type identifier.\n /// @param contextId Context identifier.\n /// @param issuerId Unique identifier for the issuer.\n /// @return The root hash of the signature state.\n function getSignatureStateRoot(uint160 typeId, uint160 contextId, uint256 issuerId) external view returns (bytes32);\n}\n" + }, + "contracts/interfaces/IProofVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\n/// @title IProofVerifier\n/// @dev Interface for static verification of zero-knowledge proofs.\ninterface IProofVerifier {\n /// @notice Retrieves the verification keys.\n /// @dev This function is used to get the verification keys that are necessary for verifying proofs.\n /// @return An array of `uint` representing the verification keys.\n function getVerificationKeys() external view returns (uint256[] memory);\n\n /// @dev Checks if the public signals are aliased. Aliased signals should never be used in proofs.\n /// This is useful when using proof aggregators that does not check for signal aliasing.\n /// @param _pubSignals An array of `uint` representing the public signals.\n /// @return A boolean value indicating if any public signal is aliased (`true`) or not (`false`).\n function isAliased(uint256[] calldata _pubSignals) external view returns (bool);\n\n /// @dev This function takes a cryptographic proof and public signals to verify the proof's validity.\n /// @notice It verifies the proof and check if public signals were aliased.\n /// @param _proofs An array of `uint` representing the proof.\n /// @param _pubSignals An array of `uint` representing the public signals.\n /// @return A boolean value indicating whether the proof is valid (`true`) or not (`false`).\n function verifyProof(uint256[] calldata _proofs, uint256[] calldata _pubSignals) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IPublicSignalGetter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\n/// @title Intrinsic Signal enum\nenum IntrinsicSignalName {\n TYPE,\n CONTEXT,\n NULLIFIER,\n EXTERNAL_NULLIFIER,\n REVEAL_IDENTITY,\n EXPIRATION_LB,\n KEY_ID,\n ID_EQUALS_TO,\n SIG_REVOCATION_SMT_ROOT\n}\n\n/// @title Public Signal Getter Interface\n/// @dev Public signals (inputs) are represented as an array of uints in galxe identity protocol.\n/// To find the public signal for a given signal name, type designer should set a contract\n/// in the type registry that implements this interface.\ninterface IPublicSignalGetter {\n /// @dev get the public signal for the signal name, represented as the given enum (represented as uint8), based on the public signals.\n /// @notice Implementation must be able to handle intrinsic signals, defiend in IntrinsicSignalName enum.\n /// Type-specific signals support is optional.\n /// @param name The signal name, represented as the given enum (converted to uint8).\n /// @param publicSignals The public signals.\n function getPublicSignal(uint8 name, uint256[] calldata publicSignals) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IStatefulVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport { IIssuerRegistry } from \"./IIssuerRegistry.sol\";\nimport { ITypeRegistry } from \"./ITypeRegistry.sol\";\n\n/// @title VerifyResult\n/// @notice Enum representing the possible results of a proof verification.\n/// Only the OK result indicates a successful verification.\nenum VerifyResult {\n OK,\n TYPE_UNINITIALIZED,\n TYPE_ID_MISMATCH,\n CONTEXT_ID_MISMATCH,\n PUBKEY_INACTIVE,\n SIG_REVOCATION_SMT_ROOT_MISMATCH,\n PROOF_INVALID,\n EXPIRED,\n UNKNOWN_ERROR\n}\n\n/// @title IBabyzkStatefulVerifier\n/// @notice Interface for the BabyzkStatefulVerifier contract which handles on-chain stateful verification of zero-knowledge proofs.\ninterface IStatefulVerifier {\n /// @notice Emitted when the TypeRegistry is updated.\n /// @param oldTypeRegistry The address of the old TypeRegistry.\n /// @param newTypeRegistry The address of the new TypeRegistry.\n event TypeRegistryUpdated(ITypeRegistry oldTypeRegistry, ITypeRegistry newTypeRegistry);\n\n /// @notice Emitted when the IssuerRegistry is updated.\n /// @param oldIssuerRegistry The address of the old IssuerRegistry.\n /// @param newIssuerRegistry The address of the new IssuerRegistry.\n event IssuerRegistryUpdated(IIssuerRegistry oldIssuerRegistry, IIssuerRegistry newIssuerRegistry);\n\n /// @notice Performs static verification of zero-knowledge proofs.\n /// @param typeId The type ID of the proof to verify.\n /// @param contextId The context ID of the proof to verify.\n /// @param keyId The key ID associated with the proof.\n /// @param proofs An array containing the proof data.\n /// @param publicSignals An array containing the public signals data.\n /// @return A value from the VerifyResult enum representing the verification result.\n function verifyProofStatic(\n uint160 typeId,\n uint160 contextId,\n uint256 keyId,\n uint256[] calldata proofs,\n uint256[] calldata publicSignals\n ) external view returns (VerifyResult);\n\n /// @notice Performs full verification of zero-knowledge proofs, including issuer public key activity and revocation checks.\n /// @param typeId The type ID of the proof to verify.\n /// @param contextId The context ID of the proof to verify.\n /// @param issuerId The issuer ID associated with the proof.\n /// @param proofs An array containing the proof data.\n /// @param publicSignals An array containing the public signals data.\n /// @return A value from the VerifyResult enum representing the verification result.\n function verifyProofFull(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n uint256[] calldata proofs,\n uint256[] calldata publicSignals\n ) external view returns (VerifyResult);\n\n /// @notice Returns the current TypeRegistry address.\n /// @return The address of the TypeRegistry.\n function getTypeRegistry() external view returns (ITypeRegistry);\n\n /// @notice Returns the current IssuerRegistry address.\n /// @return The address of the IssuerRegistry.\n function getIssuerRegistry() external view returns (IIssuerRegistry);\n}\n" + }, + "contracts/interfaces/ITypeRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport { IProofVerifier } from \"./IProofVerifier.sol\";\nimport { IPublicSignalGetter } from \"./IPublicSignalGetter.sol\";\n\n/// @title Credential Type\n/// @dev Defines the structure of a credential type.\nstruct CredentialType {\n // @dev This flag indicates if the credential type support revocation.\n bool revocable;\n // @dev The address of the admin of the credential type, initially set to the creator.\n address admin;\n // @dev Provides a human-readable identifier for the credential.\n string name;\n // @dev The type specification of Galxe Identity Credential Type Schema.\n string definition;\n // @dev Additional context or information about the type.\n string description;\n // @dev A URI to an external JSON file of more information about the credential.\n // See whitepaper for the JSON schema specification.\n string resourceURI;\n}\n\n/// @title Credential Type Config, miscellanous.\n/// @notice To save stack space, we use this struct to store the verifier and public signal getter.\nstruct CredentialTypeMiscConfig {\n bool revocable;\n uint8 verificationStackId;\n IProofVerifier verifier;\n IPublicSignalGetter publicSignalGetter;\n}\n\n/// @title Interface for Type Registration Contract\n/// @notice This interface defines the functions for registering and managing types by users.\ninterface ITypeRegistry {\n /// @dev Emitted when a new type is registered\n /// @param typeID Unique identifier for the registered type\n /// @param admin Address of the admin of the type.\n /// @param name Name of the type\n /// @param definition Immutable definition of the type\n /// @param description Immutable description of the type\n /// @param resourceURI Mutable resource URI for the type\n event TypeRegistered(\n uint160 indexed typeID,\n address indexed admin,\n string name,\n string definition,\n string description,\n string resourceURI\n );\n\n /// @dev Emitted when the resource URI of a type is updated\n /// @param typeID Unique identifier for the type being updated\n /// @param oldResourceURI The previous resource URI\n /// @param newResourceURI The new resource URI\n event TypeResourceURIUpdated(uint160 indexed typeID, string oldResourceURI, string newResourceURI);\n\n /// @dev Emitted when a proof verifier is updated for a type\n /// @param typeID type id\n /// @param verificationStackID verification stack id\n /// @param verifier address of the verifier\n event TypeVerifierUpdated(uint160 indexed typeID, uint8 indexed verificationStackID, address indexed verifier);\n\n /// @dev Emitted when the intrinsic signal indexes are updated for a type\n /// @param typeID type id\n /// @param verificationStackID verification stack id\n /// @param publicSignalGetter address of the public signal getter\n event TypePublicSignalGetterUpdated(\n uint160 indexed typeID,\n uint8 indexed verificationStackID,\n address indexed publicSignalGetter\n );\n\n /// @dev Emitted when the admin of a type is transferred\n /// @param typeID type id\n /// @param oldAdmin address of the old admin\n /// @param newAdmin address of the new admin\n event TypeAdminTransferred(uint160 indexed typeID, address indexed oldAdmin, address indexed newAdmin);\n\n /// @dev transfer the ownership of a type.\n /// @param typeId type id of the type\n /// @param newAdmin address of the new admin\n function transferTypeAdmin(uint160 typeId, address newAdmin) external;\n\n /// @notice set a primitive type, only callable by the admin.\n /// @param typeId the type id of the primitive type\n /// @param name name of the type\n /// @param definition definition string\n /// @param description Description of the type\n /// @param resourceURI Mutable resource URI of the type\n /// @param config revocable, verifier and public signal getter.\n function setPrimitiveType(\n uint160 typeId,\n string calldata name,\n string calldata definition,\n string calldata description,\n string calldata resourceURI,\n CredentialTypeMiscConfig calldata config\n ) external;\n\n /// @notice Register a new type by `msg.sender`\n /// @param name Type name\n /// @param definition Immutable type definition string\n /// @param description Description of the type\n /// @param resourceURI Mutable resource URI of the type\n /// @return typeID Unique identifier of the registered type\n function registerType(\n bool revocable,\n string calldata name,\n string calldata definition,\n string calldata description,\n string calldata resourceURI\n ) external returns (uint160);\n\n /// @notice Register a new type by `msg.sender` with verifier and public signal getter set for a specific verification stack.\n /// @param name Type name\n /// @param definition Immutable type definition string\n /// @param description Description of the type\n /// @param resourceURI Mutable resource URI of the type\n /// @param verifier verifier for the type\n /// @param publicSignalGetter public signal getter for the type\n /// @return typeID Unique identifier of the registered type\n function registerType1Step(\n bool revocable,\n string calldata name,\n string calldata definition,\n string calldata description,\n string calldata resourceURI,\n uint8 verificationStackId,\n IProofVerifier verifier,\n IPublicSignalGetter publicSignalGetter\n ) external returns (uint160);\n\n /// @notice Update the resource URI of a type\n /// @dev Can only be called by the type owner (`msg.sender`)\n /// @param _id ID of the type to update\n /// @param _resourceURI New resource URI for the type\n function updateTypeResourceURI(uint160 _id, string calldata _resourceURI) external;\n\n /// @dev update the verifier for a type\n function updateTypeVerifier(uint160 typeId, uint8 verificationStackId, IProofVerifier verifier) external;\n\n /// @dev update the verifier for a type\n function updateTypePublicSignalGetter(\n uint160 typeId,\n uint8 verificationStackId,\n IPublicSignalGetter getter\n ) external;\n\n /// @param typeId type id of the type\n /// @param verificationStackId verification stack id\n function getVerifier(uint160 typeId, uint8 verificationStackId) external view returns (IProofVerifier);\n\n /// @param typeId type id of the type\n /// @param verificationStackId verification stack id\n function getPublicSignalGetter(\n uint160 typeId,\n uint8 verificationStackId\n ) external view returns (IPublicSignalGetter);\n\n /// @dev check if the type is fully initialized for the given verification stack.\n /// @param typeId id of the type\n /// @param verificationStackId id the verification stack\n function isTypeFullyInitializedForStack(uint160 typeId, uint8 verificationStackId) external view returns (bool);\n\n /// @dev Retrieve details of a type for the given typeID\n /// @param _id ID of the type to retrieve\n /// @return A `CredentialType` struct containing details of the type\n function getType(uint160 _id) external view returns (CredentialType memory);\n\n /// @dev Retrieve the admin of a type\n /// @param typeId type id of the type\n /// @return address of the admin of the type\n function getTypeAdmin(uint160 typeId) external view returns (address);\n\n /// @dev check if the type is revocable\n function isRevocable(uint160 typeId) external view returns (bool);\n\n /// @notice Calculate the typeID of a type, typeID is keccak256(creator, name) in uint160.\n /// @param creator Address of the type creator\n /// @param name Name of the type\n /// @return The calculated typeID based on the creator address and type name\n function calcTypeID(address creator, string calldata name) external pure returns (uint160);\n}\n" + }, + "contracts/interfaces/IUpaVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/// Reference to a single proof in a Submission. Used by clients to show that\n/// a given proof appears in a submission which has been verified as part of\n/// an aggregated proof. Not required for single-proof submissions, since in\n/// this case `submissionId == proofId`, and the `merkleProof` and `location`\n/// are trivial.\nstruct ProofReference {\n bytes32 submissionId;\n bytes32[] merkleProof;\n /// Index into the proofs in the submission. The sequence of proofs\n /// within the submission starts at this index.\n uint16 location;\n}\n\n/// @title IUpaVerifier interface\n/// @notice Any UPA that supports this interface can be used by the AggregatedStatefulVerifier contract.\ninterface IUpaVerifier {\n // Checks if UPA has verified a proof that publicInputs is valid for\n // the circuit `circuitId`.\n function isVerified(uint256 circuitId, uint256[] calldata publicInputs) external view returns (bool);\n\n // Checks if UPA has verified a proof that publicInputs is valid for\n // the circuit `circuitId`, where the proof belongs to a multi-proof\n // submission.\n function isVerified(\n uint256 circuitId,\n uint256[] calldata publicInputs,\n ProofReference calldata proofReference\n ) external view returns (bool);\n}\n" + }, + "contracts/IssuerRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport { IIssuerRegistry, Issuer, PublicKey, PublicKeyStatus, SignatureState } from \"./interfaces/IIssuerRegistry.sol\";\n\n// IssuerRegistry is a contract that manages the issuers and their public keys and signature state.\ncontract IssuerRegistry is IIssuerRegistry {\n error IssuerAlreadyExists();\n error IssuerNotExists();\n error PublicKeyNotExists();\n error PublicKeyAlreadyExists();\n error NotIssuerOwner(address owner);\n error NotOwner();\n error InvalidName();\n\n /// @dev all issuers, isser id = uint256(caller)\n // mapping issuer id to issuer.\n mapping(uint256 isserId => Issuer issuer) private _issuers;\n\n // (issuerId, publickeyId) => PublicKey\n mapping(uint256 issuerId => mapping(uint256 publicKeyId => PublicKey publicKey)) private _issuerPublicKeys;\n\n // mapping of hash(credentialType, contextId, issuerId) => SignatureState.\n mapping(uint256 credHashValue => SignatureState sigStatus) private _revocableSigStates;\n\n /// @dev only issuer owner can call this function\n modifier onlyIssuerAdmin(uint256 issuerId) {\n _onlyIssuerAdmin(issuerId);\n _;\n }\n\n /// @dev only issuer owner can call this function\n function _onlyIssuerAdmin(uint256 issuerId) private view {\n if (!_issuerExists(issuerId)) {\n revert IssuerNotExists();\n }\n if (msg.sender != _issuers[issuerId].admin) {\n revert NotIssuerOwner(_issuers[issuerId].admin);\n }\n }\n\n /// @dev register a new issuer\n // @notice the issuerId is the address of the caller, so 1 address can only have 1 issuer.\n function registerIssuer(\n string calldata name,\n uint8 verificationStackId,\n uint256 publicKeyId,\n bytes calldata publicKeyRaw\n ) external override returns (uint256) {\n uint256 issuerId = uint256(uint160(msg.sender));\n // register new issuer\n _registerNewIssuer(issuerId, name);\n // add public key\n _setPublicKey(issuerId, verificationStackId, publicKeyId, publicKeyRaw);\n // transfer ownership\n return issuerId;\n }\n\n /// @dev transfer the admin of the issuer\n function transferIssuerAdmin(uint256 issuerId, address newOwner) external override onlyIssuerAdmin(issuerId) {\n _issuers[issuerId].admin = newOwner;\n emit IssuerAdminTransferred(issuerId, msg.sender, newOwner);\n }\n\n /// @dev add a new public key to the issuer.\n // @param issuerId the id of the issuer\n // @param verificationStackId the id of the verification stack\n // @param publicKeyId the id of the public key\n // @param publicKeyRaw the raw public key\n // @notice only the issuer admin can call this function\n // @notice the public key can only be added once, if incorrect, use a new key.\n function addPublicKey(\n uint256 issuerId,\n uint8 verificationStackId,\n uint256 publicKeyId,\n bytes calldata publicKeyRaw\n ) external override onlyIssuerAdmin(issuerId) {\n if (_publicKeyExists(issuerId, publicKeyId)) {\n revert PublicKeyAlreadyExists();\n }\n _setPublicKey(issuerId, verificationStackId, publicKeyId, publicKeyRaw);\n }\n\n /// @dev update the status of the public key.\n function updatePublicKeyStatus(\n uint256 issuerId,\n uint256 publicKeyId,\n PublicKeyStatus status\n ) external override onlyIssuerAdmin(issuerId) {\n if (!_publicKeyExists(issuerId, publicKeyId)) {\n revert PublicKeyNotExists();\n }\n\n _issuerPublicKeys[issuerId][publicKeyId].status = status;\n emit PublicKeyStatusUpdated(issuerId, publicKeyId, status);\n }\n\n /// @dev update the status of the public key.\n function updatePublicKeyVerificationStack(\n uint256 issuerId,\n uint256 publicKeyId,\n uint8 verificationStackId,\n bool enabled\n ) external override onlyIssuerAdmin(issuerId) {\n if (!_publicKeyExists(issuerId, publicKeyId)) {\n revert PublicKeyNotExists();\n }\n\n _issuerPublicKeys[issuerId][publicKeyId].enabledVerificationStacks[verificationStackId] = enabled;\n emit PublicKeyVerificationStackUpdated(issuerId, publicKeyId, verificationStackId, enabled);\n }\n\n /// @dev set the signature state URI\n function updateSignatureStateURI(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n string calldata treeURI\n ) external override onlyIssuerAdmin(issuerId) {\n uint256 key = _calculateCredentialHash(typeId, contextId, issuerId);\n _revocableSigStates[key].treeURI = treeURI;\n emit SignatureStateURIUpdated(typeId, contextId, issuerId, treeURI);\n }\n\n /// @dev set the signature state root\n function updateSignatureState(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n bytes32 root\n ) external override onlyIssuerAdmin(issuerId) {\n uint256 key = _calculateCredentialHash(typeId, contextId, issuerId);\n _revocableSigStates[key].root = root;\n emit SignatureStateRootUpdated(typeId, contextId, issuerId, root);\n }\n\n /// @dev set both the signature state URI and root.\n function setSignatureState(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId,\n string calldata treeURI,\n bytes32 root\n ) external override onlyIssuerAdmin(issuerId) {\n uint256 key = _calculateCredentialHash(typeId, contextId, issuerId);\n _revocableSigStates[key] = SignatureState({ treeURI: treeURI, root: root });\n emit SignatureStateURIUpdated(typeId, contextId, issuerId, treeURI);\n emit SignatureStateRootUpdated(typeId, contextId, issuerId, root);\n }\n\n /// @dev calculate the hash of the credential, which is the key of the revocableSigStates.\n function _calculateCredentialHash(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId\n ) private pure returns (uint256) {\n return uint256(keccak256(abi.encodePacked(typeId, contextId, issuerId)));\n }\n\n /// @dev register a new issuer\n // @param issuerId the id of the issuer\n // @param name the name of the issuer\n function _registerNewIssuer(uint256 issuerId, string calldata name) private {\n if (bytes(name).length == 0) {\n revert InvalidName();\n }\n if (_issuerExists(issuerId)) {\n revert IssuerAlreadyExists();\n }\n\n _issuers[issuerId] = Issuer({ name: name, admin: msg.sender });\n emit IssuerRegistered(issuerId, name);\n emit IssuerAdminTransferred(issuerId, address(0), msg.sender);\n }\n\n /// @dev add a new public key to the issuer\n // @param issuerId the id of the issuer\n // @param verificationStackId the id of the verification stack\n // @param publicKeyId the id of the public key\n // @param publicKeyRaw the raw public key\n function _setPublicKey(\n uint256 issuerId,\n uint8 verificationStackId,\n uint256 publicKeyId,\n bytes calldata publicKeyRaw\n ) private {\n mapping(uint256 => PublicKey) storage keys = _issuerPublicKeys[issuerId];\n keys[publicKeyId].enabledVerificationStacks[verificationStackId] = true;\n keys[publicKeyId].status = PublicKeyStatus.ACTIVE;\n keys[publicKeyId].raw = publicKeyRaw;\n\n emit PublicKeyStatusUpdated(issuerId, publicKeyId, PublicKeyStatus.ACTIVE);\n emit PublicKeyVerificationStackUpdated(issuerId, publicKeyId, verificationStackId, true);\n }\n\n /// @dev return the issuer, if not exists, revert.\n function getIssuer(uint256 issuerId) external view override returns (Issuer memory) {\n if (!_issuerExists(issuerId)) {\n revert IssuerNotExists();\n }\n return _issuers[issuerId];\n }\n\n /// @dev return the public key, if not exists, revert.\n function getPublicKeyRaw(uint256 issuerId, uint256 publicKeyId) external view override returns (bytes memory) {\n if (!_publicKeyExists(issuerId, publicKeyId)) {\n revert PublicKeyNotExists();\n }\n return _issuerPublicKeys[issuerId][publicKeyId].raw;\n }\n\n /// @dev return if public key is active. If public key is not exists, return false.\n function isPublicKeyActive(uint256 issuerId, uint256 publicKeyId) external view override returns (bool) {\n if (!_publicKeyExists(issuerId, publicKeyId)) {\n return false;\n }\n return _issuerPublicKeys[issuerId][publicKeyId].status == PublicKeyStatus.ACTIVE;\n }\n\n /// @dev return if public key is active for the verification stack. If public key is not exists, return false.\n function isPublicKeyActiveForStack(\n uint256 issuerId,\n uint256 publicKeyId,\n uint8 verificationStackId\n ) external view override returns (bool) {\n if (!_publicKeyExists(issuerId, publicKeyId)) {\n return false;\n }\n return\n _issuerPublicKeys[issuerId][publicKeyId].enabledVerificationStacks[verificationStackId] &&\n _issuerPublicKeys[issuerId][publicKeyId].status == PublicKeyStatus.ACTIVE;\n }\n\n /// @dev return the status of the public key, if not exists, returns UNINITIALIZED.\n function getSignatureState(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId\n ) external view override returns (SignatureState memory) {\n return _revocableSigStates[_calculateCredentialHash(typeId, contextId, issuerId)];\n }\n\n /// @dev return the status of the public key, if not exists, returns empty string.\n function getSignatureStateURI(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId\n ) external view override returns (string memory) {\n return _revocableSigStates[_calculateCredentialHash(typeId, contextId, issuerId)].treeURI;\n }\n\n /// @dev return the root of the signature state, if not exists, returns empty bytes.\n function getSignatureStateRoot(\n uint160 typeId,\n uint160 contextId,\n uint256 issuerId\n ) external view override returns (bytes32) {\n return _revocableSigStates[_calculateCredentialHash(typeId, contextId, issuerId)].root;\n }\n\n /// @dev internal function to check if the public key exists.\n function _publicKeyExists(uint256 issuerId, uint256 publicKeyId) internal view returns (bool) {\n return _issuerPublicKeys[issuerId][publicKeyId].status != PublicKeyStatus.UNINITIALIZED;\n }\n\n /// @dev internal function to check if the issuer exists.\n function _issuerExists(uint256 issuerId) internal view returns (bool) {\n return bytes(_issuers[issuerId].name).length != 0;\n }\n}\n" + }, + "contracts/primitive/boolean_verifier.sol": { + "content": "\n// SPDX-License-Identifier: GPL-3.0\n/*\n Copyright (c) 2021 0KIMS association.\n Copyright (c) [2024] Galxe.com.\n\n Modifications to this file are part of the Galxe Identity Protocol SDK,\n which is built using the snarkJS template and is subject to the GNU\n General Public License v3.0.\n\n snarkJS is free software: you can redistribute it and/or modify it\n under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\ncontract BabyZKGroth16BooleanVerifier {\n error AliasedPublicSignal();\n\n // Scalar field size\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\n // Base field size\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\n\n // Verification Key data\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n uint256 constant deltax1 = 18281420389139490670240572462309728931069762758666384847478890846556477812965;\n uint256 constant deltax2 = 13401048439837810951017914211936278660216063821494073603722338220435396604496;\n uint256 constant deltay1 = 21202874041022648331698980994305693341595566632225027482785352902129485264727;\n uint256 constant deltay2 = 18936150877052652216308940020674055541483409091516037105694618299681834990474;\n\n uint256 constant IC0x = 11708618300626501124421915901735889591197446563131571476394569301508043971365;\n uint256 constant IC0y = 5667514267789447089323739319302611763465078048052662562196140462383395872508;\n uint256 constant IC1x = 15195705616700521012127976013459675996720680873721938174087344817064767499959;\n uint256 constant IC1y = 10672412375348497688974862364812884221172587257800457800668811962573422720732;\n uint256 constant IC2x = 4469767714974381441038544382870449937983870305031160934495947295783672104013;\n uint256 constant IC2y = 4361256855208731585297541461256540828791924499734176154562126034217325411934;\n uint256 constant IC3x = 4065007474830663054201212769345725643214519104637863460251326998261224908568;\n uint256 constant IC3y = 6722062532354494177039541269624640687683302797177341622876247091615420138062;\n uint256 constant IC4x = 1608339021418891675882917683154745444281045012507703357182246989049514310802;\n uint256 constant IC4y = 8128620874671164172824065936832829796083958521475019452105747777459375950633;\n uint256 constant IC5x = 5257146532344065012887276372955246831140342551839377880655400784457099064055;\n uint256 constant IC5y = 7978844236199995179937224040162027377080018126978522079920482177471499890762;\n uint256 constant IC6x = 10919099488333612709240051641143996285651554605790292501117844479164219585395;\n uint256 constant IC6y = 635941112977521509791637454846079128545601403436336522285604528441058883176;\n uint256 constant IC7x = 705061730669005706983263006435004752941196689804428750178681337792905619800;\n uint256 constant IC7y = 18860749750051025290426084402442253763575791772481148599856400050650550936756;\n uint256 constant IC8x = 11127748386585527685549602598855629727831492527374704844754329658052519779790;\n uint256 constant IC8y = 21812178917568511189373133106334498782516965982617079750055782729466471342097;\n uint256 constant IC9x = 14606668935673508299530739594649429081565836775860125129151272617815996710514;\n uint256 constant IC9y = 17331858016265809439561525313334479042500557416338688182261061090557648779826;\n // Memory data\n uint16 constant pVk = 0;\n uint16 constant pPairing = 128;\n\n uint16 constant pLastMem = 896;\n\n uint16 constant proofLength = 8;\n uint32 constant pubSignalLength = 9;\n\n /// @dev returns the verification keys in the order that the verifier expects them:\n /// alpha, beta, gamma, delta, ICs..\n function getVerificationKeys() public pure returns (uint[] memory) {\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n vks[10] = 18281420389139490670240572462309728931069762758666384847478890846556477812965;\n vks[11] = 13401048439837810951017914211936278660216063821494073603722338220435396604496;\n vks[12] = 21202874041022648331698980994305693341595566632225027482785352902129485264727;\n vks[13] = 18936150877052652216308940020674055541483409091516037105694618299681834990474;\n vks[14] = 11708618300626501124421915901735889591197446563131571476394569301508043971365;\n vks[15] = 5667514267789447089323739319302611763465078048052662562196140462383395872508;\n vks[16] = 15195705616700521012127976013459675996720680873721938174087344817064767499959;\n vks[17] = 10672412375348497688974862364812884221172587257800457800668811962573422720732;\n vks[18] = 4469767714974381441038544382870449937983870305031160934495947295783672104013;\n vks[19] = 4361256855208731585297541461256540828791924499734176154562126034217325411934;\n vks[20] = 4065007474830663054201212769345725643214519104637863460251326998261224908568;\n vks[21] = 6722062532354494177039541269624640687683302797177341622876247091615420138062;\n vks[22] = 1608339021418891675882917683154745444281045012507703357182246989049514310802;\n vks[23] = 8128620874671164172824065936832829796083958521475019452105747777459375950633;\n vks[24] = 5257146532344065012887276372955246831140342551839377880655400784457099064055;\n vks[25] = 7978844236199995179937224040162027377080018126978522079920482177471499890762;\n vks[26] = 10919099488333612709240051641143996285651554605790292501117844479164219585395;\n vks[27] = 635941112977521509791637454846079128545601403436336522285604528441058883176;\n vks[28] = 705061730669005706983263006435004752941196689804428750178681337792905619800;\n vks[29] = 18860749750051025290426084402442253763575791772481148599856400050650550936756;\n vks[30] = 11127748386585527685549602598855629727831492527374704844754329658052519779790;\n vks[31] = 21812178917568511189373133106334498782516965982617079750055782729466471342097;\n vks[32] = 14606668935673508299530739594649429081565836775860125129151272617815996710514;\n vks[33] = 17331858016265809439561525313334479042500557416338688182261061090557648779826;\n return vks;\n }\n\n /// @dev return true if the public signal is aliased\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\n // Alias check\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\n if (_pubSignals[8] >= 4) { return true; }\n return false;\n }\n\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\n // Check Argument\n require(_proofs.length == proofLength, \"Invalid proof\");\n require(_pubSignals.length == pubSignalLength, \"Invalid public signal\");\n if (isAliased(_pubSignals)) { return false; }\n assembly {\n // G1 function to multiply a G1 value(x,y) to value in an address\n function g1_mulAccC(pR, x, y, s) {\n let success\n let mIn := mload(0x40)\n mstore(mIn, x)\n mstore(add(mIn, 32), y)\n mstore(add(mIn, 64), s)\n\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n\n mstore(add(mIn, 64), mload(pR))\n mstore(add(mIn, 96), mload(add(pR, 32)))\n\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n }\n\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\n let _pPairing := add(pMem, pPairing)\n let _pVk := add(pMem, pVk)\n\n mstore(_pVk, IC0x)\n mstore(add(_pVk, 32), IC0y)\n\n // Compute the linear combination it.vkey.vk_x\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\n // -A\n mstore(_pPairing, calldataload(pA))\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\n\n // B\n mstore(add(_pPairing, 64), calldataload(pB))\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\n\n // alpha1\n mstore(add(_pPairing, 192), alphax)\n mstore(add(_pPairing, 224), alphay)\n\n // beta2\n mstore(add(_pPairing, 256), betax1)\n mstore(add(_pPairing, 288), betax2)\n mstore(add(_pPairing, 320), betay1)\n mstore(add(_pPairing, 352), betay2)\n\n // it.vkey.vk_x\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\n\n // gamma2\n mstore(add(_pPairing, 448), gammax1)\n mstore(add(_pPairing, 480), gammax2)\n mstore(add(_pPairing, 512), gammay1)\n mstore(add(_pPairing, 544), gammay2)\n\n // C\n mstore(add(_pPairing, 576), calldataload(pC))\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\n\n // delta2\n mstore(add(_pPairing, 640), deltax1)\n mstore(add(_pPairing, 672), deltax2)\n mstore(add(_pPairing, 704), deltay1)\n mstore(add(_pPairing, 736), deltay2)\n\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\n\n isOk := and(success, mload(_pPairing))\n }\n\n let pMem := mload(0x40)\n mstore(0x40, add(pMem, pLastMem))\n\n // Validate all evaluations\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\n\n mstore(0, isValid)\n return(0, 0x20)\n }\n }\n}\n" + }, + "contracts/primitive/passport_verifier.sol": { + "content": "\n// SPDX-License-Identifier: GPL-3.0\n/*\n Copyright (c) 2021 0KIMS association.\n Copyright (c) [2024] Galxe.com.\n\n Modifications to this file are part of the Galxe Identity Protocol SDK,\n which is built using the snarkJS template and is subject to the GNU\n General Public License v3.0.\n\n snarkJS is free software: you can redistribute it and/or modify it\n under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\ncontract BabyZKGroth16PassportVerifier {\n error AliasedPublicSignal();\n\n // Scalar field size\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\n // Base field size\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\n\n // Verification Key data\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n uint256 constant deltax1 = 19465865793281917433205729628238261619528912558571179302590449641923237336493;\n uint256 constant deltax2 = 9836552181821908562825916423250803559339661121322145769320042878374376765273;\n uint256 constant deltay1 = 2972527452298515494899373054205226502120059050542082406518238980762330882252;\n uint256 constant deltay2 = 12421615868696903838937420292736115333185255389288618736203999552328749392036;\n\n uint256 constant IC0x = 14776984778530556927051751502780752183532812497404227468852865294447689899684;\n uint256 constant IC0y = 17685773495787771094438025456819460668298495540048327298895397288184307325705;\n uint256 constant IC1x = 6664034107315858311511422569979074983940834486517859620395348427249564206809;\n uint256 constant IC1y = 12760303119269580208319586542009971848846817012628300531806360956833814629985;\n uint256 constant IC2x = 19366280974360769350356367686803112440430113251959095768046213591385594101452;\n uint256 constant IC2y = 17093801976549281609260567293079493225703051358912668487337441826987698704629;\n uint256 constant IC3x = 386851811089208845300030074706526125506346469239487083374842154361030488565;\n uint256 constant IC3y = 18722900404056108381554785792201341384763351744307988156700500270397393292732;\n uint256 constant IC4x = 4682885476595323933561358213075143845865774565593388066206531532132885959348;\n uint256 constant IC4y = 5850994174503380950194612080364128937581319994284055744730951666132926716666;\n uint256 constant IC5x = 15671798360572900223707477220512929244521356522801969550571363436690903144802;\n uint256 constant IC5y = 10365135309026182539079935651272653598311663268323515026144018074820112882940;\n uint256 constant IC6x = 19044951846105234723485623366315216752655547854406509098803621396685828349735;\n uint256 constant IC6y = 19119610279035899152877324941264186837683296682672983594588992458876011602394;\n uint256 constant IC7x = 3538973459932245424591080247559641414911379468388749572642782649132300694873;\n uint256 constant IC7y = 15450719178532314846227623080510163606699070908397610381718487804798251587693;\n uint256 constant IC8x = 16876617330818855626116296478024652384126117123695368471762633545558573896773;\n uint256 constant IC8y = 16193141427372493169292876992166155262969525209114649123090477166198873198166;\n uint256 constant IC9x = 12245164925172007974734702097824026495870184765972763204164284229199196985191;\n uint256 constant IC9y = 12877388159301963624026183752692400587898554342657425638914901104687244639616;\n uint256 constant IC10x = 1642518435529379014933816046234663107124606721915453421690810126711022023230;\n uint256 constant IC10y = 15532519778263684349242587058200885042110074093745843241055075421064406476669;\n uint256 constant IC11x = 1653927913992255150899961094135665055425982831140138862712571865555131509868;\n uint256 constant IC11y = 19393088897719280708581363655688228044720171045462825030543833052850948179740;\n uint256 constant IC12x = 13966415817554039303739898824237199730701799478932718815462469052086437585191;\n uint256 constant IC12y = 754271034707522992282394485482277485341974743131758625275366007666120138859;\n uint256 constant IC13x = 15884825247689712408312925540215748703066083669829831328659638305740457476879;\n uint256 constant IC13y = 12771933037538988398040840113815326310960186624471152131651855797745402277939;\n uint256 constant IC14x = 8394770979324344966026278699875572494666589345829918109276181251315274817937;\n uint256 constant IC14y = 11484580623249470639116718499851788517924543321814685177346338720867864440295;\n uint256 constant IC15x = 2607410923300790366774499215286000362261472013817978473990399675507507574512;\n uint256 constant IC15y = 6958758652141884706015711090185066201141278356799200066863982636406009987588;\n uint256 constant IC16x = 16765204562724608091354341011996342229773188726287008240326829505597474712634;\n uint256 constant IC16y = 19739567344797965471793313547844484828999916933327397878003982434835796394260;\n uint256 constant IC17x = 14074679229462710819872164161119812718373415447195746807959578699883989143186;\n uint256 constant IC17y = 10588000997939792236273108802221683663922471858182522013077384244140964700796;\n uint256 constant IC18x = 18426230130554689199393080729988153687119207645378405098824079273992586065141;\n uint256 constant IC18y = 8226264301303767066406457085142607073537275812022598298127625299231198633417;\n uint256 constant IC19x = 12018424623824039804768990498045015717817358670618610760607022379116842166459;\n uint256 constant IC19y = 19818733566309795525407328598613797183517002730310020378704719724980933829476;\n uint256 constant IC20x = 2155416569781886977751998854462475956858609815137594097300025364802951637558;\n uint256 constant IC20y = 141128875753766578724317791812215586543301183501077871848828184088510192733;\n uint256 constant IC21x = 13790369610773720064654435593502578583928416453136099982166437289553717459667;\n uint256 constant IC21y = 1426290107802354671423278516763628976372973919574173083902016091405801970355;\n // Memory data\n uint16 constant pVk = 0;\n uint16 constant pPairing = 128;\n\n uint16 constant pLastMem = 896;\n\n uint16 constant proofLength = 8;\n uint32 constant pubSignalLength = 21;\n\n /// @dev returns the verification keys in the order that the verifier expects them:\n /// alpha, beta, gamma, delta, ICs..\n function getVerificationKeys() public pure returns (uint[] memory) {\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n vks[10] = 19465865793281917433205729628238261619528912558571179302590449641923237336493;\n vks[11] = 9836552181821908562825916423250803559339661121322145769320042878374376765273;\n vks[12] = 2972527452298515494899373054205226502120059050542082406518238980762330882252;\n vks[13] = 12421615868696903838937420292736115333185255389288618736203999552328749392036;\n vks[14] = 14776984778530556927051751502780752183532812497404227468852865294447689899684;\n vks[15] = 17685773495787771094438025456819460668298495540048327298895397288184307325705;\n vks[16] = 6664034107315858311511422569979074983940834486517859620395348427249564206809;\n vks[17] = 12760303119269580208319586542009971848846817012628300531806360956833814629985;\n vks[18] = 19366280974360769350356367686803112440430113251959095768046213591385594101452;\n vks[19] = 17093801976549281609260567293079493225703051358912668487337441826987698704629;\n vks[20] = 386851811089208845300030074706526125506346469239487083374842154361030488565;\n vks[21] = 18722900404056108381554785792201341384763351744307988156700500270397393292732;\n vks[22] = 4682885476595323933561358213075143845865774565593388066206531532132885959348;\n vks[23] = 5850994174503380950194612080364128937581319994284055744730951666132926716666;\n vks[24] = 15671798360572900223707477220512929244521356522801969550571363436690903144802;\n vks[25] = 10365135309026182539079935651272653598311663268323515026144018074820112882940;\n vks[26] = 19044951846105234723485623366315216752655547854406509098803621396685828349735;\n vks[27] = 19119610279035899152877324941264186837683296682672983594588992458876011602394;\n vks[28] = 3538973459932245424591080247559641414911379468388749572642782649132300694873;\n vks[29] = 15450719178532314846227623080510163606699070908397610381718487804798251587693;\n vks[30] = 16876617330818855626116296478024652384126117123695368471762633545558573896773;\n vks[31] = 16193141427372493169292876992166155262969525209114649123090477166198873198166;\n vks[32] = 12245164925172007974734702097824026495870184765972763204164284229199196985191;\n vks[33] = 12877388159301963624026183752692400587898554342657425638914901104687244639616;\n vks[34] = 1642518435529379014933816046234663107124606721915453421690810126711022023230;\n vks[35] = 15532519778263684349242587058200885042110074093745843241055075421064406476669;\n vks[36] = 1653927913992255150899961094135665055425982831140138862712571865555131509868;\n vks[37] = 19393088897719280708581363655688228044720171045462825030543833052850948179740;\n vks[38] = 13966415817554039303739898824237199730701799478932718815462469052086437585191;\n vks[39] = 754271034707522992282394485482277485341974743131758625275366007666120138859;\n vks[40] = 15884825247689712408312925540215748703066083669829831328659638305740457476879;\n vks[41] = 12771933037538988398040840113815326310960186624471152131651855797745402277939;\n vks[42] = 8394770979324344966026278699875572494666589345829918109276181251315274817937;\n vks[43] = 11484580623249470639116718499851788517924543321814685177346338720867864440295;\n vks[44] = 2607410923300790366774499215286000362261472013817978473990399675507507574512;\n vks[45] = 6958758652141884706015711090185066201141278356799200066863982636406009987588;\n vks[46] = 16765204562724608091354341011996342229773188726287008240326829505597474712634;\n vks[47] = 19739567344797965471793313547844484828999916933327397878003982434835796394260;\n vks[48] = 14074679229462710819872164161119812718373415447195746807959578699883989143186;\n vks[49] = 10588000997939792236273108802221683663922471858182522013077384244140964700796;\n vks[50] = 18426230130554689199393080729988153687119207645378405098824079273992586065141;\n vks[51] = 8226264301303767066406457085142607073537275812022598298127625299231198633417;\n vks[52] = 12018424623824039804768990498045015717817358670618610760607022379116842166459;\n vks[53] = 19818733566309795525407328598613797183517002730310020378704719724980933829476;\n vks[54] = 2155416569781886977751998854462475956858609815137594097300025364802951637558;\n vks[55] = 141128875753766578724317791812215586543301183501077871848828184088510192733;\n vks[56] = 13790369610773720064654435593502578583928416453136099982166437289553717459667;\n vks[57] = 1426290107802354671423278516763628976372973919574173083902016091405801970355;\n return vks;\n }\n\n /// @dev return true if the public signal is aliased\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\n // Alias check\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\n if (_pubSignals[8] >= 18446744073709551616) { return true; }\n if (_pubSignals[9] >= 18446744073709551616) { return true; }\n if (_pubSignals[10] >= 512) { return true; }\n if (_pubSignals[11] >= 131072) { return true; }\n if (_pubSignals[12] >= 512) { return true; }\n if (_pubSignals[13] >= 18446744073709551616) { return true; }\n if (_pubSignals[14] >= 18446744073709551616) { return true; }\n if (_pubSignals[15] >= 18446744073709551616) { return true; }\n if (_pubSignals[16] >= 18446744073709551616) { return true; }\n if (_pubSignals[17] >= 18446744073709551616) { return true; }\n if (_pubSignals[18] >= 18446744073709551616) { return true; }\n if (_pubSignals[19] >= 256) { return true; }\n if (_pubSignals[20] >= 256) { return true; }\n return false;\n }\n\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\n // Check Argument\n require(_proofs.length == proofLength, \"Invalid proof\");\n require(_pubSignals.length == pubSignalLength, \"Invalid public signal\");\n if (isAliased(_pubSignals)) { return false; }\n assembly {\n // G1 function to multiply a G1 value(x,y) to value in an address\n function g1_mulAccC(pR, x, y, s) {\n let success\n let mIn := mload(0x40)\n mstore(mIn, x)\n mstore(add(mIn, 32), y)\n mstore(add(mIn, 64), s)\n\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n\n mstore(add(mIn, 64), mload(pR))\n mstore(add(mIn, 96), mload(add(pR, 32)))\n\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n }\n\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\n let _pPairing := add(pMem, pPairing)\n let _pVk := add(pMem, pVk)\n\n mstore(_pVk, IC0x)\n mstore(add(_pVk, 32), IC0y)\n\n // Compute the linear combination it.vkey.vk_x\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\n g1_mulAccC(_pVk, IC10x, IC10y, calldataload(add(pubSignals, 288)))\n g1_mulAccC(_pVk, IC11x, IC11y, calldataload(add(pubSignals, 320)))\n g1_mulAccC(_pVk, IC12x, IC12y, calldataload(add(pubSignals, 352)))\n g1_mulAccC(_pVk, IC13x, IC13y, calldataload(add(pubSignals, 384)))\n g1_mulAccC(_pVk, IC14x, IC14y, calldataload(add(pubSignals, 416)))\n g1_mulAccC(_pVk, IC15x, IC15y, calldataload(add(pubSignals, 448)))\n g1_mulAccC(_pVk, IC16x, IC16y, calldataload(add(pubSignals, 480)))\n g1_mulAccC(_pVk, IC17x, IC17y, calldataload(add(pubSignals, 512)))\n g1_mulAccC(_pVk, IC18x, IC18y, calldataload(add(pubSignals, 544)))\n g1_mulAccC(_pVk, IC19x, IC19y, calldataload(add(pubSignals, 576)))\n g1_mulAccC(_pVk, IC20x, IC20y, calldataload(add(pubSignals, 608)))\n g1_mulAccC(_pVk, IC21x, IC21y, calldataload(add(pubSignals, 640)))\n // -A\n mstore(_pPairing, calldataload(pA))\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\n\n // B\n mstore(add(_pPairing, 64), calldataload(pB))\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\n\n // alpha1\n mstore(add(_pPairing, 192), alphax)\n mstore(add(_pPairing, 224), alphay)\n\n // beta2\n mstore(add(_pPairing, 256), betax1)\n mstore(add(_pPairing, 288), betax2)\n mstore(add(_pPairing, 320), betay1)\n mstore(add(_pPairing, 352), betay2)\n\n // it.vkey.vk_x\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\n\n // gamma2\n mstore(add(_pPairing, 448), gammax1)\n mstore(add(_pPairing, 480), gammax2)\n mstore(add(_pPairing, 512), gammay1)\n mstore(add(_pPairing, 544), gammay2)\n\n // C\n mstore(add(_pPairing, 576), calldataload(pC))\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\n\n // delta2\n mstore(add(_pPairing, 640), deltax1)\n mstore(add(_pPairing, 672), deltax2)\n mstore(add(_pPairing, 704), deltay1)\n mstore(add(_pPairing, 736), deltay2)\n\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\n\n isOk := and(success, mload(_pPairing))\n }\n\n let pMem := mload(0x40)\n mstore(0x40, add(pMem, pLastMem))\n\n // Validate all evaluations\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\n\n mstore(0, isValid)\n return(0, 0x20)\n }\n }\n}\n" + }, + "contracts/primitive/property_verifier.sol": { + "content": "\n// SPDX-License-Identifier: GPL-3.0\n/*\n Copyright (c) 2021 0KIMS association.\n Copyright (c) [2024] Galxe.com.\n\n Modifications to this file are part of the Galxe Identity Protocol SDK,\n which is built using the snarkJS template and is subject to the GNU\n General Public License v3.0.\n\n snarkJS is free software: you can redistribute it and/or modify it\n under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\ncontract BabyZKGroth16PropertyVerifier {\n error AliasedPublicSignal();\n\n // Scalar field size\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\n // Base field size\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\n\n // Verification Key data\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n uint256 constant deltax1 = 11414308741845866070085426566452317103435919953372480741769117942559358064929;\n uint256 constant deltax2 = 17374122188591355265489391850630525848516844913531328314518114624786540918774;\n uint256 constant deltay1 = 4805943426435892795193533207491585471028169447506182975505804821707709387402;\n uint256 constant deltay2 = 3779852072385966186983736777112504712320379578988346798663720253445993794904;\n\n uint256 constant IC0x = 21282914606544504841446672183548976667336734118384326986872441490213100233198;\n uint256 constant IC0y = 7244048437405094008788643878823791229689413336569675755260786565615017673008;\n uint256 constant IC1x = 21763052119897271951546724350030855801695388906317992478303308144361455108360;\n uint256 constant IC1y = 1608872978305347168059657251469436932629356088876393997410585169556277214185;\n uint256 constant IC2x = 8003254435902758560853985611657072128887881951452160772919242672441473611036;\n uint256 constant IC2y = 15242606809601150172252505741824596697604315081038945113202486841786263119977;\n uint256 constant IC3x = 18715776049104124383839709405670487216213184446656248593352020123074988458716;\n uint256 constant IC3y = 7887753228505704161087653224279922305694581204716337599935911852199096742082;\n uint256 constant IC4x = 7028110773054326845365750137080078100350298258694196533394851493040606284105;\n uint256 constant IC4y = 8877289167867341027725747071299324574174288751192044206896596093060066561123;\n uint256 constant IC5x = 18260458696454177334207880249354179258160632746613408803694682950372458468206;\n uint256 constant IC5y = 10126634442774700961252304838128483126544953720700398087547427995192566709086;\n uint256 constant IC6x = 9841956294051706864891709641279649298130727235403428423642298228287728688465;\n uint256 constant IC6y = 17527792556901344875361897616626915647320681218054984845236097073487992050734;\n uint256 constant IC7x = 5534428345459510038894105382957122802917358379136265058504320326972661342047;\n uint256 constant IC7y = 6766275239836979735121846401420445341184822174372517830008145522949992864758;\n uint256 constant IC8x = 11113242123452701361566984741890081046161278831617575462222796064073948004605;\n uint256 constant IC8y = 642831114213191244891766047504367930246914717751276308143851811549806736860;\n uint256 constant IC9x = 18527281753934920101755634341734088616055121926321307995214486570920284521957;\n uint256 constant IC9y = 1195297180455881505551214113785314370379730340976398177208182758359244249907;\n // Memory data\n uint16 constant pVk = 0;\n uint16 constant pPairing = 128;\n\n uint16 constant pLastMem = 896;\n\n uint16 constant proofLength = 8;\n uint32 constant pubSignalLength = 9;\n\n /// @dev returns the verification keys in the order that the verifier expects them:\n /// alpha, beta, gamma, delta, ICs..\n function getVerificationKeys() public pure returns (uint[] memory) {\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n vks[10] = 11414308741845866070085426566452317103435919953372480741769117942559358064929;\n vks[11] = 17374122188591355265489391850630525848516844913531328314518114624786540918774;\n vks[12] = 4805943426435892795193533207491585471028169447506182975505804821707709387402;\n vks[13] = 3779852072385966186983736777112504712320379578988346798663720253445993794904;\n vks[14] = 21282914606544504841446672183548976667336734118384326986872441490213100233198;\n vks[15] = 7244048437405094008788643878823791229689413336569675755260786565615017673008;\n vks[16] = 21763052119897271951546724350030855801695388906317992478303308144361455108360;\n vks[17] = 1608872978305347168059657251469436932629356088876393997410585169556277214185;\n vks[18] = 8003254435902758560853985611657072128887881951452160772919242672441473611036;\n vks[19] = 15242606809601150172252505741824596697604315081038945113202486841786263119977;\n vks[20] = 18715776049104124383839709405670487216213184446656248593352020123074988458716;\n vks[21] = 7887753228505704161087653224279922305694581204716337599935911852199096742082;\n vks[22] = 7028110773054326845365750137080078100350298258694196533394851493040606284105;\n vks[23] = 8877289167867341027725747071299324574174288751192044206896596093060066561123;\n vks[24] = 18260458696454177334207880249354179258160632746613408803694682950372458468206;\n vks[25] = 10126634442774700961252304838128483126544953720700398087547427995192566709086;\n vks[26] = 9841956294051706864891709641279649298130727235403428423642298228287728688465;\n vks[27] = 17527792556901344875361897616626915647320681218054984845236097073487992050734;\n vks[28] = 5534428345459510038894105382957122802917358379136265058504320326972661342047;\n vks[29] = 6766275239836979735121846401420445341184822174372517830008145522949992864758;\n vks[30] = 11113242123452701361566984741890081046161278831617575462222796064073948004605;\n vks[31] = 642831114213191244891766047504367930246914717751276308143851811549806736860;\n vks[32] = 18527281753934920101755634341734088616055121926321307995214486570920284521957;\n vks[33] = 1195297180455881505551214113785314370379730340976398177208182758359244249907;\n return vks;\n }\n\n /// @dev return true if the public signal is aliased\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\n // Alias check\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\n if (_pubSignals[8] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\n return false;\n }\n\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\n // Check Argument\n require(_proofs.length == proofLength, \"Invalid proof\");\n require(_pubSignals.length == pubSignalLength, \"Invalid public signal\");\n if (isAliased(_pubSignals)) { return false; }\n assembly {\n // G1 function to multiply a G1 value(x,y) to value in an address\n function g1_mulAccC(pR, x, y, s) {\n let success\n let mIn := mload(0x40)\n mstore(mIn, x)\n mstore(add(mIn, 32), y)\n mstore(add(mIn, 64), s)\n\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n\n mstore(add(mIn, 64), mload(pR))\n mstore(add(mIn, 96), mload(add(pR, 32)))\n\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n }\n\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\n let _pPairing := add(pMem, pPairing)\n let _pVk := add(pMem, pVk)\n\n mstore(_pVk, IC0x)\n mstore(add(_pVk, 32), IC0y)\n\n // Compute the linear combination it.vkey.vk_x\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\n // -A\n mstore(_pPairing, calldataload(pA))\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\n\n // B\n mstore(add(_pPairing, 64), calldataload(pB))\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\n\n // alpha1\n mstore(add(_pPairing, 192), alphax)\n mstore(add(_pPairing, 224), alphay)\n\n // beta2\n mstore(add(_pPairing, 256), betax1)\n mstore(add(_pPairing, 288), betax2)\n mstore(add(_pPairing, 320), betay1)\n mstore(add(_pPairing, 352), betay2)\n\n // it.vkey.vk_x\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\n\n // gamma2\n mstore(add(_pPairing, 448), gammax1)\n mstore(add(_pPairing, 480), gammax2)\n mstore(add(_pPairing, 512), gammay1)\n mstore(add(_pPairing, 544), gammay2)\n\n // C\n mstore(add(_pPairing, 576), calldataload(pC))\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\n\n // delta2\n mstore(add(_pPairing, 640), deltax1)\n mstore(add(_pPairing, 672), deltax2)\n mstore(add(_pPairing, 704), deltay1)\n mstore(add(_pPairing, 736), deltay2)\n\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\n\n isOk := and(success, mload(_pPairing))\n }\n\n let pMem := mload(0x40)\n mstore(0x40, add(pMem, pLastMem))\n\n // Validate all evaluations\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\n\n mstore(0, isValid)\n return(0, 0x20)\n }\n }\n}\n" + }, + "contracts/primitive/scalar_verifier.sol": { + "content": "\n// SPDX-License-Identifier: GPL-3.0\n/*\n Copyright (c) 2021 0KIMS association.\n Copyright (c) [2024] Galxe.com.\n\n Modifications to this file are part of the Galxe Identity Protocol SDK,\n which is built using the snarkJS template and is subject to the GNU\n General Public License v3.0.\n\n snarkJS is free software: you can redistribute it and/or modify it\n under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\ncontract BabyZKGroth16ScalarVerifier {\n error AliasedPublicSignal();\n\n // Scalar field size\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\n // Base field size\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\n\n // Verification Key data\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n uint256 constant deltax1 = 11386766365824379679527974311800739296620166334678560777819386094772738908117;\n uint256 constant deltax2 = 5914602868708600112219413104636571687761738884936609474954954410582503098408;\n uint256 constant deltay1 = 4651652966715538918037908003920688590707225453456401092100837651799858508873;\n uint256 constant deltay2 = 5750097786758545771271419578462125638542345819747228567491655641926808625820;\n\n uint256 constant IC0x = 19718694483962552457546703022943755844960272065236852983483449121878944032229;\n uint256 constant IC0y = 19277224091235934629720467697154129029409763052492419487195354501450906873293;\n uint256 constant IC1x = 11524898445759539751988664644643984354080320377887036267619838360664088041388;\n uint256 constant IC1y = 12052476618631930474450519376758323338799389525512264273381315623349871320459;\n uint256 constant IC2x = 1796432713996171209429206469628339720979571370972673842341066237052302144708;\n uint256 constant IC2y = 15910694945325453731816254570140821145883366324705775641131332163142393553430;\n uint256 constant IC3x = 13301490279450482586102948347778809500550800419089382713271598741737846927098;\n uint256 constant IC3y = 14259881931883214004278332811480412945774487191113970531745254373843301815030;\n uint256 constant IC4x = 1207500870815263464967774976312359598755762009848827143199201686666476624758;\n uint256 constant IC4y = 8435967651447070421240072360683620289857808299003263625530661340454266925495;\n uint256 constant IC5x = 20596312126307507544254706071585116472086770107182790995667405884937786149072;\n uint256 constant IC5y = 20101366561967269911230004725117599795346838430903241466492512719716156452494;\n uint256 constant IC6x = 17526481656940755408681043575718606969101388584842965003168213187937318841363;\n uint256 constant IC6y = 13265795018345573998790937061244260230280148075859101413091614551080502238943;\n uint256 constant IC7x = 8797399508837900954995623995490844490558692290611898196384918943481136881246;\n uint256 constant IC7y = 1189204587490882345729074991940308020536737538799963545904189346677112172621;\n uint256 constant IC8x = 17425938981588937088170006395579119680236927961246903247977312401168286974480;\n uint256 constant IC8y = 5313672417270749056228790951665922810430694276452143630621001803078527956704;\n uint256 constant IC9x = 21558569413462776597053285568737324938159130522610738437830367783496513501490;\n uint256 constant IC9y = 12326766729916800830567908978618969396776317942337594117075699985152575345284;\n uint256 constant IC10x = 6395915430939619962955569365706969975441352219959453609660666075170686062244;\n uint256 constant IC10y = 8282983962149557587079522102277232822891054043805116932692253318963003844810;\n // Memory data\n uint16 constant pVk = 0;\n uint16 constant pPairing = 128;\n\n uint16 constant pLastMem = 896;\n\n uint16 constant proofLength = 8;\n uint32 constant pubSignalLength = 10;\n\n /// @dev returns the verification keys in the order that the verifier expects them:\n /// alpha, beta, gamma, delta, ICs..\n function getVerificationKeys() public pure returns (uint[] memory) {\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n vks[10] = 11386766365824379679527974311800739296620166334678560777819386094772738908117;\n vks[11] = 5914602868708600112219413104636571687761738884936609474954954410582503098408;\n vks[12] = 4651652966715538918037908003920688590707225453456401092100837651799858508873;\n vks[13] = 5750097786758545771271419578462125638542345819747228567491655641926808625820;\n vks[14] = 19718694483962552457546703022943755844960272065236852983483449121878944032229;\n vks[15] = 19277224091235934629720467697154129029409763052492419487195354501450906873293;\n vks[16] = 11524898445759539751988664644643984354080320377887036267619838360664088041388;\n vks[17] = 12052476618631930474450519376758323338799389525512264273381315623349871320459;\n vks[18] = 1796432713996171209429206469628339720979571370972673842341066237052302144708;\n vks[19] = 15910694945325453731816254570140821145883366324705775641131332163142393553430;\n vks[20] = 13301490279450482586102948347778809500550800419089382713271598741737846927098;\n vks[21] = 14259881931883214004278332811480412945774487191113970531745254373843301815030;\n vks[22] = 1207500870815263464967774976312359598755762009848827143199201686666476624758;\n vks[23] = 8435967651447070421240072360683620289857808299003263625530661340454266925495;\n vks[24] = 20596312126307507544254706071585116472086770107182790995667405884937786149072;\n vks[25] = 20101366561967269911230004725117599795346838430903241466492512719716156452494;\n vks[26] = 17526481656940755408681043575718606969101388584842965003168213187937318841363;\n vks[27] = 13265795018345573998790937061244260230280148075859101413091614551080502238943;\n vks[28] = 8797399508837900954995623995490844490558692290611898196384918943481136881246;\n vks[29] = 1189204587490882345729074991940308020536737538799963545904189346677112172621;\n vks[30] = 17425938981588937088170006395579119680236927961246903247977312401168286974480;\n vks[31] = 5313672417270749056228790951665922810430694276452143630621001803078527956704;\n vks[32] = 21558569413462776597053285568737324938159130522610738437830367783496513501490;\n vks[33] = 12326766729916800830567908978618969396776317942337594117075699985152575345284;\n vks[34] = 6395915430939619962955569365706969975441352219959453609660666075170686062244;\n vks[35] = 8282983962149557587079522102277232822891054043805116932692253318963003844810;\n return vks;\n }\n\n /// @dev return true if the public signal is aliased\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\n // Alias check\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\n if (_pubSignals[8] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\n if (_pubSignals[9] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\n return false;\n }\n\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\n // Check Argument\n require(_proofs.length == proofLength, \"Invalid proof\");\n require(_pubSignals.length == pubSignalLength, \"Invalid public signal\");\n if (isAliased(_pubSignals)) { return false; }\n assembly {\n // G1 function to multiply a G1 value(x,y) to value in an address\n function g1_mulAccC(pR, x, y, s) {\n let success\n let mIn := mload(0x40)\n mstore(mIn, x)\n mstore(add(mIn, 32), y)\n mstore(add(mIn, 64), s)\n\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n\n mstore(add(mIn, 64), mload(pR))\n mstore(add(mIn, 96), mload(add(pR, 32)))\n\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n }\n\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\n let _pPairing := add(pMem, pPairing)\n let _pVk := add(pMem, pVk)\n\n mstore(_pVk, IC0x)\n mstore(add(_pVk, 32), IC0y)\n\n // Compute the linear combination it.vkey.vk_x\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\n g1_mulAccC(_pVk, IC10x, IC10y, calldataload(add(pubSignals, 288)))\n // -A\n mstore(_pPairing, calldataload(pA))\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\n\n // B\n mstore(add(_pPairing, 64), calldataload(pB))\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\n\n // alpha1\n mstore(add(_pPairing, 192), alphax)\n mstore(add(_pPairing, 224), alphay)\n\n // beta2\n mstore(add(_pPairing, 256), betax1)\n mstore(add(_pPairing, 288), betax2)\n mstore(add(_pPairing, 320), betay1)\n mstore(add(_pPairing, 352), betay2)\n\n // it.vkey.vk_x\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\n\n // gamma2\n mstore(add(_pPairing, 448), gammax1)\n mstore(add(_pPairing, 480), gammax2)\n mstore(add(_pPairing, 512), gammay1)\n mstore(add(_pPairing, 544), gammay2)\n\n // C\n mstore(add(_pPairing, 576), calldataload(pC))\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\n\n // delta2\n mstore(add(_pPairing, 640), deltax1)\n mstore(add(_pPairing, 672), deltax2)\n mstore(add(_pPairing, 704), deltay1)\n mstore(add(_pPairing, 736), deltay2)\n\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\n\n isOk := and(success, mload(_pPairing))\n }\n\n let pMem := mload(0x40)\n mstore(0x40, add(pMem, pLastMem))\n\n // Validate all evaluations\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\n\n mstore(0, isValid)\n return(0, 0x20)\n }\n }\n}\n" + }, + "contracts/primitive/scalar256_verifier.sol": { + "content": "\n// SPDX-License-Identifier: GPL-3.0\n/*\n Copyright (c) 2021 0KIMS association.\n Copyright (c) [2024] Galxe.com.\n\n Modifications to this file are part of the Galxe Identity Protocol SDK,\n which is built using the snarkJS template and is subject to the GNU\n General Public License v3.0.\n\n snarkJS is free software: you can redistribute it and/or modify it\n under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\ncontract BabyZKGroth16Scalar256Verifier {\n error AliasedPublicSignal();\n\n // Scalar field size\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\n // Base field size\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\n\n // Verification Key data\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n uint256 constant deltax1 = 9002726567792901338145770338648851440665823341997621957553321445773518291201;\n uint256 constant deltax2 = 8048387181119775934407874257556010377368046340138774947391638565383453457854;\n uint256 constant deltay1 = 2718645317831892489973703729635262538568144422731125202585769031798053045300;\n uint256 constant deltay2 = 8957442281714910990845537002241963810890562605622744722122848529914409256547;\n\n uint256 constant IC0x = 11479251601148187970310415309010146480899682740703523247990590200202053807124;\n uint256 constant IC0y = 21083168692728939898991139059058064552332968885842672334904791808186019136560;\n uint256 constant IC1x = 17139656022314565899947223226238212498153791883758684666359146887235985027355;\n uint256 constant IC1y = 5759831185708410406027533711712631497041173639600475498340532362099836591454;\n uint256 constant IC2x = 3840892930183184286382169754048061207708010033264629551235506756284868765597;\n uint256 constant IC2y = 13292935637386979710163367957575589475676317839630145123575964867360518760078;\n uint256 constant IC3x = 14425896658876322153841736821227659462338658563206356116834179948859021927820;\n uint256 constant IC3y = 11998837696571103490805989765147144523338663550360011135029236260560590145167;\n uint256 constant IC4x = 15838157656396283205758658870397744925938821754679242646369185562562468458734;\n uint256 constant IC4y = 12586452593690608472550984698912707597984671686143445239302138098157518018732;\n uint256 constant IC5x = 14656106878490889611505265823914944212494806408313040095736331493814099525095;\n uint256 constant IC5y = 12013065347588874809825301263760346302728620767901113064623351697573528443070;\n uint256 constant IC6x = 19034340618162277641950528462193750482846207017748396234762342999785567728268;\n uint256 constant IC6y = 15683528069115324522560017126210462968459896549455082442918093229099690097179;\n uint256 constant IC7x = 18200465409922896053135045999544076760811890024681939696983399445993694455931;\n uint256 constant IC7y = 10708753298528809752558899093280528895981363761543638893574652765326674760686;\n uint256 constant IC8x = 5222312593979339166706479205702886433485592614970797473745807179984592999446;\n uint256 constant IC8y = 20999559870318689626143767431956003169444715876689551820757291506975530922585;\n uint256 constant IC9x = 3589838198546727926920845044363223471614991762538708293653429894967180730196;\n uint256 constant IC9y = 819276690311245205150423144210659610500241984162727857374977686978219357658;\n uint256 constant IC10x = 1452880846127336750523534286062738236740957577253439876227021057199618563670;\n uint256 constant IC10y = 21143486064061152869147893343070572783058213567010851666764323467996393626269;\n uint256 constant IC11x = 18823881327175454868891113067085648636669687864583281765945646841861181353658;\n uint256 constant IC11y = 16865319818275834632795027598001079767321134040468678707665858147692037386957;\n uint256 constant IC12x = 17758171080275092220228017196714472086483239056016118195876589472141758971515;\n uint256 constant IC12y = 14894516246997233613141689717875005468127476778596469201935650082217142575778;\n // Memory data\n uint16 constant pVk = 0;\n uint16 constant pPairing = 128;\n\n uint16 constant pLastMem = 896;\n\n uint16 constant proofLength = 8;\n uint32 constant pubSignalLength = 12;\n\n /// @dev returns the verification keys in the order that the verifier expects them:\n /// alpha, beta, gamma, delta, ICs..\n function getVerificationKeys() public pure returns (uint[] memory) {\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n vks[10] = 9002726567792901338145770338648851440665823341997621957553321445773518291201;\n vks[11] = 8048387181119775934407874257556010377368046340138774947391638565383453457854;\n vks[12] = 2718645317831892489973703729635262538568144422731125202585769031798053045300;\n vks[13] = 8957442281714910990845537002241963810890562605622744722122848529914409256547;\n vks[14] = 11479251601148187970310415309010146480899682740703523247990590200202053807124;\n vks[15] = 21083168692728939898991139059058064552332968885842672334904791808186019136560;\n vks[16] = 17139656022314565899947223226238212498153791883758684666359146887235985027355;\n vks[17] = 5759831185708410406027533711712631497041173639600475498340532362099836591454;\n vks[18] = 3840892930183184286382169754048061207708010033264629551235506756284868765597;\n vks[19] = 13292935637386979710163367957575589475676317839630145123575964867360518760078;\n vks[20] = 14425896658876322153841736821227659462338658563206356116834179948859021927820;\n vks[21] = 11998837696571103490805989765147144523338663550360011135029236260560590145167;\n vks[22] = 15838157656396283205758658870397744925938821754679242646369185562562468458734;\n vks[23] = 12586452593690608472550984698912707597984671686143445239302138098157518018732;\n vks[24] = 14656106878490889611505265823914944212494806408313040095736331493814099525095;\n vks[25] = 12013065347588874809825301263760346302728620767901113064623351697573528443070;\n vks[26] = 19034340618162277641950528462193750482846207017748396234762342999785567728268;\n vks[27] = 15683528069115324522560017126210462968459896549455082442918093229099690097179;\n vks[28] = 18200465409922896053135045999544076760811890024681939696983399445993694455931;\n vks[29] = 10708753298528809752558899093280528895981363761543638893574652765326674760686;\n vks[30] = 5222312593979339166706479205702886433485592614970797473745807179984592999446;\n vks[31] = 20999559870318689626143767431956003169444715876689551820757291506975530922585;\n vks[32] = 3589838198546727926920845044363223471614991762538708293653429894967180730196;\n vks[33] = 819276690311245205150423144210659610500241984162727857374977686978219357658;\n vks[34] = 1452880846127336750523534286062738236740957577253439876227021057199618563670;\n vks[35] = 21143486064061152869147893343070572783058213567010851666764323467996393626269;\n vks[36] = 18823881327175454868891113067085648636669687864583281765945646841861181353658;\n vks[37] = 16865319818275834632795027598001079767321134040468678707665858147692037386957;\n vks[38] = 17758171080275092220228017196714472086483239056016118195876589472141758971515;\n vks[39] = 14894516246997233613141689717875005468127476778596469201935650082217142575778;\n return vks;\n }\n\n /// @dev return true if the public signal is aliased\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\n // Alias check\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\n if (_pubSignals[8] >= 340282366920938463463374607431768211456) { return true; }\n if (_pubSignals[9] >= 340282366920938463463374607431768211456) { return true; }\n if (_pubSignals[10] >= 340282366920938463463374607431768211456) { return true; }\n if (_pubSignals[11] >= 340282366920938463463374607431768211456) { return true; }\n return false;\n }\n\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\n // Check Argument\n require(_proofs.length == proofLength, \"Invalid proof\");\n require(_pubSignals.length == pubSignalLength, \"Invalid public signal\");\n if (isAliased(_pubSignals)) { return false; }\n assembly {\n // G1 function to multiply a G1 value(x,y) to value in an address\n function g1_mulAccC(pR, x, y, s) {\n let success\n let mIn := mload(0x40)\n mstore(mIn, x)\n mstore(add(mIn, 32), y)\n mstore(add(mIn, 64), s)\n\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n\n mstore(add(mIn, 64), mload(pR))\n mstore(add(mIn, 96), mload(add(pR, 32)))\n\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n }\n\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\n let _pPairing := add(pMem, pPairing)\n let _pVk := add(pMem, pVk)\n\n mstore(_pVk, IC0x)\n mstore(add(_pVk, 32), IC0y)\n\n // Compute the linear combination it.vkey.vk_x\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\n g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))\n g1_mulAccC(_pVk, IC10x, IC10y, calldataload(add(pubSignals, 288)))\n g1_mulAccC(_pVk, IC11x, IC11y, calldataload(add(pubSignals, 320)))\n g1_mulAccC(_pVk, IC12x, IC12y, calldataload(add(pubSignals, 352)))\n // -A\n mstore(_pPairing, calldataload(pA))\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\n\n // B\n mstore(add(_pPairing, 64), calldataload(pB))\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\n\n // alpha1\n mstore(add(_pPairing, 192), alphax)\n mstore(add(_pPairing, 224), alphay)\n\n // beta2\n mstore(add(_pPairing, 256), betax1)\n mstore(add(_pPairing, 288), betax2)\n mstore(add(_pPairing, 320), betay1)\n mstore(add(_pPairing, 352), betay2)\n\n // it.vkey.vk_x\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\n\n // gamma2\n mstore(add(_pPairing, 448), gammax1)\n mstore(add(_pPairing, 480), gammax2)\n mstore(add(_pPairing, 512), gammay1)\n mstore(add(_pPairing, 544), gammay2)\n\n // C\n mstore(add(_pPairing, 576), calldataload(pC))\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\n\n // delta2\n mstore(add(_pPairing, 640), deltax1)\n mstore(add(_pPairing, 672), deltax2)\n mstore(add(_pPairing, 704), deltay1)\n mstore(add(_pPairing, 736), deltay2)\n\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\n\n isOk := and(success, mload(_pPairing))\n }\n\n let pMem := mload(0x40)\n mstore(0x40, add(pMem, pLastMem))\n\n // Validate all evaluations\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\n\n mstore(0, isValid)\n return(0, 0x20)\n }\n }\n}\n" + }, + "contracts/primitive/unit_verifier.sol": { + "content": "\n// SPDX-License-Identifier: GPL-3.0\n/*\n Copyright (c) 2021 0KIMS association.\n Copyright (c) [2024] Galxe.com.\n\n Modifications to this file are part of the Galxe Identity Protocol SDK,\n which is built using the snarkJS template and is subject to the GNU\n General Public License v3.0.\n\n snarkJS is free software: you can redistribute it and/or modify it\n under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\ncontract BabyZKGroth16UnitVerifier {\n error AliasedPublicSignal();\n\n // Scalar field size\n uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\n // Base field size\n uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;\n\n // Verification Key data\n uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n uint256 constant deltax1 = 15637418380756236601718213192255613136045919407816081601661261207618084073597;\n uint256 constant deltax2 = 16569784677986731884848814767977081422246581497389376666284070100669021849313;\n uint256 constant deltay1 = 17775141888156869748745527945157624548875521553021038167785799262294965116348;\n uint256 constant deltay2 = 3246184716089128973746765775249737516048676435198106546989660202706440984521;\n\n uint256 constant IC0x = 4990317659614575818156037472214188417509096922233331003555642014823238651184;\n uint256 constant IC0y = 14469248329543848838153834859360699519345616103861941229956057140145693492508;\n uint256 constant IC1x = 10837138624576207424789978193086542153499320344753530437477168438248082178960;\n uint256 constant IC1y = 917015773848957701033958467874666708682927187095469719889324478895656869516;\n uint256 constant IC2x = 5037499117481750214477112555364145021274012966256645948893036512248435385840;\n uint256 constant IC2y = 19826826480151452757007846213434794238926452546710485787711011712233552633495;\n uint256 constant IC3x = 20945528997632428738612501906743782336475532295455403104686278305604488099835;\n uint256 constant IC3y = 20744191411948171901695905522237963923426425453283062602166914445806285227301;\n uint256 constant IC4x = 8513991002836348269358097045344942553237626798000929884704947463798784967405;\n uint256 constant IC4y = 19338209321160679542018365847622795887832971526814598737666811533118912666856;\n uint256 constant IC5x = 3569844613050455610552335538126280293963365442570334539158228936972825900539;\n uint256 constant IC5y = 16528366039144804325194354617729911304908458001966274902042903564466963990992;\n uint256 constant IC6x = 1570945769731720797444624982944778925162368447218125765326050361254312822358;\n uint256 constant IC6y = 2602548857774106882745290052940216670975889108043343483573122286840504404756;\n uint256 constant IC7x = 21301906662599840990524780602285271554623267433315428422652065889924533228332;\n uint256 constant IC7y = 11716127211538228300463074562279867241595264693476507064906125029152968407192;\n uint256 constant IC8x = 11201724637271039764798623441350903487110912630994328063735802041659149290802;\n uint256 constant IC8y = 9584899601398928135093189759789914293671858783478336033800854558608680407297;\n // Memory data\n uint16 constant pVk = 0;\n uint16 constant pPairing = 128;\n\n uint16 constant pLastMem = 896;\n\n uint16 constant proofLength = 8;\n uint32 constant pubSignalLength = 8;\n\n /// @dev returns the verification keys in the order that the verifier expects them:\n /// alpha, beta, gamma, delta, ICs..\n function getVerificationKeys() public pure returns (uint[] memory) {\n uint[] memory vks = new uint[](16 + pubSignalLength * 2);\n vks[0] = 20491192805390485299153009773594534940189261866228447918068658471970481763042;\n vks[1] = 9383485363053290200918347156157836566562967994039712273449902621266178545958;\n vks[2] = 4252822878758300859123897981450591353533073413197771768651442665752259397132;\n vks[3] = 6375614351688725206403948262868962793625744043794305715222011528459656738731;\n vks[4] = 21847035105528745403288232691147584728191162732299865338377159692350059136679;\n vks[5] = 10505242626370262277552901082094356697409835680220590971873171140371331206856;\n vks[6] = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n vks[7] = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n vks[8] = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n vks[9] = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n vks[10] = 15637418380756236601718213192255613136045919407816081601661261207618084073597;\n vks[11] = 16569784677986731884848814767977081422246581497389376666284070100669021849313;\n vks[12] = 17775141888156869748745527945157624548875521553021038167785799262294965116348;\n vks[13] = 3246184716089128973746765775249737516048676435198106546989660202706440984521;\n vks[14] = 4990317659614575818156037472214188417509096922233331003555642014823238651184;\n vks[15] = 14469248329543848838153834859360699519345616103861941229956057140145693492508;\n vks[16] = 10837138624576207424789978193086542153499320344753530437477168438248082178960;\n vks[17] = 917015773848957701033958467874666708682927187095469719889324478895656869516;\n vks[18] = 5037499117481750214477112555364145021274012966256645948893036512248435385840;\n vks[19] = 19826826480151452757007846213434794238926452546710485787711011712233552633495;\n vks[20] = 20945528997632428738612501906743782336475532295455403104686278305604488099835;\n vks[21] = 20744191411948171901695905522237963923426425453283062602166914445806285227301;\n vks[22] = 8513991002836348269358097045344942553237626798000929884704947463798784967405;\n vks[23] = 19338209321160679542018365847622795887832971526814598737666811533118912666856;\n vks[24] = 3569844613050455610552335538126280293963365442570334539158228936972825900539;\n vks[25] = 16528366039144804325194354617729911304908458001966274902042903564466963990992;\n vks[26] = 1570945769731720797444624982944778925162368447218125765326050361254312822358;\n vks[27] = 2602548857774106882745290052940216670975889108043343483573122286840504404756;\n vks[28] = 21301906662599840990524780602285271554623267433315428422652065889924533228332;\n vks[29] = 11716127211538228300463074562279867241595264693476507064906125029152968407192;\n vks[30] = 11201724637271039764798623441350903487110912630994328063735802041659149290802;\n vks[31] = 9584899601398928135093189759789914293671858783478336033800854558608680407297;\n return vks;\n }\n\n /// @dev return true if the public signal is aliased\n function isAliased(uint[] calldata _pubSignals) public pure returns (bool) {\n // Alias check\n if (_pubSignals[0] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[1] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[2] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[3] >= 1461501637330902918203684832716283019655932542976) { return true; }\n if (_pubSignals[4] >= 452312848583266388373324160190187140051835877600158453279131187530910662656) { return true; }\n if (_pubSignals[5] >= 18446744073709551616) { return true; }\n if (_pubSignals[6] >= 21888242871839275222246405745257275088548364400416034343698204186575808495617) { return true; }\n if (_pubSignals[7] >= 904625697166532776746648320380374280103671755200316906558262375061821325312) { return true; }\n return false;\n }\n\n function verifyProof(uint[] calldata _proofs, uint[] calldata _pubSignals) public view returns (bool) {\n // Check Argument\n require(_proofs.length == proofLength, \"Invalid proof\");\n require(_pubSignals.length == pubSignalLength, \"Invalid public signal\");\n if (isAliased(_pubSignals)) { return false; }\n assembly {\n // G1 function to multiply a G1 value(x,y) to value in an address\n function g1_mulAccC(pR, x, y, s) {\n let success\n let mIn := mload(0x40)\n mstore(mIn, x)\n mstore(add(mIn, 32), y)\n mstore(add(mIn, 64), s)\n\n success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n\n mstore(add(mIn, 64), mload(pR))\n mstore(add(mIn, 96), mload(add(pR, 32)))\n\n success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)\n\n if iszero(success) {\n mstore(0, 0)\n return(0, 0x20)\n }\n }\n\n function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {\n let _pPairing := add(pMem, pPairing)\n let _pVk := add(pMem, pVk)\n\n mstore(_pVk, IC0x)\n mstore(add(_pVk, 32), IC0y)\n\n // Compute the linear combination it.vkey.vk_x\n g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))\n g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))\n g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))\n g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))\n g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))\n g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))\n g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))\n g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))\n // -A\n mstore(_pPairing, calldataload(pA))\n mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))\n\n // B\n mstore(add(_pPairing, 64), calldataload(pB))\n mstore(add(_pPairing, 96), calldataload(add(pB, 32)))\n mstore(add(_pPairing, 128), calldataload(add(pB, 64)))\n mstore(add(_pPairing, 160), calldataload(add(pB, 96)))\n\n // alpha1\n mstore(add(_pPairing, 192), alphax)\n mstore(add(_pPairing, 224), alphay)\n\n // beta2\n mstore(add(_pPairing, 256), betax1)\n mstore(add(_pPairing, 288), betax2)\n mstore(add(_pPairing, 320), betay1)\n mstore(add(_pPairing, 352), betay2)\n\n // it.vkey.vk_x\n mstore(add(_pPairing, 384), mload(add(pMem, pVk)))\n mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))\n\n // gamma2\n mstore(add(_pPairing, 448), gammax1)\n mstore(add(_pPairing, 480), gammax2)\n mstore(add(_pPairing, 512), gammay1)\n mstore(add(_pPairing, 544), gammay2)\n\n // C\n mstore(add(_pPairing, 576), calldataload(pC))\n mstore(add(_pPairing, 608), calldataload(add(pC, 32)))\n\n // delta2\n mstore(add(_pPairing, 640), deltax1)\n mstore(add(_pPairing, 672), deltax2)\n mstore(add(_pPairing, 704), deltay1)\n mstore(add(_pPairing, 736), deltay2)\n\n let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)\n\n isOk := and(success, mload(_pPairing))\n }\n\n let pMem := mload(0x40)\n mstore(0x40, add(pMem, pLastMem))\n\n // Validate all evaluations\n let isValid := checkPairing(_proofs.offset, add(_proofs.offset, 64), add(_proofs.offset, 192), _pubSignals.offset, pMem)\n\n mstore(0, isValid)\n return(0, 0x20)\n }\n }\n}\n" + }, + "contracts/TypeRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.18;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\nimport { ITypeRegistry, CredentialType, CredentialTypeMiscConfig } from \"./interfaces/ITypeRegistry.sol\";\nimport { IProofVerifier } from \"./interfaces/IProofVerifier.sol\";\nimport { IPublicSignalGetter } from \"./interfaces/IPublicSignalGetter.sol\";\n\n/**\n * @title TypeRegistry\n * @dev A contract that allows the registration of credential types.\n * Credential types are unique per creator and type name.\n * @notice Getters in this contract does not do any parameter validation,\n * so callers should validate the inputs and outputs and uninitialized values will be zero.\n */\ncontract TypeRegistry is ITypeRegistry, Ownable {\n error TypeAlreadyExists();\n error TypeDoesNotExist();\n error InvalidTypeName();\n error NotTypeOwner();\n\n /// @dev mapping from typeID to CredentialType.\n mapping(uint160 typeId => CredentialType credType) private _credTypes;\n\n /// @dev mapping from typeID to its verification stack's verifier.\n /// @dev verifier typeID => verificationStackID => verifier\n mapping(uint160 typeId => mapping(uint8 veriStackId => IProofVerifier verifier)) private _verifiers;\n\n /// @dev mapping from typeID to its verification stack's intrinsic value .\n /// @dev verifier typeID => verificationStackID => verifier\n mapping(uint160 typeId => mapping(uint8 veriStackId => IPublicSignalGetter psGetter)) private _psGetters;\n\n /// @param admin admin of the contract\n constructor(address admin) {\n transferOwnership(admin);\n }\n\n /// @notice set a primitive type, only callable by the admin.\n /// @param typeId the type id of the primitive type\n /// @param name name of the type\n /// @param definition definition string\n /// @param description description of the type\n /// @param resourceURI mutable resource URI of the type\n /// @param config misc config for the type\n function setPrimitiveType(\n uint160 typeId,\n string calldata name,\n string calldata definition,\n string calldata description,\n string calldata resourceURI,\n CredentialTypeMiscConfig calldata config\n ) external override onlyOwner {\n // check if the type is already set by others.\n // primitive type will have its creator as 0x0.\n if (bytes(_credTypes[typeId].name).length != 0) {\n revert TypeAlreadyExists();\n }\n if (bytes(name).length == 0) {\n revert InvalidTypeName();\n }\n // save type info\n _credTypes[typeId] = CredentialType({\n revocable: config.revocable,\n admin: address(0),\n name: name,\n definition: definition,\n description: description,\n resourceURI: resourceURI\n });\n emit TypeRegistered(typeId, address(0), name, definition, description, resourceURI);\n // add verifier and public signal getter\n _verifiers[typeId][config.verificationStackId] = config.verifier;\n emit TypeVerifierUpdated(typeId, config.verificationStackId, address(config.verifier));\n _psGetters[typeId][config.verificationStackId] = config.publicSignalGetter;\n emit TypePublicSignalGetterUpdated(typeId, config.verificationStackId, address(config.publicSignalGetter));\n }\n\n /// @dev register a new type by msg.sender\n /// @param name type name\n /// @param definition type definition string, immutable\n /// @param description description of the type, immutable\n /// @param resourceURI resource URI of the type, mutable\n /// @return typeID of the registered type\n function registerType(\n bool revocable,\n string calldata name,\n string calldata definition,\n string calldata description,\n string calldata resourceURI\n ) external override returns (uint160) {\n return _registerType(revocable, name, definition, description, resourceURI);\n }\n\n /// @notice Register a new type by `msg.sender` with verifier and public signal getter set for a specific verification stack.\n /// @param name Type name\n /// @param definition Immutable type definition string\n /// @param description Description of the type\n /// @param resourceURI Mutable resource URI of the type\n /// @param verifier verifier for the type\n /// @param publicSignalGetter public signal getter for the type\n /// @return typeID Unique identifier of the registered type\n function registerType1Step(\n bool revocable,\n string calldata name,\n string calldata definition,\n string calldata description,\n string calldata resourceURI,\n uint8 verificationStackId,\n IProofVerifier verifier,\n IPublicSignalGetter publicSignalGetter\n ) external override returns (uint160) {\n uint160 typeId = _registerType(revocable, name, definition, description, resourceURI);\n // add verifier and public signal getter\n _verifiers[typeId][verificationStackId] = verifier;\n emit TypeVerifierUpdated(typeId, verificationStackId, address(verifier));\n _psGetters[typeId][verificationStackId] = publicSignalGetter;\n emit TypePublicSignalGetterUpdated(typeId, verificationStackId, address(publicSignalGetter));\n return typeId;\n }\n\n /// @dev register a new type by msg.sender\n /// @param name type name\n /// @param definition type definition string, immutable\n /// @param description description of the type, immutable\n /// @param resourceURI resource URI of the type, mutable\n /// @return typeID of the registered type\n function _registerType(\n bool revocable,\n string calldata name,\n string calldata definition,\n string calldata description,\n string calldata resourceURI\n ) internal returns (uint160) {\n uint160 credTypeID = _calcTypeID(msg.sender, name);\n if (bytes(_credTypes[credTypeID].name).length != 0) {\n revert TypeAlreadyExists();\n }\n if (bytes(name).length == 0) {\n revert InvalidTypeName();\n }\n CredentialType memory credType = CredentialType({\n revocable: revocable,\n admin: msg.sender,\n name: name,\n definition: definition,\n description: description,\n resourceURI: resourceURI\n });\n _credTypes[credTypeID] = credType;\n emit TypeRegistered(\n credTypeID,\n credType.admin,\n credType.name,\n credType.definition,\n credType.description,\n credType.resourceURI\n );\n return credTypeID;\n }\n\n /// @dev check if the type is fully initialized for the given verification stack.\n /// @param typeId id of the type\n /// @param verificationStackId id the verification stack\n function isTypeFullyInitializedForStack(\n uint160 typeId,\n uint8 verificationStackId\n ) external view override returns (bool) {\n return\n _typeExists(typeId) &&\n _verifiers[typeId][verificationStackId] != IProofVerifier(address(0)) &&\n _psGetters[typeId][verificationStackId] != IPublicSignalGetter(address(0));\n }\n\n /// @dev transfer the ownership of a type.\n /// @param typeId type id of the type\n /// @param newAdmin address of the new admin\n function transferTypeAdmin(uint160 typeId, address newAdmin) external override onlyTypeOwner(typeId) {\n if (_credTypes[typeId].admin == address(0)) {\n // primitive type doesn't have an admin, so the owner can't transfer it.\n return;\n }\n _credTypes[typeId].admin = newAdmin;\n emit TypeAdminTransferred(typeId, msg.sender, newAdmin);\n }\n\n /// @dev update the resource URI of a type\n /// @param typeId of the type\n /// @param uri new resource URI\n /// TODO: resource URI specifcation: support multiple verification stack.\n function updateTypeResourceURI(uint160 typeId, string calldata uri) external override onlyTypeOwner(typeId) {\n emit TypeResourceURIUpdated(typeId, _credTypes[typeId].resourceURI, uri);\n _credTypes[typeId].resourceURI = uri;\n }\n\n /// @dev update the verifier for a type\n function updateTypeVerifier(\n uint160 typeId,\n uint8 verificationStackId,\n IProofVerifier verifier\n ) external override onlyTypeOwner(typeId) {\n _verifiers[typeId][verificationStackId] = verifier;\n emit TypeVerifierUpdated(typeId, verificationStackId, address(verifier));\n }\n\n /// @dev update the public signal getter for a type\n /// @param typeId id of the type\n /// @param verificationStackId id of the verification stack\n /// @param getter the address of the public signal getter\n function updateTypePublicSignalGetter(\n uint160 typeId,\n uint8 verificationStackId,\n IPublicSignalGetter getter\n ) external override onlyTypeOwner(typeId) {\n _psGetters[typeId][verificationStackId] = getter;\n emit TypePublicSignalGetterUpdated(typeId, verificationStackId, address(getter));\n }\n\n /// @dev get the type for the given typeID\n function getType(uint160 _id) external view override returns (CredentialType memory) {\n return _credTypes[_id];\n }\n\n /// @dev Retrieve the admin of a type\n /// @param typeId type id of the type\n /// @return address of the admin of the type\n function getTypeAdmin(uint160 typeId) external view override returns (address) {\n /// uninitialized type, return 0x0\n if (!_typeExists(typeId)) {\n return address(0);\n }\n if (_credTypes[typeId].admin != address(0)) {\n return _credTypes[typeId].admin;\n }\n return owner();\n }\n\n /// @dev check if the type is revocable\n function isRevocable(uint160 typeId) external view override returns (bool) {\n return _credTypes[typeId].revocable;\n }\n\n /// @dev get the verifier for the given typeID and verificationStackID.\n function getVerifier(uint160 typeId, uint8 verificationStackId) external view override returns (IProofVerifier) {\n return _verifiers[typeId][verificationStackId];\n }\n\n /// @param typeId type id of the type\n /// @param verificationStackId verification stack id\n function getPublicSignalGetter(\n uint160 typeId,\n uint8 verificationStackId\n ) external view override returns (IPublicSignalGetter) {\n return _psGetters[typeId][verificationStackId];\n }\n\n /// @dev calculate the typeID of a type\n function calcTypeID(address creator, string calldata name) external pure override returns (uint160) {\n return _calcTypeID(creator, name);\n }\n\n /// @dev calculate the typeID of a type\n function _calcTypeID(address creator, string calldata name) private pure returns (uint160) {\n return uint160(uint256(keccak256(abi.encodePacked(creator, name))));\n }\n\n /// @dev check if the type exists\n function _typeExists(uint160 typeId) private view returns (bool) {\n return bytes(_credTypes[typeId].name).length != 0;\n }\n\n /// @dev check if the caller is the owner of the type\n function _onlyTypeOwner(uint160 typeId) private view {\n if (!_typeExists(typeId)) {\n revert TypeDoesNotExist();\n }\n // primitive type will have its creator as 0x0, so only the admin can update it.\n if (_credTypes[typeId].admin == address(0)) {\n if (msg.sender != owner()) {\n revert NotTypeOwner();\n }\n return;\n }\n if (_credTypes[typeId].admin != msg.sender) {\n revert NotTypeOwner();\n }\n }\n\n modifier onlyTypeOwner(uint160 typeId) {\n _onlyTypeOwner(typeId);\n _;\n }\n}\n" + } + }, + "settings": { + "metadata": { + "bytecodeHash": "none", + "useLiteralContent": true + }, + "optimizer": { + "enabled": true, + "runs": 800 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/packages/evm-contracts/hardhat.config.ts b/packages/evm-contracts/hardhat.config.ts index 7a197fd..002dda9 100644 --- a/packages/evm-contracts/hardhat.config.ts +++ b/packages/evm-contracts/hardhat.config.ts @@ -33,6 +33,7 @@ switch (process.env.NETWORK) { verifyApiKey = process.env.POLYGONSCAN_API_KEY || ""; break; case "sepolia": + console.log("etherscan apiKey"); verifyApiKey = process.env.ETHERSCAN_API_KEY || ""; break; default: @@ -82,6 +83,17 @@ const config: HardhatUserConfig = { chainId: 1, accounts: [privateKey], }, + gravity: { + url: "https://rpc.gravity.xyz", + chainId: 1625, + accounts: [privateKey], + verify: { + etherscan: { + apiKey: "no-op", // verification on conduit does not require an API key, but hardhat etherscan-verify does. + apiUrl: "https://explorer.gravity.xyz/api", + }, + }, + }, }, paths: { artifacts: "./artifacts", diff --git a/packages/evm-contracts/package.json b/packages/evm-contracts/package.json index 317cbe3..950c944 100644 --- a/packages/evm-contracts/package.json +++ b/packages/evm-contracts/package.json @@ -42,7 +42,11 @@ "deploy:mainnet": "hardhat deploy --tags GalxeIdentityProtocol --network mainnet", "deploy-primitive:mainnet": "hardhat deploy --tags BabyZKPrimitive --network mainnet", "verify:mainnet": "NETWORK=mainnet hardhat etherscan-verify --network mainnet", - "register-primitive:mainnet": "hardhat run scripts/registerPrimitiveTypes.ts --network mainnet" + "register-primitive:mainnet": "hardhat run scripts/registerPrimitiveTypes.ts --network mainnet", + "deploy:gravity": "hardhat deploy --tags GalxeIdentityProtocol --network gravity", + "deploy-primitive:gravity": "hardhat deploy --tags BabyZKPrimitive --network gravity", + "verify:gravity": "NETWORK=gravity hardhat etherscan-verify --network gravity", + "register-primitive:gravity": "hardhat run scripts/registerPrimitiveTypes.ts --network gravity" }, "devDependencies": { "@nomicfoundation/hardhat-chai-matchers": "^2.0.6",