From 9392027851114b0ab0d1893b07bbdf5b6b36163c Mon Sep 17 00:00:00 2001 From: ButterflyEffect Date: Mon, 23 Oct 2023 13:48:36 +0000 Subject: [PATCH] tests --- .prettierrc | 2 +- contracts/RegistryUpgradeProposal.sol | 24 +++- contracts/RelayerRegistry.sol | 58 ++------ contracts/interfaces/RelayerRegistry.sol | 7 + hardhat.config.js | 5 +- package-lock.json | 13 ++ package.json | 4 +- test/RelayerRegistry.js | 175 +++++++++++++++++++++++ test/abi/aggregator.abi.json | 1 + test/abi/ensRegistry.abi.json | 1 + test/abi/ensResolver.abi.json | 1 + test/abi/governance.abi.json | 1 + test/abi/relayerRegistryOld.abi.json | 1 + test/abi/torn.abi.json | 1 + 14 files changed, 240 insertions(+), 54 deletions(-) create mode 100644 contracts/interfaces/RelayerRegistry.sol create mode 100644 test/RelayerRegistry.js create mode 100644 test/abi/aggregator.abi.json create mode 100644 test/abi/ensRegistry.abi.json create mode 100644 test/abi/ensResolver.abi.json create mode 100644 test/abi/governance.abi.json create mode 100644 test/abi/relayerRegistryOld.abi.json create mode 100644 test/abi/torn.abi.json diff --git a/.prettierrc b/.prettierrc index 491fcd1..03c9fea 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,7 +3,7 @@ { "files": "*.sol", "options": { - "printWidth": 80, + "printWidth": 120, "tabWidth": 4, "useTabs": false, "singleQuote": false, diff --git a/contracts/RegistryUpgradeProposal.sol b/contracts/RegistryUpgradeProposal.sol index 7e6f501..46e7aa3 100644 --- a/contracts/RegistryUpgradeProposal.sol +++ b/contracts/RegistryUpgradeProposal.sol @@ -4,16 +4,34 @@ pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import { IRelayerRegistryProxy } from "./interfaces/RelayerRegistryProxy.sol"; +import { IRelayerRegistry } from "./interfaces/RelayerRegistry.sol"; +import { ENSNamehash } from "./libraries/EnsNamehash.sol"; +import { EnsResolve } from "torn-token/contracts/ENS.sol"; + +contract Proposal is EnsResolve { + using ENSNamehash for bytes; -contract Proposal { address immutable newRelayerRegistry; + address constant relayerRegistryProxyAddr = 0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2; constructor(address _newRelayerRegistry) public { newRelayerRegistry = _newRelayerRegistry; } function executeProposal() public { - IRelayerRegistryProxy relayerRegistryProxy = IRelayerRegistryProxy(0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2); + IRelayerRegistryProxy relayerRegistryProxy = IRelayerRegistryProxy(relayerRegistryProxyAddr); relayerRegistryProxy.upgradeTo(newRelayerRegistry); + + string[5] memory cheatingRelayers = [ + "available-reliable-relayer.eth", + "0xtornadocash.eth", + "0xtorn365.eth", + "tornrelayers.eth", + "moon-relayer.eth" + ]; + for (uint i = 0; i < cheatingRelayers.length; i++) { + address cheatingRelayer = resolve(bytes(cheatingRelayers[i]).namehash()); + IRelayerRegistry(relayerRegistryProxyAddr).unregisterRelayer(cheatingRelayer); + } } -} \ No newline at end of file +} diff --git a/contracts/RelayerRegistry.sol b/contracts/RelayerRegistry.sol index 9d711db..7c9db6b 100644 --- a/contracts/RelayerRegistry.sol +++ b/contracts/RelayerRegistry.sol @@ -58,12 +58,7 @@ contract RelayerRegistry is Initializable, EnsResolve { event StakeBurned(address relayer, uint256 amountBurned); event MinimumStakeAmount(uint256 minStakeAmount); event RouterRegistered(address tornadoRouter); - event RelayerRegistered( - bytes32 relayer, - string ensName, - address relayerAddress, - uint256 stakedAmount - ); + event RelayerRegistered(bytes32 relayer, string ensName, address relayerAddress, uint256 stakedAmount); event RelayerUnregistered(address relayer); modifier onlyGovernance() { @@ -81,13 +76,7 @@ contract RelayerRegistry is Initializable, EnsResolve { _; } - constructor( - address _torn, - address _governance, - address _ens, - address _staking, - address _feeManager - ) public { + constructor(address _torn, address _governance, address _ens, address _staking, address _feeManager) public { torn = TORN(_torn); governance = _governance; ens = IENS(_ens); @@ -112,11 +101,7 @@ contract RelayerRegistry is Initializable, EnsResolve { * @param stake the initial amount of stake in TORN the relayer is depositing * */ - function register( - string calldata ensName, - uint256 stake, - address[] calldata workersToRegister - ) external { + function register(string calldata ensName, uint256 stake, address[] calldata workersToRegister) external { _register(msg.sender, ensName, stake, workersToRegister); } @@ -173,10 +158,7 @@ contract RelayerRegistry is Initializable, EnsResolve { * @param worker Address to register * */ - function registerWorker( - address relayer, - address worker - ) external onlyRelayer(msg.sender, relayer) { + function registerWorker(address relayer, address worker) external onlyRelayer(msg.sender, relayer) { _registerWorker(relayer, worker); } @@ -195,8 +177,7 @@ contract RelayerRegistry is Initializable, EnsResolve { * */ function unregisterWorker(address worker) external { - if (worker != msg.sender) - require(workers[worker] == msg.sender, "only owner of worker"); + if (worker != msg.sender) require(workers[worker] == msg.sender, "only owner of worker"); require(workers[worker] != worker, "cant unregister master"); emit WorkerUnregistered(workers[worker], worker); workers[worker] = address(0); @@ -242,11 +223,7 @@ contract RelayerRegistry is Initializable, EnsResolve { _stakeToRelayer(staker, relayer, stake); } - function _stakeToRelayer( - address staker, - address relayer, - uint256 stake - ) internal { + function _stakeToRelayer(address staker, address relayer, uint256 stake) internal { require(workers[relayer] == relayer, "!registered"); torn.safeTransferFrom(staker, address(staking), stake); relayers[relayer].balance = stake.add(relayers[relayer].balance); @@ -265,11 +242,7 @@ contract RelayerRegistry is Initializable, EnsResolve { * @param pool instance to get fee for * */ - function burn( - address sender, - address relayer, - ITornadoInstance pool - ) external onlyTornadoRouter { + function burn(address sender, address relayer, ITornadoInstance pool) external onlyTornadoRouter { address masterAddress = workers[sender]; if (masterAddress == address(0)) { require(workers[relayer] == address(0), "Only custom relayer"); @@ -298,9 +271,7 @@ contract RelayerRegistry is Initializable, EnsResolve { * @param tornadoRouterAddress address of the new proxy * */ - function setTornadoRouter( - address tornadoRouterAddress - ) external onlyGovernance { + function setTornadoRouter(address tornadoRouterAddress) external onlyGovernance { tornadoRouter = tornadoRouterAddress; emit RouterRegistered(tornadoRouterAddress); } @@ -337,10 +308,7 @@ contract RelayerRegistry is Initializable, EnsResolve { * @return true if registered * */ - function isRelayerRegistered( - address relayer, - address toResolve - ) external view returns (bool) { + function isRelayerRegistered(address relayer, address toResolve) external view returns (bool) { return workers[toResolve] == relayer; } @@ -350,9 +318,7 @@ contract RelayerRegistry is Initializable, EnsResolve { * @return relayer's ensHash * */ - function getRelayerEnsHash( - address relayer - ) external view returns (bytes32) { + function getRelayerEnsHash(address relayer) external view returns (bytes32) { return relayers[workers[relayer]].ensHash; } @@ -362,9 +328,7 @@ contract RelayerRegistry is Initializable, EnsResolve { * @return relayer's balance * */ - function getRelayerBalance( - address relayer - ) external view returns (uint256) { + function getRelayerBalance(address relayer) external view returns (uint256) { return relayers[workers[relayer]].balance; } } diff --git a/contracts/interfaces/RelayerRegistry.sol b/contracts/interfaces/RelayerRegistry.sol new file mode 100644 index 0000000..d41a512 --- /dev/null +++ b/contracts/interfaces/RelayerRegistry.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.12; + +interface IRelayerRegistry { + function unregisterRelayer(address relayer) external; +} \ No newline at end of file diff --git a/hardhat.config.js b/hardhat.config.js index 4d45998..3dfa0fb 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -16,8 +16,9 @@ module.exports = { forking: { url: "https://eth.llamarpc.com", enabled: true, - blockNumber: 18391425 - } + blockNumber: 18391425, + }, + chainId: 1 } }, etherscan: { diff --git a/package-lock.json b/package-lock.json index 08a3be2..9059379 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "@types/chai": "^4.3.9", "@types/mocha": "^10.0.2", "chai": "^4.3.10", + "chai-things": "^0.2.0", "dotenv": "^16.3.1", "ethers": "^6.8.0", "hardhat": "^2.18.1", @@ -2796,6 +2797,12 @@ "chai": ">= 2.1.2 < 5" } }, + "node_modules/chai-things": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/chai-things/-/chai-things-0.2.0.tgz", + "integrity": "sha512-6ns0SU21xdRCoEXVKH3HGbwnsgfVMXQ+sU5V8PI9rfxaITos8lss1vUxbF1FAcJKjfqmmmLVlr/z3sLes00w+A==", + "dev": true + }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -12272,6 +12279,12 @@ "check-error": "^1.0.2" } }, + "chai-things": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/chai-things/-/chai-things-0.2.0.tgz", + "integrity": "sha512-6ns0SU21xdRCoEXVKH3HGbwnsgfVMXQ+sU5V8PI9rfxaITos8lss1vUxbF1FAcJKjfqmmmLVlr/z3sLes00w+A==", + "dev": true + }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", diff --git a/package.json b/package.json index 4102e48..45e5dc8 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "test": "test" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "npx hardhat test", + "deploy": "npx hardhat run script/deploy.js" }, "author": "", "license": "ISC", @@ -22,6 +23,7 @@ "@types/chai": "^4.3.9", "@types/mocha": "^10.0.2", "chai": "^4.3.10", + "chai-things": "^0.2.0", "dotenv": "^16.3.1", "ethers": "^6.8.0", "hardhat": "^2.18.1", diff --git a/test/RelayerRegistry.js b/test/RelayerRegistry.js new file mode 100644 index 0000000..3207606 --- /dev/null +++ b/test/RelayerRegistry.js @@ -0,0 +1,175 @@ +const { time, loadFixture } = require("@nomicfoundation/hardhat-toolbox/network-helpers"); +const { expect, assert } = require("chai"); +const { ethers, network } = require("hardhat"); +const { relayerRegistry } = require("torn-token"); + +describe("Registry update", function () { + async function deployAndExecuteFixture() { + const RelayerRegistryFactory = await ethers.getContractFactory("RelayerRegistry"); + const constructorArgs = [ + "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C", + "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce", + "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + "0x5B3f656C80E8ddb9ec01Dd9018815576E9238c29", + "0x5f6c97C6AD7bdd0AE7E0Dd4ca33A4ED3fDabD4D7", + ]; + const relayerRegistry = await RelayerRegistryFactory.deploy(...constructorArgs); + const deployedRegistryAddr = await relayerRegistry.getAddress(); + const proposalFactory = await ethers.getContractFactory("Proposal"); + const proposal = await proposalFactory.deploy(deployedRegistryAddr); + const deployedProposalAddr = await proposal.getAddress(); + + + const bigStakerAddr = "0xE4143f6377AEcd7193b9731d1C28815b57C4f5Ab"; + await network.provider.send("hardhat_setBalance", [ + bigStakerAddr, + "0x116663015358483537" + ]); + const stakerSigner = await ethers.getImpersonatedSigner(bigStakerAddr); + const governanceAddr = "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce"; + const governanceContract = await ethers.getContractAt(require("./abi/governance.abi.json"), governanceAddr, stakerSigner); + await governanceContract.propose(deployedProposalAddr, ""); + const proposalId = await governanceContract.proposalCount(); + await time.increase(60 * 60); + await governanceContract.castVote(proposalId, true); + await time.increase(60 * 60 * 24 * 7 + 60); + await governanceContract.execute(proposalId); + + const governanceSigner = await ethers.getImpersonatedSigner(governanceAddr); + const relayerRegistryProxyAddr = "0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2"; + const relayerRegistryContract = await ethers.getContractAt("RelayerRegistry", relayerRegistryProxyAddr, governanceSigner); + + return { relayerRegistryProxyAddr, deployedRegistryAddr, relayerRegistryContract, governanceSigner }; + } + + async function unregisterRelayer(ensNameOrAddress){ + const { relayerRegistryContract } = await loadFixture(deployAndExecuteFixture); + const relayerAddr = ethers.isAddress(ensNameOrAddress) ? ensNameOrAddress : resolveAddr(ensNameOrAddress); + await relayerRegistryContract.unregisterRelayer(relayerAddr); + } + + async function resolveAddr(ensName){ + const ensNode = ethers.namehash(ensName); + const ensAddr = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"; + const registryContract = await ethers.getContractAt(require("./abi/ensRegistry.abi.json"), ensAddr); + const resolverAddr = await registryContract.resolver(ensNode); + const resolverContract = await ethers.getContractAt(require("./abi/ensResolver.abi.json"), resolverAddr); + + return await resolverContract.addr(ensNode); + } + + async function getOldRelayerRegistryContractFixture(){ + const relayerRegistryProxyAddr = "0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2"; + return await ethers.getContractAt(require("./abi/relayerRegistryOld.abi.json"), relayerRegistryProxyAddr); + } + + it("Implementation address should be updated", async function () { + await loadFixture(getOldRelayerRegistryContractFixture); + const { relayerRegistryProxyAddr, deployedRegistryAddr } = await loadFixture(deployAndExecuteFixture); + const implementation = await ethers.provider.getStorage(relayerRegistryProxyAddr, "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"); + const [implementationAddr] = new ethers.AbiCoder().decode(["address"], implementation); + + expect(implementationAddr).to.equal(deployedRegistryAddr) + }); + + describe("Unregister relayer", function(){ + + it("Uregister relayer function should work", async function(){ + const testRelayerAddr = await resolveAddr("first-relayer.eth"); + + const relayerRegistryOldContract = await loadFixture(getOldRelayerRegistryContractFixture); + let isRelayer = await relayerRegistryOldContract.isRelayer(testRelayerAddr); + let isRelayerRegistered = await relayerRegistryOldContract.isRelayerRegistered(testRelayerAddr, testRelayerAddr); + expect(isRelayer).to.equal(true); + expect(isRelayerRegistered).to.equal(true); + + const { relayerRegistryContract } = await loadFixture(deployAndExecuteFixture); + await unregisterRelayer(testRelayerAddr); + + isRelayer = await relayerRegistryContract.isRelayer(testRelayerAddr); + isRelayerRegistered = await relayerRegistryContract.isRelayerRegistered(testRelayerAddr, testRelayerAddr); + + expect(isRelayer).to.equal(false); + expect(isRelayerRegistered).to.equal(false); + }) + + it("Unregistered relayer should have zero balance", async function(){ + const testRelayerAddr = await resolveAddr("first-relayer.eth"); + const { relayerRegistryContract } = await loadFixture(deployAndExecuteFixture); + await unregisterRelayer(testRelayerAddr); + + const relayerBalance = await relayerRegistryContract.getRelayerBalance(testRelayerAddr); + expect(relayerBalance).to.equal(0); + }) + + it("Tornado router address should be valid", async function(){ + const relayerRegistryOldContract = await loadFixture(getOldRelayerRegistryContractFixture); + const oldRegistryRouterAddress = await relayerRegistryOldContract.tornadoRouter(); + + const { relayerRegistryContract } = await loadFixture(deployAndExecuteFixture); + expect(await relayerRegistryContract.tornadoRouter()).to.equal(oldRegistryRouterAddress); + }) + + it("Aggregator contract data for unregistered relayers should be valid", async function(){ + const aggregatorAddr = "0xE8F47A78A6D52D317D0D2FFFac56739fE14D1b49"; + const aggregatorContract = await ethers.getContractAt(require("./abi/aggregator.abi.json"), aggregatorAddr); + const notRelayer = "🦋️-effect.eth"; + const testRelayer = "first-relayer.eth"; + + const callAggr = async () => await aggregatorContract.relayersData([notRelayer, testRelayer].map(ethers.namehash), ["mainnet-tornado", "bsc-tornado"]); + const oldData = await callAggr(); + + await loadFixture(deployAndExecuteFixture); + await unregisterRelayer(testRelayer); + + const newData = await callAggr(); + + assert.deepEqual(oldData[0], newData[0]); + expect(oldData[1][1]).to.greaterThan(500n * 10n ** 18n); + expect(newData[1][1]).to.equal(0); + expect(oldData[1][2]).to.equal(true); + expect(newData[1][2]).to.equal(false); + }) + + it("Cheating relayers should be unregistered", async function(){ + const cheatingRelayers = await Promise.all([ + "available-reliable-relayer.eth", + "0xtornadocash.eth", + "0xtorn365.eth", + "tornrelayers.eth", + "moon-relayer.eth" + ].map(resolveAddr)); + + const relayerRegistryOldContract = await loadFixture(getOldRelayerRegistryContractFixture); + let areRegistered = await Promise.all(cheatingRelayers.map(r => relayerRegistryOldContract.isRelayer(r))); + let balances = await Promise.all(cheatingRelayers.map(r => relayerRegistryOldContract.getRelayerBalance(r))); + + expect(areRegistered).satisfy(v => v.every(v => v === true)); + expect(balances).satisfy(v => v.every(v => v >= 0n)); + + const { relayerRegistryContract } = await loadFixture(deployAndExecuteFixture); + areRegistered = await Promise.all(cheatingRelayers.map(r => relayerRegistryContract.isRelayer(r))); + balances = await Promise.all(cheatingRelayers.map(r => relayerRegistryContract.getRelayerBalance(r))); + + expect(areRegistered).satisfy(v => v.every(v => v === false)); + expect(balances).satisfy(v => v.every(v => v === 0n)); + }) + }) + + it("Unregistered relayers can register again", async function(){ + const { relayerRegistryContract, governanceSigner } = await loadFixture(deployAndExecuteFixture); + const relayerEns = "moon-relayer.eth"; + const unregisteredRelayer = await resolveAddr(relayerEns); + const tornContract = await ethers.getContractAt(require("./abi/torn.abi.json"), "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C", governanceSigner); + const toStake = 2000n * 10n ** 18n; + await tornContract.transfer(unregisteredRelayer, toStake); + + const relayerSigner = await ethers.getImpersonatedSigner(unregisteredRelayer); + await relayerRegistryContract.connect(relayerSigner).register(relayerEns, toStake, []); + const isRelayerRegistered = await relayerRegistryContract.isRelayerRegistered(unregisteredRelayer, unregisteredRelayer); + const relayerBalance = await relayerRegistryContract.getRelayerBalance(unregisteredRelayer); + + expect(isRelayerRegistered).to.be.equal(true); + expect(relayerBalance).to.be.equal(toStake); + }) +}); diff --git a/test/abi/aggregator.abi.json b/test/abi/aggregator.abi.json new file mode 100644 index 0000000..9366bee --- /dev/null +++ b/test/abi/aggregator.abi.json @@ -0,0 +1 @@ +[{"inputs":[],"name":"ensRegistry","outputs":[{"internalType":"contract ENSRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract Governance","name":"governance","type":"address"}],"name":"getAllProposals","outputs":[{"components":[{"internalType":"address","name":"proposer","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"forVotes","type":"uint256"},{"internalType":"uint256","name":"againstVotes","type":"uint256"},{"internalType":"bool","name":"executed","type":"bool"},{"internalType":"bool","name":"extended","type":"bool"},{"internalType":"enum Governance.ProposalState","name":"state","type":"uint8"}],"internalType":"struct GovernanceAggregator.Proposal[]","name":"proposals","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract Governance","name":"governance","type":"address"},{"internalType":"address[]","name":"accs","type":"address[]"}],"name":"getGovernanceBalances","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract Governance","name":"governance","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getUserData","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"latestProposalId","type":"uint256"},{"internalType":"uint256","name":"latestProposalIdState","type":"uint256"},{"internalType":"uint256","name":"timelock","type":"uint256"},{"internalType":"address","name":"delegatee","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"relayerRegistry","outputs":[{"internalType":"contract RelayerRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_relayers","type":"bytes32[]"},{"internalType":"string[]","name":"_subdomains","type":"string[]"}],"name":"relayersData","outputs":[{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"bool","name":"isRegistered","type":"bool"},{"internalType":"string[20]","name":"records","type":"string[20]"}],"internalType":"struct Relayer[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/test/abi/ensRegistry.abi.json b/test/abi/ensRegistry.abi.json new file mode 100644 index 0000000..d0cfe79 --- /dev/null +++ b/test/abi/ensRegistry.abi.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"contract ENS","name":"_old","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"label","type":"bytes32"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"NewOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"address","name":"resolver","type":"address"}],"name":"NewResolver","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"NewTTL","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"old","outputs":[{"internalType":"contract ENS","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"recordExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"resolver","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"setRecord","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"resolver","type":"address"}],"name":"setResolver","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"label","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"}],"name":"setSubnodeOwner","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"label","type":"bytes32"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"setSubnodeRecord","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint64","name":"ttl","type":"uint64"}],"name":"setTTL","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"ttl","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/test/abi/ensResolver.abi.json b/test/abi/ensResolver.abi.json new file mode 100644 index 0000000..302db71 --- /dev/null +++ b/test/abi/ensResolver.abi.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"contract ENS","name":"_ens","type":"address"},{"internalType":"contract INameWrapper","name":"wrapperAddress","type":"address"},{"internalType":"address","name":"_trustedETHController","type":"address"},{"internalType":"address","name":"_trustedReverseRegistrar","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"contentType","type":"uint256"}],"name":"ABIChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"address","name":"a","type":"address"}],"name":"AddrChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"coinType","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newAddress","type":"bytes"}],"name":"AddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":true,"internalType":"bool","name":"approved","type":"bool"}],"name":"Approved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"hash","type":"bytes"}],"name":"ContenthashChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"name","type":"bytes"},{"indexed":false,"internalType":"uint16","name":"resource","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"record","type":"bytes"}],"name":"DNSRecordChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"name","type":"bytes"},{"indexed":false,"internalType":"uint16","name":"resource","type":"uint16"}],"name":"DNSRecordDeleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"lastzonehash","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"zonehash","type":"bytes"}],"name":"DNSZonehashChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"bytes4","name":"interfaceID","type":"bytes4"},{"indexed":false,"internalType":"address","name":"implementer","type":"address"}],"name":"InterfaceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"NameChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"x","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"y","type":"bytes32"}],"name":"PubkeyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":true,"internalType":"string","name":"indexedKey","type":"string"},{"indexed":false,"internalType":"string","name":"key","type":"string"},{"indexed":false,"internalType":"string","name":"value","type":"string"}],"name":"TextChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"node","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"newVersion","type":"uint64"}],"name":"VersionChanged","type":"event"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"contentTypes","type":"uint256"}],"name":"ABI","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"addr","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"coinType","type":"uint256"}],"name":"addr","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"clearRecords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"contenthash","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"uint16","name":"resource","type":"uint16"}],"name":"dnsRecord","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"name","type":"bytes32"}],"name":"hasDNSRecords","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"interfaceImplementer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"delegate","type":"address"}],"name":"isApprovedFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"nodehash","type":"bytes32"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicallWithNodeCheck","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"pubkey","outputs":[{"internalType":"bytes32","name":"x","type":"bytes32"},{"internalType":"bytes32","name":"y","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"recordVersions","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"contentType","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"setABI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"uint256","name":"coinType","type":"uint256"},{"internalType":"bytes","name":"a","type":"bytes"}],"name":"setAddr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"address","name":"a","type":"address"}],"name":"setAddr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes","name":"hash","type":"bytes"}],"name":"setContenthash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"setDNSRecords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes4","name":"interfaceID","type":"bytes4"},{"internalType":"address","name":"implementer","type":"address"}],"name":"setInterface","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"string","name":"newName","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes32","name":"x","type":"bytes32"},{"internalType":"bytes32","name":"y","type":"bytes32"}],"name":"setPubkey","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"string","name":"key","type":"string"},{"internalType":"string","name":"value","type":"string"}],"name":"setText","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"bytes","name":"hash","type":"bytes"}],"name":"setZonehash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"},{"internalType":"string","name":"key","type":"string"}],"name":"text","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"zonehash","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/test/abi/governance.abi.json b/test/abi/governance.abi.json new file mode 100644 index 0000000..033b2aa --- /dev/null +++ b/test/abi/governance.abi.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"address","name":"stakingRewardsAddress","type":"address"},{"internalType":"address","name":"gasCompLogic","type":"address"},{"internalType":"address","name":"userVaultAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Delegated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"proposer","type":"address"},{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"},{"indexed":false,"internalType":"string","name":"description","type":"string"}],"name":"ProposalCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"ProposalExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"bytes","name":"errorData","type":"bytes"}],"name":"RewardUpdateFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"RewardUpdateSuccessful","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"}],"name":"Undelegated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"bool","name":"support","type":"bool"},{"indexed":false,"internalType":"uint256","name":"votes","type":"uint256"}],"name":"Voted","type":"event"},{"inputs":[],"name":"CLOSING_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXECUTION_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXECUTION_EXPIRATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROPOSAL_THRESHOLD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"QUORUM_VOTES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"Staking","outputs":[{"internalType":"contract ITornadoStakingRewards","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VOTE_EXTEND_TIME","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VOTING_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VOTING_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"domains","type":"bytes32[]"}],"name":"bulkResolve","outputs":[{"internalType":"address[]","name":"result","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"canWithdrawAfter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"from","type":"address[]"},{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"support","type":"bool"}],"name":"castDelegatedVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"support","type":"bool"}],"name":"castVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"checkIfQuorumReached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"delegatedTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"gasCompensationVault","outputs":[{"internalType":"contract IGasCompensationVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"voter","type":"address"}],"name":"getReceipt","outputs":[{"components":[{"internalType":"bool","name":"hasVoted","type":"bool"},{"internalType":"bool","name":"support","type":"bool"},{"internalType":"uint256","name":"votes","type":"uint256"}],"internalType":"struct Governance.Receipt","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"hasAccountVoted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_torn","type":"bytes32"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"latestProposalIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"lockWithApproval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lockedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proposalCodehashes","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proposalCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proposals","outputs":[{"internalType":"address","name":"proposer","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"forVotes","type":"uint256"},{"internalType":"uint256","name":"againstVotes","type":"uint256"},{"internalType":"bool","name":"executed","type":"bool"},{"internalType":"bool","name":"extended","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"string","name":"description","type":"string"}],"name":"propose","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"string","name":"description","type":"string"}],"name":"proposeByDelegate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"resolve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"returnMultisigAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"closingPeriod","type":"uint256"}],"name":"setClosingPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"executionDelay","type":"uint256"}],"name":"setExecutionDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"executionExpiration","type":"uint256"}],"name":"setExecutionExpiration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"gasCompensationsLimit","type":"uint256"}],"name":"setGasCompensations","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalThreshold","type":"uint256"}],"name":"setProposalThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quorumVotes","type":"uint256"}],"name":"setQuorumVotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"voteExtendTime","type":"uint256"}],"name":"setVoteExtendTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"votingDelay","type":"uint256"}],"name":"setVotingDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"votingPeriod","type":"uint256"}],"name":"setVotingPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"state","outputs":[{"internalType":"enum Governance.ProposalState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"torn","outputs":[{"internalType":"contract TORN","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"undelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"userVault","outputs":[{"internalType":"contract ITornadoVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawFromHelper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}] \ No newline at end of file diff --git a/test/abi/relayerRegistryOld.abi.json b/test/abi/relayerRegistryOld.abi.json new file mode 100644 index 0000000..5bcc073 --- /dev/null +++ b/test/abi/relayerRegistryOld.abi.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"address","name":"_torn","type":"address"},{"internalType":"address","name":"_governance","type":"address"},{"internalType":"address","name":"_ens","type":"address"},{"internalType":"address","name":"_staking","type":"address"},{"internalType":"address","name":"_feeManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minStakeAmount","type":"uint256"}],"name":"MinimumStakeAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"}],"name":"RelayerBalanceNullified","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"relayer","type":"bytes32"},{"indexed":false,"internalType":"string","name":"ensName","type":"string"},{"indexed":false,"internalType":"address","name":"relayerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"stakedAmount","type":"uint256"}],"name":"RelayerRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tornadoRouter","type":"address"}],"name":"RouterRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountStakeAdded","type":"uint256"}],"name":"StakeAddedToRelayer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountBurned","type":"uint256"}],"name":"StakeBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"address","name":"worker","type":"address"}],"name":"WorkerRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"address","name":"worker","type":"address"}],"name":"WorkerUnregistered","type":"event"},{"inputs":[{"internalType":"bytes32[]","name":"domains","type":"bytes32[]"}],"name":"bulkResolve","outputs":[{"internalType":"address[]","name":"result","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"contract ITornadoInstance","name":"pool","type":"address"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ens","outputs":[{"internalType":"contract IENS","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeManager","outputs":[{"internalType":"contract IFeeManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"getRelayerBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"getRelayerEnsHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_tornadoRouter","type":"bytes32"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"toResolve","type":"address"}],"name":"isRelayer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"},{"internalType":"address","name":"toResolve","type":"address"}],"name":"isRelayerRegistered","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minStakeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"nullifyBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"ensName","type":"string"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"address[]","name":"workersToRegister","type":"address[]"}],"name":"register","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"ensName","type":"string"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"address[]","name":"workersToRegister","type":"address[]"},{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"registerPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"},{"internalType":"address","name":"worker","type":"address"}],"name":"registerWorker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"relayers","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"bytes32","name":"ensHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"resolve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"minAmount","type":"uint256"}],"name":"setMinStakeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tornadoRouterAddress","type":"address"}],"name":"setTornadoRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"stake","type":"uint256"}],"name":"stakeToRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"stakeToRelayerPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"staking","outputs":[{"internalType":"contract TornadoStakingRewards","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"torn","outputs":[{"internalType":"contract TORN","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tornadoRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"worker","type":"address"}],"name":"unregisterWorker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"workers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/test/abi/torn.abi.json b/test/abi/torn.abi.json new file mode 100644 index 0000000..420aa95 --- /dev/null +++ b/test/abi/torn.abi.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"bytes32","name":"_governance","type":"bytes32"},{"internalType":"uint256","name":"_pausePeriod","type":"uint256"},{"components":[{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct TORN.Recipient[]","name":"_vestings","type":"tuple[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"target","type":"address"}],"name":"Allowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"target","type":"address"}],"name":"Disallowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address[]","name":"target","type":"address[]"}],"name":"addToAllowedList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedTransferee","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blockTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"domains","type":"bytes32[]"}],"name":"bulkResolve","outputs":[{"internalType":"address[]","name":"result","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"canUnpauseAfter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainID","outputs":[{"internalType":"uint256","name":"_chainID","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"decision","type":"bool"}],"name":"changeTransferability","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"target","type":"address[]"}],"name":"removeFromAllowedList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"address payable","name":"_to","type":"address"},{"internalType":"uint256","name":"_balance","type":"uint256"}],"name":"rescueTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"node","type":"bytes32"}],"name":"resolve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file