diff --git a/contracts/WakuRlnRegistry.sol b/contracts/WakuRlnRegistry.sol index 595a105..cb8688a 100644 --- a/contracts/WakuRlnRegistry.sol +++ b/contracts/WakuRlnRegistry.sol @@ -10,7 +10,7 @@ error NoStorageContractAvailable(); error FailedToRegister(string reason); contract WakuRlnRegistry is Ownable { - uint16 public currentStorageIndex; + uint16 public nextStorageIndex; mapping(uint16 => address) public storages; uint16 public usingStorageIndex = 0; @@ -24,23 +24,23 @@ contract WakuRlnRegistry is Ownable { } function _insertIntoStorageMap(address storageAddress) internal { - storages[currentStorageIndex] = storageAddress; - emit NewStorageContract(currentStorageIndex, storageAddress); - currentStorageIndex += 1; + storages[nextStorageIndex] = storageAddress; + emit NewStorageContract(nextStorageIndex, storageAddress); + nextStorageIndex += 1; } function registerStorage(address storageAddress) external onlyOwner { - if (storages[currentStorageIndex] != address(0)) revert StorageAlreadyExists(storageAddress); + if (storages[nextStorageIndex] != address(0)) revert StorageAlreadyExists(storageAddress); _insertIntoStorageMap(storageAddress); } function newStorage() external onlyOwner { - WakuRln newStorageContract = new WakuRln(address(poseidonHasher), currentStorageIndex); + WakuRln newStorageContract = new WakuRln(address(poseidonHasher), nextStorageIndex); _insertIntoStorageMap(address(newStorageContract)); } function register(uint256 commitment) external payable { - if (usingStorageIndex >= currentStorageIndex) revert NoStorageContractAvailable(); + if (usingStorageIndex >= nextStorageIndex) revert NoStorageContractAvailable(); // iteratively check if the storage contract is full, and increment the usingStorageIndex if it is while (true) { diff --git a/deploy/002_deploy_rln.ts b/deploy/002_deploy_rln_registry.ts similarity index 89% rename from deploy/002_deploy_rln.ts rename to deploy/002_deploy_rln_registry.ts index 81b2dab..145df9f 100644 --- a/deploy/002_deploy_rln.ts +++ b/deploy/002_deploy_rln_registry.ts @@ -10,7 +10,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const poseidonHasherAddress = (await deployments.get("PoseidonHasher")) .address; - await deploy("WakuRln", { + await deploy("WakuRlnRegistry", { from: deployer, log: true, args: [poseidonHasherAddress], @@ -18,5 +18,5 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { }; export default func; -func.tags = ["WakuRln"]; +func.tags = ["WakuRlnRegistry"]; func.dependencies = ["PoseidonHasher"]; diff --git a/deploy/003_deploy_rln.ts b/deploy/003_deploy_rln.ts new file mode 100644 index 0000000..e3c2f88 --- /dev/null +++ b/deploy/003_deploy_rln.ts @@ -0,0 +1,45 @@ +import { HardhatRuntimeEnvironment } from "hardhat/types"; +import { DeployFunction, DeploymentSubmission } from "hardhat-deploy/types"; + +const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const { deployments, getUnnamedAccounts } = hre; + + const [deployer] = await getUnnamedAccounts(); + + const wakuRlnRegistry = await deployments.get("WakuRlnRegistry"); + const registryContract = new hre.ethers.Contract( + wakuRlnRegistry.address, + wakuRlnRegistry.abi, + hre.ethers.provider.getSigner(deployer) + ); + + const indexOfStorageToBeDeployed = await registryContract.nextStorageIndex(); + const tx = await registryContract.newStorage(); + await tx.wait(); + + const poseidonHasherAddress = (await deployments.get("PoseidonHasher")) + .address; + const storageAddress = await registryContract.storages( + indexOfStorageToBeDeployed + ); + const extendedArtifact = await deployments.getExtendedArtifact("WakuRln"); + + console.log("Storage address: ", storageAddress); + const d: DeploymentSubmission = { + abi: extendedArtifact.abi, + address: storageAddress, + args: [poseidonHasherAddress, indexOfStorageToBeDeployed], + bytecode: extendedArtifact.bytecode, + deployedBytecode: extendedArtifact.deployedBytecode, + receipt: tx, + transactionHash: tx.hash, + metadata: extendedArtifact.metadata, + solcInput: extendedArtifact.solcInput, + devdoc: extendedArtifact.devdoc, + }; + console.log(d); + deployments.save(`WakuRlnStorage_${indexOfStorageToBeDeployed}`, d); +}; + +export default func; +func.dependencies = ["WakuRlnRegistry"]; diff --git a/deployments/allDeployments.json b/deployments/allDeployments.json index 2a4b373..3496cf2 100644 --- a/deployments/allDeployments.json +++ b/deployments/allDeployments.json @@ -334,6 +334,861 @@ "type": "function" } ] + }, + "WakuRlnRegistry": { + "address": "0x50D658a2ab7f66f4B73E27e8731B8b13Cd06Df8A", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_poseidonHasher", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "FailedToRegister", + "type": "error" + }, + { + "inputs": [], + "name": "NoStorageContractAvailable", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "storageAddress", + "type": "address" + } + ], + "name": "StorageAlreadyExists", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "index", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "storageAddress", + "type": "address" + } + ], + "name": "NewStorageContract", + "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" + }, + { + "inputs": [], + "name": "newStorage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "nextStorageIndex", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poseidonHasher", + "outputs": [ + { + "internalType": "contract IPoseidonHasher", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "commitment", + "type": "uint256" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "storageAddress", + "type": "address" + } + ], + "name": "registerStorage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "storages", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "usingStorageIndex", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + }, + "WakuRlnStorage_0": { + "address": "0x02c233d3899c3A435631AC857DAD5555F4f9656C", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_poseidonHasher", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_contractIndex", + "type": "uint16" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "DuplicateIdCommitment", + "type": "error" + }, + { + "inputs": [], + "name": "NotImplemented", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "MemberRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "MemberWithdrawn", + "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" + }, + { + "inputs": [], + "name": "DEPTH", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MEMBERSHIP_DEPOSIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SET_SIZE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractIndex", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "idCommitmentIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "members", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poseidonHasher", + "outputs": [ + { + "internalType": "contract IPoseidonHasher", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "idCommitments", + "type": "uint256[]" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256[8]", + "name": "proof", + "type": "uint256[8]" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "stakedAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "verifier", + "outputs": [ + { + "internalType": "contract IVerifier", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "withdrawalBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ] + }, + "WakuRlnStorage_1": { + "address": "0x662Be55E75c829A03c52CDba4Ab7dAde4e1be8a9", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_poseidonHasher", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_contractIndex", + "type": "uint16" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "DuplicateIdCommitment", + "type": "error" + }, + { + "inputs": [], + "name": "NotImplemented", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "MemberRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "MemberWithdrawn", + "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" + }, + { + "inputs": [], + "name": "DEPTH", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MEMBERSHIP_DEPOSIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SET_SIZE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractIndex", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "idCommitmentIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "members", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poseidonHasher", + "outputs": [ + { + "internalType": "contract IPoseidonHasher", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "idCommitments", + "type": "uint256[]" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256[8]", + "name": "proof", + "type": "uint256[8]" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "stakedAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "verifier", + "outputs": [ + { + "internalType": "contract IVerifier", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "withdrawalBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ] } } } diff --git a/deployments/sepolia/WakuRlnRegistry.json b/deployments/sepolia/WakuRlnRegistry.json new file mode 100644 index 0000000..ea4b9d9 --- /dev/null +++ b/deployments/sepolia/WakuRlnRegistry.json @@ -0,0 +1,317 @@ +{ + "address": "0x50D658a2ab7f66f4B73E27e8731B8b13Cd06Df8A", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_poseidonHasher", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "FailedToRegister", + "type": "error" + }, + { + "inputs": [], + "name": "NoStorageContractAvailable", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "storageAddress", + "type": "address" + } + ], + "name": "StorageAlreadyExists", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "index", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "address", + "name": "storageAddress", + "type": "address" + } + ], + "name": "NewStorageContract", + "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" + }, + { + "inputs": [], + "name": "newStorage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "nextStorageIndex", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poseidonHasher", + "outputs": [ + { + "internalType": "contract IPoseidonHasher", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "commitment", + "type": "uint256" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "storageAddress", + "type": "address" + } + ], + "name": "registerStorage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "storages", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "usingStorageIndex", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xd75ffb9e757256c3134094a9063e4c465f2286040a33c00257ef08cf5b692030", + "receipt": { + "to": null, + "from": "0x3F47b2a1dF96DE2e198d646b598C37251CCC3b98", + "contractAddress": "0x50D658a2ab7f66f4B73E27e8731B8b13Cd06Df8A", + "transactionIndex": 2, + "gasUsed": "2034745", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000001000000000000000000000000000000000000000000000002000000020000000000000000000000000000002000000000000000000000000000000000040", + "blockHash": "0x62cb9408edce3db02389d21aa4d40e85ddaabf2dead4362c22b44dfcd7d817cf", + "transactionHash": "0xd75ffb9e757256c3134094a9063e4c465f2286040a33c00257ef08cf5b692030", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 4018055, + "transactionHash": "0xd75ffb9e757256c3134094a9063e4c465f2286040a33c00257ef08cf5b692030", + "address": "0x50D658a2ab7f66f4B73E27e8731B8b13Cd06Df8A", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000003f47b2a1df96de2e198d646b598c37251ccc3b98" + ], + "data": "0x", + "logIndex": 2, + "blockHash": "0x62cb9408edce3db02389d21aa4d40e85ddaabf2dead4362c22b44dfcd7d817cf" + } + ], + "blockNumber": 4018055, + "cumulativeGasUsed": "2116994", + "status": 1, + "byzantium": true + }, + "args": ["0xCF6ccD3691f67dfa0EdDeFED1B295139d0197609"], + "numDeployments": 1, + "solcInputHash": "40de5bebbf86e467166c280b4e48ebe9", + "metadata": "{\"compiler\":{\"version\":\"0.8.15+commit.e14f2714\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poseidonHasher\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"FailedToRegister\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoStorageContractAvailable\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"storageAddress\",\"type\":\"address\"}],\"name\":\"StorageAlreadyExists\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"index\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"storageAddress\",\"type\":\"address\"}],\"name\":\"NewStorageContract\",\"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\"},{\"inputs\":[],\"name\":\"newStorage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextStorageIndex\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poseidonHasher\",\"outputs\":[{\"internalType\":\"contract IPoseidonHasher\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"commitment\",\"type\":\"uint256\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"storageAddress\",\"type\":\"address\"}],\"name\":\"registerStorage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"storages\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"usingStorageIndex\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"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.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/WakuRlnRegistry.sol\":\"WakuRlnRegistry\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\",\":openzeppelin/=lib/openzeppelin-contracts/contracts/\",\":rln-contract/=lib/rln-contract/contracts/\"]},\"sources\":{\"contracts/WakuRln.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.15;\\n\\nimport {IPoseidonHasher} from \\\"rln-contract/PoseidonHasher.sol\\\";\\nimport {RlnBase, DuplicateIdCommitment} from \\\"rln-contract/RlnBase.sol\\\";\\nimport {Ownable} from \\\"openzeppelin-contracts/contracts/access/Ownable.sol\\\";\\n\\nerror NotImplemented();\\n\\ncontract WakuRln is Ownable, RlnBase {\\n uint16 public immutable contractIndex;\\n\\n constructor(address _poseidonHasher, uint16 _contractIndex) Ownable() RlnBase(0, 20, _poseidonHasher, address(0)) {\\n contractIndex = _contractIndex;\\n }\\n\\n /// Registers a member\\n /// @param idCommitment The idCommitment of the member\\n function _register(uint256 idCommitment) internal {\\n _validateRegistration(idCommitment);\\n\\n members[idCommitment] = 1;\\n\\n emit MemberRegistered(idCommitment, idCommitmentIndex);\\n idCommitmentIndex += 1;\\n }\\n\\n function register(uint256[] memory idCommitments) external onlyOwner {\\n uint256 len = idCommitments.length;\\n for (uint256 i = 0; i < len;) {\\n _register(idCommitments[i]);\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function register(uint256 idCommitment) external payable override {\\n revert NotImplemented();\\n }\\n\\n function slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) external pure override {\\n revert NotImplemented();\\n }\\n\\n function _validateRegistration(uint256 idCommitment) internal view override {\\n if (members[idCommitment] != 0) revert DuplicateIdCommitment();\\n }\\n\\n function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof)\\n internal\\n pure\\n override\\n {\\n revert NotImplemented();\\n }\\n\\n function withdraw() external pure override {\\n revert NotImplemented();\\n }\\n}\\n\",\"keccak256\":\"0xaa4c93ed9c0656a01c113f0453b6f6a3db742e53b3371e34ed608902913d9700\",\"license\":\"MIT\"},\"contracts/WakuRlnRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.15;\\n\\nimport {WakuRln} from \\\"./WakuRln.sol\\\";\\nimport {IPoseidonHasher} from \\\"rln-contract/PoseidonHasher.sol\\\";\\nimport {Ownable} from \\\"openzeppelin-contracts/contracts/access/Ownable.sol\\\";\\n\\nerror StorageAlreadyExists(address storageAddress);\\nerror NoStorageContractAvailable();\\nerror FailedToRegister(string reason);\\n\\ncontract WakuRlnRegistry is Ownable {\\n uint16 public nextStorageIndex;\\n mapping(uint16 => address) public storages;\\n\\n uint16 public usingStorageIndex = 0;\\n\\n IPoseidonHasher public immutable poseidonHasher;\\n\\n event NewStorageContract(uint16 index, address storageAddress);\\n\\n constructor(address _poseidonHasher) Ownable() {\\n poseidonHasher = IPoseidonHasher(_poseidonHasher);\\n }\\n\\n function _insertIntoStorageMap(address storageAddress) internal {\\n storages[nextStorageIndex] = storageAddress;\\n emit NewStorageContract(nextStorageIndex, storageAddress);\\n nextStorageIndex += 1;\\n }\\n\\n function registerStorage(address storageAddress) external onlyOwner {\\n if (storages[nextStorageIndex] != address(0)) revert StorageAlreadyExists(storageAddress);\\n _insertIntoStorageMap(storageAddress);\\n }\\n\\n function newStorage() external onlyOwner {\\n WakuRln newStorageContract = new WakuRln(address(poseidonHasher), nextStorageIndex);\\n _insertIntoStorageMap(address(newStorageContract));\\n }\\n\\n function register(uint256 commitment) external payable {\\n if (usingStorageIndex >= nextStorageIndex) revert NoStorageContractAvailable();\\n\\n // iteratively check if the storage contract is full, and increment the usingStorageIndex if it is\\n while (true) {\\n try WakuRln(storages[usingStorageIndex]).register{value: msg.value}(commitment) {\\n break;\\n } catch Error(string memory reason) {\\n if (keccak256(abi.encodePacked(reason)) != keccak256(abi.encodePacked(\\\"FullTree()\\\"))) {\\n revert FailedToRegister(reason);\\n }\\n usingStorageIndex += 1;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3566c0c2f89c198617bde71d37ff4491911a2fa73dfa2f653f16be54ccce5d17\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/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\"},\"lib/openzeppelin-contracts/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"lib/rln-contract/contracts/IVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0 OR MIT\\npragma solidity 0.8.15;\\n\\ninterface IVerifier {\\n function verifyProof(uint256[2] memory a, uint256[2][2] memory b, uint256[2] memory c, uint256[2] memory input)\\n external\\n view\\n returns (bool);\\n}\\n\",\"keccak256\":\"0x538e61fbb62bf1ef9f0c3f7e7d771ddfc8506a97e7d98aada763830fc741d8b8\",\"license\":\"Apache-2.0 OR MIT\"},\"lib/rln-contract/contracts/PoseidonHasher.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// Forked from https://github.com/kilic/rlnapp/\\n\\npragma solidity 0.8.15;\\n\\ninterface IPoseidonHasher {\\n /// @notice Hashes the input using the Poseidon hash function, n = 2, second input is the constant 0\\n /// @param input The input to hash\\n function hash(uint256 input) external pure returns (uint256 result);\\n}\\n\\ncontract PoseidonHasher is IPoseidonHasher {\\n uint256 constant Q = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\\n uint256 constant C0 = 4417881134626180770308697923359573201005643519861877412381846989312604493735;\\n uint256 constant C1 = 5433650512959517612316327474713065966758808864213826738576266661723522780033;\\n uint256 constant C2 = 13641176377184356099764086973022553863760045607496549923679278773208775739952;\\n uint256 constant C3 = 17949713444224994136330421782109149544629237834775211751417461773584374506783;\\n uint256 constant C4 = 13765628375339178273710281891027109699578766420463125835325926111705201856003;\\n uint256 constant C5 = 19179513468172002314585757290678967643352171735526887944518845346318719730387;\\n uint256 constant C6 = 5157412437176756884543472904098424903141745259452875378101256928559722612176;\\n uint256 constant C7 = 535160875740282236955320458485730000677124519901643397458212725410971557409;\\n uint256 constant C8 = 1050793453380762984940163090920066886770841063557081906093018330633089036729;\\n uint256 constant C9 = 10665495010329663932664894101216428400933984666065399374198502106997623173873;\\n uint256 constant C10 = 19965634623406616956648724894636666805991993496469370618546874926025059150737;\\n uint256 constant C11 = 13007250030070838431593222885902415182312449212965120303174723305710127422213;\\n uint256 constant C12 = 16877538715074991604507979123743768693428157847423939051086744213162455276374;\\n uint256 constant C13 = 18211747749504876135588847560312685184956239426147543810126553367063157141465;\\n uint256 constant C14 = 18151553319826126919739798892854572062191241985315767086020821632812331245635;\\n uint256 constant C15 = 19957033149976712666746140949846950406660099037474791840946955175819555930825;\\n uint256 constant C16 = 3469514863538261843186854830917934449567467100548474599735384052339577040841;\\n uint256 constant C17 = 989698510043911779243192466312362856042600749099921773896924315611668507708;\\n uint256 constant C18 = 12568377015646290945235387813564567111330046038050864455358059568128000172201;\\n uint256 constant C19 = 20856104135605479600325529349246932565148587186338606236677138505306779314172;\\n uint256 constant C20 = 8206918720503535523121349917159924938835810381723474192155637697065780938424;\\n uint256 constant C21 = 1309058477013932989380617265069188723120054926187607548493110334522527703566;\\n uint256 constant C22 = 14076116939332667074621703729512195584105250395163383769419390236426287710606;\\n uint256 constant C23 = 10153498892749751942204288991871286290442690932856658983589258153608012428674;\\n uint256 constant C24 = 18202499207234128286137597834010475797175973146805180988367589376893530181575;\\n uint256 constant C25 = 12739388830157083522877690211447248168864006284243907142044329113461613743052;\\n uint256 constant C26 = 15123358710467780770838026754240340042441262572309759635224051333176022613949;\\n uint256 constant C27 = 19925004701844594370904593774447343836015483888496504201331110250494635362184;\\n uint256 constant C28 = 10352416606816998476681131583320899030072315953910679608943150613208329645891;\\n uint256 constant C29 = 10567371822366244361703342347428230537114808440249611395507235283708966113221;\\n uint256 constant C30 = 5635498582763880627392290206431559361272660937399944184533035305989295959602;\\n uint256 constant C31 = 11866432933224219174041051738704352719163271639958083608224676028593315904909;\\n uint256 constant C32 = 5795020705294401441272215064554385591292330721703923167136157291459784140431;\\n uint256 constant C33 = 9482202378699252817564375087302794636287866584767523335624368774856230692758;\\n uint256 constant C34 = 4245237636894546151746468406560945873445548423466753843402086544922216329298;\\n uint256 constant C35 = 12000500941313982757584712677991730019124834399479314697467598397927435905133;\\n uint256 constant C36 = 7596790274058425558167520209857956363736666939016807569082239187494363541787;\\n uint256 constant C37 = 2484867918246116343205467273440098378820186751202461278013576281097918148877;\\n uint256 constant C38 = 18312645949449997391810445935615409295369169383463185688973803378104013950190;\\n uint256 constant C39 = 15320686572748723004980855263301182130424010735782762814513954166519592552733;\\n uint256 constant C40 = 12618438900597948888520621062416758747872180395546164387827245287017031303859;\\n uint256 constant C41 = 17438141672027706116733201008397064011774368832458707512367404736905021019585;\\n uint256 constant C42 = 6374197807230665998865688675365359100400438034755781666913068586172586548950;\\n uint256 constant C43 = 2189398913433273865510950346186699930188746169476472274335177556702504595264;\\n uint256 constant C44 = 6268495580028970231803791523870131137294646402347399003576649137450213034606;\\n uint256 constant C45 = 17896250365994900261202920044129628104272791547990619503076839618914047059275;\\n uint256 constant C46 = 13692156312448722528008862371944543449350293305158722920787736248435893008873;\\n uint256 constant C47 = 15234446864368744483209945022439268713300180233589581910497691316744177619376;\\n uint256 constant C48 = 1572426502623310766593681563281600503979671244997798691029595521622402217227;\\n uint256 constant C49 = 80103447810215150918585162168214870083573048458555897999822831203653996617;\\n uint256 constant C50 = 8228820324013669567851850635126713973797711779951230446503353812192849106342;\\n uint256 constant C51 = 5375851433746509614045812476958526065449377558695752132494533666370449415873;\\n uint256 constant C52 = 12115998939203497346386774317892338270561208357481805380546938146796257365018;\\n uint256 constant C53 = 9764067909645821279940531410531154041386008396840887338272986634350423466622;\\n uint256 constant C54 = 8538708244538850542384936174629541085495830544298260335345008245230827876882;\\n uint256 constant C55 = 7140127896620013355910287215441004676619168261422440177712039790284719613114;\\n uint256 constant C56 = 14297402962228458726038826185823085337698917275385741292940049024977027409762;\\n uint256 constant C57 = 6667115556431351074165934212337261254608231545257434281887966406956835140819;\\n uint256 constant C58 = 20226761165244293291042617464655196752671169026542832236139342122602741090001;\\n uint256 constant C59 = 12038289506489256655759141386763477208196694421666339040483042079632134429119;\\n uint256 constant C60 = 19027757334170818571203982241812412991528769934917288000224335655934473717551;\\n uint256 constant C61 = 16272152964456553579565580463468069884359929612321610357528838696790370074720;\\n uint256 constant C62 = 2500392889689246014710135696485946334448570271481948765283016105301740284071;\\n uint256 constant C63 = 8595254970528530312401637448610398388203855633951264114100575485022581946023;\\n uint256 constant C64 = 11635945688914011450976408058407206367914559009113158286982919675551688078198;\\n uint256 constant C65 = 614739068603482619581328040478536306925147663946742687395148680260956671871;\\n uint256 constant C66 = 18692271780377861570175282183255720350972693125537599213951106550953176268753;\\n uint256 constant C67 = 4987059230784976306647166378298632695585915319042844495357753339378260807164;\\n uint256 constant C68 = 21851403978498723616722415377430107676258664746210815234490134600998983955497;\\n uint256 constant C69 = 9830635451186415300891533983087800047564037813328875992115573428596207326204;\\n uint256 constant C70 = 4842706106434537116860242620706030229206345167233200482994958847436425185478;\\n uint256 constant C71 = 6422235064906823218421386871122109085799298052314922856340127798647926126490;\\n uint256 constant C72 = 4564364104986856861943331689105797031330091877115997069096365671501473357846;\\n uint256 constant C73 = 1944043894089780613038197112872830569538541856657037469098448708685350671343;\\n uint256 constant C74 = 21179865974855950600518216085229498748425990426231530451599322283119880194955;\\n uint256 constant C75 = 14296697761894107574369608843560006996183955751502547883167824879840894933162;\\n uint256 constant C76 = 12274619649702218570450581712439138337725246879938860735460378251639845671898;\\n uint256 constant C77 = 16371396450276899401411886674029075408418848209575273031725505038938314070356;\\n uint256 constant C78 = 3702561221750983937578095019779188631407216522704543451228773892695044653565;\\n uint256 constant C79 = 19721616877735564664624984774636557499099875603996426215495516594530838681980;\\n uint256 constant C80 = 6383350109027696789969911008057747025018308755462287526819231672217685282429;\\n uint256 constant C81 = 20860583956177367265984596617324237471765572961978977333122281041544719622905;\\n uint256 constant C82 = 5766390934595026947545001478457407504285452477687752470140790011329357286275;\\n uint256 constant C83 = 4043175758319898049344746138515323336207420888499903387536875603879441092484;\\n uint256 constant C84 = 15579382179133608217098622223834161692266188678101563820988612253342538956534;\\n uint256 constant C85 = 1864640783252634743892105383926602930909039567065240010338908865509831749824;\\n uint256 constant C86 = 15943719865023133586707144161652035291705809358178262514871056013754142625673;\\n uint256 constant C87 = 2326415993032390211558498780803238091925402878871059708106213703504162832999;\\n uint256 constant C88 = 19995326402773833553207196590622808505547443523750970375738981396588337910289;\\n uint256 constant C89 = 5143583711361588952673350526320181330406047695593201009385718506918735286622;\\n uint256 constant C90 = 15436006486881920976813738625999473183944244531070780793506388892313517319583;\\n uint256 constant C91 = 16660446760173633166698660166238066533278664023818938868110282615200613695857;\\n uint256 constant C92 = 4966065365695755376133119391352131079892396024584848298231004326013366253934;\\n uint256 constant C93 = 20683781957411705574951987677641476019618457561419278856689645563561076926702;\\n uint256 constant C94 = 17280836839165902792086432296371645107551519324565649849400948918605456875699;\\n uint256 constant C95 = 17045635513701208892073056357048619435743564064921155892004135325530808465371;\\n uint256 constant C96 = 17055032967194400710390142791334572297458033582458169295920670679093585707295;\\n uint256 constant C97 = 15727174639569115300068198908071514334002742825679221638729902577962862163505;\\n uint256 constant C98 = 1001755657610446661315902885492677747789366510875120894840818704741370398633;\\n uint256 constant C99 = 18638547332826171619311285502376343504539399518545103511265465604926625041234;\\n uint256 constant C100 = 6751954224763196429755298529194402870632445298969935050224267844020826420799;\\n uint256 constant C101 = 3526747115904224771452549517614107688674036840088422555827581348280834879405;\\n uint256 constant C102 = 15705897908180497062880001271426561999724005008972544196300715293701537574122;\\n uint256 constant C103 = 574386695213920937259007343820417029802510752426579750428758189312416867750;\\n uint256 constant C104 = 15973040855000600860816974646787367136127946402908768408978806375685439868553;\\n uint256 constant C105 = 20934130413948796333037139460875996342810005558806621330680156931816867321122;\\n uint256 constant C106 = 6918585327145564636398173845411579411526758237572034236476079610890705810764;\\n uint256 constant C107 = 14158163500813182062258176233162498241310167509137716527054939926126453647182;\\n uint256 constant C108 = 4164602626597695668474100217150111342272610479949122406544277384862187287433;\\n uint256 constant C109 = 12146526846507496913615390662823936206892812880963914267275606265272996025304;\\n uint256 constant C110 = 10153527926900017763244212043512822363696541810586522108597162891799345289938;\\n uint256 constant C111 = 13564663485965299104296214940873270349072051793008946663855767889066202733588;\\n uint256 constant C112 = 5612449256997576125867742696783020582952387615430650198777254717398552960096;\\n uint256 constant C113 = 12151885480032032868507892738683067544172874895736290365318623681886999930120;\\n uint256 constant C114 = 380452237704664384810613424095477896605414037288009963200982915188629772177;\\n uint256 constant C115 = 9067557551252570188533509616805287919563636482030947363841198066124642069518;\\n uint256 constant C116 = 21280306817619711661335268484199763923870315733198162896599997188206277056900;\\n uint256 constant C117 = 5567165819557297006750252582140767993422097822227408837378089569369734876257;\\n uint256 constant C118 = 10411936321072105429908396649383171465939606386380071222095155850987201580137;\\n uint256 constant C119 = 21338390051413922944780864872652000187403217966653363270851298678606449622266;\\n uint256 constant C120 = 12156296560457833712186127325312904760045212412680904475497938949653569234473;\\n uint256 constant C121 = 4271647814574748734312113971565139132510281260328947438246615707172526380757;\\n uint256 constant C122 = 9061738206062369647211128232833114177054715885442782773131292534862178874950;\\n uint256 constant C123 = 10134551893627587797380445583959894183158393780166496661696555422178052339133;\\n uint256 constant C124 = 8932270237664043612366044102088319242789325050842783721780970129656616386103;\\n uint256 constant C125 = 3339412934966886386194449782756711637636784424032779155216609410591712750636;\\n uint256 constant C126 = 9704903972004596791086522314847373103670545861209569267884026709445485704400;\\n uint256 constant C127 = 17467570179597572575614276429760169990940929887711661192333523245667228809456;\\n uint256 constant M00 = 2910766817845651019878574839501801340070030115151021261302834310722729507541;\\n uint256 constant M01 = 19727366863391167538122140361473584127147630672623100827934084310230022599144;\\n uint256 constant M10 = 5776684794125549462448597414050232243778680302179439492664047328281728356345;\\n uint256 constant M11 = 8348174920934122550483593999453880006756108121341067172388445916328941978568;\\n\\n function hash(uint256 input) external pure override returns (uint256 result) {\\n return _hash(input);\\n }\\n\\n function _hash(uint256 input) internal pure returns (uint256 result) {\\n assembly {\\n // Poseidon parameters should be t = 2, RF = 8, RP = 56\\n\\n // We load the characteristic\\n let q := Q\\n\\n // In zerokit implementation, if we pass inp = [a0,a1,..,an] to Poseidon what is effectively hashed is [0,a0,a1,..,an]\\n // Note that a sequence of MIX-ARK involves 3 Bn254 field additions before the mulmod happens. Worst case we have a value corresponding to 2*(p-1) which is less than 2^256 and hence doesn't overflow\\n //ROUND 0 - FULL\\n let s0 := C0\\n let s1 := add(input, C1)\\n // SBOX\\n let t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 1 - FULL\\n s0 := add(s0, C2)\\n s1 := add(s1, C3)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 2 - FULL\\n s0 := add(s0, C4)\\n s1 := add(s1, C5)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 3 - FULL\\n s0 := add(s0, C6)\\n s1 := add(s1, C7)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 4 - PARTIAL\\n s0 := add(s0, C8)\\n s1 := add(s1, C9)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 5 - PARTIAL\\n s0 := add(s0, C10)\\n s1 := add(s1, C11)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 6 - PARTIAL\\n s0 := add(s0, C12)\\n s1 := add(s1, C13)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 7 - PARTIAL\\n s0 := add(s0, C14)\\n s1 := add(s1, C15)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 8 - PARTIAL\\n s0 := add(s0, C16)\\n s1 := add(s1, C17)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 9 - PARTIAL\\n s0 := add(s0, C18)\\n s1 := add(s1, C19)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 10 - PARTIAL\\n s0 := add(s0, C20)\\n s1 := add(s1, C21)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 11 - PARTIAL\\n s0 := add(s0, C22)\\n s1 := add(s1, C23)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 12 - PARTIAL\\n s0 := add(s0, C24)\\n s1 := add(s1, C25)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 13 - PARTIAL\\n s0 := add(s0, C26)\\n s1 := add(s1, C27)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 14 - PARTIAL\\n s0 := add(s0, C28)\\n s1 := add(s1, C29)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 15 - PARTIAL\\n s0 := add(s0, C30)\\n s1 := add(s1, C31)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 16 - PARTIAL\\n s0 := add(s0, C32)\\n s1 := add(s1, C33)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 17 - PARTIAL\\n s0 := add(s0, C34)\\n s1 := add(s1, C35)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 18 - PARTIAL\\n s0 := add(s0, C36)\\n s1 := add(s1, C37)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 19 - PARTIAL\\n s0 := add(s0, C38)\\n s1 := add(s1, C39)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 20 - PARTIAL\\n s0 := add(s0, C40)\\n s1 := add(s1, C41)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 21 - PARTIAL\\n s0 := add(s0, C42)\\n s1 := add(s1, C43)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 22 - PARTIAL\\n s0 := add(s0, C44)\\n s1 := add(s1, C45)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 23 - PARTIAL\\n s0 := add(s0, C46)\\n s1 := add(s1, C47)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 24 - PARTIAL\\n s0 := add(s0, C48)\\n s1 := add(s1, C49)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 25 - PARTIAL\\n s0 := add(s0, C50)\\n s1 := add(s1, C51)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 26 - PARTIAL\\n s0 := add(s0, C52)\\n s1 := add(s1, C53)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 27 - PARTIAL\\n s0 := add(s0, C54)\\n s1 := add(s1, C55)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 28 - PARTIAL\\n s0 := add(s0, C56)\\n s1 := add(s1, C57)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 29 - PARTIAL\\n s0 := add(s0, C58)\\n s1 := add(s1, C59)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 30 - PARTIAL\\n s0 := add(s0, C60)\\n s1 := add(s1, C61)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 31 - PARTIAL\\n s0 := add(s0, C62)\\n s1 := add(s1, C63)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 32 - PARTIAL\\n s0 := add(s0, C64)\\n s1 := add(s1, C65)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 33 - PARTIAL\\n s0 := add(s0, C66)\\n s1 := add(s1, C67)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 34 - PARTIAL\\n s0 := add(s0, C68)\\n s1 := add(s1, C69)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 35 - PARTIAL\\n s0 := add(s0, C70)\\n s1 := add(s1, C71)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 36 - PARTIAL\\n s0 := add(s0, C72)\\n s1 := add(s1, C73)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 37 - PARTIAL\\n s0 := add(s0, C74)\\n s1 := add(s1, C75)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 38 - PARTIAL\\n s0 := add(s0, C76)\\n s1 := add(s1, C77)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 39 - PARTIAL\\n s0 := add(s0, C78)\\n s1 := add(s1, C79)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 40 - PARTIAL\\n s0 := add(s0, C80)\\n s1 := add(s1, C81)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 41 - PARTIAL\\n s0 := add(s0, C82)\\n s1 := add(s1, C83)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 42 - PARTIAL\\n s0 := add(s0, C84)\\n s1 := add(s1, C85)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 43 - PARTIAL\\n s0 := add(s0, C86)\\n s1 := add(s1, C87)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 44 - PARTIAL\\n s0 := add(s0, C88)\\n s1 := add(s1, C89)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 45 - PARTIAL\\n s0 := add(s0, C90)\\n s1 := add(s1, C91)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 46 - PARTIAL\\n s0 := add(s0, C92)\\n s1 := add(s1, C93)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 47 - PARTIAL\\n s0 := add(s0, C94)\\n s1 := add(s1, C95)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 48 - PARTIAL\\n s0 := add(s0, C96)\\n s1 := add(s1, C97)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 49 - PARTIAL\\n s0 := add(s0, C98)\\n s1 := add(s1, C99)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 50 - PARTIAL\\n s0 := add(s0, C100)\\n s1 := add(s1, C101)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 51 - PARTIAL\\n s0 := add(s0, C102)\\n s1 := add(s1, C103)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 52 - PARTIAL\\n s0 := add(s0, C104)\\n s1 := add(s1, C105)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 53 - PARTIAL\\n s0 := add(s0, C106)\\n s1 := add(s1, C107)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 54 - PARTIAL\\n s0 := add(s0, C108)\\n s1 := add(s1, C109)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 55 - PARTIAL\\n s0 := add(s0, C110)\\n s1 := add(s1, C111)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 56 - PARTIAL\\n s0 := add(s0, C112)\\n s1 := add(s1, C113)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 57 - PARTIAL\\n s0 := add(s0, C114)\\n s1 := add(s1, C115)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 58 - PARTIAL\\n s0 := add(s0, C116)\\n s1 := add(s1, C117)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 59 - PARTIAL\\n s0 := add(s0, C118)\\n s1 := add(s1, C119)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 60 - FULL\\n s0 := add(s0, C120)\\n s1 := add(s1, C121)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 61 - FULL\\n s0 := add(s0, C122)\\n s1 := add(s1, C123)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 62 - FULL\\n s0 := add(s0, C124)\\n s1 := add(s1, C125)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 63 - FULL\\n s0 := add(s0, C126)\\n s1 := add(s1, C127)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n s0 := mod(add(mulmod(s0, M00, q), mulmod(s1, M01, q)), q)\\n\\n result := s0\\n }\\n }\\n}\\n\",\"keccak256\":\"0x50d1490b2e804f044f0013aabfe08b34dbeba972e51969d42bdb427ca8ffa037\",\"license\":\"MIT\"},\"lib/rln-contract/contracts/RlnBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.15;\\n\\nimport {IPoseidonHasher} from \\\"./PoseidonHasher.sol\\\";\\nimport {IVerifier} from \\\"./IVerifier.sol\\\";\\n\\n/// The tree is full\\nerror FullTree();\\n\\n/// Invalid deposit amount\\n/// @param required The required deposit amount\\n/// @param provided The provided deposit amount\\nerror InsufficientDeposit(uint256 required, uint256 provided);\\n\\n/// Member is already registered\\nerror DuplicateIdCommitment();\\n\\n/// Failed validation on registration/slashing\\nerror FailedValidation();\\n\\n/// Invalid receiver address, when the receiver is the contract itself or 0x0\\nerror InvalidReceiverAddress(address to);\\n\\n/// Member is not registered\\nerror MemberNotRegistered(uint256 idCommitment);\\n\\n/// Member has no stake\\nerror MemberHasNoStake(uint256 idCommitment);\\n\\n/// User has insufficient balance to withdraw\\nerror InsufficientWithdrawalBalance();\\n\\n/// Contract has insufficient balance to return\\nerror InsufficientContractBalance();\\n\\n/// Invalid proof\\nerror InvalidProof();\\n\\nabstract contract RlnBase {\\n /// @notice The deposit amount required to register as a member\\n uint256 public immutable MEMBERSHIP_DEPOSIT;\\n\\n /// @notice The depth of the merkle tree\\n uint256 public immutable DEPTH;\\n\\n /// @notice The size of the merkle tree, i.e 2^depth\\n uint256 public immutable SET_SIZE;\\n\\n /// @notice The index of the next member to be registered\\n uint256 public idCommitmentIndex = 1;\\n\\n /// @notice The amount of eth staked by each member\\n /// maps from idCommitment to the amount staked\\n mapping(uint256 => uint256) public stakedAmounts;\\n\\n /// @notice The membership status of each member\\n /// maps from idCommitment to their index in the set\\n mapping(uint256 => uint256) public members;\\n\\n /// @notice The balance of each user that can be withdrawn\\n mapping(address => uint256) public withdrawalBalance;\\n\\n /// @notice The Poseidon hasher contract\\n IPoseidonHasher public immutable poseidonHasher;\\n\\n /// @notice The groth16 verifier contract\\n IVerifier public immutable verifier;\\n\\n /// Emitted when a new member is added to the set\\n /// @param idCommitment The idCommitment of the member\\n /// @param index The index of the member in the set\\n event MemberRegistered(uint256 idCommitment, uint256 index);\\n\\n /// Emitted when a member is removed from the set\\n /// @param idCommitment The idCommitment of the member\\n /// @param index The index of the member in the set\\n event MemberWithdrawn(uint256 idCommitment, uint256 index);\\n\\n constructor(uint256 membershipDeposit, uint256 depth, address _poseidonHasher, address _verifier) {\\n MEMBERSHIP_DEPOSIT = membershipDeposit;\\n DEPTH = depth;\\n SET_SIZE = 1 << depth;\\n poseidonHasher = IPoseidonHasher(_poseidonHasher);\\n verifier = IVerifier(_verifier);\\n }\\n\\n /// Allows a user to register as a member\\n /// @param idCommitment The idCommitment of the member\\n function register(uint256 idCommitment) external payable virtual {\\n if (msg.value != MEMBERSHIP_DEPOSIT) {\\n revert InsufficientDeposit(MEMBERSHIP_DEPOSIT, msg.value);\\n }\\n _validateRegistration(idCommitment);\\n _register(idCommitment, msg.value);\\n }\\n\\n /// Registers a member\\n /// @param idCommitment The idCommitment of the member\\n /// @param stake The amount of eth staked by the member\\n function _register(uint256 idCommitment, uint256 stake) internal virtual {\\n if (members[idCommitment] != 0) revert DuplicateIdCommitment();\\n if (idCommitmentIndex >= SET_SIZE) revert FullTree();\\n\\n members[idCommitment] = idCommitmentIndex;\\n stakedAmounts[idCommitment] = stake;\\n\\n emit MemberRegistered(idCommitment, idCommitmentIndex);\\n idCommitmentIndex += 1;\\n }\\n\\n /// @dev Inheriting contracts MUST override this function\\n function _validateRegistration(uint256 idCommitment) internal view virtual;\\n\\n /// @dev Allows a user to slash a member\\n /// @param idCommitment The idCommitment of the member\\n function slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) external virtual {\\n _validateSlash(idCommitment, receiver, proof);\\n _slash(idCommitment, receiver, proof);\\n }\\n\\n /// @dev Slashes a member by removing them from the set, and adding their\\n /// stake to the receiver's available withdrawal balance\\n /// @param idCommitment The idCommitment of the member\\n /// @param receiver The address to receive the funds\\n function _slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) internal virtual {\\n if (receiver == address(this) || receiver == address(0)) {\\n revert InvalidReceiverAddress(receiver);\\n }\\n\\n if (members[idCommitment] == 0) revert MemberNotRegistered(idCommitment);\\n // check if member is registered\\n if (stakedAmounts[idCommitment] == 0) {\\n revert MemberHasNoStake(idCommitment);\\n }\\n\\n if (!_verifyProof(idCommitment, receiver, proof)) {\\n revert InvalidProof();\\n }\\n\\n uint256 amountToTransfer = stakedAmounts[idCommitment];\\n\\n // delete member\\n uint256 index = members[idCommitment];\\n members[idCommitment] = 0;\\n stakedAmounts[idCommitment] = 0;\\n\\n // refund deposit\\n withdrawalBalance[receiver] += amountToTransfer;\\n\\n emit MemberWithdrawn(idCommitment, index);\\n }\\n\\n function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof)\\n internal\\n view\\n virtual;\\n\\n /// Allows a user to withdraw funds allocated to them upon slashing a member\\n function withdraw() external virtual {\\n uint256 amount = withdrawalBalance[msg.sender];\\n\\n if (amount == 0) revert InsufficientWithdrawalBalance();\\n if (amount > address(this).balance) {\\n revert InsufficientContractBalance();\\n }\\n\\n withdrawalBalance[msg.sender] = 0;\\n\\n payable(msg.sender).transfer(amount);\\n }\\n\\n /// Hashes a value using the Poseidon hasher\\n /// NOTE: The variant of Poseidon we use accepts only 1 input, assume n=2, and the second input is 0\\n /// @param input The value to hash\\n function hash(uint256 input) internal view returns (uint256) {\\n return poseidonHasher.hash(input);\\n }\\n\\n /// @dev Groth16 proof verification\\n function _verifyProof(uint256 idCommitment, address receiver, uint256[8] calldata proof)\\n internal\\n view\\n virtual\\n returns (bool)\\n {\\n return verifier.verifyProof(\\n [proof[0], proof[1]],\\n [[proof[2], proof[3]], [proof[4], proof[5]]],\\n [proof[6], proof[7]],\\n [idCommitment, uint256(uint160(receiver))]\\n );\\n }\\n}\\n\",\"keccak256\":\"0x7d6c1d1ade6910fa07b5b8c228e494697852ece42d21752f917c66612470e0a1\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a06040526000600260006101000a81548161ffff021916908361ffff1602179055503480156200002f57600080fd5b50604051620025ae380380620025ae8339818101604052810190620000559190620001e6565b6200007562000069620000b060201b60201c565b620000b860201b60201c565b8073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250505062000218565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001ae8262000181565b9050919050565b620001c081620001a1565b8114620001cc57600080fd5b50565b600081519050620001e081620001b5565b92915050565b600060208284031215620001ff57620001fe6200017c565b5b60006200020f84828501620001cf565b91505092915050565b6080516123736200023b60003960008181610259015261028901526123736000f3fe6080604052600436106200009e5760003560e01c8063ef653d5e1162000061578063ef653d5e1462000167578063f184ef4c1462000195578063f207564e14620001c5578063f2fde38b14620001e5578063f55421471462000213576200009e565b8063331b6ab314620000a357806342f542e214620000d3578063715018a614620000ed5780638da5cb5b1462000107578063cf6163741462000137575b600080fd5b348015620000b057600080fd5b50620000bb62000257565b604051620000ca919062000a26565b60405180910390f35b348015620000e057600080fd5b50620000eb6200027b565b005b348015620000fa57600080fd5b506200010562000302565b005b3480156200011457600080fd5b506200011f6200031a565b6040516200012e919062000a68565b60405180910390f35b3480156200014457600080fd5b506200014f62000343565b6040516200015e919062000aa4565b60405180910390f35b3480156200017457600080fd5b506200019360048036038101906200018d919062000b01565b62000357565b005b348015620001a257600080fd5b50620001ad6200042d565b604051620001bc919062000aa4565b60405180910390f35b620001e36004803603810190620001dd919062000b6e565b62000441565b005b348015620001f257600080fd5b506200021160048036038101906200020b919062000b01565b6200068c565b005b3480156200022057600080fd5b506200023f600480360381019062000239919062000bd1565b62000716565b6040516200024e919062000a68565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b6200028562000749565b60007f0000000000000000000000000000000000000000000000000000000000000000600060149054906101000a900461ffff16604051620002c7906200098d565b620002d492919062000c03565b604051809103906000f080158015620002f1573d6000803e3d6000fd5b509050620002ff81620007ce565b50565b6200030c62000749565b620003186000620008c1565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600260009054906101000a900461ffff1681565b6200036162000749565b600073ffffffffffffffffffffffffffffffffffffffff16600160008060149054906101000a900461ffff1661ffff1661ffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146200041f57806040517f9cfabd1600000000000000000000000000000000000000000000000000000000815260040162000416919062000a68565b60405180910390fd5b6200042a81620007ce565b50565b600060149054906101000a900461ffff1681565b600060149054906101000a900461ffff1661ffff16600260009054906101000a900461ffff1661ffff1610620004a3576040517fd23276a200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b600115620006895760016000600260009054906101000a900461ffff1661ffff1661ffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f207564e34836040518363ffffffff1660e01b815260040162000533919062000c41565b6000604051808303818588803b1580156200054d57600080fd5b505af19350505050801562000560575060015b6200067d576200056f62000c6b565b806308c379a0036200066b57506200058662000d06565b806200059357506200066d565b604051602001620005a49062000dfc565b6040516020818303038152906040528051906020012081604051602001620005cd919062000e8b565b60405160208183030381529060405280519060200120146200062857806040517f4ebf35db0000000000000000000000000000000000000000000000000000000081526004016200061f919062000ef6565b60405180910390fd5b6001600260008282829054906101000a900461ffff166200064a919062000f49565b92506101000a81548161ffff021916908361ffff1602179055505062000677565b505b3d6000803e3d6000fd5b62000683565b62000689565b620004a4565b50565b6200069662000749565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160362000708576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620006ff9062000ffe565b60405180910390fd5b6200071381620008c1565b50565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6200075362000985565b73ffffffffffffffffffffffffffffffffffffffff16620007736200031a565b73ffffffffffffffffffffffffffffffffffffffff1614620007cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620007c39062001070565b60405180910390fd5b565b80600160008060149054906101000a900461ffff1661ffff1661ffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcf6a3b406170499209d0fcf152a1605c7c5a5c99c855e2bb803433fc960718eb600060149054906101000a900461ffff16826040516200087a92919062001092565b60405180910390a16001600060148282829054906101000a900461ffff16620008a4919062000f49565b92506101000a81548161ffff021916908361ffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b61127e80620010c083390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620009e6620009e0620009da846200099b565b620009bb565b6200099b565b9050919050565b6000620009fa82620009c5565b9050919050565b600062000a0e82620009ed565b9050919050565b62000a208162000a01565b82525050565b600060208201905062000a3d600083018462000a15565b92915050565b600062000a50826200099b565b9050919050565b62000a628162000a43565b82525050565b600060208201905062000a7f600083018462000a57565b92915050565b600061ffff82169050919050565b62000a9e8162000a85565b82525050565b600060208201905062000abb600083018462000a93565b92915050565b6000604051905090565b600080fd5b62000adb8162000a43565b811462000ae757600080fd5b50565b60008135905062000afb8162000ad0565b92915050565b60006020828403121562000b1a5762000b1962000acb565b5b600062000b2a8482850162000aea565b91505092915050565b6000819050919050565b62000b488162000b33565b811462000b5457600080fd5b50565b60008135905062000b688162000b3d565b92915050565b60006020828403121562000b875762000b8662000acb565b5b600062000b978482850162000b57565b91505092915050565b62000bab8162000a85565b811462000bb757600080fd5b50565b60008135905062000bcb8162000ba0565b92915050565b60006020828403121562000bea5762000be962000acb565b5b600062000bfa8482850162000bba565b91505092915050565b600060408201905062000c1a600083018562000a57565b62000c29602083018462000a93565b9392505050565b62000c3b8162000b33565b82525050565b600060208201905062000c58600083018462000c30565b92915050565b60008160e01c9050919050565b600060033d111562000c8d5760046000803e62000c8a60005162000c5e565b90505b90565b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000cdb8262000c90565b810181811067ffffffffffffffff8211171562000cfd5762000cfc62000ca1565b5b80604052505050565b600060443d1062000d9e5762000d1b62000ac1565b60043d036004823e80513d602482011167ffffffffffffffff8211171562000d4557505062000d9e565b808201805167ffffffffffffffff81111562000d65575050505062000d9e565b80602083010160043d03850181111562000d8457505050505062000d9e565b62000d958260200185018662000cd0565b82955050505050505b90565b600081905092915050565b7f46756c6c54726565282900000000000000000000000000000000000000000000600082015250565b600062000de4600a8362000da1565b915062000df18262000dac565b600a82019050919050565b600062000e098262000dd5565b9150819050919050565b600081519050919050565b60005b8381101562000e3e57808201518184015260208101905062000e21565b8381111562000e4e576000848401525b50505050565b600062000e618262000e13565b62000e6d818562000da1565b935062000e7f81856020860162000e1e565b80840191505092915050565b600062000e99828462000e54565b915081905092915050565b600082825260208201905092915050565b600062000ec28262000e13565b62000ece818562000ea4565b935062000ee081856020860162000e1e565b62000eeb8162000c90565b840191505092915050565b6000602082019050818103600083015262000f12818462000eb5565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600062000f568262000a85565b915062000f638362000a85565b92508261ffff0382111562000f7d5762000f7c62000f1a565b5b828201905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600062000fe660268362000ea4565b915062000ff38262000f88565b604082019050919050565b60006020820190508181036000830152620010198162000fd7565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006200105860208362000ea4565b9150620010658262001020565b602082019050919050565b600060208201905081810360008301526200108b8162001049565b9050919050565b6000604082019050620010a9600083018562000a93565b620010b8602083018462000a57565b939250505056fe610140604052600180553480156200001657600080fd5b506040516200127e3803806200127e83398181016040528101906200003c91906200027a565b6000601483600062000063620000576200010560201b60201c565b6200010d60201b60201c565b83608081815250508260a08181525050826001901b60c081815250508173ffffffffffffffffffffffffffffffffffffffff1660e08173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff166101008173ffffffffffffffffffffffffffffffffffffffff1681525050505050508061ffff166101208161ffff16815250505050620002c1565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200020382620001d6565b9050919050565b6200021581620001f6565b81146200022157600080fd5b50565b60008151905062000235816200020a565b92915050565b600061ffff82169050919050565b62000254816200023b565b81146200026057600080fd5b50565b600081519050620002748162000249565b92915050565b60008060408385031215620002945762000293620001d1565b5b6000620002a48582860162000224565b9250506020620002b78582860162000263565b9150509250929050565b60805160a05160c05160e0516101005161012051610f6d6200031160003960006103d9015260006103fd01526000610421015260006105a40152600061054a015260006105fa0152610f6d6000f3fe6080604052600436106100fe5760003560e01c80638da5cb5b11610095578063c5b208ff11610064578063c5b208ff146102ff578063d0383d681461033c578063f207564e14610367578063f220b9ec14610383578063f2fde38b146103ae576100fe565b80638da5cb5b1461024157806398366e351461026c578063ae74552a14610297578063bc499128146102c2576100fe565b80635daf08ca116100d15780635daf08ca1461019b578063715018a6146101d85780637a34289d146101ef5780638be9b11914610218576100fe565b806328b070e0146101035780632b7ac3f31461012e578063331b6ab3146101595780633ccfd60b14610184575b600080fd5b34801561010f57600080fd5b506101186103d7565b60405161012591906108ce565b60405180910390f35b34801561013a57600080fd5b506101436103fb565b6040516101509190610968565b60405180910390f35b34801561016557600080fd5b5061016e61041f565b60405161017b91906109a4565b60405180910390f35b34801561019057600080fd5b50610199610443565b005b3480156101a757600080fd5b506101c260048036038101906101bd9190610a09565b610475565b6040516101cf9190610a45565b60405180910390f35b3480156101e457600080fd5b506101ed61048d565b005b3480156101fb57600080fd5b5061021660048036038101906102119190610bb9565b6104a1565b005b34801561022457600080fd5b5061023f600480360381019061023a9190610c62565b6104ed565b005b34801561024d57600080fd5b5061025661051f565b6040516102639190610cd7565b60405180910390f35b34801561027857600080fd5b50610281610548565b60405161028e9190610a45565b60405180910390f35b3480156102a357600080fd5b506102ac61056c565b6040516102b99190610a45565b60405180910390f35b3480156102ce57600080fd5b506102e960048036038101906102e49190610a09565b610572565b6040516102f69190610a45565b60405180910390f35b34801561030b57600080fd5b5061032660048036038101906103219190610d1e565b61058a565b6040516103339190610a45565b60405180910390f35b34801561034857600080fd5b506103516105a2565b60405161035e9190610a45565b60405180910390f35b610381600480360381019061037c9190610a09565b6105c6565b005b34801561038f57600080fd5b506103986105f8565b6040516103a59190610a45565b60405180910390f35b3480156103ba57600080fd5b506103d560048036038101906103d09190610d1e565b61061c565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60036020528060005260406000206000915090505481565b61049561069f565b61049f600061071d565b565b6104a961069f565b60008151905060005b818110156104e8576104dd8382815181106104d0576104cf610d4b565b5b60200260200101516107e1565b8060010190506104b2565b505050565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60026020528060005260406000206000915090505481565b60046020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000081565b61062461069f565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610693576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068a90610dfd565b60405180910390fd5b61069c8161071d565b50565b6106a761085a565b73ffffffffffffffffffffffffffffffffffffffff166106c561051f565b73ffffffffffffffffffffffffffffffffffffffff161461071b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071290610e69565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6107ea81610862565b600160036000838152602001908152602001600020819055507f5a92c2530f207992057b9c3e544108ffce3beda4a63719f316967c49bf6159d281600154604051610836929190610e89565b60405180910390a160018060008282546108509190610ee1565b9250508190555050565b600033905090565b60006003600083815260200190815260200160002054146108ae576040517e0a60f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b600061ffff82169050919050565b6108c8816108b1565b82525050565b60006020820190506108e360008301846108bf565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061092e610929610924846108e9565b610909565b6108e9565b9050919050565b600061094082610913565b9050919050565b600061095282610935565b9050919050565b61096281610947565b82525050565b600060208201905061097d6000830184610959565b92915050565b600061098e82610935565b9050919050565b61099e81610983565b82525050565b60006020820190506109b96000830184610995565b92915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6109e6816109d3565b81146109f157600080fd5b50565b600081359050610a03816109dd565b92915050565b600060208284031215610a1f57610a1e6109c9565b5b6000610a2d848285016109f4565b91505092915050565b610a3f816109d3565b82525050565b6000602082019050610a5a6000830184610a36565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610aae82610a65565b810181811067ffffffffffffffff82111715610acd57610acc610a76565b5b80604052505050565b6000610ae06109bf565b9050610aec8282610aa5565b919050565b600067ffffffffffffffff821115610b0c57610b0b610a76565b5b602082029050602081019050919050565b600080fd5b6000610b35610b3084610af1565b610ad6565b90508083825260208201905060208402830185811115610b5857610b57610b1d565b5b835b81811015610b815780610b6d88826109f4565b845260208401935050602081019050610b5a565b5050509392505050565b600082601f830112610ba057610b9f610a60565b5b8135610bb0848260208601610b22565b91505092915050565b600060208284031215610bcf57610bce6109c9565b5b600082013567ffffffffffffffff811115610bed57610bec6109ce565b5b610bf984828501610b8b565b91505092915050565b6000610c0d826108e9565b9050919050565b610c1d81610c02565b8114610c2857600080fd5b50565b600081359050610c3a81610c14565b92915050565b600081905082602060080282011115610c5c57610c5b610b1d565b5b92915050565b60008060006101408486031215610c7c57610c7b6109c9565b5b6000610c8a868287016109f4565b9350506020610c9b86828701610c2b565b9250506040610cac86828701610c40565b9150509250925092565b6000610cc1826108e9565b9050919050565b610cd181610cb6565b82525050565b6000602082019050610cec6000830184610cc8565b92915050565b610cfb81610cb6565b8114610d0657600080fd5b50565b600081359050610d1881610cf2565b92915050565b600060208284031215610d3457610d336109c9565b5b6000610d4284828501610d09565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082825260208201905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610de7602683610d7a565b9150610df282610d8b565b604082019050919050565b60006020820190508181036000830152610e1681610dda565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000610e53602083610d7a565b9150610e5e82610e1d565b602082019050919050565b60006020820190508181036000830152610e8281610e46565b9050919050565b6000604082019050610e9e6000830185610a36565b610eab6020830184610a36565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610eec826109d3565b9150610ef7836109d3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610f2c57610f2b610eb2565b5b82820190509291505056fea2646970667358221220da67ff31fb04406d288565daf496c41920eb7b2fc65318a1f86281ac336152ab64736f6c634300080f0033a264697066735822122049902012337557bbfed2a6b580addc827037a23f408d64b61559b0aee2d95e6264736f6c634300080f0033", + "deployedBytecode": "0x6080604052600436106200009e5760003560e01c8063ef653d5e1162000061578063ef653d5e1462000167578063f184ef4c1462000195578063f207564e14620001c5578063f2fde38b14620001e5578063f55421471462000213576200009e565b8063331b6ab314620000a357806342f542e214620000d3578063715018a614620000ed5780638da5cb5b1462000107578063cf6163741462000137575b600080fd5b348015620000b057600080fd5b50620000bb62000257565b604051620000ca919062000a26565b60405180910390f35b348015620000e057600080fd5b50620000eb6200027b565b005b348015620000fa57600080fd5b506200010562000302565b005b3480156200011457600080fd5b506200011f6200031a565b6040516200012e919062000a68565b60405180910390f35b3480156200014457600080fd5b506200014f62000343565b6040516200015e919062000aa4565b60405180910390f35b3480156200017457600080fd5b506200019360048036038101906200018d919062000b01565b62000357565b005b348015620001a257600080fd5b50620001ad6200042d565b604051620001bc919062000aa4565b60405180910390f35b620001e36004803603810190620001dd919062000b6e565b62000441565b005b348015620001f257600080fd5b506200021160048036038101906200020b919062000b01565b6200068c565b005b3480156200022057600080fd5b506200023f600480360381019062000239919062000bd1565b62000716565b6040516200024e919062000a68565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b6200028562000749565b60007f0000000000000000000000000000000000000000000000000000000000000000600060149054906101000a900461ffff16604051620002c7906200098d565b620002d492919062000c03565b604051809103906000f080158015620002f1573d6000803e3d6000fd5b509050620002ff81620007ce565b50565b6200030c62000749565b620003186000620008c1565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600260009054906101000a900461ffff1681565b6200036162000749565b600073ffffffffffffffffffffffffffffffffffffffff16600160008060149054906101000a900461ffff1661ffff1661ffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146200041f57806040517f9cfabd1600000000000000000000000000000000000000000000000000000000815260040162000416919062000a68565b60405180910390fd5b6200042a81620007ce565b50565b600060149054906101000a900461ffff1681565b600060149054906101000a900461ffff1661ffff16600260009054906101000a900461ffff1661ffff1610620004a3576040517fd23276a200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b600115620006895760016000600260009054906101000a900461ffff1661ffff1661ffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f207564e34836040518363ffffffff1660e01b815260040162000533919062000c41565b6000604051808303818588803b1580156200054d57600080fd5b505af19350505050801562000560575060015b6200067d576200056f62000c6b565b806308c379a0036200066b57506200058662000d06565b806200059357506200066d565b604051602001620005a49062000dfc565b6040516020818303038152906040528051906020012081604051602001620005cd919062000e8b565b60405160208183030381529060405280519060200120146200062857806040517f4ebf35db0000000000000000000000000000000000000000000000000000000081526004016200061f919062000ef6565b60405180910390fd5b6001600260008282829054906101000a900461ffff166200064a919062000f49565b92506101000a81548161ffff021916908361ffff1602179055505062000677565b505b3d6000803e3d6000fd5b62000683565b62000689565b620004a4565b50565b6200069662000749565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160362000708576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620006ff9062000ffe565b60405180910390fd5b6200071381620008c1565b50565b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6200075362000985565b73ffffffffffffffffffffffffffffffffffffffff16620007736200031a565b73ffffffffffffffffffffffffffffffffffffffff1614620007cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620007c39062001070565b60405180910390fd5b565b80600160008060149054906101000a900461ffff1661ffff1661ffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcf6a3b406170499209d0fcf152a1605c7c5a5c99c855e2bb803433fc960718eb600060149054906101000a900461ffff16826040516200087a92919062001092565b60405180910390a16001600060148282829054906101000a900461ffff16620008a4919062000f49565b92506101000a81548161ffff021916908361ffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b61127e80620010c083390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620009e6620009e0620009da846200099b565b620009bb565b6200099b565b9050919050565b6000620009fa82620009c5565b9050919050565b600062000a0e82620009ed565b9050919050565b62000a208162000a01565b82525050565b600060208201905062000a3d600083018462000a15565b92915050565b600062000a50826200099b565b9050919050565b62000a628162000a43565b82525050565b600060208201905062000a7f600083018462000a57565b92915050565b600061ffff82169050919050565b62000a9e8162000a85565b82525050565b600060208201905062000abb600083018462000a93565b92915050565b6000604051905090565b600080fd5b62000adb8162000a43565b811462000ae757600080fd5b50565b60008135905062000afb8162000ad0565b92915050565b60006020828403121562000b1a5762000b1962000acb565b5b600062000b2a8482850162000aea565b91505092915050565b6000819050919050565b62000b488162000b33565b811462000b5457600080fd5b50565b60008135905062000b688162000b3d565b92915050565b60006020828403121562000b875762000b8662000acb565b5b600062000b978482850162000b57565b91505092915050565b62000bab8162000a85565b811462000bb757600080fd5b50565b60008135905062000bcb8162000ba0565b92915050565b60006020828403121562000bea5762000be962000acb565b5b600062000bfa8482850162000bba565b91505092915050565b600060408201905062000c1a600083018562000a57565b62000c29602083018462000a93565b9392505050565b62000c3b8162000b33565b82525050565b600060208201905062000c58600083018462000c30565b92915050565b60008160e01c9050919050565b600060033d111562000c8d5760046000803e62000c8a60005162000c5e565b90505b90565b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000cdb8262000c90565b810181811067ffffffffffffffff8211171562000cfd5762000cfc62000ca1565b5b80604052505050565b600060443d1062000d9e5762000d1b62000ac1565b60043d036004823e80513d602482011167ffffffffffffffff8211171562000d4557505062000d9e565b808201805167ffffffffffffffff81111562000d65575050505062000d9e565b80602083010160043d03850181111562000d8457505050505062000d9e565b62000d958260200185018662000cd0565b82955050505050505b90565b600081905092915050565b7f46756c6c54726565282900000000000000000000000000000000000000000000600082015250565b600062000de4600a8362000da1565b915062000df18262000dac565b600a82019050919050565b600062000e098262000dd5565b9150819050919050565b600081519050919050565b60005b8381101562000e3e57808201518184015260208101905062000e21565b8381111562000e4e576000848401525b50505050565b600062000e618262000e13565b62000e6d818562000da1565b935062000e7f81856020860162000e1e565b80840191505092915050565b600062000e99828462000e54565b915081905092915050565b600082825260208201905092915050565b600062000ec28262000e13565b62000ece818562000ea4565b935062000ee081856020860162000e1e565b62000eeb8162000c90565b840191505092915050565b6000602082019050818103600083015262000f12818462000eb5565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600062000f568262000a85565b915062000f638362000a85565b92508261ffff0382111562000f7d5762000f7c62000f1a565b5b828201905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600062000fe660268362000ea4565b915062000ff38262000f88565b604082019050919050565b60006020820190508181036000830152620010198162000fd7565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006200105860208362000ea4565b9150620010658262001020565b602082019050919050565b600060208201905081810360008301526200108b8162001049565b9050919050565b6000604082019050620010a9600083018562000a93565b620010b8602083018462000a57565b939250505056fe610140604052600180553480156200001657600080fd5b506040516200127e3803806200127e83398181016040528101906200003c91906200027a565b6000601483600062000063620000576200010560201b60201c565b6200010d60201b60201c565b83608081815250508260a08181525050826001901b60c081815250508173ffffffffffffffffffffffffffffffffffffffff1660e08173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff166101008173ffffffffffffffffffffffffffffffffffffffff1681525050505050508061ffff166101208161ffff16815250505050620002c1565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200020382620001d6565b9050919050565b6200021581620001f6565b81146200022157600080fd5b50565b60008151905062000235816200020a565b92915050565b600061ffff82169050919050565b62000254816200023b565b81146200026057600080fd5b50565b600081519050620002748162000249565b92915050565b60008060408385031215620002945762000293620001d1565b5b6000620002a48582860162000224565b9250506020620002b78582860162000263565b9150509250929050565b60805160a05160c05160e0516101005161012051610f6d6200031160003960006103d9015260006103fd01526000610421015260006105a40152600061054a015260006105fa0152610f6d6000f3fe6080604052600436106100fe5760003560e01c80638da5cb5b11610095578063c5b208ff11610064578063c5b208ff146102ff578063d0383d681461033c578063f207564e14610367578063f220b9ec14610383578063f2fde38b146103ae576100fe565b80638da5cb5b1461024157806398366e351461026c578063ae74552a14610297578063bc499128146102c2576100fe565b80635daf08ca116100d15780635daf08ca1461019b578063715018a6146101d85780637a34289d146101ef5780638be9b11914610218576100fe565b806328b070e0146101035780632b7ac3f31461012e578063331b6ab3146101595780633ccfd60b14610184575b600080fd5b34801561010f57600080fd5b506101186103d7565b60405161012591906108ce565b60405180910390f35b34801561013a57600080fd5b506101436103fb565b6040516101509190610968565b60405180910390f35b34801561016557600080fd5b5061016e61041f565b60405161017b91906109a4565b60405180910390f35b34801561019057600080fd5b50610199610443565b005b3480156101a757600080fd5b506101c260048036038101906101bd9190610a09565b610475565b6040516101cf9190610a45565b60405180910390f35b3480156101e457600080fd5b506101ed61048d565b005b3480156101fb57600080fd5b5061021660048036038101906102119190610bb9565b6104a1565b005b34801561022457600080fd5b5061023f600480360381019061023a9190610c62565b6104ed565b005b34801561024d57600080fd5b5061025661051f565b6040516102639190610cd7565b60405180910390f35b34801561027857600080fd5b50610281610548565b60405161028e9190610a45565b60405180910390f35b3480156102a357600080fd5b506102ac61056c565b6040516102b99190610a45565b60405180910390f35b3480156102ce57600080fd5b506102e960048036038101906102e49190610a09565b610572565b6040516102f69190610a45565b60405180910390f35b34801561030b57600080fd5b5061032660048036038101906103219190610d1e565b61058a565b6040516103339190610a45565b60405180910390f35b34801561034857600080fd5b506103516105a2565b60405161035e9190610a45565b60405180910390f35b610381600480360381019061037c9190610a09565b6105c6565b005b34801561038f57600080fd5b506103986105f8565b6040516103a59190610a45565b60405180910390f35b3480156103ba57600080fd5b506103d560048036038101906103d09190610d1e565b61061c565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60036020528060005260406000206000915090505481565b61049561069f565b61049f600061071d565b565b6104a961069f565b60008151905060005b818110156104e8576104dd8382815181106104d0576104cf610d4b565b5b60200260200101516107e1565b8060010190506104b2565b505050565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60026020528060005260406000206000915090505481565b60046020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000081565b61062461069f565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610693576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068a90610dfd565b60405180910390fd5b61069c8161071d565b50565b6106a761085a565b73ffffffffffffffffffffffffffffffffffffffff166106c561051f565b73ffffffffffffffffffffffffffffffffffffffff161461071b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071290610e69565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6107ea81610862565b600160036000838152602001908152602001600020819055507f5a92c2530f207992057b9c3e544108ffce3beda4a63719f316967c49bf6159d281600154604051610836929190610e89565b60405180910390a160018060008282546108509190610ee1565b9250508190555050565b600033905090565b60006003600083815260200190815260200160002054146108ae576040517e0a60f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b600061ffff82169050919050565b6108c8816108b1565b82525050565b60006020820190506108e360008301846108bf565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061092e610929610924846108e9565b610909565b6108e9565b9050919050565b600061094082610913565b9050919050565b600061095282610935565b9050919050565b61096281610947565b82525050565b600060208201905061097d6000830184610959565b92915050565b600061098e82610935565b9050919050565b61099e81610983565b82525050565b60006020820190506109b96000830184610995565b92915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6109e6816109d3565b81146109f157600080fd5b50565b600081359050610a03816109dd565b92915050565b600060208284031215610a1f57610a1e6109c9565b5b6000610a2d848285016109f4565b91505092915050565b610a3f816109d3565b82525050565b6000602082019050610a5a6000830184610a36565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610aae82610a65565b810181811067ffffffffffffffff82111715610acd57610acc610a76565b5b80604052505050565b6000610ae06109bf565b9050610aec8282610aa5565b919050565b600067ffffffffffffffff821115610b0c57610b0b610a76565b5b602082029050602081019050919050565b600080fd5b6000610b35610b3084610af1565b610ad6565b90508083825260208201905060208402830185811115610b5857610b57610b1d565b5b835b81811015610b815780610b6d88826109f4565b845260208401935050602081019050610b5a565b5050509392505050565b600082601f830112610ba057610b9f610a60565b5b8135610bb0848260208601610b22565b91505092915050565b600060208284031215610bcf57610bce6109c9565b5b600082013567ffffffffffffffff811115610bed57610bec6109ce565b5b610bf984828501610b8b565b91505092915050565b6000610c0d826108e9565b9050919050565b610c1d81610c02565b8114610c2857600080fd5b50565b600081359050610c3a81610c14565b92915050565b600081905082602060080282011115610c5c57610c5b610b1d565b5b92915050565b60008060006101408486031215610c7c57610c7b6109c9565b5b6000610c8a868287016109f4565b9350506020610c9b86828701610c2b565b9250506040610cac86828701610c40565b9150509250925092565b6000610cc1826108e9565b9050919050565b610cd181610cb6565b82525050565b6000602082019050610cec6000830184610cc8565b92915050565b610cfb81610cb6565b8114610d0657600080fd5b50565b600081359050610d1881610cf2565b92915050565b600060208284031215610d3457610d336109c9565b5b6000610d4284828501610d09565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082825260208201905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610de7602683610d7a565b9150610df282610d8b565b604082019050919050565b60006020820190508181036000830152610e1681610dda565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000610e53602083610d7a565b9150610e5e82610e1d565b602082019050919050565b60006020820190508181036000830152610e8281610e46565b9050919050565b6000604082019050610e9e6000830185610a36565b610eab6020830184610a36565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610eec826109d3565b9150610ef7836109d3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610f2c57610f2b610eb2565b5b82820190509291505056fea2646970667358221220da67ff31fb04406d288565daf496c41920eb7b2fc65318a1f86281ac336152ab64736f6c634300080f0033a264697066735822122049902012337557bbfed2a6b580addc827037a23f408d64b61559b0aee2d95e6264736f6c634300080f0033", + "devdoc": { + "kind": "dev", + "methods": { + "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." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 357, + "contract": "contracts/WakuRlnRegistry.sol:WakuRlnRegistry", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 187, + "contract": "contracts/WakuRlnRegistry.sol:WakuRlnRegistry", + "label": "nextStorageIndex", + "offset": 20, + "slot": "0", + "type": "t_uint16" + }, + { + "astId": 191, + "contract": "contracts/WakuRlnRegistry.sol:WakuRlnRegistry", + "label": "storages", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint16,t_address)" + }, + { + "astId": 194, + "contract": "contracts/WakuRlnRegistry.sol:WakuRlnRegistry", + "label": "usingStorageIndex", + "offset": 0, + "slot": "2", + "type": "t_uint16" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_uint16,t_address)": { + "encoding": "mapping", + "key": "t_uint16", + "label": "mapping(uint16 => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + } + } + } +} diff --git a/deployments/sepolia/WakuRlnStorage_0.json b/deployments/sepolia/WakuRlnStorage_0.json new file mode 100644 index 0000000..ef0cb67 --- /dev/null +++ b/deployments/sepolia/WakuRlnStorage_0.json @@ -0,0 +1,364 @@ +{ + "address": "0x02c233d3899c3A435631AC857DAD5555F4f9656C", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_poseidonHasher", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_contractIndex", + "type": "uint16" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "DuplicateIdCommitment", + "type": "error" + }, + { + "inputs": [], + "name": "NotImplemented", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "MemberRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "MemberWithdrawn", + "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" + }, + { + "inputs": [], + "name": "DEPTH", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MEMBERSHIP_DEPOSIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SET_SIZE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractIndex", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "idCommitmentIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "members", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poseidonHasher", + "outputs": [ + { + "internalType": "contract IPoseidonHasher", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "idCommitments", + "type": "uint256[]" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256[8]", + "name": "proof", + "type": "uint256[8]" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "stakedAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "verifier", + "outputs": [ + { + "internalType": "contract IVerifier", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "withdrawalBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x6383f95e87da38d14a39a77be748a1b984275541762c1e08fb9cd2c51b202efc", + "receipt": { + "to": "0x50D658a2ab7f66f4B73E27e8731B8b13Cd06Df8A", + "from": "0x3F47b2a1dF96DE2e198d646b598C37251CCC3b98", + "transactionIndex": null, + "blockHash": null, + "blockNumber": null + }, + "args": ["0xCF6ccD3691f67dfa0EdDeFED1B295139d0197609", 0], + "numDeployments": 1, + "metadata": "{\"compiler\":{\"version\":\"0.8.15+commit.e14f2714\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poseidonHasher\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_contractIndex\",\"type\":\"uint16\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"DuplicateIdCommitment\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotImplemented\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"idCommitment\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"MemberRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"idCommitment\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"MemberWithdrawn\",\"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\"},{\"inputs\":[],\"name\":\"DEPTH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MEMBERSHIP_DEPOSIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SET_SIZE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"contractIndex\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"idCommitmentIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"members\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poseidonHasher\",\"outputs\":[{\"internalType\":\"contract IPoseidonHasher\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"idCommitments\",\"type\":\"uint256[]\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"idCommitment\",\"type\":\"uint256\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"idCommitment\",\"type\":\"uint256\"},{\"internalType\":\"address payable\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256[8]\",\"name\":\"proof\",\"type\":\"uint256[8]\"}],\"name\":\"slash\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"stakedAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifier\",\"outputs\":[{\"internalType\":\"contract IVerifier\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"withdrawalBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"register(uint256)\":{\"params\":{\"idCommitment\":\"The idCommitment of the member\"}},\"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.\"},\"slash(uint256,address,uint256[8])\":{\"details\":\"Allows a user to slash a member\",\"params\":{\"idCommitment\":\"The idCommitment of the member\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"errors\":{\"DuplicateIdCommitment()\":[{\"notice\":\"Member is already registered\"}]},\"events\":{\"MemberRegistered(uint256,uint256)\":{\"notice\":\"Emitted when a new member is added to the set\"},\"MemberWithdrawn(uint256,uint256)\":{\"notice\":\"Emitted when a member is removed from the set\"}},\"kind\":\"user\",\"methods\":{\"DEPTH()\":{\"notice\":\"The depth of the merkle tree\"},\"MEMBERSHIP_DEPOSIT()\":{\"notice\":\"The deposit amount required to register as a member\"},\"SET_SIZE()\":{\"notice\":\"The size of the merkle tree, i.e 2^depth\"},\"idCommitmentIndex()\":{\"notice\":\"The index of the next member to be registered\"},\"members(uint256)\":{\"notice\":\"The membership status of each member maps from idCommitment to their index in the set\"},\"poseidonHasher()\":{\"notice\":\"The Poseidon hasher contract\"},\"register(uint256)\":{\"notice\":\"Allows a user to register as a member\"},\"stakedAmounts(uint256)\":{\"notice\":\"The amount of eth staked by each member maps from idCommitment to the amount staked\"},\"verifier()\":{\"notice\":\"The groth16 verifier contract\"},\"withdraw()\":{\"notice\":\"Allows a user to withdraw funds allocated to them upon slashing a member\"},\"withdrawalBalance(address)\":{\"notice\":\"The balance of each user that can be withdrawn\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/WakuRln.sol\":\"WakuRln\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\",\":openzeppelin/=lib/openzeppelin-contracts/contracts/\",\":rln-contract/=lib/rln-contract/contracts/\"]},\"sources\":{\"contracts/WakuRln.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.15;\\n\\nimport {IPoseidonHasher} from \\\"rln-contract/PoseidonHasher.sol\\\";\\nimport {RlnBase, DuplicateIdCommitment} from \\\"rln-contract/RlnBase.sol\\\";\\nimport {Ownable} from \\\"openzeppelin-contracts/contracts/access/Ownable.sol\\\";\\n\\nerror NotImplemented();\\n\\ncontract WakuRln is Ownable, RlnBase {\\n uint16 public immutable contractIndex;\\n\\n constructor(address _poseidonHasher, uint16 _contractIndex) Ownable() RlnBase(0, 20, _poseidonHasher, address(0)) {\\n contractIndex = _contractIndex;\\n }\\n\\n /// Registers a member\\n /// @param idCommitment The idCommitment of the member\\n function _register(uint256 idCommitment) internal {\\n _validateRegistration(idCommitment);\\n\\n members[idCommitment] = 1;\\n\\n emit MemberRegistered(idCommitment, idCommitmentIndex);\\n idCommitmentIndex += 1;\\n }\\n\\n function register(uint256[] memory idCommitments) external onlyOwner {\\n uint256 len = idCommitments.length;\\n for (uint256 i = 0; i < len;) {\\n _register(idCommitments[i]);\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function register(uint256 idCommitment) external payable override {\\n revert NotImplemented();\\n }\\n\\n function slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) external pure override {\\n revert NotImplemented();\\n }\\n\\n function _validateRegistration(uint256 idCommitment) internal view override {\\n if (members[idCommitment] != 0) revert DuplicateIdCommitment();\\n }\\n\\n function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof)\\n internal\\n pure\\n override\\n {\\n revert NotImplemented();\\n }\\n\\n function withdraw() external pure override {\\n revert NotImplemented();\\n }\\n}\\n\",\"keccak256\":\"0xaa4c93ed9c0656a01c113f0453b6f6a3db742e53b3371e34ed608902913d9700\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/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\"},\"lib/openzeppelin-contracts/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"lib/rln-contract/contracts/IVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0 OR MIT\\npragma solidity 0.8.15;\\n\\ninterface IVerifier {\\n function verifyProof(uint256[2] memory a, uint256[2][2] memory b, uint256[2] memory c, uint256[2] memory input)\\n external\\n view\\n returns (bool);\\n}\\n\",\"keccak256\":\"0x538e61fbb62bf1ef9f0c3f7e7d771ddfc8506a97e7d98aada763830fc741d8b8\",\"license\":\"Apache-2.0 OR MIT\"},\"lib/rln-contract/contracts/PoseidonHasher.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// Forked from https://github.com/kilic/rlnapp/\\n\\npragma solidity 0.8.15;\\n\\ninterface IPoseidonHasher {\\n /// @notice Hashes the input using the Poseidon hash function, n = 2, second input is the constant 0\\n /// @param input The input to hash\\n function hash(uint256 input) external pure returns (uint256 result);\\n}\\n\\ncontract PoseidonHasher is IPoseidonHasher {\\n uint256 constant Q = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\\n uint256 constant C0 = 4417881134626180770308697923359573201005643519861877412381846989312604493735;\\n uint256 constant C1 = 5433650512959517612316327474713065966758808864213826738576266661723522780033;\\n uint256 constant C2 = 13641176377184356099764086973022553863760045607496549923679278773208775739952;\\n uint256 constant C3 = 17949713444224994136330421782109149544629237834775211751417461773584374506783;\\n uint256 constant C4 = 13765628375339178273710281891027109699578766420463125835325926111705201856003;\\n uint256 constant C5 = 19179513468172002314585757290678967643352171735526887944518845346318719730387;\\n uint256 constant C6 = 5157412437176756884543472904098424903141745259452875378101256928559722612176;\\n uint256 constant C7 = 535160875740282236955320458485730000677124519901643397458212725410971557409;\\n uint256 constant C8 = 1050793453380762984940163090920066886770841063557081906093018330633089036729;\\n uint256 constant C9 = 10665495010329663932664894101216428400933984666065399374198502106997623173873;\\n uint256 constant C10 = 19965634623406616956648724894636666805991993496469370618546874926025059150737;\\n uint256 constant C11 = 13007250030070838431593222885902415182312449212965120303174723305710127422213;\\n uint256 constant C12 = 16877538715074991604507979123743768693428157847423939051086744213162455276374;\\n uint256 constant C13 = 18211747749504876135588847560312685184956239426147543810126553367063157141465;\\n uint256 constant C14 = 18151553319826126919739798892854572062191241985315767086020821632812331245635;\\n uint256 constant C15 = 19957033149976712666746140949846950406660099037474791840946955175819555930825;\\n uint256 constant C16 = 3469514863538261843186854830917934449567467100548474599735384052339577040841;\\n uint256 constant C17 = 989698510043911779243192466312362856042600749099921773896924315611668507708;\\n uint256 constant C18 = 12568377015646290945235387813564567111330046038050864455358059568128000172201;\\n uint256 constant C19 = 20856104135605479600325529349246932565148587186338606236677138505306779314172;\\n uint256 constant C20 = 8206918720503535523121349917159924938835810381723474192155637697065780938424;\\n uint256 constant C21 = 1309058477013932989380617265069188723120054926187607548493110334522527703566;\\n uint256 constant C22 = 14076116939332667074621703729512195584105250395163383769419390236426287710606;\\n uint256 constant C23 = 10153498892749751942204288991871286290442690932856658983589258153608012428674;\\n uint256 constant C24 = 18202499207234128286137597834010475797175973146805180988367589376893530181575;\\n uint256 constant C25 = 12739388830157083522877690211447248168864006284243907142044329113461613743052;\\n uint256 constant C26 = 15123358710467780770838026754240340042441262572309759635224051333176022613949;\\n uint256 constant C27 = 19925004701844594370904593774447343836015483888496504201331110250494635362184;\\n uint256 constant C28 = 10352416606816998476681131583320899030072315953910679608943150613208329645891;\\n uint256 constant C29 = 10567371822366244361703342347428230537114808440249611395507235283708966113221;\\n uint256 constant C30 = 5635498582763880627392290206431559361272660937399944184533035305989295959602;\\n uint256 constant C31 = 11866432933224219174041051738704352719163271639958083608224676028593315904909;\\n uint256 constant C32 = 5795020705294401441272215064554385591292330721703923167136157291459784140431;\\n uint256 constant C33 = 9482202378699252817564375087302794636287866584767523335624368774856230692758;\\n uint256 constant C34 = 4245237636894546151746468406560945873445548423466753843402086544922216329298;\\n uint256 constant C35 = 12000500941313982757584712677991730019124834399479314697467598397927435905133;\\n uint256 constant C36 = 7596790274058425558167520209857956363736666939016807569082239187494363541787;\\n uint256 constant C37 = 2484867918246116343205467273440098378820186751202461278013576281097918148877;\\n uint256 constant C38 = 18312645949449997391810445935615409295369169383463185688973803378104013950190;\\n uint256 constant C39 = 15320686572748723004980855263301182130424010735782762814513954166519592552733;\\n uint256 constant C40 = 12618438900597948888520621062416758747872180395546164387827245287017031303859;\\n uint256 constant C41 = 17438141672027706116733201008397064011774368832458707512367404736905021019585;\\n uint256 constant C42 = 6374197807230665998865688675365359100400438034755781666913068586172586548950;\\n uint256 constant C43 = 2189398913433273865510950346186699930188746169476472274335177556702504595264;\\n uint256 constant C44 = 6268495580028970231803791523870131137294646402347399003576649137450213034606;\\n uint256 constant C45 = 17896250365994900261202920044129628104272791547990619503076839618914047059275;\\n uint256 constant C46 = 13692156312448722528008862371944543449350293305158722920787736248435893008873;\\n uint256 constant C47 = 15234446864368744483209945022439268713300180233589581910497691316744177619376;\\n uint256 constant C48 = 1572426502623310766593681563281600503979671244997798691029595521622402217227;\\n uint256 constant C49 = 80103447810215150918585162168214870083573048458555897999822831203653996617;\\n uint256 constant C50 = 8228820324013669567851850635126713973797711779951230446503353812192849106342;\\n uint256 constant C51 = 5375851433746509614045812476958526065449377558695752132494533666370449415873;\\n uint256 constant C52 = 12115998939203497346386774317892338270561208357481805380546938146796257365018;\\n uint256 constant C53 = 9764067909645821279940531410531154041386008396840887338272986634350423466622;\\n uint256 constant C54 = 8538708244538850542384936174629541085495830544298260335345008245230827876882;\\n uint256 constant C55 = 7140127896620013355910287215441004676619168261422440177712039790284719613114;\\n uint256 constant C56 = 14297402962228458726038826185823085337698917275385741292940049024977027409762;\\n uint256 constant C57 = 6667115556431351074165934212337261254608231545257434281887966406956835140819;\\n uint256 constant C58 = 20226761165244293291042617464655196752671169026542832236139342122602741090001;\\n uint256 constant C59 = 12038289506489256655759141386763477208196694421666339040483042079632134429119;\\n uint256 constant C60 = 19027757334170818571203982241812412991528769934917288000224335655934473717551;\\n uint256 constant C61 = 16272152964456553579565580463468069884359929612321610357528838696790370074720;\\n uint256 constant C62 = 2500392889689246014710135696485946334448570271481948765283016105301740284071;\\n uint256 constant C63 = 8595254970528530312401637448610398388203855633951264114100575485022581946023;\\n uint256 constant C64 = 11635945688914011450976408058407206367914559009113158286982919675551688078198;\\n uint256 constant C65 = 614739068603482619581328040478536306925147663946742687395148680260956671871;\\n uint256 constant C66 = 18692271780377861570175282183255720350972693125537599213951106550953176268753;\\n uint256 constant C67 = 4987059230784976306647166378298632695585915319042844495357753339378260807164;\\n uint256 constant C68 = 21851403978498723616722415377430107676258664746210815234490134600998983955497;\\n uint256 constant C69 = 9830635451186415300891533983087800047564037813328875992115573428596207326204;\\n uint256 constant C70 = 4842706106434537116860242620706030229206345167233200482994958847436425185478;\\n uint256 constant C71 = 6422235064906823218421386871122109085799298052314922856340127798647926126490;\\n uint256 constant C72 = 4564364104986856861943331689105797031330091877115997069096365671501473357846;\\n uint256 constant C73 = 1944043894089780613038197112872830569538541856657037469098448708685350671343;\\n uint256 constant C74 = 21179865974855950600518216085229498748425990426231530451599322283119880194955;\\n uint256 constant C75 = 14296697761894107574369608843560006996183955751502547883167824879840894933162;\\n uint256 constant C76 = 12274619649702218570450581712439138337725246879938860735460378251639845671898;\\n uint256 constant C77 = 16371396450276899401411886674029075408418848209575273031725505038938314070356;\\n uint256 constant C78 = 3702561221750983937578095019779188631407216522704543451228773892695044653565;\\n uint256 constant C79 = 19721616877735564664624984774636557499099875603996426215495516594530838681980;\\n uint256 constant C80 = 6383350109027696789969911008057747025018308755462287526819231672217685282429;\\n uint256 constant C81 = 20860583956177367265984596617324237471765572961978977333122281041544719622905;\\n uint256 constant C82 = 5766390934595026947545001478457407504285452477687752470140790011329357286275;\\n uint256 constant C83 = 4043175758319898049344746138515323336207420888499903387536875603879441092484;\\n uint256 constant C84 = 15579382179133608217098622223834161692266188678101563820988612253342538956534;\\n uint256 constant C85 = 1864640783252634743892105383926602930909039567065240010338908865509831749824;\\n uint256 constant C86 = 15943719865023133586707144161652035291705809358178262514871056013754142625673;\\n uint256 constant C87 = 2326415993032390211558498780803238091925402878871059708106213703504162832999;\\n uint256 constant C88 = 19995326402773833553207196590622808505547443523750970375738981396588337910289;\\n uint256 constant C89 = 5143583711361588952673350526320181330406047695593201009385718506918735286622;\\n uint256 constant C90 = 15436006486881920976813738625999473183944244531070780793506388892313517319583;\\n uint256 constant C91 = 16660446760173633166698660166238066533278664023818938868110282615200613695857;\\n uint256 constant C92 = 4966065365695755376133119391352131079892396024584848298231004326013366253934;\\n uint256 constant C93 = 20683781957411705574951987677641476019618457561419278856689645563561076926702;\\n uint256 constant C94 = 17280836839165902792086432296371645107551519324565649849400948918605456875699;\\n uint256 constant C95 = 17045635513701208892073056357048619435743564064921155892004135325530808465371;\\n uint256 constant C96 = 17055032967194400710390142791334572297458033582458169295920670679093585707295;\\n uint256 constant C97 = 15727174639569115300068198908071514334002742825679221638729902577962862163505;\\n uint256 constant C98 = 1001755657610446661315902885492677747789366510875120894840818704741370398633;\\n uint256 constant C99 = 18638547332826171619311285502376343504539399518545103511265465604926625041234;\\n uint256 constant C100 = 6751954224763196429755298529194402870632445298969935050224267844020826420799;\\n uint256 constant C101 = 3526747115904224771452549517614107688674036840088422555827581348280834879405;\\n uint256 constant C102 = 15705897908180497062880001271426561999724005008972544196300715293701537574122;\\n uint256 constant C103 = 574386695213920937259007343820417029802510752426579750428758189312416867750;\\n uint256 constant C104 = 15973040855000600860816974646787367136127946402908768408978806375685439868553;\\n uint256 constant C105 = 20934130413948796333037139460875996342810005558806621330680156931816867321122;\\n uint256 constant C106 = 6918585327145564636398173845411579411526758237572034236476079610890705810764;\\n uint256 constant C107 = 14158163500813182062258176233162498241310167509137716527054939926126453647182;\\n uint256 constant C108 = 4164602626597695668474100217150111342272610479949122406544277384862187287433;\\n uint256 constant C109 = 12146526846507496913615390662823936206892812880963914267275606265272996025304;\\n uint256 constant C110 = 10153527926900017763244212043512822363696541810586522108597162891799345289938;\\n uint256 constant C111 = 13564663485965299104296214940873270349072051793008946663855767889066202733588;\\n uint256 constant C112 = 5612449256997576125867742696783020582952387615430650198777254717398552960096;\\n uint256 constant C113 = 12151885480032032868507892738683067544172874895736290365318623681886999930120;\\n uint256 constant C114 = 380452237704664384810613424095477896605414037288009963200982915188629772177;\\n uint256 constant C115 = 9067557551252570188533509616805287919563636482030947363841198066124642069518;\\n uint256 constant C116 = 21280306817619711661335268484199763923870315733198162896599997188206277056900;\\n uint256 constant C117 = 5567165819557297006750252582140767993422097822227408837378089569369734876257;\\n uint256 constant C118 = 10411936321072105429908396649383171465939606386380071222095155850987201580137;\\n uint256 constant C119 = 21338390051413922944780864872652000187403217966653363270851298678606449622266;\\n uint256 constant C120 = 12156296560457833712186127325312904760045212412680904475497938949653569234473;\\n uint256 constant C121 = 4271647814574748734312113971565139132510281260328947438246615707172526380757;\\n uint256 constant C122 = 9061738206062369647211128232833114177054715885442782773131292534862178874950;\\n uint256 constant C123 = 10134551893627587797380445583959894183158393780166496661696555422178052339133;\\n uint256 constant C124 = 8932270237664043612366044102088319242789325050842783721780970129656616386103;\\n uint256 constant C125 = 3339412934966886386194449782756711637636784424032779155216609410591712750636;\\n uint256 constant C126 = 9704903972004596791086522314847373103670545861209569267884026709445485704400;\\n uint256 constant C127 = 17467570179597572575614276429760169990940929887711661192333523245667228809456;\\n uint256 constant M00 = 2910766817845651019878574839501801340070030115151021261302834310722729507541;\\n uint256 constant M01 = 19727366863391167538122140361473584127147630672623100827934084310230022599144;\\n uint256 constant M10 = 5776684794125549462448597414050232243778680302179439492664047328281728356345;\\n uint256 constant M11 = 8348174920934122550483593999453880006756108121341067172388445916328941978568;\\n\\n function hash(uint256 input) external pure override returns (uint256 result) {\\n return _hash(input);\\n }\\n\\n function _hash(uint256 input) internal pure returns (uint256 result) {\\n assembly {\\n // Poseidon parameters should be t = 2, RF = 8, RP = 56\\n\\n // We load the characteristic\\n let q := Q\\n\\n // In zerokit implementation, if we pass inp = [a0,a1,..,an] to Poseidon what is effectively hashed is [0,a0,a1,..,an]\\n // Note that a sequence of MIX-ARK involves 3 Bn254 field additions before the mulmod happens. Worst case we have a value corresponding to 2*(p-1) which is less than 2^256 and hence doesn't overflow\\n //ROUND 0 - FULL\\n let s0 := C0\\n let s1 := add(input, C1)\\n // SBOX\\n let t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 1 - FULL\\n s0 := add(s0, C2)\\n s1 := add(s1, C3)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 2 - FULL\\n s0 := add(s0, C4)\\n s1 := add(s1, C5)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 3 - FULL\\n s0 := add(s0, C6)\\n s1 := add(s1, C7)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 4 - PARTIAL\\n s0 := add(s0, C8)\\n s1 := add(s1, C9)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 5 - PARTIAL\\n s0 := add(s0, C10)\\n s1 := add(s1, C11)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 6 - PARTIAL\\n s0 := add(s0, C12)\\n s1 := add(s1, C13)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 7 - PARTIAL\\n s0 := add(s0, C14)\\n s1 := add(s1, C15)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 8 - PARTIAL\\n s0 := add(s0, C16)\\n s1 := add(s1, C17)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 9 - PARTIAL\\n s0 := add(s0, C18)\\n s1 := add(s1, C19)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 10 - PARTIAL\\n s0 := add(s0, C20)\\n s1 := add(s1, C21)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 11 - PARTIAL\\n s0 := add(s0, C22)\\n s1 := add(s1, C23)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 12 - PARTIAL\\n s0 := add(s0, C24)\\n s1 := add(s1, C25)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 13 - PARTIAL\\n s0 := add(s0, C26)\\n s1 := add(s1, C27)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 14 - PARTIAL\\n s0 := add(s0, C28)\\n s1 := add(s1, C29)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 15 - PARTIAL\\n s0 := add(s0, C30)\\n s1 := add(s1, C31)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 16 - PARTIAL\\n s0 := add(s0, C32)\\n s1 := add(s1, C33)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 17 - PARTIAL\\n s0 := add(s0, C34)\\n s1 := add(s1, C35)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 18 - PARTIAL\\n s0 := add(s0, C36)\\n s1 := add(s1, C37)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 19 - PARTIAL\\n s0 := add(s0, C38)\\n s1 := add(s1, C39)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 20 - PARTIAL\\n s0 := add(s0, C40)\\n s1 := add(s1, C41)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 21 - PARTIAL\\n s0 := add(s0, C42)\\n s1 := add(s1, C43)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 22 - PARTIAL\\n s0 := add(s0, C44)\\n s1 := add(s1, C45)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 23 - PARTIAL\\n s0 := add(s0, C46)\\n s1 := add(s1, C47)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 24 - PARTIAL\\n s0 := add(s0, C48)\\n s1 := add(s1, C49)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 25 - PARTIAL\\n s0 := add(s0, C50)\\n s1 := add(s1, C51)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 26 - PARTIAL\\n s0 := add(s0, C52)\\n s1 := add(s1, C53)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 27 - PARTIAL\\n s0 := add(s0, C54)\\n s1 := add(s1, C55)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 28 - PARTIAL\\n s0 := add(s0, C56)\\n s1 := add(s1, C57)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 29 - PARTIAL\\n s0 := add(s0, C58)\\n s1 := add(s1, C59)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 30 - PARTIAL\\n s0 := add(s0, C60)\\n s1 := add(s1, C61)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 31 - PARTIAL\\n s0 := add(s0, C62)\\n s1 := add(s1, C63)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 32 - PARTIAL\\n s0 := add(s0, C64)\\n s1 := add(s1, C65)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 33 - PARTIAL\\n s0 := add(s0, C66)\\n s1 := add(s1, C67)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 34 - PARTIAL\\n s0 := add(s0, C68)\\n s1 := add(s1, C69)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 35 - PARTIAL\\n s0 := add(s0, C70)\\n s1 := add(s1, C71)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 36 - PARTIAL\\n s0 := add(s0, C72)\\n s1 := add(s1, C73)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 37 - PARTIAL\\n s0 := add(s0, C74)\\n s1 := add(s1, C75)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 38 - PARTIAL\\n s0 := add(s0, C76)\\n s1 := add(s1, C77)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 39 - PARTIAL\\n s0 := add(s0, C78)\\n s1 := add(s1, C79)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 40 - PARTIAL\\n s0 := add(s0, C80)\\n s1 := add(s1, C81)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 41 - PARTIAL\\n s0 := add(s0, C82)\\n s1 := add(s1, C83)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 42 - PARTIAL\\n s0 := add(s0, C84)\\n s1 := add(s1, C85)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 43 - PARTIAL\\n s0 := add(s0, C86)\\n s1 := add(s1, C87)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 44 - PARTIAL\\n s0 := add(s0, C88)\\n s1 := add(s1, C89)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 45 - PARTIAL\\n s0 := add(s0, C90)\\n s1 := add(s1, C91)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 46 - PARTIAL\\n s0 := add(s0, C92)\\n s1 := add(s1, C93)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 47 - PARTIAL\\n s0 := add(s0, C94)\\n s1 := add(s1, C95)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 48 - PARTIAL\\n s0 := add(s0, C96)\\n s1 := add(s1, C97)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 49 - PARTIAL\\n s0 := add(s0, C98)\\n s1 := add(s1, C99)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 50 - PARTIAL\\n s0 := add(s0, C100)\\n s1 := add(s1, C101)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 51 - PARTIAL\\n s0 := add(s0, C102)\\n s1 := add(s1, C103)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 52 - PARTIAL\\n s0 := add(s0, C104)\\n s1 := add(s1, C105)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 53 - PARTIAL\\n s0 := add(s0, C106)\\n s1 := add(s1, C107)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 54 - PARTIAL\\n s0 := add(s0, C108)\\n s1 := add(s1, C109)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 55 - PARTIAL\\n s0 := add(s0, C110)\\n s1 := add(s1, C111)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 56 - PARTIAL\\n s0 := add(s0, C112)\\n s1 := add(s1, C113)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 57 - PARTIAL\\n s0 := add(s0, C114)\\n s1 := add(s1, C115)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 58 - PARTIAL\\n s0 := add(s0, C116)\\n s1 := add(s1, C117)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 59 - PARTIAL\\n s0 := add(s0, C118)\\n s1 := add(s1, C119)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 60 - FULL\\n s0 := add(s0, C120)\\n s1 := add(s1, C121)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 61 - FULL\\n s0 := add(s0, C122)\\n s1 := add(s1, C123)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 62 - FULL\\n s0 := add(s0, C124)\\n s1 := add(s1, C125)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 63 - FULL\\n s0 := add(s0, C126)\\n s1 := add(s1, C127)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n s0 := mod(add(mulmod(s0, M00, q), mulmod(s1, M01, q)), q)\\n\\n result := s0\\n }\\n }\\n}\\n\",\"keccak256\":\"0x50d1490b2e804f044f0013aabfe08b34dbeba972e51969d42bdb427ca8ffa037\",\"license\":\"MIT\"},\"lib/rln-contract/contracts/RlnBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.15;\\n\\nimport {IPoseidonHasher} from \\\"./PoseidonHasher.sol\\\";\\nimport {IVerifier} from \\\"./IVerifier.sol\\\";\\n\\n/// The tree is full\\nerror FullTree();\\n\\n/// Invalid deposit amount\\n/// @param required The required deposit amount\\n/// @param provided The provided deposit amount\\nerror InsufficientDeposit(uint256 required, uint256 provided);\\n\\n/// Member is already registered\\nerror DuplicateIdCommitment();\\n\\n/// Failed validation on registration/slashing\\nerror FailedValidation();\\n\\n/// Invalid receiver address, when the receiver is the contract itself or 0x0\\nerror InvalidReceiverAddress(address to);\\n\\n/// Member is not registered\\nerror MemberNotRegistered(uint256 idCommitment);\\n\\n/// Member has no stake\\nerror MemberHasNoStake(uint256 idCommitment);\\n\\n/// User has insufficient balance to withdraw\\nerror InsufficientWithdrawalBalance();\\n\\n/// Contract has insufficient balance to return\\nerror InsufficientContractBalance();\\n\\n/// Invalid proof\\nerror InvalidProof();\\n\\nabstract contract RlnBase {\\n /// @notice The deposit amount required to register as a member\\n uint256 public immutable MEMBERSHIP_DEPOSIT;\\n\\n /// @notice The depth of the merkle tree\\n uint256 public immutable DEPTH;\\n\\n /// @notice The size of the merkle tree, i.e 2^depth\\n uint256 public immutable SET_SIZE;\\n\\n /// @notice The index of the next member to be registered\\n uint256 public idCommitmentIndex = 1;\\n\\n /// @notice The amount of eth staked by each member\\n /// maps from idCommitment to the amount staked\\n mapping(uint256 => uint256) public stakedAmounts;\\n\\n /// @notice The membership status of each member\\n /// maps from idCommitment to their index in the set\\n mapping(uint256 => uint256) public members;\\n\\n /// @notice The balance of each user that can be withdrawn\\n mapping(address => uint256) public withdrawalBalance;\\n\\n /// @notice The Poseidon hasher contract\\n IPoseidonHasher public immutable poseidonHasher;\\n\\n /// @notice The groth16 verifier contract\\n IVerifier public immutable verifier;\\n\\n /// Emitted when a new member is added to the set\\n /// @param idCommitment The idCommitment of the member\\n /// @param index The index of the member in the set\\n event MemberRegistered(uint256 idCommitment, uint256 index);\\n\\n /// Emitted when a member is removed from the set\\n /// @param idCommitment The idCommitment of the member\\n /// @param index The index of the member in the set\\n event MemberWithdrawn(uint256 idCommitment, uint256 index);\\n\\n constructor(uint256 membershipDeposit, uint256 depth, address _poseidonHasher, address _verifier) {\\n MEMBERSHIP_DEPOSIT = membershipDeposit;\\n DEPTH = depth;\\n SET_SIZE = 1 << depth;\\n poseidonHasher = IPoseidonHasher(_poseidonHasher);\\n verifier = IVerifier(_verifier);\\n }\\n\\n /// Allows a user to register as a member\\n /// @param idCommitment The idCommitment of the member\\n function register(uint256 idCommitment) external payable virtual {\\n if (msg.value != MEMBERSHIP_DEPOSIT) {\\n revert InsufficientDeposit(MEMBERSHIP_DEPOSIT, msg.value);\\n }\\n _validateRegistration(idCommitment);\\n _register(idCommitment, msg.value);\\n }\\n\\n /// Registers a member\\n /// @param idCommitment The idCommitment of the member\\n /// @param stake The amount of eth staked by the member\\n function _register(uint256 idCommitment, uint256 stake) internal virtual {\\n if (members[idCommitment] != 0) revert DuplicateIdCommitment();\\n if (idCommitmentIndex >= SET_SIZE) revert FullTree();\\n\\n members[idCommitment] = idCommitmentIndex;\\n stakedAmounts[idCommitment] = stake;\\n\\n emit MemberRegistered(idCommitment, idCommitmentIndex);\\n idCommitmentIndex += 1;\\n }\\n\\n /// @dev Inheriting contracts MUST override this function\\n function _validateRegistration(uint256 idCommitment) internal view virtual;\\n\\n /// @dev Allows a user to slash a member\\n /// @param idCommitment The idCommitment of the member\\n function slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) external virtual {\\n _validateSlash(idCommitment, receiver, proof);\\n _slash(idCommitment, receiver, proof);\\n }\\n\\n /// @dev Slashes a member by removing them from the set, and adding their\\n /// stake to the receiver's available withdrawal balance\\n /// @param idCommitment The idCommitment of the member\\n /// @param receiver The address to receive the funds\\n function _slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) internal virtual {\\n if (receiver == address(this) || receiver == address(0)) {\\n revert InvalidReceiverAddress(receiver);\\n }\\n\\n if (members[idCommitment] == 0) revert MemberNotRegistered(idCommitment);\\n // check if member is registered\\n if (stakedAmounts[idCommitment] == 0) {\\n revert MemberHasNoStake(idCommitment);\\n }\\n\\n if (!_verifyProof(idCommitment, receiver, proof)) {\\n revert InvalidProof();\\n }\\n\\n uint256 amountToTransfer = stakedAmounts[idCommitment];\\n\\n // delete member\\n uint256 index = members[idCommitment];\\n members[idCommitment] = 0;\\n stakedAmounts[idCommitment] = 0;\\n\\n // refund deposit\\n withdrawalBalance[receiver] += amountToTransfer;\\n\\n emit MemberWithdrawn(idCommitment, index);\\n }\\n\\n function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof)\\n internal\\n view\\n virtual;\\n\\n /// Allows a user to withdraw funds allocated to them upon slashing a member\\n function withdraw() external virtual {\\n uint256 amount = withdrawalBalance[msg.sender];\\n\\n if (amount == 0) revert InsufficientWithdrawalBalance();\\n if (amount > address(this).balance) {\\n revert InsufficientContractBalance();\\n }\\n\\n withdrawalBalance[msg.sender] = 0;\\n\\n payable(msg.sender).transfer(amount);\\n }\\n\\n /// Hashes a value using the Poseidon hasher\\n /// NOTE: The variant of Poseidon we use accepts only 1 input, assume n=2, and the second input is 0\\n /// @param input The value to hash\\n function hash(uint256 input) internal view returns (uint256) {\\n return poseidonHasher.hash(input);\\n }\\n\\n /// @dev Groth16 proof verification\\n function _verifyProof(uint256 idCommitment, address receiver, uint256[8] calldata proof)\\n internal\\n view\\n virtual\\n returns (bool)\\n {\\n return verifier.verifyProof(\\n [proof[0], proof[1]],\\n [[proof[2], proof[3]], [proof[4], proof[5]]],\\n [proof[6], proof[7]],\\n [idCommitment, uint256(uint160(receiver))]\\n );\\n }\\n}\\n\",\"keccak256\":\"0x7d6c1d1ade6910fa07b5b8c228e494697852ece42d21752f917c66612470e0a1\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x610140604052600180553480156200001657600080fd5b506040516200127e3803806200127e83398181016040528101906200003c91906200027a565b6000601483600062000063620000576200010560201b60201c565b6200010d60201b60201c565b83608081815250508260a08181525050826001901b60c081815250508173ffffffffffffffffffffffffffffffffffffffff1660e08173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff166101008173ffffffffffffffffffffffffffffffffffffffff1681525050505050508061ffff166101208161ffff16815250505050620002c1565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200020382620001d6565b9050919050565b6200021581620001f6565b81146200022157600080fd5b50565b60008151905062000235816200020a565b92915050565b600061ffff82169050919050565b62000254816200023b565b81146200026057600080fd5b50565b600081519050620002748162000249565b92915050565b60008060408385031215620002945762000293620001d1565b5b6000620002a48582860162000224565b9250506020620002b78582860162000263565b9150509250929050565b60805160a05160c05160e0516101005161012051610f6d6200031160003960006103d9015260006103fd01526000610421015260006105a40152600061054a015260006105fa0152610f6d6000f3fe6080604052600436106100fe5760003560e01c80638da5cb5b11610095578063c5b208ff11610064578063c5b208ff146102ff578063d0383d681461033c578063f207564e14610367578063f220b9ec14610383578063f2fde38b146103ae576100fe565b80638da5cb5b1461024157806398366e351461026c578063ae74552a14610297578063bc499128146102c2576100fe565b80635daf08ca116100d15780635daf08ca1461019b578063715018a6146101d85780637a34289d146101ef5780638be9b11914610218576100fe565b806328b070e0146101035780632b7ac3f31461012e578063331b6ab3146101595780633ccfd60b14610184575b600080fd5b34801561010f57600080fd5b506101186103d7565b60405161012591906108ce565b60405180910390f35b34801561013a57600080fd5b506101436103fb565b6040516101509190610968565b60405180910390f35b34801561016557600080fd5b5061016e61041f565b60405161017b91906109a4565b60405180910390f35b34801561019057600080fd5b50610199610443565b005b3480156101a757600080fd5b506101c260048036038101906101bd9190610a09565b610475565b6040516101cf9190610a45565b60405180910390f35b3480156101e457600080fd5b506101ed61048d565b005b3480156101fb57600080fd5b5061021660048036038101906102119190610bb9565b6104a1565b005b34801561022457600080fd5b5061023f600480360381019061023a9190610c62565b6104ed565b005b34801561024d57600080fd5b5061025661051f565b6040516102639190610cd7565b60405180910390f35b34801561027857600080fd5b50610281610548565b60405161028e9190610a45565b60405180910390f35b3480156102a357600080fd5b506102ac61056c565b6040516102b99190610a45565b60405180910390f35b3480156102ce57600080fd5b506102e960048036038101906102e49190610a09565b610572565b6040516102f69190610a45565b60405180910390f35b34801561030b57600080fd5b5061032660048036038101906103219190610d1e565b61058a565b6040516103339190610a45565b60405180910390f35b34801561034857600080fd5b506103516105a2565b60405161035e9190610a45565b60405180910390f35b610381600480360381019061037c9190610a09565b6105c6565b005b34801561038f57600080fd5b506103986105f8565b6040516103a59190610a45565b60405180910390f35b3480156103ba57600080fd5b506103d560048036038101906103d09190610d1e565b61061c565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60036020528060005260406000206000915090505481565b61049561069f565b61049f600061071d565b565b6104a961069f565b60008151905060005b818110156104e8576104dd8382815181106104d0576104cf610d4b565b5b60200260200101516107e1565b8060010190506104b2565b505050565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60026020528060005260406000206000915090505481565b60046020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000081565b61062461069f565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610693576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068a90610dfd565b60405180910390fd5b61069c8161071d565b50565b6106a761085a565b73ffffffffffffffffffffffffffffffffffffffff166106c561051f565b73ffffffffffffffffffffffffffffffffffffffff161461071b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071290610e69565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6107ea81610862565b600160036000838152602001908152602001600020819055507f5a92c2530f207992057b9c3e544108ffce3beda4a63719f316967c49bf6159d281600154604051610836929190610e89565b60405180910390a160018060008282546108509190610ee1565b9250508190555050565b600033905090565b60006003600083815260200190815260200160002054146108ae576040517e0a60f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b600061ffff82169050919050565b6108c8816108b1565b82525050565b60006020820190506108e360008301846108bf565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061092e610929610924846108e9565b610909565b6108e9565b9050919050565b600061094082610913565b9050919050565b600061095282610935565b9050919050565b61096281610947565b82525050565b600060208201905061097d6000830184610959565b92915050565b600061098e82610935565b9050919050565b61099e81610983565b82525050565b60006020820190506109b96000830184610995565b92915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6109e6816109d3565b81146109f157600080fd5b50565b600081359050610a03816109dd565b92915050565b600060208284031215610a1f57610a1e6109c9565b5b6000610a2d848285016109f4565b91505092915050565b610a3f816109d3565b82525050565b6000602082019050610a5a6000830184610a36565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610aae82610a65565b810181811067ffffffffffffffff82111715610acd57610acc610a76565b5b80604052505050565b6000610ae06109bf565b9050610aec8282610aa5565b919050565b600067ffffffffffffffff821115610b0c57610b0b610a76565b5b602082029050602081019050919050565b600080fd5b6000610b35610b3084610af1565b610ad6565b90508083825260208201905060208402830185811115610b5857610b57610b1d565b5b835b81811015610b815780610b6d88826109f4565b845260208401935050602081019050610b5a565b5050509392505050565b600082601f830112610ba057610b9f610a60565b5b8135610bb0848260208601610b22565b91505092915050565b600060208284031215610bcf57610bce6109c9565b5b600082013567ffffffffffffffff811115610bed57610bec6109ce565b5b610bf984828501610b8b565b91505092915050565b6000610c0d826108e9565b9050919050565b610c1d81610c02565b8114610c2857600080fd5b50565b600081359050610c3a81610c14565b92915050565b600081905082602060080282011115610c5c57610c5b610b1d565b5b92915050565b60008060006101408486031215610c7c57610c7b6109c9565b5b6000610c8a868287016109f4565b9350506020610c9b86828701610c2b565b9250506040610cac86828701610c40565b9150509250925092565b6000610cc1826108e9565b9050919050565b610cd181610cb6565b82525050565b6000602082019050610cec6000830184610cc8565b92915050565b610cfb81610cb6565b8114610d0657600080fd5b50565b600081359050610d1881610cf2565b92915050565b600060208284031215610d3457610d336109c9565b5b6000610d4284828501610d09565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082825260208201905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610de7602683610d7a565b9150610df282610d8b565b604082019050919050565b60006020820190508181036000830152610e1681610dda565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000610e53602083610d7a565b9150610e5e82610e1d565b602082019050919050565b60006020820190508181036000830152610e8281610e46565b9050919050565b6000604082019050610e9e6000830185610a36565b610eab6020830184610a36565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610eec826109d3565b9150610ef7836109d3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610f2c57610f2b610eb2565b5b82820190509291505056fea2646970667358221220da67ff31fb04406d288565daf496c41920eb7b2fc65318a1f86281ac336152ab64736f6c634300080f0033", + "deployedBytecode": "0x6080604052600436106100fe5760003560e01c80638da5cb5b11610095578063c5b208ff11610064578063c5b208ff146102ff578063d0383d681461033c578063f207564e14610367578063f220b9ec14610383578063f2fde38b146103ae576100fe565b80638da5cb5b1461024157806398366e351461026c578063ae74552a14610297578063bc499128146102c2576100fe565b80635daf08ca116100d15780635daf08ca1461019b578063715018a6146101d85780637a34289d146101ef5780638be9b11914610218576100fe565b806328b070e0146101035780632b7ac3f31461012e578063331b6ab3146101595780633ccfd60b14610184575b600080fd5b34801561010f57600080fd5b506101186103d7565b60405161012591906108ce565b60405180910390f35b34801561013a57600080fd5b506101436103fb565b6040516101509190610968565b60405180910390f35b34801561016557600080fd5b5061016e61041f565b60405161017b91906109a4565b60405180910390f35b34801561019057600080fd5b50610199610443565b005b3480156101a757600080fd5b506101c260048036038101906101bd9190610a09565b610475565b6040516101cf9190610a45565b60405180910390f35b3480156101e457600080fd5b506101ed61048d565b005b3480156101fb57600080fd5b5061021660048036038101906102119190610bb9565b6104a1565b005b34801561022457600080fd5b5061023f600480360381019061023a9190610c62565b6104ed565b005b34801561024d57600080fd5b5061025661051f565b6040516102639190610cd7565b60405180910390f35b34801561027857600080fd5b50610281610548565b60405161028e9190610a45565b60405180910390f35b3480156102a357600080fd5b506102ac61056c565b6040516102b99190610a45565b60405180910390f35b3480156102ce57600080fd5b506102e960048036038101906102e49190610a09565b610572565b6040516102f69190610a45565b60405180910390f35b34801561030b57600080fd5b5061032660048036038101906103219190610d1e565b61058a565b6040516103339190610a45565b60405180910390f35b34801561034857600080fd5b506103516105a2565b60405161035e9190610a45565b60405180910390f35b610381600480360381019061037c9190610a09565b6105c6565b005b34801561038f57600080fd5b506103986105f8565b6040516103a59190610a45565b60405180910390f35b3480156103ba57600080fd5b506103d560048036038101906103d09190610d1e565b61061c565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60036020528060005260406000206000915090505481565b61049561069f565b61049f600061071d565b565b6104a961069f565b60008151905060005b818110156104e8576104dd8382815181106104d0576104cf610d4b565b5b60200260200101516107e1565b8060010190506104b2565b505050565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60026020528060005260406000206000915090505481565b60046020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000081565b61062461069f565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610693576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068a90610dfd565b60405180910390fd5b61069c8161071d565b50565b6106a761085a565b73ffffffffffffffffffffffffffffffffffffffff166106c561051f565b73ffffffffffffffffffffffffffffffffffffffff161461071b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071290610e69565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6107ea81610862565b600160036000838152602001908152602001600020819055507f5a92c2530f207992057b9c3e544108ffce3beda4a63719f316967c49bf6159d281600154604051610836929190610e89565b60405180910390a160018060008282546108509190610ee1565b9250508190555050565b600033905090565b60006003600083815260200190815260200160002054146108ae576040517e0a60f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b600061ffff82169050919050565b6108c8816108b1565b82525050565b60006020820190506108e360008301846108bf565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061092e610929610924846108e9565b610909565b6108e9565b9050919050565b600061094082610913565b9050919050565b600061095282610935565b9050919050565b61096281610947565b82525050565b600060208201905061097d6000830184610959565b92915050565b600061098e82610935565b9050919050565b61099e81610983565b82525050565b60006020820190506109b96000830184610995565b92915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6109e6816109d3565b81146109f157600080fd5b50565b600081359050610a03816109dd565b92915050565b600060208284031215610a1f57610a1e6109c9565b5b6000610a2d848285016109f4565b91505092915050565b610a3f816109d3565b82525050565b6000602082019050610a5a6000830184610a36565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610aae82610a65565b810181811067ffffffffffffffff82111715610acd57610acc610a76565b5b80604052505050565b6000610ae06109bf565b9050610aec8282610aa5565b919050565b600067ffffffffffffffff821115610b0c57610b0b610a76565b5b602082029050602081019050919050565b600080fd5b6000610b35610b3084610af1565b610ad6565b90508083825260208201905060208402830185811115610b5857610b57610b1d565b5b835b81811015610b815780610b6d88826109f4565b845260208401935050602081019050610b5a565b5050509392505050565b600082601f830112610ba057610b9f610a60565b5b8135610bb0848260208601610b22565b91505092915050565b600060208284031215610bcf57610bce6109c9565b5b600082013567ffffffffffffffff811115610bed57610bec6109ce565b5b610bf984828501610b8b565b91505092915050565b6000610c0d826108e9565b9050919050565b610c1d81610c02565b8114610c2857600080fd5b50565b600081359050610c3a81610c14565b92915050565b600081905082602060080282011115610c5c57610c5b610b1d565b5b92915050565b60008060006101408486031215610c7c57610c7b6109c9565b5b6000610c8a868287016109f4565b9350506020610c9b86828701610c2b565b9250506040610cac86828701610c40565b9150509250925092565b6000610cc1826108e9565b9050919050565b610cd181610cb6565b82525050565b6000602082019050610cec6000830184610cc8565b92915050565b610cfb81610cb6565b8114610d0657600080fd5b50565b600081359050610d1881610cf2565b92915050565b600060208284031215610d3457610d336109c9565b5b6000610d4284828501610d09565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082825260208201905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610de7602683610d7a565b9150610df282610d8b565b604082019050919050565b60006020820190508181036000830152610e1681610dda565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000610e53602083610d7a565b9150610e5e82610e1d565b602082019050919050565b60006020820190508181036000830152610e8281610e46565b9050919050565b6000604082019050610e9e6000830185610a36565b610eab6020830184610a36565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610eec826109d3565b9150610ef7836109d3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610f2c57610f2b610eb2565b5b82820190509291505056fea2646970667358221220da67ff31fb04406d288565daf496c41920eb7b2fc65318a1f86281ac336152ab64736f6c634300080f0033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "register(uint256)": { + "params": { + "idCommitment": "The idCommitment of the member" + } + }, + "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." + }, + "slash(uint256,address,uint256[8])": { + "details": "Allows a user to slash a member", + "params": { + "idCommitment": "The idCommitment of the member" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + } +} diff --git a/deployments/sepolia/WakuRlnStorage_1.json b/deployments/sepolia/WakuRlnStorage_1.json new file mode 100644 index 0000000..d7fbd31 --- /dev/null +++ b/deployments/sepolia/WakuRlnStorage_1.json @@ -0,0 +1,364 @@ +{ + "address": "0x662Be55E75c829A03c52CDba4Ab7dAde4e1be8a9", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_poseidonHasher", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_contractIndex", + "type": "uint16" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "DuplicateIdCommitment", + "type": "error" + }, + { + "inputs": [], + "name": "NotImplemented", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "MemberRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "MemberWithdrawn", + "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" + }, + { + "inputs": [], + "name": "DEPTH", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MEMBERSHIP_DEPOSIT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SET_SIZE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractIndex", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "idCommitmentIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "members", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poseidonHasher", + "outputs": [ + { + "internalType": "contract IPoseidonHasher", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "idCommitments", + "type": "uint256[]" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "idCommitment", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256[8]", + "name": "proof", + "type": "uint256[8]" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "stakedAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "verifier", + "outputs": [ + { + "internalType": "contract IVerifier", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "withdrawalBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xa45fa96233892df438b638ce9402b9028ab4670aed2a95260577749d40459c6c", + "receipt": { + "to": "0x50D658a2ab7f66f4B73E27e8731B8b13Cd06Df8A", + "from": "0x3F47b2a1dF96DE2e198d646b598C37251CCC3b98", + "transactionIndex": null, + "blockHash": null, + "blockNumber": null + }, + "args": ["0xCF6ccD3691f67dfa0EdDeFED1B295139d0197609", 1], + "numDeployments": 1, + "metadata": "{\"compiler\":{\"version\":\"0.8.15+commit.e14f2714\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poseidonHasher\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_contractIndex\",\"type\":\"uint16\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"DuplicateIdCommitment\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotImplemented\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"idCommitment\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"MemberRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"idCommitment\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"MemberWithdrawn\",\"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\"},{\"inputs\":[],\"name\":\"DEPTH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MEMBERSHIP_DEPOSIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SET_SIZE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"contractIndex\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"idCommitmentIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"members\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poseidonHasher\",\"outputs\":[{\"internalType\":\"contract IPoseidonHasher\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"idCommitments\",\"type\":\"uint256[]\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"idCommitment\",\"type\":\"uint256\"}],\"name\":\"register\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"idCommitment\",\"type\":\"uint256\"},{\"internalType\":\"address payable\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256[8]\",\"name\":\"proof\",\"type\":\"uint256[8]\"}],\"name\":\"slash\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"stakedAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifier\",\"outputs\":[{\"internalType\":\"contract IVerifier\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"withdrawalBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"register(uint256)\":{\"params\":{\"idCommitment\":\"The idCommitment of the member\"}},\"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.\"},\"slash(uint256,address,uint256[8])\":{\"details\":\"Allows a user to slash a member\",\"params\":{\"idCommitment\":\"The idCommitment of the member\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"errors\":{\"DuplicateIdCommitment()\":[{\"notice\":\"Member is already registered\"}]},\"events\":{\"MemberRegistered(uint256,uint256)\":{\"notice\":\"Emitted when a new member is added to the set\"},\"MemberWithdrawn(uint256,uint256)\":{\"notice\":\"Emitted when a member is removed from the set\"}},\"kind\":\"user\",\"methods\":{\"DEPTH()\":{\"notice\":\"The depth of the merkle tree\"},\"MEMBERSHIP_DEPOSIT()\":{\"notice\":\"The deposit amount required to register as a member\"},\"SET_SIZE()\":{\"notice\":\"The size of the merkle tree, i.e 2^depth\"},\"idCommitmentIndex()\":{\"notice\":\"The index of the next member to be registered\"},\"members(uint256)\":{\"notice\":\"The membership status of each member maps from idCommitment to their index in the set\"},\"poseidonHasher()\":{\"notice\":\"The Poseidon hasher contract\"},\"register(uint256)\":{\"notice\":\"Allows a user to register as a member\"},\"stakedAmounts(uint256)\":{\"notice\":\"The amount of eth staked by each member maps from idCommitment to the amount staked\"},\"verifier()\":{\"notice\":\"The groth16 verifier contract\"},\"withdraw()\":{\"notice\":\"Allows a user to withdraw funds allocated to them upon slashing a member\"},\"withdrawalBalance(address)\":{\"notice\":\"The balance of each user that can be withdrawn\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/WakuRln.sol\":\"WakuRln\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\",\":openzeppelin/=lib/openzeppelin-contracts/contracts/\",\":rln-contract/=lib/rln-contract/contracts/\"]},\"sources\":{\"contracts/WakuRln.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.15;\\n\\nimport {IPoseidonHasher} from \\\"rln-contract/PoseidonHasher.sol\\\";\\nimport {RlnBase, DuplicateIdCommitment} from \\\"rln-contract/RlnBase.sol\\\";\\nimport {Ownable} from \\\"openzeppelin-contracts/contracts/access/Ownable.sol\\\";\\n\\nerror NotImplemented();\\n\\ncontract WakuRln is Ownable, RlnBase {\\n uint16 public immutable contractIndex;\\n\\n constructor(address _poseidonHasher, uint16 _contractIndex) Ownable() RlnBase(0, 20, _poseidonHasher, address(0)) {\\n contractIndex = _contractIndex;\\n }\\n\\n /// Registers a member\\n /// @param idCommitment The idCommitment of the member\\n function _register(uint256 idCommitment) internal {\\n _validateRegistration(idCommitment);\\n\\n members[idCommitment] = 1;\\n\\n emit MemberRegistered(idCommitment, idCommitmentIndex);\\n idCommitmentIndex += 1;\\n }\\n\\n function register(uint256[] memory idCommitments) external onlyOwner {\\n uint256 len = idCommitments.length;\\n for (uint256 i = 0; i < len;) {\\n _register(idCommitments[i]);\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function register(uint256 idCommitment) external payable override {\\n revert NotImplemented();\\n }\\n\\n function slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) external pure override {\\n revert NotImplemented();\\n }\\n\\n function _validateRegistration(uint256 idCommitment) internal view override {\\n if (members[idCommitment] != 0) revert DuplicateIdCommitment();\\n }\\n\\n function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof)\\n internal\\n pure\\n override\\n {\\n revert NotImplemented();\\n }\\n\\n function withdraw() external pure override {\\n revert NotImplemented();\\n }\\n}\\n\",\"keccak256\":\"0xaa4c93ed9c0656a01c113f0453b6f6a3db742e53b3371e34ed608902913d9700\",\"license\":\"MIT\"},\"lib/openzeppelin-contracts/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\"},\"lib/openzeppelin-contracts/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (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\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"lib/rln-contract/contracts/IVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0 OR MIT\\npragma solidity 0.8.15;\\n\\ninterface IVerifier {\\n function verifyProof(uint256[2] memory a, uint256[2][2] memory b, uint256[2] memory c, uint256[2] memory input)\\n external\\n view\\n returns (bool);\\n}\\n\",\"keccak256\":\"0x538e61fbb62bf1ef9f0c3f7e7d771ddfc8506a97e7d98aada763830fc741d8b8\",\"license\":\"Apache-2.0 OR MIT\"},\"lib/rln-contract/contracts/PoseidonHasher.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// Forked from https://github.com/kilic/rlnapp/\\n\\npragma solidity 0.8.15;\\n\\ninterface IPoseidonHasher {\\n /// @notice Hashes the input using the Poseidon hash function, n = 2, second input is the constant 0\\n /// @param input The input to hash\\n function hash(uint256 input) external pure returns (uint256 result);\\n}\\n\\ncontract PoseidonHasher is IPoseidonHasher {\\n uint256 constant Q = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\\n uint256 constant C0 = 4417881134626180770308697923359573201005643519861877412381846989312604493735;\\n uint256 constant C1 = 5433650512959517612316327474713065966758808864213826738576266661723522780033;\\n uint256 constant C2 = 13641176377184356099764086973022553863760045607496549923679278773208775739952;\\n uint256 constant C3 = 17949713444224994136330421782109149544629237834775211751417461773584374506783;\\n uint256 constant C4 = 13765628375339178273710281891027109699578766420463125835325926111705201856003;\\n uint256 constant C5 = 19179513468172002314585757290678967643352171735526887944518845346318719730387;\\n uint256 constant C6 = 5157412437176756884543472904098424903141745259452875378101256928559722612176;\\n uint256 constant C7 = 535160875740282236955320458485730000677124519901643397458212725410971557409;\\n uint256 constant C8 = 1050793453380762984940163090920066886770841063557081906093018330633089036729;\\n uint256 constant C9 = 10665495010329663932664894101216428400933984666065399374198502106997623173873;\\n uint256 constant C10 = 19965634623406616956648724894636666805991993496469370618546874926025059150737;\\n uint256 constant C11 = 13007250030070838431593222885902415182312449212965120303174723305710127422213;\\n uint256 constant C12 = 16877538715074991604507979123743768693428157847423939051086744213162455276374;\\n uint256 constant C13 = 18211747749504876135588847560312685184956239426147543810126553367063157141465;\\n uint256 constant C14 = 18151553319826126919739798892854572062191241985315767086020821632812331245635;\\n uint256 constant C15 = 19957033149976712666746140949846950406660099037474791840946955175819555930825;\\n uint256 constant C16 = 3469514863538261843186854830917934449567467100548474599735384052339577040841;\\n uint256 constant C17 = 989698510043911779243192466312362856042600749099921773896924315611668507708;\\n uint256 constant C18 = 12568377015646290945235387813564567111330046038050864455358059568128000172201;\\n uint256 constant C19 = 20856104135605479600325529349246932565148587186338606236677138505306779314172;\\n uint256 constant C20 = 8206918720503535523121349917159924938835810381723474192155637697065780938424;\\n uint256 constant C21 = 1309058477013932989380617265069188723120054926187607548493110334522527703566;\\n uint256 constant C22 = 14076116939332667074621703729512195584105250395163383769419390236426287710606;\\n uint256 constant C23 = 10153498892749751942204288991871286290442690932856658983589258153608012428674;\\n uint256 constant C24 = 18202499207234128286137597834010475797175973146805180988367589376893530181575;\\n uint256 constant C25 = 12739388830157083522877690211447248168864006284243907142044329113461613743052;\\n uint256 constant C26 = 15123358710467780770838026754240340042441262572309759635224051333176022613949;\\n uint256 constant C27 = 19925004701844594370904593774447343836015483888496504201331110250494635362184;\\n uint256 constant C28 = 10352416606816998476681131583320899030072315953910679608943150613208329645891;\\n uint256 constant C29 = 10567371822366244361703342347428230537114808440249611395507235283708966113221;\\n uint256 constant C30 = 5635498582763880627392290206431559361272660937399944184533035305989295959602;\\n uint256 constant C31 = 11866432933224219174041051738704352719163271639958083608224676028593315904909;\\n uint256 constant C32 = 5795020705294401441272215064554385591292330721703923167136157291459784140431;\\n uint256 constant C33 = 9482202378699252817564375087302794636287866584767523335624368774856230692758;\\n uint256 constant C34 = 4245237636894546151746468406560945873445548423466753843402086544922216329298;\\n uint256 constant C35 = 12000500941313982757584712677991730019124834399479314697467598397927435905133;\\n uint256 constant C36 = 7596790274058425558167520209857956363736666939016807569082239187494363541787;\\n uint256 constant C37 = 2484867918246116343205467273440098378820186751202461278013576281097918148877;\\n uint256 constant C38 = 18312645949449997391810445935615409295369169383463185688973803378104013950190;\\n uint256 constant C39 = 15320686572748723004980855263301182130424010735782762814513954166519592552733;\\n uint256 constant C40 = 12618438900597948888520621062416758747872180395546164387827245287017031303859;\\n uint256 constant C41 = 17438141672027706116733201008397064011774368832458707512367404736905021019585;\\n uint256 constant C42 = 6374197807230665998865688675365359100400438034755781666913068586172586548950;\\n uint256 constant C43 = 2189398913433273865510950346186699930188746169476472274335177556702504595264;\\n uint256 constant C44 = 6268495580028970231803791523870131137294646402347399003576649137450213034606;\\n uint256 constant C45 = 17896250365994900261202920044129628104272791547990619503076839618914047059275;\\n uint256 constant C46 = 13692156312448722528008862371944543449350293305158722920787736248435893008873;\\n uint256 constant C47 = 15234446864368744483209945022439268713300180233589581910497691316744177619376;\\n uint256 constant C48 = 1572426502623310766593681563281600503979671244997798691029595521622402217227;\\n uint256 constant C49 = 80103447810215150918585162168214870083573048458555897999822831203653996617;\\n uint256 constant C50 = 8228820324013669567851850635126713973797711779951230446503353812192849106342;\\n uint256 constant C51 = 5375851433746509614045812476958526065449377558695752132494533666370449415873;\\n uint256 constant C52 = 12115998939203497346386774317892338270561208357481805380546938146796257365018;\\n uint256 constant C53 = 9764067909645821279940531410531154041386008396840887338272986634350423466622;\\n uint256 constant C54 = 8538708244538850542384936174629541085495830544298260335345008245230827876882;\\n uint256 constant C55 = 7140127896620013355910287215441004676619168261422440177712039790284719613114;\\n uint256 constant C56 = 14297402962228458726038826185823085337698917275385741292940049024977027409762;\\n uint256 constant C57 = 6667115556431351074165934212337261254608231545257434281887966406956835140819;\\n uint256 constant C58 = 20226761165244293291042617464655196752671169026542832236139342122602741090001;\\n uint256 constant C59 = 12038289506489256655759141386763477208196694421666339040483042079632134429119;\\n uint256 constant C60 = 19027757334170818571203982241812412991528769934917288000224335655934473717551;\\n uint256 constant C61 = 16272152964456553579565580463468069884359929612321610357528838696790370074720;\\n uint256 constant C62 = 2500392889689246014710135696485946334448570271481948765283016105301740284071;\\n uint256 constant C63 = 8595254970528530312401637448610398388203855633951264114100575485022581946023;\\n uint256 constant C64 = 11635945688914011450976408058407206367914559009113158286982919675551688078198;\\n uint256 constant C65 = 614739068603482619581328040478536306925147663946742687395148680260956671871;\\n uint256 constant C66 = 18692271780377861570175282183255720350972693125537599213951106550953176268753;\\n uint256 constant C67 = 4987059230784976306647166378298632695585915319042844495357753339378260807164;\\n uint256 constant C68 = 21851403978498723616722415377430107676258664746210815234490134600998983955497;\\n uint256 constant C69 = 9830635451186415300891533983087800047564037813328875992115573428596207326204;\\n uint256 constant C70 = 4842706106434537116860242620706030229206345167233200482994958847436425185478;\\n uint256 constant C71 = 6422235064906823218421386871122109085799298052314922856340127798647926126490;\\n uint256 constant C72 = 4564364104986856861943331689105797031330091877115997069096365671501473357846;\\n uint256 constant C73 = 1944043894089780613038197112872830569538541856657037469098448708685350671343;\\n uint256 constant C74 = 21179865974855950600518216085229498748425990426231530451599322283119880194955;\\n uint256 constant C75 = 14296697761894107574369608843560006996183955751502547883167824879840894933162;\\n uint256 constant C76 = 12274619649702218570450581712439138337725246879938860735460378251639845671898;\\n uint256 constant C77 = 16371396450276899401411886674029075408418848209575273031725505038938314070356;\\n uint256 constant C78 = 3702561221750983937578095019779188631407216522704543451228773892695044653565;\\n uint256 constant C79 = 19721616877735564664624984774636557499099875603996426215495516594530838681980;\\n uint256 constant C80 = 6383350109027696789969911008057747025018308755462287526819231672217685282429;\\n uint256 constant C81 = 20860583956177367265984596617324237471765572961978977333122281041544719622905;\\n uint256 constant C82 = 5766390934595026947545001478457407504285452477687752470140790011329357286275;\\n uint256 constant C83 = 4043175758319898049344746138515323336207420888499903387536875603879441092484;\\n uint256 constant C84 = 15579382179133608217098622223834161692266188678101563820988612253342538956534;\\n uint256 constant C85 = 1864640783252634743892105383926602930909039567065240010338908865509831749824;\\n uint256 constant C86 = 15943719865023133586707144161652035291705809358178262514871056013754142625673;\\n uint256 constant C87 = 2326415993032390211558498780803238091925402878871059708106213703504162832999;\\n uint256 constant C88 = 19995326402773833553207196590622808505547443523750970375738981396588337910289;\\n uint256 constant C89 = 5143583711361588952673350526320181330406047695593201009385718506918735286622;\\n uint256 constant C90 = 15436006486881920976813738625999473183944244531070780793506388892313517319583;\\n uint256 constant C91 = 16660446760173633166698660166238066533278664023818938868110282615200613695857;\\n uint256 constant C92 = 4966065365695755376133119391352131079892396024584848298231004326013366253934;\\n uint256 constant C93 = 20683781957411705574951987677641476019618457561419278856689645563561076926702;\\n uint256 constant C94 = 17280836839165902792086432296371645107551519324565649849400948918605456875699;\\n uint256 constant C95 = 17045635513701208892073056357048619435743564064921155892004135325530808465371;\\n uint256 constant C96 = 17055032967194400710390142791334572297458033582458169295920670679093585707295;\\n uint256 constant C97 = 15727174639569115300068198908071514334002742825679221638729902577962862163505;\\n uint256 constant C98 = 1001755657610446661315902885492677747789366510875120894840818704741370398633;\\n uint256 constant C99 = 18638547332826171619311285502376343504539399518545103511265465604926625041234;\\n uint256 constant C100 = 6751954224763196429755298529194402870632445298969935050224267844020826420799;\\n uint256 constant C101 = 3526747115904224771452549517614107688674036840088422555827581348280834879405;\\n uint256 constant C102 = 15705897908180497062880001271426561999724005008972544196300715293701537574122;\\n uint256 constant C103 = 574386695213920937259007343820417029802510752426579750428758189312416867750;\\n uint256 constant C104 = 15973040855000600860816974646787367136127946402908768408978806375685439868553;\\n uint256 constant C105 = 20934130413948796333037139460875996342810005558806621330680156931816867321122;\\n uint256 constant C106 = 6918585327145564636398173845411579411526758237572034236476079610890705810764;\\n uint256 constant C107 = 14158163500813182062258176233162498241310167509137716527054939926126453647182;\\n uint256 constant C108 = 4164602626597695668474100217150111342272610479949122406544277384862187287433;\\n uint256 constant C109 = 12146526846507496913615390662823936206892812880963914267275606265272996025304;\\n uint256 constant C110 = 10153527926900017763244212043512822363696541810586522108597162891799345289938;\\n uint256 constant C111 = 13564663485965299104296214940873270349072051793008946663855767889066202733588;\\n uint256 constant C112 = 5612449256997576125867742696783020582952387615430650198777254717398552960096;\\n uint256 constant C113 = 12151885480032032868507892738683067544172874895736290365318623681886999930120;\\n uint256 constant C114 = 380452237704664384810613424095477896605414037288009963200982915188629772177;\\n uint256 constant C115 = 9067557551252570188533509616805287919563636482030947363841198066124642069518;\\n uint256 constant C116 = 21280306817619711661335268484199763923870315733198162896599997188206277056900;\\n uint256 constant C117 = 5567165819557297006750252582140767993422097822227408837378089569369734876257;\\n uint256 constant C118 = 10411936321072105429908396649383171465939606386380071222095155850987201580137;\\n uint256 constant C119 = 21338390051413922944780864872652000187403217966653363270851298678606449622266;\\n uint256 constant C120 = 12156296560457833712186127325312904760045212412680904475497938949653569234473;\\n uint256 constant C121 = 4271647814574748734312113971565139132510281260328947438246615707172526380757;\\n uint256 constant C122 = 9061738206062369647211128232833114177054715885442782773131292534862178874950;\\n uint256 constant C123 = 10134551893627587797380445583959894183158393780166496661696555422178052339133;\\n uint256 constant C124 = 8932270237664043612366044102088319242789325050842783721780970129656616386103;\\n uint256 constant C125 = 3339412934966886386194449782756711637636784424032779155216609410591712750636;\\n uint256 constant C126 = 9704903972004596791086522314847373103670545861209569267884026709445485704400;\\n uint256 constant C127 = 17467570179597572575614276429760169990940929887711661192333523245667228809456;\\n uint256 constant M00 = 2910766817845651019878574839501801340070030115151021261302834310722729507541;\\n uint256 constant M01 = 19727366863391167538122140361473584127147630672623100827934084310230022599144;\\n uint256 constant M10 = 5776684794125549462448597414050232243778680302179439492664047328281728356345;\\n uint256 constant M11 = 8348174920934122550483593999453880006756108121341067172388445916328941978568;\\n\\n function hash(uint256 input) external pure override returns (uint256 result) {\\n return _hash(input);\\n }\\n\\n function _hash(uint256 input) internal pure returns (uint256 result) {\\n assembly {\\n // Poseidon parameters should be t = 2, RF = 8, RP = 56\\n\\n // We load the characteristic\\n let q := Q\\n\\n // In zerokit implementation, if we pass inp = [a0,a1,..,an] to Poseidon what is effectively hashed is [0,a0,a1,..,an]\\n // Note that a sequence of MIX-ARK involves 3 Bn254 field additions before the mulmod happens. Worst case we have a value corresponding to 2*(p-1) which is less than 2^256 and hence doesn't overflow\\n //ROUND 0 - FULL\\n let s0 := C0\\n let s1 := add(input, C1)\\n // SBOX\\n let t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 1 - FULL\\n s0 := add(s0, C2)\\n s1 := add(s1, C3)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 2 - FULL\\n s0 := add(s0, C4)\\n s1 := add(s1, C5)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 3 - FULL\\n s0 := add(s0, C6)\\n s1 := add(s1, C7)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 4 - PARTIAL\\n s0 := add(s0, C8)\\n s1 := add(s1, C9)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 5 - PARTIAL\\n s0 := add(s0, C10)\\n s1 := add(s1, C11)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 6 - PARTIAL\\n s0 := add(s0, C12)\\n s1 := add(s1, C13)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 7 - PARTIAL\\n s0 := add(s0, C14)\\n s1 := add(s1, C15)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 8 - PARTIAL\\n s0 := add(s0, C16)\\n s1 := add(s1, C17)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 9 - PARTIAL\\n s0 := add(s0, C18)\\n s1 := add(s1, C19)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 10 - PARTIAL\\n s0 := add(s0, C20)\\n s1 := add(s1, C21)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 11 - PARTIAL\\n s0 := add(s0, C22)\\n s1 := add(s1, C23)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 12 - PARTIAL\\n s0 := add(s0, C24)\\n s1 := add(s1, C25)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 13 - PARTIAL\\n s0 := add(s0, C26)\\n s1 := add(s1, C27)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 14 - PARTIAL\\n s0 := add(s0, C28)\\n s1 := add(s1, C29)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 15 - PARTIAL\\n s0 := add(s0, C30)\\n s1 := add(s1, C31)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 16 - PARTIAL\\n s0 := add(s0, C32)\\n s1 := add(s1, C33)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 17 - PARTIAL\\n s0 := add(s0, C34)\\n s1 := add(s1, C35)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 18 - PARTIAL\\n s0 := add(s0, C36)\\n s1 := add(s1, C37)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 19 - PARTIAL\\n s0 := add(s0, C38)\\n s1 := add(s1, C39)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 20 - PARTIAL\\n s0 := add(s0, C40)\\n s1 := add(s1, C41)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 21 - PARTIAL\\n s0 := add(s0, C42)\\n s1 := add(s1, C43)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 22 - PARTIAL\\n s0 := add(s0, C44)\\n s1 := add(s1, C45)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 23 - PARTIAL\\n s0 := add(s0, C46)\\n s1 := add(s1, C47)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 24 - PARTIAL\\n s0 := add(s0, C48)\\n s1 := add(s1, C49)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 25 - PARTIAL\\n s0 := add(s0, C50)\\n s1 := add(s1, C51)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 26 - PARTIAL\\n s0 := add(s0, C52)\\n s1 := add(s1, C53)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 27 - PARTIAL\\n s0 := add(s0, C54)\\n s1 := add(s1, C55)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 28 - PARTIAL\\n s0 := add(s0, C56)\\n s1 := add(s1, C57)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 29 - PARTIAL\\n s0 := add(s0, C58)\\n s1 := add(s1, C59)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 30 - PARTIAL\\n s0 := add(s0, C60)\\n s1 := add(s1, C61)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 31 - PARTIAL\\n s0 := add(s0, C62)\\n s1 := add(s1, C63)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 32 - PARTIAL\\n s0 := add(s0, C64)\\n s1 := add(s1, C65)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 33 - PARTIAL\\n s0 := add(s0, C66)\\n s1 := add(s1, C67)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 34 - PARTIAL\\n s0 := add(s0, C68)\\n s1 := add(s1, C69)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 35 - PARTIAL\\n s0 := add(s0, C70)\\n s1 := add(s1, C71)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 36 - PARTIAL\\n s0 := add(s0, C72)\\n s1 := add(s1, C73)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 37 - PARTIAL\\n s0 := add(s0, C74)\\n s1 := add(s1, C75)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 38 - PARTIAL\\n s0 := add(s0, C76)\\n s1 := add(s1, C77)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 39 - PARTIAL\\n s0 := add(s0, C78)\\n s1 := add(s1, C79)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 40 - PARTIAL\\n s0 := add(s0, C80)\\n s1 := add(s1, C81)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 41 - PARTIAL\\n s0 := add(s0, C82)\\n s1 := add(s1, C83)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 42 - PARTIAL\\n s0 := add(s0, C84)\\n s1 := add(s1, C85)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 43 - PARTIAL\\n s0 := add(s0, C86)\\n s1 := add(s1, C87)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 44 - PARTIAL\\n s0 := add(s0, C88)\\n s1 := add(s1, C89)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 45 - PARTIAL\\n s0 := add(s0, C90)\\n s1 := add(s1, C91)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 46 - PARTIAL\\n s0 := add(s0, C92)\\n s1 := add(s1, C93)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 47 - PARTIAL\\n s0 := add(s0, C94)\\n s1 := add(s1, C95)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 48 - PARTIAL\\n s0 := add(s0, C96)\\n s1 := add(s1, C97)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 49 - PARTIAL\\n s0 := add(s0, C98)\\n s1 := add(s1, C99)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 50 - PARTIAL\\n s0 := add(s0, C100)\\n s1 := add(s1, C101)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 51 - PARTIAL\\n s0 := add(s0, C102)\\n s1 := add(s1, C103)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 52 - PARTIAL\\n s0 := add(s0, C104)\\n s1 := add(s1, C105)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 53 - PARTIAL\\n s0 := add(s0, C106)\\n s1 := add(s1, C107)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 54 - PARTIAL\\n s0 := add(s0, C108)\\n s1 := add(s1, C109)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 55 - PARTIAL\\n s0 := add(s0, C110)\\n s1 := add(s1, C111)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 56 - PARTIAL\\n s0 := add(s0, C112)\\n s1 := add(s1, C113)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 57 - PARTIAL\\n s0 := add(s0, C114)\\n s1 := add(s1, C115)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 58 - PARTIAL\\n s0 := add(s0, C116)\\n s1 := add(s1, C117)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 59 - PARTIAL\\n s0 := add(s0, C118)\\n s1 := add(s1, C119)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 60 - FULL\\n s0 := add(s0, C120)\\n s1 := add(s1, C121)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 61 - FULL\\n s0 := add(s0, C122)\\n s1 := add(s1, C123)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 62 - FULL\\n s0 := add(s0, C124)\\n s1 := add(s1, C125)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\\n s0 := t\\n\\n //ROUND 63 - FULL\\n s0 := add(s0, C126)\\n s1 := add(s1, C127)\\n // SBOX\\n t := mulmod(s0, s0, q)\\n s0 := mulmod(mulmod(t, t, q), s0, q)\\n t := mulmod(s1, s1, q)\\n s1 := mulmod(mulmod(t, t, q), s1, q)\\n // MIX\\n s0 := mod(add(mulmod(s0, M00, q), mulmod(s1, M01, q)), q)\\n\\n result := s0\\n }\\n }\\n}\\n\",\"keccak256\":\"0x50d1490b2e804f044f0013aabfe08b34dbeba972e51969d42bdb427ca8ffa037\",\"license\":\"MIT\"},\"lib/rln-contract/contracts/RlnBase.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.15;\\n\\nimport {IPoseidonHasher} from \\\"./PoseidonHasher.sol\\\";\\nimport {IVerifier} from \\\"./IVerifier.sol\\\";\\n\\n/// The tree is full\\nerror FullTree();\\n\\n/// Invalid deposit amount\\n/// @param required The required deposit amount\\n/// @param provided The provided deposit amount\\nerror InsufficientDeposit(uint256 required, uint256 provided);\\n\\n/// Member is already registered\\nerror DuplicateIdCommitment();\\n\\n/// Failed validation on registration/slashing\\nerror FailedValidation();\\n\\n/// Invalid receiver address, when the receiver is the contract itself or 0x0\\nerror InvalidReceiverAddress(address to);\\n\\n/// Member is not registered\\nerror MemberNotRegistered(uint256 idCommitment);\\n\\n/// Member has no stake\\nerror MemberHasNoStake(uint256 idCommitment);\\n\\n/// User has insufficient balance to withdraw\\nerror InsufficientWithdrawalBalance();\\n\\n/// Contract has insufficient balance to return\\nerror InsufficientContractBalance();\\n\\n/// Invalid proof\\nerror InvalidProof();\\n\\nabstract contract RlnBase {\\n /// @notice The deposit amount required to register as a member\\n uint256 public immutable MEMBERSHIP_DEPOSIT;\\n\\n /// @notice The depth of the merkle tree\\n uint256 public immutable DEPTH;\\n\\n /// @notice The size of the merkle tree, i.e 2^depth\\n uint256 public immutable SET_SIZE;\\n\\n /// @notice The index of the next member to be registered\\n uint256 public idCommitmentIndex = 1;\\n\\n /// @notice The amount of eth staked by each member\\n /// maps from idCommitment to the amount staked\\n mapping(uint256 => uint256) public stakedAmounts;\\n\\n /// @notice The membership status of each member\\n /// maps from idCommitment to their index in the set\\n mapping(uint256 => uint256) public members;\\n\\n /// @notice The balance of each user that can be withdrawn\\n mapping(address => uint256) public withdrawalBalance;\\n\\n /// @notice The Poseidon hasher contract\\n IPoseidonHasher public immutable poseidonHasher;\\n\\n /// @notice The groth16 verifier contract\\n IVerifier public immutable verifier;\\n\\n /// Emitted when a new member is added to the set\\n /// @param idCommitment The idCommitment of the member\\n /// @param index The index of the member in the set\\n event MemberRegistered(uint256 idCommitment, uint256 index);\\n\\n /// Emitted when a member is removed from the set\\n /// @param idCommitment The idCommitment of the member\\n /// @param index The index of the member in the set\\n event MemberWithdrawn(uint256 idCommitment, uint256 index);\\n\\n constructor(uint256 membershipDeposit, uint256 depth, address _poseidonHasher, address _verifier) {\\n MEMBERSHIP_DEPOSIT = membershipDeposit;\\n DEPTH = depth;\\n SET_SIZE = 1 << depth;\\n poseidonHasher = IPoseidonHasher(_poseidonHasher);\\n verifier = IVerifier(_verifier);\\n }\\n\\n /// Allows a user to register as a member\\n /// @param idCommitment The idCommitment of the member\\n function register(uint256 idCommitment) external payable virtual {\\n if (msg.value != MEMBERSHIP_DEPOSIT) {\\n revert InsufficientDeposit(MEMBERSHIP_DEPOSIT, msg.value);\\n }\\n _validateRegistration(idCommitment);\\n _register(idCommitment, msg.value);\\n }\\n\\n /// Registers a member\\n /// @param idCommitment The idCommitment of the member\\n /// @param stake The amount of eth staked by the member\\n function _register(uint256 idCommitment, uint256 stake) internal virtual {\\n if (members[idCommitment] != 0) revert DuplicateIdCommitment();\\n if (idCommitmentIndex >= SET_SIZE) revert FullTree();\\n\\n members[idCommitment] = idCommitmentIndex;\\n stakedAmounts[idCommitment] = stake;\\n\\n emit MemberRegistered(idCommitment, idCommitmentIndex);\\n idCommitmentIndex += 1;\\n }\\n\\n /// @dev Inheriting contracts MUST override this function\\n function _validateRegistration(uint256 idCommitment) internal view virtual;\\n\\n /// @dev Allows a user to slash a member\\n /// @param idCommitment The idCommitment of the member\\n function slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) external virtual {\\n _validateSlash(idCommitment, receiver, proof);\\n _slash(idCommitment, receiver, proof);\\n }\\n\\n /// @dev Slashes a member by removing them from the set, and adding their\\n /// stake to the receiver's available withdrawal balance\\n /// @param idCommitment The idCommitment of the member\\n /// @param receiver The address to receive the funds\\n function _slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) internal virtual {\\n if (receiver == address(this) || receiver == address(0)) {\\n revert InvalidReceiverAddress(receiver);\\n }\\n\\n if (members[idCommitment] == 0) revert MemberNotRegistered(idCommitment);\\n // check if member is registered\\n if (stakedAmounts[idCommitment] == 0) {\\n revert MemberHasNoStake(idCommitment);\\n }\\n\\n if (!_verifyProof(idCommitment, receiver, proof)) {\\n revert InvalidProof();\\n }\\n\\n uint256 amountToTransfer = stakedAmounts[idCommitment];\\n\\n // delete member\\n uint256 index = members[idCommitment];\\n members[idCommitment] = 0;\\n stakedAmounts[idCommitment] = 0;\\n\\n // refund deposit\\n withdrawalBalance[receiver] += amountToTransfer;\\n\\n emit MemberWithdrawn(idCommitment, index);\\n }\\n\\n function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof)\\n internal\\n view\\n virtual;\\n\\n /// Allows a user to withdraw funds allocated to them upon slashing a member\\n function withdraw() external virtual {\\n uint256 amount = withdrawalBalance[msg.sender];\\n\\n if (amount == 0) revert InsufficientWithdrawalBalance();\\n if (amount > address(this).balance) {\\n revert InsufficientContractBalance();\\n }\\n\\n withdrawalBalance[msg.sender] = 0;\\n\\n payable(msg.sender).transfer(amount);\\n }\\n\\n /// Hashes a value using the Poseidon hasher\\n /// NOTE: The variant of Poseidon we use accepts only 1 input, assume n=2, and the second input is 0\\n /// @param input The value to hash\\n function hash(uint256 input) internal view returns (uint256) {\\n return poseidonHasher.hash(input);\\n }\\n\\n /// @dev Groth16 proof verification\\n function _verifyProof(uint256 idCommitment, address receiver, uint256[8] calldata proof)\\n internal\\n view\\n virtual\\n returns (bool)\\n {\\n return verifier.verifyProof(\\n [proof[0], proof[1]],\\n [[proof[2], proof[3]], [proof[4], proof[5]]],\\n [proof[6], proof[7]],\\n [idCommitment, uint256(uint160(receiver))]\\n );\\n }\\n}\\n\",\"keccak256\":\"0x7d6c1d1ade6910fa07b5b8c228e494697852ece42d21752f917c66612470e0a1\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x610140604052600180553480156200001657600080fd5b506040516200127e3803806200127e83398181016040528101906200003c91906200027a565b6000601483600062000063620000576200010560201b60201c565b6200010d60201b60201c565b83608081815250508260a08181525050826001901b60c081815250508173ffffffffffffffffffffffffffffffffffffffff1660e08173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff166101008173ffffffffffffffffffffffffffffffffffffffff1681525050505050508061ffff166101208161ffff16815250505050620002c1565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200020382620001d6565b9050919050565b6200021581620001f6565b81146200022157600080fd5b50565b60008151905062000235816200020a565b92915050565b600061ffff82169050919050565b62000254816200023b565b81146200026057600080fd5b50565b600081519050620002748162000249565b92915050565b60008060408385031215620002945762000293620001d1565b5b6000620002a48582860162000224565b9250506020620002b78582860162000263565b9150509250929050565b60805160a05160c05160e0516101005161012051610f6d6200031160003960006103d9015260006103fd01526000610421015260006105a40152600061054a015260006105fa0152610f6d6000f3fe6080604052600436106100fe5760003560e01c80638da5cb5b11610095578063c5b208ff11610064578063c5b208ff146102ff578063d0383d681461033c578063f207564e14610367578063f220b9ec14610383578063f2fde38b146103ae576100fe565b80638da5cb5b1461024157806398366e351461026c578063ae74552a14610297578063bc499128146102c2576100fe565b80635daf08ca116100d15780635daf08ca1461019b578063715018a6146101d85780637a34289d146101ef5780638be9b11914610218576100fe565b806328b070e0146101035780632b7ac3f31461012e578063331b6ab3146101595780633ccfd60b14610184575b600080fd5b34801561010f57600080fd5b506101186103d7565b60405161012591906108ce565b60405180910390f35b34801561013a57600080fd5b506101436103fb565b6040516101509190610968565b60405180910390f35b34801561016557600080fd5b5061016e61041f565b60405161017b91906109a4565b60405180910390f35b34801561019057600080fd5b50610199610443565b005b3480156101a757600080fd5b506101c260048036038101906101bd9190610a09565b610475565b6040516101cf9190610a45565b60405180910390f35b3480156101e457600080fd5b506101ed61048d565b005b3480156101fb57600080fd5b5061021660048036038101906102119190610bb9565b6104a1565b005b34801561022457600080fd5b5061023f600480360381019061023a9190610c62565b6104ed565b005b34801561024d57600080fd5b5061025661051f565b6040516102639190610cd7565b60405180910390f35b34801561027857600080fd5b50610281610548565b60405161028e9190610a45565b60405180910390f35b3480156102a357600080fd5b506102ac61056c565b6040516102b99190610a45565b60405180910390f35b3480156102ce57600080fd5b506102e960048036038101906102e49190610a09565b610572565b6040516102f69190610a45565b60405180910390f35b34801561030b57600080fd5b5061032660048036038101906103219190610d1e565b61058a565b6040516103339190610a45565b60405180910390f35b34801561034857600080fd5b506103516105a2565b60405161035e9190610a45565b60405180910390f35b610381600480360381019061037c9190610a09565b6105c6565b005b34801561038f57600080fd5b506103986105f8565b6040516103a59190610a45565b60405180910390f35b3480156103ba57600080fd5b506103d560048036038101906103d09190610d1e565b61061c565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60036020528060005260406000206000915090505481565b61049561069f565b61049f600061071d565b565b6104a961069f565b60008151905060005b818110156104e8576104dd8382815181106104d0576104cf610d4b565b5b60200260200101516107e1565b8060010190506104b2565b505050565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60026020528060005260406000206000915090505481565b60046020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000081565b61062461069f565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610693576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068a90610dfd565b60405180910390fd5b61069c8161071d565b50565b6106a761085a565b73ffffffffffffffffffffffffffffffffffffffff166106c561051f565b73ffffffffffffffffffffffffffffffffffffffff161461071b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071290610e69565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6107ea81610862565b600160036000838152602001908152602001600020819055507f5a92c2530f207992057b9c3e544108ffce3beda4a63719f316967c49bf6159d281600154604051610836929190610e89565b60405180910390a160018060008282546108509190610ee1565b9250508190555050565b600033905090565b60006003600083815260200190815260200160002054146108ae576040517e0a60f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b600061ffff82169050919050565b6108c8816108b1565b82525050565b60006020820190506108e360008301846108bf565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061092e610929610924846108e9565b610909565b6108e9565b9050919050565b600061094082610913565b9050919050565b600061095282610935565b9050919050565b61096281610947565b82525050565b600060208201905061097d6000830184610959565b92915050565b600061098e82610935565b9050919050565b61099e81610983565b82525050565b60006020820190506109b96000830184610995565b92915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6109e6816109d3565b81146109f157600080fd5b50565b600081359050610a03816109dd565b92915050565b600060208284031215610a1f57610a1e6109c9565b5b6000610a2d848285016109f4565b91505092915050565b610a3f816109d3565b82525050565b6000602082019050610a5a6000830184610a36565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610aae82610a65565b810181811067ffffffffffffffff82111715610acd57610acc610a76565b5b80604052505050565b6000610ae06109bf565b9050610aec8282610aa5565b919050565b600067ffffffffffffffff821115610b0c57610b0b610a76565b5b602082029050602081019050919050565b600080fd5b6000610b35610b3084610af1565b610ad6565b90508083825260208201905060208402830185811115610b5857610b57610b1d565b5b835b81811015610b815780610b6d88826109f4565b845260208401935050602081019050610b5a565b5050509392505050565b600082601f830112610ba057610b9f610a60565b5b8135610bb0848260208601610b22565b91505092915050565b600060208284031215610bcf57610bce6109c9565b5b600082013567ffffffffffffffff811115610bed57610bec6109ce565b5b610bf984828501610b8b565b91505092915050565b6000610c0d826108e9565b9050919050565b610c1d81610c02565b8114610c2857600080fd5b50565b600081359050610c3a81610c14565b92915050565b600081905082602060080282011115610c5c57610c5b610b1d565b5b92915050565b60008060006101408486031215610c7c57610c7b6109c9565b5b6000610c8a868287016109f4565b9350506020610c9b86828701610c2b565b9250506040610cac86828701610c40565b9150509250925092565b6000610cc1826108e9565b9050919050565b610cd181610cb6565b82525050565b6000602082019050610cec6000830184610cc8565b92915050565b610cfb81610cb6565b8114610d0657600080fd5b50565b600081359050610d1881610cf2565b92915050565b600060208284031215610d3457610d336109c9565b5b6000610d4284828501610d09565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082825260208201905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610de7602683610d7a565b9150610df282610d8b565b604082019050919050565b60006020820190508181036000830152610e1681610dda565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000610e53602083610d7a565b9150610e5e82610e1d565b602082019050919050565b60006020820190508181036000830152610e8281610e46565b9050919050565b6000604082019050610e9e6000830185610a36565b610eab6020830184610a36565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610eec826109d3565b9150610ef7836109d3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610f2c57610f2b610eb2565b5b82820190509291505056fea2646970667358221220da67ff31fb04406d288565daf496c41920eb7b2fc65318a1f86281ac336152ab64736f6c634300080f0033", + "deployedBytecode": "0x6080604052600436106100fe5760003560e01c80638da5cb5b11610095578063c5b208ff11610064578063c5b208ff146102ff578063d0383d681461033c578063f207564e14610367578063f220b9ec14610383578063f2fde38b146103ae576100fe565b80638da5cb5b1461024157806398366e351461026c578063ae74552a14610297578063bc499128146102c2576100fe565b80635daf08ca116100d15780635daf08ca1461019b578063715018a6146101d85780637a34289d146101ef5780638be9b11914610218576100fe565b806328b070e0146101035780632b7ac3f31461012e578063331b6ab3146101595780633ccfd60b14610184575b600080fd5b34801561010f57600080fd5b506101186103d7565b60405161012591906108ce565b60405180910390f35b34801561013a57600080fd5b506101436103fb565b6040516101509190610968565b60405180910390f35b34801561016557600080fd5b5061016e61041f565b60405161017b91906109a4565b60405180910390f35b34801561019057600080fd5b50610199610443565b005b3480156101a757600080fd5b506101c260048036038101906101bd9190610a09565b610475565b6040516101cf9190610a45565b60405180910390f35b3480156101e457600080fd5b506101ed61048d565b005b3480156101fb57600080fd5b5061021660048036038101906102119190610bb9565b6104a1565b005b34801561022457600080fd5b5061023f600480360381019061023a9190610c62565b6104ed565b005b34801561024d57600080fd5b5061025661051f565b6040516102639190610cd7565b60405180910390f35b34801561027857600080fd5b50610281610548565b60405161028e9190610a45565b60405180910390f35b3480156102a357600080fd5b506102ac61056c565b6040516102b99190610a45565b60405180910390f35b3480156102ce57600080fd5b506102e960048036038101906102e49190610a09565b610572565b6040516102f69190610a45565b60405180910390f35b34801561030b57600080fd5b5061032660048036038101906103219190610d1e565b61058a565b6040516103339190610a45565b60405180910390f35b34801561034857600080fd5b506103516105a2565b60405161035e9190610a45565b60405180910390f35b610381600480360381019061037c9190610a09565b6105c6565b005b34801561038f57600080fd5b506103986105f8565b6040516103a59190610a45565b60405180910390f35b3480156103ba57600080fd5b506103d560048036038101906103d09190610d1e565b61061c565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60036020528060005260406000206000915090505481565b61049561069f565b61049f600061071d565b565b6104a961069f565b60008151905060005b818110156104e8576104dd8382815181106104d0576104cf610d4b565b5b60200260200101516107e1565b8060010190506104b2565b505050565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60026020528060005260406000206000915090505481565b60046020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000081565b61062461069f565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610693576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068a90610dfd565b60405180910390fd5b61069c8161071d565b50565b6106a761085a565b73ffffffffffffffffffffffffffffffffffffffff166106c561051f565b73ffffffffffffffffffffffffffffffffffffffff161461071b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071290610e69565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6107ea81610862565b600160036000838152602001908152602001600020819055507f5a92c2530f207992057b9c3e544108ffce3beda4a63719f316967c49bf6159d281600154604051610836929190610e89565b60405180910390a160018060008282546108509190610ee1565b9250508190555050565b600033905090565b60006003600083815260200190815260200160002054146108ae576040517e0a60f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b600061ffff82169050919050565b6108c8816108b1565b82525050565b60006020820190506108e360008301846108bf565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061092e610929610924846108e9565b610909565b6108e9565b9050919050565b600061094082610913565b9050919050565b600061095282610935565b9050919050565b61096281610947565b82525050565b600060208201905061097d6000830184610959565b92915050565b600061098e82610935565b9050919050565b61099e81610983565b82525050565b60006020820190506109b96000830184610995565b92915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6109e6816109d3565b81146109f157600080fd5b50565b600081359050610a03816109dd565b92915050565b600060208284031215610a1f57610a1e6109c9565b5b6000610a2d848285016109f4565b91505092915050565b610a3f816109d3565b82525050565b6000602082019050610a5a6000830184610a36565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610aae82610a65565b810181811067ffffffffffffffff82111715610acd57610acc610a76565b5b80604052505050565b6000610ae06109bf565b9050610aec8282610aa5565b919050565b600067ffffffffffffffff821115610b0c57610b0b610a76565b5b602082029050602081019050919050565b600080fd5b6000610b35610b3084610af1565b610ad6565b90508083825260208201905060208402830185811115610b5857610b57610b1d565b5b835b81811015610b815780610b6d88826109f4565b845260208401935050602081019050610b5a565b5050509392505050565b600082601f830112610ba057610b9f610a60565b5b8135610bb0848260208601610b22565b91505092915050565b600060208284031215610bcf57610bce6109c9565b5b600082013567ffffffffffffffff811115610bed57610bec6109ce565b5b610bf984828501610b8b565b91505092915050565b6000610c0d826108e9565b9050919050565b610c1d81610c02565b8114610c2857600080fd5b50565b600081359050610c3a81610c14565b92915050565b600081905082602060080282011115610c5c57610c5b610b1d565b5b92915050565b60008060006101408486031215610c7c57610c7b6109c9565b5b6000610c8a868287016109f4565b9350506020610c9b86828701610c2b565b9250506040610cac86828701610c40565b9150509250925092565b6000610cc1826108e9565b9050919050565b610cd181610cb6565b82525050565b6000602082019050610cec6000830184610cc8565b92915050565b610cfb81610cb6565b8114610d0657600080fd5b50565b600081359050610d1881610cf2565b92915050565b600060208284031215610d3457610d336109c9565b5b6000610d4284828501610d09565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082825260208201905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000610de7602683610d7a565b9150610df282610d8b565b604082019050919050565b60006020820190508181036000830152610e1681610dda565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000610e53602083610d7a565b9150610e5e82610e1d565b602082019050919050565b60006020820190508181036000830152610e8281610e46565b9050919050565b6000604082019050610e9e6000830185610a36565b610eab6020830184610a36565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610eec826109d3565b9150610ef7836109d3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610f2c57610f2b610eb2565b5b82820190509291505056fea2646970667358221220da67ff31fb04406d288565daf496c41920eb7b2fc65318a1f86281ac336152ab64736f6c634300080f0033", + "devdoc": { + "kind": "dev", + "methods": { + "owner()": { + "details": "Returns the address of the current owner." + }, + "register(uint256)": { + "params": { + "idCommitment": "The idCommitment of the member" + } + }, + "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." + }, + "slash(uint256,address,uint256[8])": { + "details": "Allows a user to slash a member", + "params": { + "idCommitment": "The idCommitment of the member" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + } + }, + "version": 1 + } +} diff --git a/deployments/sepolia/solcInputs/40de5bebbf86e467166c280b4e48ebe9.json b/deployments/sepolia/solcInputs/40de5bebbf86e467166c280b4e48ebe9.json new file mode 100644 index 0000000..d857779 --- /dev/null +++ b/deployments/sepolia/solcInputs/40de5bebbf86e467166c280b4e48ebe9.json @@ -0,0 +1,59 @@ +{ + "language": "Solidity", + "sources": { + "contracts/WakuRln.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.15;\n\nimport {IPoseidonHasher} from \"rln-contract/PoseidonHasher.sol\";\nimport {RlnBase, DuplicateIdCommitment} from \"rln-contract/RlnBase.sol\";\nimport {Ownable} from \"openzeppelin-contracts/contracts/access/Ownable.sol\";\n\nerror NotImplemented();\n\ncontract WakuRln is Ownable, RlnBase {\n uint16 public immutable contractIndex;\n\n constructor(address _poseidonHasher, uint16 _contractIndex) Ownable() RlnBase(0, 20, _poseidonHasher, address(0)) {\n contractIndex = _contractIndex;\n }\n\n /// Registers a member\n /// @param idCommitment The idCommitment of the member\n function _register(uint256 idCommitment) internal {\n _validateRegistration(idCommitment);\n\n members[idCommitment] = 1;\n\n emit MemberRegistered(idCommitment, idCommitmentIndex);\n idCommitmentIndex += 1;\n }\n\n function register(uint256[] memory idCommitments) external onlyOwner {\n uint256 len = idCommitments.length;\n for (uint256 i = 0; i < len;) {\n _register(idCommitments[i]);\n unchecked {\n ++i;\n }\n }\n }\n\n function register(uint256 idCommitment) external payable override {\n revert NotImplemented();\n }\n\n function slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) external pure override {\n revert NotImplemented();\n }\n\n function _validateRegistration(uint256 idCommitment) internal view override {\n if (members[idCommitment] != 0) revert DuplicateIdCommitment();\n }\n\n function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof)\n internal\n pure\n override\n {\n revert NotImplemented();\n }\n\n function withdraw() external pure override {\n revert NotImplemented();\n }\n}\n" + }, + "contracts/WakuRlnRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.15;\n\nimport {WakuRln} from \"./WakuRln.sol\";\nimport {IPoseidonHasher} from \"rln-contract/PoseidonHasher.sol\";\nimport {Ownable} from \"openzeppelin-contracts/contracts/access/Ownable.sol\";\n\nerror StorageAlreadyExists(address storageAddress);\nerror NoStorageContractAvailable();\nerror FailedToRegister(string reason);\n\ncontract WakuRlnRegistry is Ownable {\n uint16 public nextStorageIndex;\n mapping(uint16 => address) public storages;\n\n uint16 public usingStorageIndex = 0;\n\n IPoseidonHasher public immutable poseidonHasher;\n\n event NewStorageContract(uint16 index, address storageAddress);\n\n constructor(address _poseidonHasher) Ownable() {\n poseidonHasher = IPoseidonHasher(_poseidonHasher);\n }\n\n function _insertIntoStorageMap(address storageAddress) internal {\n storages[nextStorageIndex] = storageAddress;\n emit NewStorageContract(nextStorageIndex, storageAddress);\n nextStorageIndex += 1;\n }\n\n function registerStorage(address storageAddress) external onlyOwner {\n if (storages[nextStorageIndex] != address(0)) revert StorageAlreadyExists(storageAddress);\n _insertIntoStorageMap(storageAddress);\n }\n\n function newStorage() external onlyOwner {\n WakuRln newStorageContract = new WakuRln(address(poseidonHasher), nextStorageIndex);\n _insertIntoStorageMap(address(newStorageContract));\n }\n\n function register(uint256 commitment) external payable {\n if (usingStorageIndex >= nextStorageIndex) revert NoStorageContractAvailable();\n\n // iteratively check if the storage contract is full, and increment the usingStorageIndex if it is\n while (true) {\n try WakuRln(storages[usingStorageIndex]).register{value: msg.value}(commitment) {\n break;\n } catch Error(string memory reason) {\n if (keccak256(abi.encodePacked(reason)) != keccak256(abi.encodePacked(\"FullTree()\"))) {\n revert FailedToRegister(reason);\n }\n usingStorageIndex += 1;\n }\n }\n }\n}\n" + }, + "lib/openzeppelin-contracts/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" + }, + "lib/openzeppelin-contracts/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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" + }, + "lib/rln-contract/contracts/IVerifier.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0 OR MIT\npragma solidity 0.8.15;\n\ninterface IVerifier {\n function verifyProof(uint256[2] memory a, uint256[2][2] memory b, uint256[2] memory c, uint256[2] memory input)\n external\n view\n returns (bool);\n}\n" + }, + "lib/rln-contract/contracts/PoseidonHasher.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// Forked from https://github.com/kilic/rlnapp/\n\npragma solidity 0.8.15;\n\ninterface IPoseidonHasher {\n /// @notice Hashes the input using the Poseidon hash function, n = 2, second input is the constant 0\n /// @param input The input to hash\n function hash(uint256 input) external pure returns (uint256 result);\n}\n\ncontract PoseidonHasher is IPoseidonHasher {\n uint256 constant Q = 21888242871839275222246405745257275088548364400416034343698204186575808495617;\n uint256 constant C0 = 4417881134626180770308697923359573201005643519861877412381846989312604493735;\n uint256 constant C1 = 5433650512959517612316327474713065966758808864213826738576266661723522780033;\n uint256 constant C2 = 13641176377184356099764086973022553863760045607496549923679278773208775739952;\n uint256 constant C3 = 17949713444224994136330421782109149544629237834775211751417461773584374506783;\n uint256 constant C4 = 13765628375339178273710281891027109699578766420463125835325926111705201856003;\n uint256 constant C5 = 19179513468172002314585757290678967643352171735526887944518845346318719730387;\n uint256 constant C6 = 5157412437176756884543472904098424903141745259452875378101256928559722612176;\n uint256 constant C7 = 535160875740282236955320458485730000677124519901643397458212725410971557409;\n uint256 constant C8 = 1050793453380762984940163090920066886770841063557081906093018330633089036729;\n uint256 constant C9 = 10665495010329663932664894101216428400933984666065399374198502106997623173873;\n uint256 constant C10 = 19965634623406616956648724894636666805991993496469370618546874926025059150737;\n uint256 constant C11 = 13007250030070838431593222885902415182312449212965120303174723305710127422213;\n uint256 constant C12 = 16877538715074991604507979123743768693428157847423939051086744213162455276374;\n uint256 constant C13 = 18211747749504876135588847560312685184956239426147543810126553367063157141465;\n uint256 constant C14 = 18151553319826126919739798892854572062191241985315767086020821632812331245635;\n uint256 constant C15 = 19957033149976712666746140949846950406660099037474791840946955175819555930825;\n uint256 constant C16 = 3469514863538261843186854830917934449567467100548474599735384052339577040841;\n uint256 constant C17 = 989698510043911779243192466312362856042600749099921773896924315611668507708;\n uint256 constant C18 = 12568377015646290945235387813564567111330046038050864455358059568128000172201;\n uint256 constant C19 = 20856104135605479600325529349246932565148587186338606236677138505306779314172;\n uint256 constant C20 = 8206918720503535523121349917159924938835810381723474192155637697065780938424;\n uint256 constant C21 = 1309058477013932989380617265069188723120054926187607548493110334522527703566;\n uint256 constant C22 = 14076116939332667074621703729512195584105250395163383769419390236426287710606;\n uint256 constant C23 = 10153498892749751942204288991871286290442690932856658983589258153608012428674;\n uint256 constant C24 = 18202499207234128286137597834010475797175973146805180988367589376893530181575;\n uint256 constant C25 = 12739388830157083522877690211447248168864006284243907142044329113461613743052;\n uint256 constant C26 = 15123358710467780770838026754240340042441262572309759635224051333176022613949;\n uint256 constant C27 = 19925004701844594370904593774447343836015483888496504201331110250494635362184;\n uint256 constant C28 = 10352416606816998476681131583320899030072315953910679608943150613208329645891;\n uint256 constant C29 = 10567371822366244361703342347428230537114808440249611395507235283708966113221;\n uint256 constant C30 = 5635498582763880627392290206431559361272660937399944184533035305989295959602;\n uint256 constant C31 = 11866432933224219174041051738704352719163271639958083608224676028593315904909;\n uint256 constant C32 = 5795020705294401441272215064554385591292330721703923167136157291459784140431;\n uint256 constant C33 = 9482202378699252817564375087302794636287866584767523335624368774856230692758;\n uint256 constant C34 = 4245237636894546151746468406560945873445548423466753843402086544922216329298;\n uint256 constant C35 = 12000500941313982757584712677991730019124834399479314697467598397927435905133;\n uint256 constant C36 = 7596790274058425558167520209857956363736666939016807569082239187494363541787;\n uint256 constant C37 = 2484867918246116343205467273440098378820186751202461278013576281097918148877;\n uint256 constant C38 = 18312645949449997391810445935615409295369169383463185688973803378104013950190;\n uint256 constant C39 = 15320686572748723004980855263301182130424010735782762814513954166519592552733;\n uint256 constant C40 = 12618438900597948888520621062416758747872180395546164387827245287017031303859;\n uint256 constant C41 = 17438141672027706116733201008397064011774368832458707512367404736905021019585;\n uint256 constant C42 = 6374197807230665998865688675365359100400438034755781666913068586172586548950;\n uint256 constant C43 = 2189398913433273865510950346186699930188746169476472274335177556702504595264;\n uint256 constant C44 = 6268495580028970231803791523870131137294646402347399003576649137450213034606;\n uint256 constant C45 = 17896250365994900261202920044129628104272791547990619503076839618914047059275;\n uint256 constant C46 = 13692156312448722528008862371944543449350293305158722920787736248435893008873;\n uint256 constant C47 = 15234446864368744483209945022439268713300180233589581910497691316744177619376;\n uint256 constant C48 = 1572426502623310766593681563281600503979671244997798691029595521622402217227;\n uint256 constant C49 = 80103447810215150918585162168214870083573048458555897999822831203653996617;\n uint256 constant C50 = 8228820324013669567851850635126713973797711779951230446503353812192849106342;\n uint256 constant C51 = 5375851433746509614045812476958526065449377558695752132494533666370449415873;\n uint256 constant C52 = 12115998939203497346386774317892338270561208357481805380546938146796257365018;\n uint256 constant C53 = 9764067909645821279940531410531154041386008396840887338272986634350423466622;\n uint256 constant C54 = 8538708244538850542384936174629541085495830544298260335345008245230827876882;\n uint256 constant C55 = 7140127896620013355910287215441004676619168261422440177712039790284719613114;\n uint256 constant C56 = 14297402962228458726038826185823085337698917275385741292940049024977027409762;\n uint256 constant C57 = 6667115556431351074165934212337261254608231545257434281887966406956835140819;\n uint256 constant C58 = 20226761165244293291042617464655196752671169026542832236139342122602741090001;\n uint256 constant C59 = 12038289506489256655759141386763477208196694421666339040483042079632134429119;\n uint256 constant C60 = 19027757334170818571203982241812412991528769934917288000224335655934473717551;\n uint256 constant C61 = 16272152964456553579565580463468069884359929612321610357528838696790370074720;\n uint256 constant C62 = 2500392889689246014710135696485946334448570271481948765283016105301740284071;\n uint256 constant C63 = 8595254970528530312401637448610398388203855633951264114100575485022581946023;\n uint256 constant C64 = 11635945688914011450976408058407206367914559009113158286982919675551688078198;\n uint256 constant C65 = 614739068603482619581328040478536306925147663946742687395148680260956671871;\n uint256 constant C66 = 18692271780377861570175282183255720350972693125537599213951106550953176268753;\n uint256 constant C67 = 4987059230784976306647166378298632695585915319042844495357753339378260807164;\n uint256 constant C68 = 21851403978498723616722415377430107676258664746210815234490134600998983955497;\n uint256 constant C69 = 9830635451186415300891533983087800047564037813328875992115573428596207326204;\n uint256 constant C70 = 4842706106434537116860242620706030229206345167233200482994958847436425185478;\n uint256 constant C71 = 6422235064906823218421386871122109085799298052314922856340127798647926126490;\n uint256 constant C72 = 4564364104986856861943331689105797031330091877115997069096365671501473357846;\n uint256 constant C73 = 1944043894089780613038197112872830569538541856657037469098448708685350671343;\n uint256 constant C74 = 21179865974855950600518216085229498748425990426231530451599322283119880194955;\n uint256 constant C75 = 14296697761894107574369608843560006996183955751502547883167824879840894933162;\n uint256 constant C76 = 12274619649702218570450581712439138337725246879938860735460378251639845671898;\n uint256 constant C77 = 16371396450276899401411886674029075408418848209575273031725505038938314070356;\n uint256 constant C78 = 3702561221750983937578095019779188631407216522704543451228773892695044653565;\n uint256 constant C79 = 19721616877735564664624984774636557499099875603996426215495516594530838681980;\n uint256 constant C80 = 6383350109027696789969911008057747025018308755462287526819231672217685282429;\n uint256 constant C81 = 20860583956177367265984596617324237471765572961978977333122281041544719622905;\n uint256 constant C82 = 5766390934595026947545001478457407504285452477687752470140790011329357286275;\n uint256 constant C83 = 4043175758319898049344746138515323336207420888499903387536875603879441092484;\n uint256 constant C84 = 15579382179133608217098622223834161692266188678101563820988612253342538956534;\n uint256 constant C85 = 1864640783252634743892105383926602930909039567065240010338908865509831749824;\n uint256 constant C86 = 15943719865023133586707144161652035291705809358178262514871056013754142625673;\n uint256 constant C87 = 2326415993032390211558498780803238091925402878871059708106213703504162832999;\n uint256 constant C88 = 19995326402773833553207196590622808505547443523750970375738981396588337910289;\n uint256 constant C89 = 5143583711361588952673350526320181330406047695593201009385718506918735286622;\n uint256 constant C90 = 15436006486881920976813738625999473183944244531070780793506388892313517319583;\n uint256 constant C91 = 16660446760173633166698660166238066533278664023818938868110282615200613695857;\n uint256 constant C92 = 4966065365695755376133119391352131079892396024584848298231004326013366253934;\n uint256 constant C93 = 20683781957411705574951987677641476019618457561419278856689645563561076926702;\n uint256 constant C94 = 17280836839165902792086432296371645107551519324565649849400948918605456875699;\n uint256 constant C95 = 17045635513701208892073056357048619435743564064921155892004135325530808465371;\n uint256 constant C96 = 17055032967194400710390142791334572297458033582458169295920670679093585707295;\n uint256 constant C97 = 15727174639569115300068198908071514334002742825679221638729902577962862163505;\n uint256 constant C98 = 1001755657610446661315902885492677747789366510875120894840818704741370398633;\n uint256 constant C99 = 18638547332826171619311285502376343504539399518545103511265465604926625041234;\n uint256 constant C100 = 6751954224763196429755298529194402870632445298969935050224267844020826420799;\n uint256 constant C101 = 3526747115904224771452549517614107688674036840088422555827581348280834879405;\n uint256 constant C102 = 15705897908180497062880001271426561999724005008972544196300715293701537574122;\n uint256 constant C103 = 574386695213920937259007343820417029802510752426579750428758189312416867750;\n uint256 constant C104 = 15973040855000600860816974646787367136127946402908768408978806375685439868553;\n uint256 constant C105 = 20934130413948796333037139460875996342810005558806621330680156931816867321122;\n uint256 constant C106 = 6918585327145564636398173845411579411526758237572034236476079610890705810764;\n uint256 constant C107 = 14158163500813182062258176233162498241310167509137716527054939926126453647182;\n uint256 constant C108 = 4164602626597695668474100217150111342272610479949122406544277384862187287433;\n uint256 constant C109 = 12146526846507496913615390662823936206892812880963914267275606265272996025304;\n uint256 constant C110 = 10153527926900017763244212043512822363696541810586522108597162891799345289938;\n uint256 constant C111 = 13564663485965299104296214940873270349072051793008946663855767889066202733588;\n uint256 constant C112 = 5612449256997576125867742696783020582952387615430650198777254717398552960096;\n uint256 constant C113 = 12151885480032032868507892738683067544172874895736290365318623681886999930120;\n uint256 constant C114 = 380452237704664384810613424095477896605414037288009963200982915188629772177;\n uint256 constant C115 = 9067557551252570188533509616805287919563636482030947363841198066124642069518;\n uint256 constant C116 = 21280306817619711661335268484199763923870315733198162896599997188206277056900;\n uint256 constant C117 = 5567165819557297006750252582140767993422097822227408837378089569369734876257;\n uint256 constant C118 = 10411936321072105429908396649383171465939606386380071222095155850987201580137;\n uint256 constant C119 = 21338390051413922944780864872652000187403217966653363270851298678606449622266;\n uint256 constant C120 = 12156296560457833712186127325312904760045212412680904475497938949653569234473;\n uint256 constant C121 = 4271647814574748734312113971565139132510281260328947438246615707172526380757;\n uint256 constant C122 = 9061738206062369647211128232833114177054715885442782773131292534862178874950;\n uint256 constant C123 = 10134551893627587797380445583959894183158393780166496661696555422178052339133;\n uint256 constant C124 = 8932270237664043612366044102088319242789325050842783721780970129656616386103;\n uint256 constant C125 = 3339412934966886386194449782756711637636784424032779155216609410591712750636;\n uint256 constant C126 = 9704903972004596791086522314847373103670545861209569267884026709445485704400;\n uint256 constant C127 = 17467570179597572575614276429760169990940929887711661192333523245667228809456;\n uint256 constant M00 = 2910766817845651019878574839501801340070030115151021261302834310722729507541;\n uint256 constant M01 = 19727366863391167538122140361473584127147630672623100827934084310230022599144;\n uint256 constant M10 = 5776684794125549462448597414050232243778680302179439492664047328281728356345;\n uint256 constant M11 = 8348174920934122550483593999453880006756108121341067172388445916328941978568;\n\n function hash(uint256 input) external pure override returns (uint256 result) {\n return _hash(input);\n }\n\n function _hash(uint256 input) internal pure returns (uint256 result) {\n assembly {\n // Poseidon parameters should be t = 2, RF = 8, RP = 56\n\n // We load the characteristic\n let q := Q\n\n // In zerokit implementation, if we pass inp = [a0,a1,..,an] to Poseidon what is effectively hashed is [0,a0,a1,..,an]\n // Note that a sequence of MIX-ARK involves 3 Bn254 field additions before the mulmod happens. Worst case we have a value corresponding to 2*(p-1) which is less than 2^256 and hence doesn't overflow\n //ROUND 0 - FULL\n let s0 := C0\n let s1 := add(input, C1)\n // SBOX\n let t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n t := mulmod(s1, s1, q)\n s1 := mulmod(mulmod(t, t, q), s1, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 1 - FULL\n s0 := add(s0, C2)\n s1 := add(s1, C3)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n t := mulmod(s1, s1, q)\n s1 := mulmod(mulmod(t, t, q), s1, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 2 - FULL\n s0 := add(s0, C4)\n s1 := add(s1, C5)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n t := mulmod(s1, s1, q)\n s1 := mulmod(mulmod(t, t, q), s1, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 3 - FULL\n s0 := add(s0, C6)\n s1 := add(s1, C7)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n t := mulmod(s1, s1, q)\n s1 := mulmod(mulmod(t, t, q), s1, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 4 - PARTIAL\n s0 := add(s0, C8)\n s1 := add(s1, C9)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 5 - PARTIAL\n s0 := add(s0, C10)\n s1 := add(s1, C11)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 6 - PARTIAL\n s0 := add(s0, C12)\n s1 := add(s1, C13)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 7 - PARTIAL\n s0 := add(s0, C14)\n s1 := add(s1, C15)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 8 - PARTIAL\n s0 := add(s0, C16)\n s1 := add(s1, C17)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 9 - PARTIAL\n s0 := add(s0, C18)\n s1 := add(s1, C19)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 10 - PARTIAL\n s0 := add(s0, C20)\n s1 := add(s1, C21)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 11 - PARTIAL\n s0 := add(s0, C22)\n s1 := add(s1, C23)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 12 - PARTIAL\n s0 := add(s0, C24)\n s1 := add(s1, C25)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 13 - PARTIAL\n s0 := add(s0, C26)\n s1 := add(s1, C27)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 14 - PARTIAL\n s0 := add(s0, C28)\n s1 := add(s1, C29)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 15 - PARTIAL\n s0 := add(s0, C30)\n s1 := add(s1, C31)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 16 - PARTIAL\n s0 := add(s0, C32)\n s1 := add(s1, C33)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 17 - PARTIAL\n s0 := add(s0, C34)\n s1 := add(s1, C35)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 18 - PARTIAL\n s0 := add(s0, C36)\n s1 := add(s1, C37)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 19 - PARTIAL\n s0 := add(s0, C38)\n s1 := add(s1, C39)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 20 - PARTIAL\n s0 := add(s0, C40)\n s1 := add(s1, C41)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 21 - PARTIAL\n s0 := add(s0, C42)\n s1 := add(s1, C43)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 22 - PARTIAL\n s0 := add(s0, C44)\n s1 := add(s1, C45)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 23 - PARTIAL\n s0 := add(s0, C46)\n s1 := add(s1, C47)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 24 - PARTIAL\n s0 := add(s0, C48)\n s1 := add(s1, C49)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 25 - PARTIAL\n s0 := add(s0, C50)\n s1 := add(s1, C51)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 26 - PARTIAL\n s0 := add(s0, C52)\n s1 := add(s1, C53)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 27 - PARTIAL\n s0 := add(s0, C54)\n s1 := add(s1, C55)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 28 - PARTIAL\n s0 := add(s0, C56)\n s1 := add(s1, C57)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 29 - PARTIAL\n s0 := add(s0, C58)\n s1 := add(s1, C59)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 30 - PARTIAL\n s0 := add(s0, C60)\n s1 := add(s1, C61)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 31 - PARTIAL\n s0 := add(s0, C62)\n s1 := add(s1, C63)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 32 - PARTIAL\n s0 := add(s0, C64)\n s1 := add(s1, C65)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 33 - PARTIAL\n s0 := add(s0, C66)\n s1 := add(s1, C67)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 34 - PARTIAL\n s0 := add(s0, C68)\n s1 := add(s1, C69)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 35 - PARTIAL\n s0 := add(s0, C70)\n s1 := add(s1, C71)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 36 - PARTIAL\n s0 := add(s0, C72)\n s1 := add(s1, C73)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 37 - PARTIAL\n s0 := add(s0, C74)\n s1 := add(s1, C75)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 38 - PARTIAL\n s0 := add(s0, C76)\n s1 := add(s1, C77)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 39 - PARTIAL\n s0 := add(s0, C78)\n s1 := add(s1, C79)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 40 - PARTIAL\n s0 := add(s0, C80)\n s1 := add(s1, C81)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 41 - PARTIAL\n s0 := add(s0, C82)\n s1 := add(s1, C83)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 42 - PARTIAL\n s0 := add(s0, C84)\n s1 := add(s1, C85)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 43 - PARTIAL\n s0 := add(s0, C86)\n s1 := add(s1, C87)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 44 - PARTIAL\n s0 := add(s0, C88)\n s1 := add(s1, C89)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 45 - PARTIAL\n s0 := add(s0, C90)\n s1 := add(s1, C91)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 46 - PARTIAL\n s0 := add(s0, C92)\n s1 := add(s1, C93)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 47 - PARTIAL\n s0 := add(s0, C94)\n s1 := add(s1, C95)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 48 - PARTIAL\n s0 := add(s0, C96)\n s1 := add(s1, C97)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 49 - PARTIAL\n s0 := add(s0, C98)\n s1 := add(s1, C99)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 50 - PARTIAL\n s0 := add(s0, C100)\n s1 := add(s1, C101)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 51 - PARTIAL\n s0 := add(s0, C102)\n s1 := add(s1, C103)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 52 - PARTIAL\n s0 := add(s0, C104)\n s1 := add(s1, C105)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 53 - PARTIAL\n s0 := add(s0, C106)\n s1 := add(s1, C107)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 54 - PARTIAL\n s0 := add(s0, C108)\n s1 := add(s1, C109)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 55 - PARTIAL\n s0 := add(s0, C110)\n s1 := add(s1, C111)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 56 - PARTIAL\n s0 := add(s0, C112)\n s1 := add(s1, C113)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 57 - PARTIAL\n s0 := add(s0, C114)\n s1 := add(s1, C115)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 58 - PARTIAL\n s0 := add(s0, C116)\n s1 := add(s1, C117)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 59 - PARTIAL\n s0 := add(s0, C118)\n s1 := add(s1, C119)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 60 - FULL\n s0 := add(s0, C120)\n s1 := add(s1, C121)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n t := mulmod(s1, s1, q)\n s1 := mulmod(mulmod(t, t, q), s1, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 61 - FULL\n s0 := add(s0, C122)\n s1 := add(s1, C123)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n t := mulmod(s1, s1, q)\n s1 := mulmod(mulmod(t, t, q), s1, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 62 - FULL\n s0 := add(s0, C124)\n s1 := add(s1, C125)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n t := mulmod(s1, s1, q)\n s1 := mulmod(mulmod(t, t, q), s1, q)\n // MIX\n t := add(mulmod(s0, M00, q), mulmod(s1, M01, q))\n s1 := add(mulmod(s0, M10, q), mulmod(s1, M11, q))\n s0 := t\n\n //ROUND 63 - FULL\n s0 := add(s0, C126)\n s1 := add(s1, C127)\n // SBOX\n t := mulmod(s0, s0, q)\n s0 := mulmod(mulmod(t, t, q), s0, q)\n t := mulmod(s1, s1, q)\n s1 := mulmod(mulmod(t, t, q), s1, q)\n // MIX\n s0 := mod(add(mulmod(s0, M00, q), mulmod(s1, M01, q)), q)\n\n result := s0\n }\n }\n}\n" + }, + "lib/rln-contract/contracts/RlnBase.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.15;\n\nimport {IPoseidonHasher} from \"./PoseidonHasher.sol\";\nimport {IVerifier} from \"./IVerifier.sol\";\n\n/// The tree is full\nerror FullTree();\n\n/// Invalid deposit amount\n/// @param required The required deposit amount\n/// @param provided The provided deposit amount\nerror InsufficientDeposit(uint256 required, uint256 provided);\n\n/// Member is already registered\nerror DuplicateIdCommitment();\n\n/// Failed validation on registration/slashing\nerror FailedValidation();\n\n/// Invalid receiver address, when the receiver is the contract itself or 0x0\nerror InvalidReceiverAddress(address to);\n\n/// Member is not registered\nerror MemberNotRegistered(uint256 idCommitment);\n\n/// Member has no stake\nerror MemberHasNoStake(uint256 idCommitment);\n\n/// User has insufficient balance to withdraw\nerror InsufficientWithdrawalBalance();\n\n/// Contract has insufficient balance to return\nerror InsufficientContractBalance();\n\n/// Invalid proof\nerror InvalidProof();\n\nabstract contract RlnBase {\n /// @notice The deposit amount required to register as a member\n uint256 public immutable MEMBERSHIP_DEPOSIT;\n\n /// @notice The depth of the merkle tree\n uint256 public immutable DEPTH;\n\n /// @notice The size of the merkle tree, i.e 2^depth\n uint256 public immutable SET_SIZE;\n\n /// @notice The index of the next member to be registered\n uint256 public idCommitmentIndex = 1;\n\n /// @notice The amount of eth staked by each member\n /// maps from idCommitment to the amount staked\n mapping(uint256 => uint256) public stakedAmounts;\n\n /// @notice The membership status of each member\n /// maps from idCommitment to their index in the set\n mapping(uint256 => uint256) public members;\n\n /// @notice The balance of each user that can be withdrawn\n mapping(address => uint256) public withdrawalBalance;\n\n /// @notice The Poseidon hasher contract\n IPoseidonHasher public immutable poseidonHasher;\n\n /// @notice The groth16 verifier contract\n IVerifier public immutable verifier;\n\n /// Emitted when a new member is added to the set\n /// @param idCommitment The idCommitment of the member\n /// @param index The index of the member in the set\n event MemberRegistered(uint256 idCommitment, uint256 index);\n\n /// Emitted when a member is removed from the set\n /// @param idCommitment The idCommitment of the member\n /// @param index The index of the member in the set\n event MemberWithdrawn(uint256 idCommitment, uint256 index);\n\n constructor(uint256 membershipDeposit, uint256 depth, address _poseidonHasher, address _verifier) {\n MEMBERSHIP_DEPOSIT = membershipDeposit;\n DEPTH = depth;\n SET_SIZE = 1 << depth;\n poseidonHasher = IPoseidonHasher(_poseidonHasher);\n verifier = IVerifier(_verifier);\n }\n\n /// Allows a user to register as a member\n /// @param idCommitment The idCommitment of the member\n function register(uint256 idCommitment) external payable virtual {\n if (msg.value != MEMBERSHIP_DEPOSIT) {\n revert InsufficientDeposit(MEMBERSHIP_DEPOSIT, msg.value);\n }\n _validateRegistration(idCommitment);\n _register(idCommitment, msg.value);\n }\n\n /// Registers a member\n /// @param idCommitment The idCommitment of the member\n /// @param stake The amount of eth staked by the member\n function _register(uint256 idCommitment, uint256 stake) internal virtual {\n if (members[idCommitment] != 0) revert DuplicateIdCommitment();\n if (idCommitmentIndex >= SET_SIZE) revert FullTree();\n\n members[idCommitment] = idCommitmentIndex;\n stakedAmounts[idCommitment] = stake;\n\n emit MemberRegistered(idCommitment, idCommitmentIndex);\n idCommitmentIndex += 1;\n }\n\n /// @dev Inheriting contracts MUST override this function\n function _validateRegistration(uint256 idCommitment) internal view virtual;\n\n /// @dev Allows a user to slash a member\n /// @param idCommitment The idCommitment of the member\n function slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) external virtual {\n _validateSlash(idCommitment, receiver, proof);\n _slash(idCommitment, receiver, proof);\n }\n\n /// @dev Slashes a member by removing them from the set, and adding their\n /// stake to the receiver's available withdrawal balance\n /// @param idCommitment The idCommitment of the member\n /// @param receiver The address to receive the funds\n function _slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) internal virtual {\n if (receiver == address(this) || receiver == address(0)) {\n revert InvalidReceiverAddress(receiver);\n }\n\n if (members[idCommitment] == 0) revert MemberNotRegistered(idCommitment);\n // check if member is registered\n if (stakedAmounts[idCommitment] == 0) {\n revert MemberHasNoStake(idCommitment);\n }\n\n if (!_verifyProof(idCommitment, receiver, proof)) {\n revert InvalidProof();\n }\n\n uint256 amountToTransfer = stakedAmounts[idCommitment];\n\n // delete member\n uint256 index = members[idCommitment];\n members[idCommitment] = 0;\n stakedAmounts[idCommitment] = 0;\n\n // refund deposit\n withdrawalBalance[receiver] += amountToTransfer;\n\n emit MemberWithdrawn(idCommitment, index);\n }\n\n function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof)\n internal\n view\n virtual;\n\n /// Allows a user to withdraw funds allocated to them upon slashing a member\n function withdraw() external virtual {\n uint256 amount = withdrawalBalance[msg.sender];\n\n if (amount == 0) revert InsufficientWithdrawalBalance();\n if (amount > address(this).balance) {\n revert InsufficientContractBalance();\n }\n\n withdrawalBalance[msg.sender] = 0;\n\n payable(msg.sender).transfer(amount);\n }\n\n /// Hashes a value using the Poseidon hasher\n /// NOTE: The variant of Poseidon we use accepts only 1 input, assume n=2, and the second input is 0\n /// @param input The value to hash\n function hash(uint256 input) internal view returns (uint256) {\n return poseidonHasher.hash(input);\n }\n\n /// @dev Groth16 proof verification\n function _verifyProof(uint256 idCommitment, address receiver, uint256[8] calldata proof)\n internal\n view\n virtual\n returns (bool)\n {\n return verifier.verifyProof(\n [proof[0], proof[1]],\n [[proof[2], proof[3]], [proof[4], proof[5]]],\n [proof[6], proof[7]],\n [idCommitment, uint256(uint160(receiver))]\n );\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": false, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": ["ast"] + } + }, + "metadata": { + "useLiteralContent": true + }, + "remappings": [ + "ds-test/=lib/forge-std/lib/ds-test/src/", + "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", + "forge-std/=lib/forge-std/src/", + "openzeppelin-contracts/=lib/openzeppelin-contracts/", + "openzeppelin/=lib/openzeppelin-contracts/contracts/", + "rln-contract/=lib/rln-contract/contracts/" + ] + } +} diff --git a/docs/index.md b/docs/index.md index 4772849..d7931ec 100644 --- a/docs/index.md +++ b/docs/index.md @@ -112,10 +112,10 @@ error FailedToRegister(string reason) ## WakuRlnRegistry -### currentStorageIndex +### nextStorageIndex ```solidity -uint16 currentStorageIndex +uint16 nextStorageIndex ``` ### storages