From 513d8148b16cae579ba4a613908b11658fe7cd15 Mon Sep 17 00:00:00 2001 From: Andres Aiello Date: Fri, 3 Nov 2023 11:40:13 -0300 Subject: [PATCH 1/4] feat: Add test to protocol contracts --- contracts/evm/ERC20Custody.sol | 7 +- contracts/evm/testing/AttackerContract.sol | 54 ++ contracts/evm/testing/ERC20Mock.sol | 13 + contracts/zevm/testing/MockSystemContract.sol | 85 ++ test/ERC20Custody.spec.ts | 279 ++++++ test/ImmutableCreate2Factory.spec.ts | 128 --- test/ZRC20.spec.ts | 117 +++ test/Zeta.non-eth.spec.ts | 155 ---- test/ZetaConnector.spec.ts | 855 ------------------ test/ZetaInteractor.spec.ts | 119 --- test/ZetaTokenConsumer.spec.ts | 213 ----- test/test.helpers.ts | 18 - .../AttackerContract.sol/AttackerContract.ts | 214 +++++ .../testing/AttackerContract.sol/Victim.ts | 168 ++++ .../evm/testing/AttackerContract.sol/index.ts | 5 + .../contracts/evm/testing/AttackerContract.ts | 183 ++++ .../contracts/evm/testing/ERC20Mock.ts | 464 ++++++++++ .../contracts/evm/testing/index.ts | 3 + typechain-types/contracts/zevm/index.ts | 2 + .../MockSystemContract.ts | 553 +++++++++++ .../SystemContractErrors.ts | 56 ++ .../testing/MockSystemContract.sol/index.ts | 5 + .../contracts/zevm/testing/index.ts | 5 + .../contracts/evm/ERC20Custody__factory.ts | 2 +- .../AttackerContract__factory.ts | 196 ++++ .../AttackerContract.sol/Victim__factory.ts | 74 ++ .../evm/testing/AttackerContract.sol/index.ts | 5 + .../evm/testing/AttackerContract__factory.ts | 149 +++ .../evm/testing/ERC20Mock__factory.ts | 386 ++++++++ .../factories/contracts/evm/testing/index.ts | 2 + .../factories/contracts/zevm/index.ts | 1 + .../MockSystemContract__factory.ts | 398 ++++++++ .../SystemContractErrors__factory.ts | 50 + .../testing/MockSystemContract.sol/index.ts | 5 + .../factories/contracts/zevm/testing/index.ts | 4 + typechain-types/hardhat.d.ts | 45 + typechain-types/index.ts | 8 + 37 files changed, 3532 insertions(+), 1494 deletions(-) create mode 100644 contracts/evm/testing/AttackerContract.sol create mode 100644 contracts/evm/testing/ERC20Mock.sol create mode 100644 contracts/zevm/testing/MockSystemContract.sol create mode 100644 test/ERC20Custody.spec.ts delete mode 100644 test/ImmutableCreate2Factory.spec.ts create mode 100644 test/ZRC20.spec.ts delete mode 100644 test/Zeta.non-eth.spec.ts delete mode 100644 test/ZetaConnector.spec.ts delete mode 100644 test/ZetaInteractor.spec.ts delete mode 100644 test/ZetaTokenConsumer.spec.ts delete mode 100644 test/test.helpers.ts create mode 100644 typechain-types/contracts/evm/testing/AttackerContract.sol/AttackerContract.ts create mode 100644 typechain-types/contracts/evm/testing/AttackerContract.sol/Victim.ts create mode 100644 typechain-types/contracts/evm/testing/AttackerContract.sol/index.ts create mode 100644 typechain-types/contracts/evm/testing/AttackerContract.ts create mode 100644 typechain-types/contracts/evm/testing/ERC20Mock.ts create mode 100644 typechain-types/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract.ts create mode 100644 typechain-types/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors.ts create mode 100644 typechain-types/contracts/zevm/testing/MockSystemContract.sol/index.ts create mode 100644 typechain-types/contracts/zevm/testing/index.ts create mode 100644 typechain-types/factories/contracts/evm/testing/AttackerContract.sol/AttackerContract__factory.ts create mode 100644 typechain-types/factories/contracts/evm/testing/AttackerContract.sol/Victim__factory.ts create mode 100644 typechain-types/factories/contracts/evm/testing/AttackerContract.sol/index.ts create mode 100644 typechain-types/factories/contracts/evm/testing/AttackerContract__factory.ts create mode 100644 typechain-types/factories/contracts/evm/testing/ERC20Mock__factory.ts create mode 100644 typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract__factory.ts create mode 100644 typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors__factory.ts create mode 100644 typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/index.ts create mode 100644 typechain-types/factories/contracts/zevm/testing/index.ts diff --git a/contracts/evm/ERC20Custody.sol b/contracts/evm/ERC20Custody.sol index 52c2d260..5c5a3455 100644 --- a/contracts/evm/ERC20Custody.sol +++ b/contracts/evm/ERC20Custody.sol @@ -115,7 +115,7 @@ contract ERC20Custody is ReentrancyGuard { /** * @dev Pause custody operations. */ - function pause() external onlyTSSUpdater { + function pause() external onlyTSS { if (paused) { revert IsPaused(); } @@ -129,7 +129,7 @@ contract ERC20Custody is ReentrancyGuard { /** * @dev Unpause custody operations. */ - function unpause() external onlyTSSUpdater { + function unpause() external onlyTSS { if (!paused) { revert NotPaused(); } @@ -191,9 +191,6 @@ contract ERC20Custody is ReentrancyGuard { * @param amount, asset amount. */ function withdraw(address recipient, IERC20 asset, uint256 amount) external nonReentrant onlyTSS { - if (paused) { - revert IsPaused(); - } if (!whitelisted[asset]) { revert NotWhitelisted(); } diff --git a/contracts/evm/testing/AttackerContract.sol b/contracts/evm/testing/AttackerContract.sol new file mode 100644 index 00000000..45606d6f --- /dev/null +++ b/contracts/evm/testing/AttackerContract.sol @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +interface Victim { + function deposit(bytes calldata recipient, address asset, uint256 amount, bytes calldata message) external; + + function withdraw(address recipient, address asset, uint256 amount) external; +} + +contract AttackerContract { + address public victimContractAddress; + uint256 private _victimMethod; + + constructor(address victimContractAddress_, address wzeta, uint256 victimMethod) { + victimContractAddress = victimContractAddress_; + IERC20(wzeta).approve(victimContractAddress, type(uint256).max); + _victimMethod = victimMethod; + } + + // Fallback function to receive ETH + receive() external payable {} + + function attackDeposit() internal { + Victim(victimContractAddress).deposit("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", address(this), 0, "0x00"); + } + + function attackWidrawal() internal { + Victim(victimContractAddress).withdraw(0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266, address(this), 0); + } + + function attack() internal { + if (_victimMethod == 1) { + attackDeposit(); + } else if (_victimMethod == 2) { + attackWidrawal(); + } + } + + function balanceOf(address account) external returns (uint256) { + attack(); + return 0; + } + + function transferFrom(address from, address to, uint256 amount) public returns (bool) { + attack(); + return true; + } + + function transfer(address to, uint256 amount) public returns (bool) { + attack(); + return true; + } +} diff --git a/contracts/evm/testing/ERC20Mock.sol b/contracts/evm/testing/ERC20Mock.sol new file mode 100644 index 00000000..61cdc0ce --- /dev/null +++ b/contracts/evm/testing/ERC20Mock.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.7; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +/** + * @dev ZetaEth is an implementation of OpenZeppelin's ERC20 + */ +contract ERC20Mock is ERC20 { + constructor(string memory name, string memory symbol, address creator, uint256 initialSupply) ERC20(name, symbol) { + _mint(creator, initialSupply * (10 ** uint256(decimals()))); + } +} diff --git a/contracts/zevm/testing/MockSystemContract.sol b/contracts/zevm/testing/MockSystemContract.sol new file mode 100644 index 00000000..ba6ec765 --- /dev/null +++ b/contracts/zevm/testing/MockSystemContract.sol @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.7; + +import "../interfaces/zContract.sol"; +import "../interfaces/IZRC20.sol"; + +interface SystemContractErrors { + error CallerIsNotFungibleModule(); + + error InvalidTarget(); + + error CantBeIdenticalAddresses(); + + error CantBeZeroAddress(); +} + +contract MockSystemContract is SystemContractErrors { + mapping(uint256 => uint256) public gasPriceByChainId; + mapping(uint256 => address) public gasCoinZRC20ByChainId; + mapping(uint256 => address) public gasZetaPoolByChainId; + + address public wZetaContractAddress; + address public uniswapv2FactoryAddress; + address public uniswapv2Router02Address; + + event SystemContractDeployed(); + event SetGasPrice(uint256, uint256); + event SetGasCoin(uint256, address); + event SetGasZetaPool(uint256, address); + event SetWZeta(address); + + constructor(address wzeta_, address uniswapv2Factory_, address uniswapv2Router02_) { + wZetaContractAddress = wzeta_; + uniswapv2FactoryAddress = uniswapv2Factory_; + uniswapv2Router02Address = uniswapv2Router02_; + emit SystemContractDeployed(); + } + + // fungible module updates the gas price oracle periodically + function setGasPrice(uint256 chainID, uint256 price) external { + gasPriceByChainId[chainID] = price; + emit SetGasPrice(chainID, price); + } + + function setGasCoinZRC20(uint256 chainID, address zrc20) external { + gasCoinZRC20ByChainId[chainID] = zrc20; + emit SetGasCoin(chainID, zrc20); + } + + function setWZETAContractAddress(address addr) external { + wZetaContractAddress = addr; + emit SetWZeta(wZetaContractAddress); + } + + // returns sorted token addresses, used to handle return values from pairs sorted in this order + function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { + if (tokenA == tokenB) revert CantBeIdenticalAddresses(); + (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); + if (token0 == address(0)) revert CantBeZeroAddress(); + } + + function uniswapv2PairFor(address factory, address tokenA, address tokenB) public pure returns (address pair) { + (address token0, address token1) = sortTokens(tokenA, tokenB); + pair = address( + uint160( + uint256( + keccak256( + abi.encodePacked( + hex"ff", + factory, + keccak256(abi.encodePacked(token0, token1)), + hex"96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f" // init code hash + ) + ) + ) + ) + ); + } + + function onCrossChainCall(address target, address zrc20, uint256 amount, bytes calldata message) external { + zContext memory context = zContext({sender: msg.sender, origin: "", chainID: block.chainid}); + IZRC20(zrc20).transfer(target, amount); + zContract(target).onCrossChainCall(context, zrc20, amount, message); + } +} diff --git a/test/ERC20Custody.spec.ts b/test/ERC20Custody.spec.ts new file mode 100644 index 00000000..82488a81 --- /dev/null +++ b/test/ERC20Custody.spec.ts @@ -0,0 +1,279 @@ +import { MaxUint256 } from "@ethersproject/constants"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { AttackerContract, ERC20Custody, ERC20Mock, ZetaEth } from "@typechain-types"; +import { expect } from "chai"; +import { parseEther } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { deployZetaEth } from "../lib/contracts.helpers"; + +const ZETA_FEE = parseEther("0.01"); +const ZETA_MAX_FEE = parseEther("0.05"); + +describe("ERC20Custody tests", () => { + let ZRC20CustodyContract: ERC20Custody; + let zetaTokenEthContract: ZetaEth; + let randomTokenContract: ERC20Mock; + let owner: SignerWithAddress; + let tssUpdater: SignerWithAddress; + let tssSigner: SignerWithAddress; + let addrs: SignerWithAddress[]; + + beforeEach(async () => { + [owner, tssUpdater, tssSigner, ...addrs] = await ethers.getSigners(); + + zetaTokenEthContract = await deployZetaEth({ + args: [tssUpdater.address, 100_000], + }); + + await zetaTokenEthContract.connect(tssUpdater).transfer(owner.address, parseEther("1000")); + + const ERC20Factory = await ethers.getContractFactory("ERC20Mock"); + randomTokenContract = (await ERC20Factory.deploy( + "RandomToken", + "RT", + owner.address, + parseEther("1000000") + )) as ERC20Mock; + + const ERC20CustodyFactory = await ethers.getContractFactory("ERC20Custody"); + ZRC20CustodyContract = (await ERC20CustodyFactory.deploy( + tssSigner.address, + tssUpdater.address, + ZETA_FEE, + ZETA_MAX_FEE, + zetaTokenEthContract.address + )) as ERC20Custody; + }); + + describe("ERC20Custody", () => { + it("Should update the tss address", async () => { + await ZRC20CustodyContract.connect(tssUpdater).updateTSSAddress(addrs[0].address); + const tssAddress = await ZRC20CustodyContract.TSSAddress(); + expect(tssAddress).to.equal(addrs[0].address); + }); + + it("Should revert if updateTSSAddress not called by tssUpdater", async () => { + const tx = ZRC20CustodyContract.connect(owner).updateTSSAddress(addrs[0].address); + await expect(tx).to.be.revertedWith("InvalidTSSUpdater"); + }); + + it("Should update zeta fee", async () => { + await ZRC20CustodyContract.connect(tssSigner).updateZetaFee(parseEther("0.02")); + const zetaFee = await ZRC20CustodyContract.zetaFee(); + expect(zetaFee).to.equal(parseEther("0.02")); + }); + + it("Should revert if updateZetaFee not called by tssUpdater", async () => { + const tx = ZRC20CustodyContract.connect(tssUpdater).updateZetaFee(parseEther("0.02")); + await expect(tx).to.be.revertedWith("InvalidSender"); + }); + + it("Should revert if updateZetaFee is higher than max", async () => { + const tx = ZRC20CustodyContract.connect(tssSigner).updateZetaFee(parseEther("0.07")); + await expect(tx).to.be.revertedWith("ZetaMaxFeeExceeded"); + }); + + it("Should renounce tssUpdater", async () => { + await ZRC20CustodyContract.connect(tssUpdater).renounceTSSAddressUpdater(); + const tssUpdaterAddress = await ZRC20CustodyContract.TSSAddressUpdater(); + expect(tssUpdaterAddress).to.equal(tssSigner.address); + }); + + it("Should whitelist", async () => { + let isWhitelisted = await ZRC20CustodyContract.whitelisted(addrs[0].address); + expect(isWhitelisted).to.equal(false); + + await ZRC20CustodyContract.connect(tssSigner).whitelist(addrs[0].address); + isWhitelisted = await ZRC20CustodyContract.whitelisted(addrs[0].address); + expect(isWhitelisted).to.equal(true); + }); + + it("Should revert if whitelist is not called by tss", async () => { + const tx = ZRC20CustodyContract.connect(tssUpdater).whitelist(addrs[0].address); + await expect(tx).to.be.revertedWith("InvalidSender"); + }); + + it("Should unwhitelist", async () => { + let isWhitelisted = await ZRC20CustodyContract.whitelisted(addrs[0].address); + expect(isWhitelisted).to.equal(false); + + await ZRC20CustodyContract.connect(tssSigner).whitelist(addrs[0].address); + isWhitelisted = await ZRC20CustodyContract.whitelisted(addrs[0].address); + expect(isWhitelisted).to.equal(true); + + await ZRC20CustodyContract.connect(tssSigner).unwhitelist(addrs[0].address); + isWhitelisted = await ZRC20CustodyContract.whitelisted(addrs[0].address); + expect(isWhitelisted).to.equal(false); + }); + + it("Should revert if unwhitelist is not called by tss", async () => { + await ZRC20CustodyContract.connect(tssSigner).whitelist(addrs[0].address); + const tx = ZRC20CustodyContract.connect(tssUpdater).unwhitelist(addrs[0].address); + await expect(tx).to.be.revertedWith("InvalidSender"); + }); + + it("Should emit Deposit event on deposit", async () => { + await ZRC20CustodyContract.connect(tssSigner).whitelist(randomTokenContract.address); + await zetaTokenEthContract.approve(ZRC20CustodyContract.address, MaxUint256); + + const amount = parseEther("1"); + await randomTokenContract.approve(ZRC20CustodyContract.address, amount); + + const tx = ZRC20CustodyContract.deposit(owner.address, randomTokenContract.address, amount, "0x00"); + await expect(tx) + .to.emit(ZRC20CustodyContract, "Deposited") + .withArgs(owner.address.toLowerCase(), randomTokenContract.address, amount, "0x00"); + }); + + it("Should emit Deposit event and do the right math if is called twice", async () => { + await ZRC20CustodyContract.connect(tssSigner).whitelist(randomTokenContract.address); + await zetaTokenEthContract.approve(ZRC20CustodyContract.address, MaxUint256); + + const amount = parseEther("1"); + await randomTokenContract.approve(ZRC20CustodyContract.address, amount); + + const tx = ZRC20CustodyContract.deposit(owner.address, randomTokenContract.address, amount, "0x00"); + await expect(tx) + .to.emit(ZRC20CustodyContract, "Deposited") + .withArgs(owner.address.toLowerCase(), randomTokenContract.address, amount, "0x00"); + + const amount2 = parseEther("5"); + await randomTokenContract.approve(ZRC20CustodyContract.address, amount2); + + const tx2 = ZRC20CustodyContract.deposit(owner.address, randomTokenContract.address, amount2, "0x00"); + await expect(tx2) + .to.emit(ZRC20CustodyContract, "Deposited") + .withArgs(owner.address.toLowerCase(), randomTokenContract.address, amount2, "0x00"); + }); + + it("Should revert deposit if is paused", async () => { + await ZRC20CustodyContract.connect(tssSigner).pause(); + await ZRC20CustodyContract.connect(tssSigner).whitelist(randomTokenContract.address); + await zetaTokenEthContract.approve(ZRC20CustodyContract.address, MaxUint256); + + const amount = parseEther("1"); + await randomTokenContract.approve(ZRC20CustodyContract.address, amount); + + const tx = ZRC20CustodyContract.deposit(owner.address, randomTokenContract.address, amount, "0x00"); + await expect(tx).to.be.revertedWith("IsPaused"); + }); + + it("Should revert deposit if is not whitelisted", async () => { + await zetaTokenEthContract.approve(ZRC20CustodyContract.address, MaxUint256); + + const amount = parseEther("1"); + await randomTokenContract.approve(ZRC20CustodyContract.address, amount); + + const tx = ZRC20CustodyContract.deposit(owner.address, randomTokenContract.address, amount, "0x00"); + await expect(tx).to.be.revertedWith("NotWhitelisted"); + }); + + it("Should revert deposit if has no zeta to pay fee", async () => { + await ZRC20CustodyContract.connect(tssSigner).whitelist(randomTokenContract.address); + await zetaTokenEthContract.connect(addrs[0]).approve(ZRC20CustodyContract.address, MaxUint256); + + const amount = parseEther("1"); + await randomTokenContract.connect(addrs[0]).approve(ZRC20CustodyContract.address, amount); + + const tx = ZRC20CustodyContract.connect(addrs[0]).deposit( + owner.address, + randomTokenContract.address, + amount, + "0x00" + ); + await expect(tx).to.be.revertedWith("ERC20: transfer amount exceeds balance"); + }); + + it("Should emit Withdrawn event", async () => { + await ZRC20CustodyContract.connect(tssSigner).whitelist(randomTokenContract.address); + + const amount = parseEther("1"); + await randomTokenContract.transfer(ZRC20CustodyContract.address, amount); + + const tx = ZRC20CustodyContract.connect(tssSigner).withdraw(owner.address, randomTokenContract.address, amount); + await expect(tx) + .to.emit(ZRC20CustodyContract, "Withdrawn") + .withArgs(owner.address, randomTokenContract.address, amount); + }); + + it("Should revert if withdraw is not called by tss", async () => { + await ZRC20CustodyContract.connect(tssSigner).whitelist(randomTokenContract.address); + + const amount = parseEther("1"); + await randomTokenContract.transfer(ZRC20CustodyContract.address, amount); + + const tx = ZRC20CustodyContract.withdraw(owner.address, randomTokenContract.address, amount); + await expect(tx).to.be.revertedWith("InvalidSender"); + }); + + it("Should not revert withdraw if is paused", async () => { + await ZRC20CustodyContract.connect(tssSigner).pause(); + await ZRC20CustodyContract.connect(tssSigner).whitelist(randomTokenContract.address); + + const amount = parseEther("1"); + await randomTokenContract.transfer(ZRC20CustodyContract.address, amount); + + const tx = ZRC20CustodyContract.connect(tssSigner).withdraw(owner.address, randomTokenContract.address, amount); + await expect(tx) + .to.emit(ZRC20CustodyContract, "Withdrawn") + .withArgs(owner.address, randomTokenContract.address, amount); + }); + + it("Should revert withdraw if is not whitelisted", async () => { + const amount = parseEther("1"); + const tx = ZRC20CustodyContract.connect(tssSigner).withdraw(owner.address, randomTokenContract.address, amount); + await expect(tx).to.be.revertedWith("NotWhitelisted"); + }); + + it("Should not allow reentrant calls to Deposit method", async () => { + // Deploy AttackerContract with the address of the ZRC20CustodyContract + const Attacker = await ethers.getContractFactory("AttackerContract"); + const attacker = (await Attacker.deploy( + ZRC20CustodyContract.address, + zetaTokenEthContract.address, + 1 + )) as AttackerContract; + await attacker.deployed(); + + // Whitelist token and approve as before + await ZRC20CustodyContract.connect(tssSigner).whitelist(attacker.address); + + await zetaTokenEthContract.approve(ZRC20CustodyContract.address, MaxUint256); + await zetaTokenEthContract.transfer(attacker.address, parseEther("1")); + + const amount = parseEther("1"); + + // Attempt to attack by calling the deposit method reentrantly + const attackTx = ZRC20CustodyContract.deposit(owner.address, attacker.address, amount, "0x00"); + + // The test expects the attack to fail due to the reentrancy guard + await expect(attackTx).to.be.revertedWith("ReentrancyGuard: reentrant call"); + }); + + it("Should not allow reentrant calls to Witdraw method", async () => { + // Deploy AttackerContract with the address of the ZRC20CustodyContract + const Attacker = await ethers.getContractFactory("AttackerContract"); + const attacker = (await Attacker.deploy( + ZRC20CustodyContract.address, + zetaTokenEthContract.address, + 2 + )) as AttackerContract; + await attacker.deployed(); + + // Whitelist token and approve as before + await ZRC20CustodyContract.connect(tssSigner).whitelist(attacker.address); + + await zetaTokenEthContract.approve(ZRC20CustodyContract.address, MaxUint256); + await zetaTokenEthContract.transfer(attacker.address, parseEther("1")); + + const amount = parseEther("1"); + + // Attempt to attack by calling the deposit method reentrantly + const attackTx = ZRC20CustodyContract.connect(tssSigner).withdraw(owner.address, attacker.address, amount); + + // The test expects the attack to fail due to the reentrancy guard + await expect(attackTx).to.be.revertedWith("ReentrancyGuard: reentrant call"); + }); + }); +}); diff --git a/test/ImmutableCreate2Factory.spec.ts b/test/ImmutableCreate2Factory.spec.ts deleted file mode 100644 index 3c713ed1..00000000 --- a/test/ImmutableCreate2Factory.spec.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -import { - IERC20__factory, - ImmutableCreate2Factory, - ImmutableCreate2Factory__factory, - ZetaEth__factory, - ZetaInteractorMock__factory, -} from "@typechain-types"; -import chai, { expect } from "chai"; -import { parseEther } from "ethers/lib/utils"; -import { ethers } from "hardhat"; - -import { MAX_ETH_ADDRESS } from "../lib/contracts.constants"; -import { - buildBytecode, - buildCreate2Address, - deployContractToAddress, - isDeployed, - saltToHex, -} from "../lib/ImmutableCreate2Factory/ImmutableCreate2Factory.helpers"; - -chai.should(); - -describe("Deterministic deployment tests", () => { - let immutableCreate2: ImmutableCreate2Factory; - - let accounts: SignerWithAddress[]; - let signer: SignerWithAddress; - - beforeEach(async () => { - accounts = await ethers.getSigners(); - [signer] = accounts; - - const immutableCreate2Factory = new ImmutableCreate2Factory__factory(signer); - immutableCreate2 = await immutableCreate2Factory.deploy(); - }); - - describe("Deploy zeta token with deterministic deployment", () => { - it("Should deploy a contract", async () => { - const salthex = saltToHex("hola", signer.address); - const constructorTypes = ["address", "uint256"]; - const constructorArgs = [signer.address, "2100000000"]; - const contractBytecode = ZetaEth__factory.bytecode; - - const bytecode = buildBytecode(constructorTypes, constructorArgs, contractBytecode); - const expectedAddress = await immutableCreate2.findCreate2Address(salthex, bytecode); - - // Deploy contract - const { address } = await deployContractToAddress({ - constructorArgs: constructorArgs, - constructorTypes: constructorTypes, - contractBytecode: ZetaEth__factory.bytecode, - factoryAddress: immutableCreate2.address, - salt: salthex, - signer: signer, - }); - - expect(address).to.be.eq(expectedAddress); - - // Query if contract deployed at address - const success = await isDeployed(address, ethers.provider); - expect(success).to.be.true; - - const token = IERC20__factory.connect(address, signer); - const totalSup = await token.totalSupply(); - expect(totalSup.toString()).to.be.eq(parseEther(constructorArgs[1])); - }); - }); - - it("Should deploy with leading zeros", async () => { - let saltStr = "0"; - - let minAddress = MAX_ETH_ADDRESS; - let minAddressSalt = ""; - for (let i = 0; i < 3000; i++) { - const salthex = saltToHex(saltStr, signer.address); - const constructorTypes = ["address", "uint256"]; - const constructorArgs = [signer.address, "2100000000"]; - const contractBytecode = ZetaEth__factory.bytecode; - - const bytecode = buildBytecode(constructorTypes, constructorArgs, contractBytecode); - const expectedAddress = buildCreate2Address(salthex, bytecode, immutableCreate2.address); - if (expectedAddress < minAddress) { - minAddress = expectedAddress; - minAddressSalt = saltStr; - } - saltStr = i.toString(); - } - - expect(minAddress.substring(0, 4)).to.be.eq("0x00"); - }); - - it("Should generate same address offchain and onchain", async () => { - let saltStr = "0"; - - const salthex = saltToHex(saltStr, signer.address); - const constructorTypes = ["address", "uint256"]; - const constructorArgs = [signer.address, "2100000000"]; - const contractBytecode = ZetaEth__factory.bytecode; - - const bytecode = buildBytecode(constructorTypes, constructorArgs, contractBytecode); - const expectedAddress = await immutableCreate2.findCreate2Address(salthex, bytecode); - const expectedAddressOffchain = buildCreate2Address(salthex, bytecode, immutableCreate2.address); - expect(expectedAddress.toLocaleLowerCase()).to.be.eq(expectedAddressOffchain); - }); - - it("Should deploy and transfer ownership to deployer", async () => { - let saltStr = "0"; - - const salthex = saltToHex(saltStr, signer.address); - const constructorTypes = ["address"]; - const constructorArgs = [signer.address]; - - const { address } = await deployContractToAddress({ - constructorArgs: constructorArgs, - constructorTypes: constructorTypes, - contractBytecode: ZetaInteractorMock__factory.bytecode, - factoryAddress: immutableCreate2.address, - salt: salthex, - signer: signer, - transferOwner: true, - }); - - const contract = ZetaInteractorMock__factory.connect(address, signer); - await contract.acceptOwnership(); - expect(await contract.owner()).to.be.eq(signer.address); - }); -}); diff --git a/test/ZRC20.spec.ts b/test/ZRC20.spec.ts new file mode 100644 index 00000000..299440d5 --- /dev/null +++ b/test/ZRC20.spec.ts @@ -0,0 +1,117 @@ +import { AddressZero } from "@ethersproject/constants"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { SystemContract, ZRC20 } from "@typechain-types"; +import { expect } from "chai"; +import { parseEther } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +const hre = require("hardhat"); + +describe("ZRC20 tests", () => { + let ZRC20Contract: ZRC20; + let systemContract: SystemContract; + let owner, fungibleModuleSigner: SignerWithAddress; + let addrs: SignerWithAddress[]; + + beforeEach(async () => { + [owner, ...addrs] = await ethers.getSigners(); + + const FUNGIBLE_MODULE_ADDRESS = "0x735b14BB79463307AAcBED86DAf3322B1e6226aB"; + + // Impersonate the fungible module account + await hre.network.provider.request({ + method: "hardhat_impersonateAccount", + params: [FUNGIBLE_MODULE_ADDRESS], + }); + + // Get a signer for the fungible module account + fungibleModuleSigner = await ethers.getSigner(FUNGIBLE_MODULE_ADDRESS); + hre.network.provider.send("hardhat_setBalance", [FUNGIBLE_MODULE_ADDRESS, parseEther("1000000").toHexString()]); + + const SystemContractFactory = await ethers.getContractFactory("MockSystemContract"); + systemContract = (await SystemContractFactory.deploy(AddressZero, AddressZero, AddressZero)) as SystemContract; + + const ZRC20Factory = await ethers.getContractFactory("ZRC20"); + ZRC20Contract = (await ZRC20Factory.connect(fungibleModuleSigner).deploy( + "TOKEN", + "TKN", + 18, + 1, + 1, + 0, + systemContract.address + )) as ZRC20; + }); + + describe("ZRC20Contract", () => { + it("Should return name", async () => { + const name = await ZRC20Contract.name(); + expect(name).to.equal("TOKEN"); + }); + + it("Should return symbol", async () => { + const symbol = await ZRC20Contract.symbol(); + expect(symbol).to.equal("TKN"); + }); + + it("Should return decimals", async () => { + const decimals = await ZRC20Contract.decimals(); + expect(decimals).to.equal(18); + }); + + it("Should return chainId", async () => { + const chainId = await ZRC20Contract.CHAIN_ID(); + expect(chainId).to.equal(1); + }); + + it("Should return coinType", async () => { + const coinType = await ZRC20Contract.COIN_TYPE(); + expect(coinType).to.equal(1); + }); + + it("Should return gasLimit", async () => { + const gasLimit = await ZRC20Contract.GAS_LIMIT(); + expect(gasLimit).to.equal(0); + }); + + it("Should return systemContractAddress", async () => { + const systemContractAddress = await ZRC20Contract.SYSTEM_CONTRACT_ADDRESS(); + expect(systemContractAddress).to.equal(systemContract.address); + }); + + it("Should return totalSupply", async () => { + const totalSupply = await ZRC20Contract.totalSupply(); + expect(totalSupply).to.equal(0); + }); + + it("Should return balanceOf", async () => { + const balanceOf = await ZRC20Contract.balanceOf(owner.address); + expect(balanceOf).to.equal(0); + }); + + it("Should return allowance", async () => { + const allowance = await ZRC20Contract.allowance(owner.address, owner.address); + expect(allowance).to.equal(0); + }); + + it("Should deposit if is called by fungible module", async () => { + const deposit = await ZRC20Contract.connect(fungibleModuleSigner).deposit(owner.address, parseEther("1")); + expect(deposit).to.emit(ZRC20Contract, "Deposit").withArgs(owner.address, parseEther("1")); + }); + + it("Should not deposit if is not called by fungible module", async () => { + const depositTx = ZRC20Contract.connect(addrs[0]).deposit(owner.address, parseEther("1")); + await expect(depositTx).to.be.revertedWith("InvalidSender"); + }); + + it("Should transfer", async () => { + await ZRC20Contract.connect(fungibleModuleSigner).deposit(owner.address, parseEther("1")); + const initialBalance = await ZRC20Contract.balanceOf(addrs[0].address); + + const transfer = await ZRC20Contract.connect(owner).transfer(addrs[0].address, parseEther("1")); + expect(transfer).to.emit(ZRC20Contract, "Transfer").withArgs(owner.address, addrs[0].address, parseEther("1")); + + const finalBalance = await ZRC20Contract.balanceOf(addrs[0].address); + expect(finalBalance.sub(initialBalance)).to.equal(parseEther("1")); + }); + }); +}); diff --git a/test/Zeta.non-eth.spec.ts b/test/Zeta.non-eth.spec.ts deleted file mode 100644 index d007a020..00000000 --- a/test/Zeta.non-eth.spec.ts +++ /dev/null @@ -1,155 +0,0 @@ -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -import { ZetaConnectorNonEth, ZetaNonEth, ZetaReceiverMock } from "@typechain-types"; -import { expect } from "chai"; -import { parseEther } from "ethers/lib/utils"; -import { ethers } from "hardhat"; - -import { deployZetaConnectorNonEth, deployZetaNonEth, deployZetaReceiverMock } from "../lib/contracts.helpers"; - -describe("ZetaNonEth tests", () => { - let zetaTokenNonEthContract: ZetaNonEth; - let zetaReceiverMockContract: ZetaReceiverMock; - let zetaConnectorNonEthContract: ZetaConnectorNonEth; - let tssUpdater: SignerWithAddress; - let tssSigner: SignerWithAddress; - let randomSigner: SignerWithAddress; - let pauserSigner: SignerWithAddress; - - const tssUpdaterApproveConnectorNonEth = async () => { - await (await zetaTokenNonEthContract.approve(zetaConnectorNonEthContract.address, parseEther("100000"))).wait(); - }; - - const mint100kZetaNonEth = async (transferTo: string) => { - const zeta100k = parseEther("100000"); - - await ( - await zetaConnectorNonEthContract - .connect(tssSigner) - .onReceive(randomSigner.address, 1, transferTo, zeta100k, [], ethers.constants.HashZero) - ).wait(); - }; - - const transfer100kZetaNonEth = async (transferTo: string) => { - await mint100kZetaNonEth(tssUpdater.address); - - await (await zetaTokenNonEthContract.connect(tssUpdater).transfer(transferTo, 100_000)).wait(); - }; - - beforeEach(async () => { - const accounts = await ethers.getSigners(); - [tssUpdater, tssSigner, randomSigner, pauserSigner] = accounts; - - zetaTokenNonEthContract = await deployZetaNonEth({ - args: [tssSigner.address, tssUpdater.address], - }); - - zetaReceiverMockContract = await deployZetaReceiverMock(); - zetaConnectorNonEthContract = await deployZetaConnectorNonEth({ - args: [zetaTokenNonEthContract.address, tssSigner.address, tssUpdater.address, pauserSigner.address], - }); - - await zetaTokenNonEthContract.updateTssAndConnectorAddresses( - tssSigner.address, - zetaConnectorNonEthContract.address - ); - - await mint100kZetaNonEth(tssUpdater.address); - }); - - describe("updateTssAndConnectorAddresses", () => { - it("Should revert if the caller is not tssAddressUpdater or TSS", async () => { - expect( - zetaTokenNonEthContract - .connect(randomSigner) - .updateTssAndConnectorAddresses(randomSigner.address, zetaConnectorNonEthContract.address) - ).to.be.revertedWith(`CallerIsNotTssOrUpdater("${randomSigner.address}")`); - }); - - it("Should change the addresses if the caller is tssAddressUpdater", async () => { - await ( - await zetaTokenNonEthContract.updateTssAndConnectorAddresses(randomSigner.address, randomSigner.address) - ).wait(); - - expect(await zetaTokenNonEthContract.tssAddress()).to.equal(randomSigner.address); - expect(await zetaTokenNonEthContract.connectorAddress()).to.equal(randomSigner.address); - }); - - it("Should change the addresses if the caller is TSS", async () => { - await ( - await zetaTokenNonEthContract - .connect(tssSigner) - .updateTssAndConnectorAddresses(randomSigner.address, randomSigner.address) - ).wait(); - - expect(await zetaTokenNonEthContract.tssAddress()).to.equal(randomSigner.address); - expect(await zetaTokenNonEthContract.connectorAddress()).to.equal(randomSigner.address); - }); - }); - - describe("renounceTssAddressUpdater", () => { - it("Should revert if the caller is not tssAddressUpdater", async () => { - expect(zetaTokenNonEthContract.connect(randomSigner).renounceTssAddressUpdater()).to.be.revertedWith( - `CallerIsNotTssUpdater("${randomSigner.address}")` - ); - }); - - it("Should change tssAddressUpdater to tssAddress if the caller is tssAddressUpdater", async () => { - await (await zetaTokenNonEthContract.renounceTssAddressUpdater()).wait(); - - expect(await zetaTokenNonEthContract.tssAddressUpdater()).to.equal(tssSigner.address); - }); - }); - - describe("mint", () => { - it("Should revert if the caller is not the Connector contract", async () => { - expect( - zetaTokenNonEthContract.connect(randomSigner).mint(tssUpdater.address, 100_000, ethers.constants.AddressZero) - ).to.be.revertedWith(`CallerIsNotConnector("${randomSigner.address}")`); - }); - - it("Should emit `Minted` on success", async () => { - const zetaMintedFilter = zetaTokenNonEthContract.filters.Minted(); - - const tx = await zetaConnectorNonEthContract - .connect(tssSigner) - .onReceive( - randomSigner.address, - 1, - zetaReceiverMockContract.address, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ); - const receipt = await tx.wait(); - - const events = await zetaTokenNonEthContract.queryFilter(zetaMintedFilter, receipt.blockHash); - expect(events.length).to.equal(1); - }); - }); - - describe("burnFrom", () => { - it("Should revert if the caller is not the Connector contract", async () => { - expect(zetaTokenNonEthContract.connect(randomSigner).burnFrom(tssUpdater.address, 100_000)).to.be.revertedWith( - `CallerIsNotConnector("${randomSigner.address}")` - ); - }); - - it("Should emit `Burnt` on success", async () => { - await tssUpdaterApproveConnectorNonEth(); - const zetaBurntFilter = zetaTokenNonEthContract.filters.Burnt(); - - const tx = await zetaConnectorNonEthContract.send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 1000, - }); - const receipt = await tx.wait(); - - const events = await zetaTokenNonEthContract.queryFilter(zetaBurntFilter, receipt.blockHash); - expect(events.length).to.equal(1); - }); - }); -}); diff --git a/test/ZetaConnector.spec.ts b/test/ZetaConnector.spec.ts deleted file mode 100644 index 380a8d67..00000000 --- a/test/ZetaConnector.spec.ts +++ /dev/null @@ -1,855 +0,0 @@ -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -import { - ZetaConnectorBase, - ZetaConnectorEth, - ZetaConnectorNonEth, - ZetaEth, - ZetaNonEth, - ZetaReceiverMock, -} from "@typechain-types"; -import { expect } from "chai"; -import { parseEther } from "ethers/lib/utils"; -import { ethers } from "hardhat"; - -import { - deployZetaConnectorBase, - deployZetaConnectorEth, - deployZetaConnectorNonEth, - deployZetaEth, - deployZetaNonEth, - deployZetaReceiverMock, -} from "../lib/contracts.helpers"; - -describe("ZetaConnector tests", () => { - let zetaTokenEthContract: ZetaEth; - let zetaTokenNonEthContract: ZetaNonEth; - let zetaConnectorBaseContract: ZetaConnectorBase; - let zetaConnectorEthContract: ZetaConnectorEth; - let zetaReceiverMockContract: ZetaReceiverMock; - let zetaConnectorNonEthContract: ZetaConnectorNonEth; - - let tssUpdater: SignerWithAddress; - let tssSigner: SignerWithAddress; - let randomSigner: SignerWithAddress; - let pauserSigner: SignerWithAddress; - - const tssUpdaterApproveConnectorEth = async () => { - await (await zetaTokenEthContract.approve(zetaConnectorEthContract.address, parseEther("100000"))).wait(); - }; - - const tssUpdaterApproveConnectorNonEth = async () => { - await (await zetaTokenNonEthContract.approve(zetaConnectorNonEthContract.address, parseEther("100000"))).wait(); - }; - - const transfer100kZetaEth = async (transferTo: string) => { - await (await zetaTokenEthContract.transfer(transferTo, 100_000)).wait(); - }; - - const mint100kZetaNonEth = async (transferTo: string) => { - const zeta100k = parseEther("100000"); - - await ( - await zetaConnectorNonEthContract - .connect(tssSigner) - .onReceive(randomSigner.address, 1, transferTo, zeta100k, [], ethers.constants.HashZero) - ).wait(); - }; - - const transfer100kZetaNonEth = async (transferTo: string) => { - await mint100kZetaNonEth(tssUpdater.address); - - await (await zetaTokenNonEthContract.connect(tssUpdater).transfer(transferTo, 100_000)).wait(); - }; - - beforeEach(async () => { - const accounts = await ethers.getSigners(); - [tssUpdater, tssSigner, randomSigner, pauserSigner] = accounts; - - zetaTokenEthContract = await deployZetaEth({ - args: [tssUpdater.address, 100_000], - }); - - zetaTokenNonEthContract = await deployZetaNonEth({ - args: [tssSigner.address, tssUpdater.address], - }); - - zetaReceiverMockContract = await deployZetaReceiverMock(); - zetaConnectorBaseContract = await deployZetaConnectorBase({ - args: [zetaTokenEthContract.address, tssSigner.address, tssUpdater.address, pauserSigner.address], - }); - zetaConnectorEthContract = await deployZetaConnectorEth({ - args: [zetaTokenEthContract.address, tssSigner.address, tssUpdater.address, pauserSigner.address], - }); - zetaConnectorNonEthContract = await deployZetaConnectorNonEth({ - args: [zetaTokenNonEthContract.address, tssSigner.address, tssUpdater.address, pauserSigner.address], - }); - - await zetaTokenNonEthContract.updateTssAndConnectorAddresses( - tssSigner.address, - zetaConnectorNonEthContract.address - ); - - await mint100kZetaNonEth(tssUpdater.address); - }); - - describe("ZetaConnector.base", () => { - describe("updateTssAddress", () => { - it("Should revert if the caller is not TSS or TSS updater", async () => { - await expect(zetaConnectorBaseContract.connect(randomSigner).updateTssAddress(randomSigner.address)) - .to.revertedWith("CallerIsNotTssOrUpdater") - .withArgs(randomSigner.address); - }); - - it("Should revert if the new TSS address is invalid", async () => { - await expect( - zetaConnectorBaseContract.updateTssAddress("0x0000000000000000000000000000000000000000") - ).to.revertedWith("InvalidAddress"); - }); - - it("Should change the TSS address if called by TSS", async () => { - await (await zetaConnectorBaseContract.connect(tssSigner).updateTssAddress(randomSigner.address)).wait(); - - const address = await zetaConnectorBaseContract.tssAddress(); - - expect(address).to.equal(randomSigner.address); - }); - - it("Should change the TSS address if called by TSS updater", async () => { - await (await zetaConnectorBaseContract.updateTssAddress(randomSigner.address)).wait(); - - const address = await zetaConnectorBaseContract.tssAddress(); - - expect(address).to.equal(randomSigner.address); - }); - }); - - describe("updatePauserAddress", () => { - it("Should revert if the caller is not the Pauser", async () => { - await expect(zetaConnectorBaseContract.connect(randomSigner).updatePauserAddress(randomSigner.address)) - .to.revertedWith("CallerIsNotPauser") - .withArgs(randomSigner.address); - }); - - it("Should revert if the new Pauser address is invalid", async () => { - await expect( - zetaConnectorBaseContract - .connect(pauserSigner) - .updatePauserAddress("0x0000000000000000000000000000000000000000") - ).to.revertedWith("InvalidAddress"); - }); - - it("Should change the Pauser address if called by Pauser", async () => { - await (await zetaConnectorBaseContract.connect(pauserSigner).updatePauserAddress(randomSigner.address)).wait(); - - const address = await zetaConnectorBaseContract.pauserAddress(); - - expect(address).to.equal(randomSigner.address); - }); - - it("Should emit `PauserAddressUpdated` on success", async () => { - const pauserAddressUpdatedFilter = zetaConnectorBaseContract.filters.PauserAddressUpdated(); - - const tx = await zetaConnectorBaseContract.connect(pauserSigner).updatePauserAddress(randomSigner.address); - const receipt = await tx.wait(); - - const address = await zetaConnectorBaseContract.pauserAddress(); - - expect(address).to.equal(randomSigner.address); - - const event = await zetaConnectorBaseContract.queryFilter(pauserAddressUpdatedFilter, receipt.blockHash); - expect(event.length).to.equal(1); - }); - }); - - describe("pause, unpause", () => { - it("Should revert if not called by the Pauser", async () => { - await expect(zetaConnectorBaseContract.connect(randomSigner).pause()) - .to.revertedWith("CallerIsNotPauser") - .withArgs(randomSigner.address); - - await expect(zetaConnectorBaseContract.connect(randomSigner).unpause()) - .to.revertedWith("CallerIsNotPauser") - .withArgs(randomSigner.address); - }); - - it("Should pause if called by the Pauser", async () => { - await (await zetaConnectorBaseContract.connect(pauserSigner).pause()).wait(); - const paused1 = await zetaConnectorBaseContract.paused(); - expect(paused1).to.equal(true); - - await (await zetaConnectorBaseContract.connect(pauserSigner).unpause()).wait(); - const paused2 = await zetaConnectorBaseContract.paused(); - expect(paused2).to.equal(false); - }); - }); - }); - - describe("ZetaConnector.eth", () => { - describe("send", () => { - it("Should revert if the contract is paused", async () => { - await (await zetaConnectorEthContract.connect(pauserSigner).pause()).wait(); - const paused1 = await zetaConnectorEthContract.paused(); - expect(paused1).to.equal(true); - - await expect( - zetaConnectorEthContract.send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 1000, - }) - ).to.revertedWith("Pausable: paused"); - }); - - it("Should revert if the zetaTxSender has no enough zeta", async () => { - await ( - await zetaTokenEthContract.connect(randomSigner).approve(zetaConnectorEthContract.address, 100_000) - ).wait(); - - await expect( - zetaConnectorEthContract.connect(randomSigner).send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 1000, - }) - ).to.revertedWith("ERC20: transfer amount exceeds balance"); - }); - - it("Should revert if the zetaTxSender didn't allow ZetaConnector to spend Zeta token", async () => { - await expect( - zetaConnectorEthContract.send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 1000, - }) - ).to.revertedWith("ERC20: insufficient allowance"); - }); - - it("Should transfer Zeta token from the zetaTxSender account to the Connector contract", async () => { - const initialBalanceDeployer = await zetaTokenEthContract.balanceOf(tssUpdater.address); - const initialBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); - - expect(initialBalanceDeployer.toString()).to.equal("100000000000000000000000"); - expect(initialBalanceConnector.toString()).to.equal("0"); - - await tssUpdaterApproveConnectorEth(); - - await ( - await zetaConnectorEthContract.send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 1000, - }) - ).wait(); - - const finalBalanceDeployer = await zetaTokenEthContract.balanceOf(tssUpdater.address); - const finalBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); - - expect(finalBalanceDeployer.toString()).to.equal("99999999999999999999000"); - expect(finalBalanceConnector.toString()).to.equal("1000"); - }); - - it("Should emit `ZetaSent` on success", async () => { - const zetaSentFilter = zetaConnectorEthContract.filters.ZetaSent(); - - const tx = await zetaConnectorEthContract.send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 0, - }); - const receipt = await tx.wait(); - const events = await zetaConnectorEthContract.queryFilter(zetaSentFilter, receipt.blockHash); - expect(events.length).to.equal(1); - }); - - it("Should emit `ZetaSent` with tx.origin as the first parameter", async () => { - const zetaSentFilter = zetaConnectorEthContract.filters.ZetaSent(); - - const tx = await zetaConnectorEthContract.connect(randomSigner).send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 0, - }); - - const receipt = await tx.wait(); - - const events = await zetaConnectorEthContract.queryFilter(zetaSentFilter, receipt.blockHash); - expect(events[0].args[0].toString()).to.equal(randomSigner.address); - }); - }); - - describe("onReceive", () => { - it("Should not revert if the contract is paused", async () => { - await (await zetaConnectorEthContract.connect(pauserSigner).pause()).wait(); - const paused1 = await zetaConnectorEthContract.paused(); - expect(paused1).to.equal(true); - - await expect( - zetaConnectorEthContract - .connect(tssSigner) - .onReceive( - tssUpdater.address, - 1, - zetaReceiverMockContract.address, - 0, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ).to.be.not.reverted; - }); - - it("Should revert if not called by TSS address", async () => { - await expect( - zetaConnectorEthContract.onReceive( - tssUpdater.address, - 1, - randomSigner.address, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ) - .to.revertedWith("CallerIsNotTss") - .withArgs(tssUpdater.address); - }); - - it("Should revert if Zeta transfer fails", async () => { - await expect( - zetaConnectorEthContract - .connect(tssSigner) - .onReceive( - randomSigner.address, - 1, - randomSigner.address, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ).to.revertedWith("ERC20: transfer amount exceeds balance"); - }); - - it("Should transfer to the receiver address", async () => { - await transfer100kZetaEth(zetaConnectorEthContract.address); - - const initialBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); - const initialBalanceReceiver = await zetaTokenEthContract.balanceOf(zetaReceiverMockContract.address); - expect(initialBalanceConnector.toString()).to.equal("100000"); - expect(initialBalanceReceiver.toString()).to.equal("0"); - - await ( - await zetaConnectorEthContract - .connect(tssSigner) - .onReceive( - randomSigner.address, - 1, - zetaReceiverMockContract.address, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ).wait(); - - const finalBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); - const finalBalanceReceiver = await zetaTokenEthContract.balanceOf(zetaReceiverMockContract.address); - - expect(finalBalanceConnector.toString()).to.equal("99000"); - expect(finalBalanceReceiver.toString()).to.equal("1000"); - }); - - it("Should emit `ZetaReceived` on success", async () => { - await transfer100kZetaEth(zetaConnectorEthContract.address); - - const zetaReceivedFilter = zetaConnectorEthContract.filters.ZetaReceived(); - - const tx = await zetaConnectorEthContract - .connect(tssSigner) - .onReceive( - randomSigner.address, - 1, - zetaReceiverMockContract.address, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ); - const receipt = await tx.wait(); - - const events = await zetaConnectorEthContract.queryFilter(zetaReceivedFilter, receipt.blockHash); - expect(events.length).to.equal(1); - }); - }); - - describe("onRevert", () => { - it("Should revert if the contract is paused", async () => { - await (await zetaConnectorEthContract.connect(pauserSigner).pause()).wait(); - const paused1 = await zetaConnectorEthContract.paused(); - expect(paused1).to.equal(true); - - await expect( - zetaConnectorEthContract.onRevert( - randomSigner.address, - 1, - randomSigner.address, - 2, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ).to.revertedWith("Pausable: paused"); - }); - - it("Should revert if not called by TSS address", async () => { - await expect( - zetaConnectorEthContract.onRevert( - randomSigner.address, - 1, - tssUpdater.address, - 1, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ) - .to.revertedWith("CallerIsNotTss") - .withArgs(tssUpdater.address); - }); - - it("Should transfer to the zetaTxSender address", async () => { - await transfer100kZetaEth(zetaConnectorEthContract.address); - - const initialBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); - const initialBalanceZetaTxSender = await zetaTokenEthContract.balanceOf(zetaReceiverMockContract.address); - expect(initialBalanceConnector.toString()).to.equal("100000"); - expect(initialBalanceZetaTxSender.toString()).to.equal("0"); - - await ( - await zetaConnectorEthContract - .connect(tssSigner) - .onRevert( - zetaReceiverMockContract.address, - 1, - randomSigner.address, - 1, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ).wait(); - - const finalBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); - const finalBalanceZetaTxSender = await zetaTokenEthContract.balanceOf(zetaReceiverMockContract.address); - - expect(finalBalanceConnector.toString()).to.equal("99000"); - expect(finalBalanceZetaTxSender.toString()).to.equal("1000"); - }); - - it("Should emit `ZetaReverted` on success", async () => { - await transfer100kZetaEth(zetaConnectorEthContract.address); - - const zetaRevertedFilter = zetaConnectorEthContract.filters.ZetaReverted(); - - const tx = await zetaConnectorEthContract - .connect(tssSigner) - .onRevert( - zetaReceiverMockContract.address, - 1, - randomSigner.address, - 1, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ); - const receipt = await tx.wait(); - - const events = await zetaConnectorEthContract.queryFilter(zetaRevertedFilter, receipt.blockHash); - expect(events.length).to.equal(1); - }); - }); - }); - - describe("ZetaConnector.non-eth", () => { - describe("send", () => { - it("Should revert if the contract is paused", async () => { - await (await zetaConnectorNonEthContract.connect(pauserSigner).pause()).wait(); - const paused1 = await zetaConnectorNonEthContract.paused(); - expect(paused1).to.equal(true); - - await expect( - zetaConnectorNonEthContract.send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 1000, - }) - ).to.revertedWith("Pausable: paused"); - }); - - it("Should revert if the zetaTxSender has no enough zeta", async () => { - await ( - await zetaTokenEthContract.connect(randomSigner).approve(zetaConnectorEthContract.address, 100_000) - ).wait(); - - await expect( - zetaConnectorNonEthContract.connect(randomSigner).send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 1000, - }) - ).to.revertedWith("ERC20: insufficient allowance"); - }); - - it("Should revert if the zetaTxSender didn't allow ZetaConnector to spend Zeta token", async () => { - await expect( - zetaConnectorNonEthContract.send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 1000, - }) - ).to.revertedWith("ERC20: insufficient allowance"); - }); - - it("Should burn Zeta token from the zetaTxSender account", async () => { - const initialBalanceDeployer = await zetaTokenNonEthContract.balanceOf(tssUpdater.address); - expect(initialBalanceDeployer.toString()).to.equal(parseEther("100000")); - - await tssUpdaterApproveConnectorNonEth(); - - await ( - await zetaConnectorNonEthContract.send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: parseEther("1"), - }) - ).wait(); - - const finalBalanceDeployer = await zetaTokenNonEthContract.balanceOf(tssUpdater.address); - expect(finalBalanceDeployer.toString()).to.equal(parseEther("99999")); - }); - - it("Should emit `ZetaSent` on success", async () => { - const zetaSentFilter = zetaConnectorNonEthContract.filters.ZetaSent(); - - const tx = await zetaConnectorNonEthContract.send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 0, - }); - const receipt = await tx.wait(); - - const events = await zetaConnectorNonEthContract.queryFilter(zetaSentFilter, receipt.blockHash); - expect(events.length).to.equal(1); - }); - - it("Should emit `ZetaSent` with tx.origin as the first parameter", async () => { - const zetaSentFilter = zetaConnectorNonEthContract.filters.ZetaSent(); - - const tx = await zetaConnectorNonEthContract.connect(randomSigner).send({ - destinationAddress: randomSigner.address, - destinationChainId: 1, - destinationGasLimit: 2500000, - message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - zetaValueAndGas: 0, - }); - const receipt = await tx.wait(); - - const events = await zetaConnectorNonEthContract.queryFilter(zetaSentFilter, receipt.blockHash); - expect(events[0].args[0].toString()).to.equal(randomSigner.address); - }); - }); - - describe("onReceive", () => { - it("Should not revert if the contract is paused", async () => { - await (await zetaConnectorNonEthContract.connect(pauserSigner).pause()).wait(); - const paused1 = await zetaConnectorNonEthContract.paused(); - expect(paused1).to.equal(true); - - await expect( - zetaConnectorNonEthContract - .connect(tssSigner) - .onReceive( - tssUpdater.address, - 1, - zetaReceiverMockContract.address, - 0, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ).to.be.not.reverted; - }); - - it("Should revert if not called by TSS address", async () => { - await expect( - zetaConnectorNonEthContract.onReceive( - tssUpdater.address, - 1, - randomSigner.address, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ) - .to.revertedWith("CallerIsNotTss") - .withArgs(tssUpdater.address); - }); - - it("Should revert if mint fails", async () => { - /** - * Update TSS and Connector addresses so minting fails - */ - await zetaTokenNonEthContract.updateTssAndConnectorAddresses(tssSigner.address, randomSigner.address); - - await expect( - zetaConnectorNonEthContract - .connect(tssSigner) - .onReceive( - randomSigner.address, - 1, - zetaReceiverMockContract.address, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ) - .to.revertedWith("CallerIsNotConnector") - .withArgs(zetaConnectorNonEthContract.address); - }); - - it("Should mint on the receiver address", async () => { - const initialBalanceReceiver = await zetaTokenNonEthContract.balanceOf(zetaReceiverMockContract.address); - expect(initialBalanceReceiver.toString()).to.equal("0"); - - await ( - await zetaConnectorNonEthContract - .connect(tssSigner) - .onReceive( - randomSigner.address, - 1, - zetaReceiverMockContract.address, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ).wait(); - - const finalBalanceReceiver = await zetaTokenNonEthContract.balanceOf(zetaReceiverMockContract.address); - - expect(finalBalanceReceiver.toString()).to.equal("1000"); - }); - - it("Should emit `ZetaReceived` on success", async () => { - const zetaReceivedFilter = zetaConnectorNonEthContract.filters.ZetaReceived(); - - const tx = await zetaConnectorNonEthContract - .connect(tssSigner) - .onReceive( - randomSigner.address, - 1, - zetaReceiverMockContract.address, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ); - const receipt = await tx.wait(); - - const events = await zetaConnectorNonEthContract.queryFilter(zetaReceivedFilter, receipt.blockHash); - expect(events.length).to.equal(1); - }); - }); - - describe("onRevert", () => { - it("Should revert if the contract is paused", async () => { - await (await zetaConnectorNonEthContract.connect(pauserSigner).pause()).wait(); - const paused1 = await zetaConnectorNonEthContract.paused(); - expect(paused1).to.equal(true); - - await expect( - zetaConnectorNonEthContract.onRevert( - randomSigner.address, - 1, - randomSigner.address, - 2, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ).to.revertedWith("Pausable: paused"); - }); - - it("Should revert if not called by TSS address", async () => { - await expect( - zetaConnectorNonEthContract.onRevert( - randomSigner.address, - 1, - tssUpdater.address, - 1, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ) - .to.revertedWith("CallerIsNotTss") - .withArgs(tssUpdater.address); - }); - - it("Should mint on the zetaTxSender address", async () => { - const initialBalanceZetaTxSender = await zetaTokenNonEthContract.balanceOf(zetaReceiverMockContract.address); - expect(initialBalanceZetaTxSender.toString()).to.equal("0"); - - await ( - await zetaConnectorNonEthContract - .connect(tssSigner) - .onRevert( - zetaReceiverMockContract.address, - 1, - randomSigner.address, - 1, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ).wait(); - - const finalBalanceZetaTxSender = await zetaTokenNonEthContract.balanceOf(zetaReceiverMockContract.address); - expect(finalBalanceZetaTxSender.toString()).to.equal("1000"); - }); - - it("Should emit `ZetaReverted` on success", async () => { - await transfer100kZetaNonEth(zetaConnectorNonEthContract.address); - - const zetaRevertedFilter = zetaConnectorNonEthContract.filters.ZetaReverted(); - - const tx = await zetaConnectorNonEthContract - .connect(tssSigner) - .onRevert( - zetaReceiverMockContract.address, - 1, - randomSigner.address, - 1, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ); - const receipt = await tx.wait(); - - const events = await zetaConnectorNonEthContract.queryFilter(zetaRevertedFilter, receipt.blockHash); - expect(events.length).to.equal(1); - }); - }); - - describe("MaxSupply", () => { - describe("setMaxSupply", () => { - it("Should revert if the caller is not the TSS address", async () => { - await expect(zetaConnectorNonEthContract.connect(randomSigner).setMaxSupply(0)) - .to.revertedWith("CallerIsNotTss") - .withArgs(randomSigner.address); - }); - - it("Should revert if want to mint more than MaxSupply", async () => { - await zetaConnectorNonEthContract.connect(tssSigner).setMaxSupply(999); - await expect( - zetaConnectorNonEthContract - .connect(tssSigner) - .onReceive( - randomSigner.address, - 1, - zetaReceiverMockContract.address, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ) - .to.revertedWith("ExceedsMaxSupply") - .withArgs(999); - }); - }); - - describe("onReceive, onRevert (mint)", () => { - it("Should mint if total supply + supply to add < max supply", async () => { - const supplyToAdd = 1000; - const initialSupply = await zetaTokenNonEthContract.totalSupply(); - - await zetaConnectorNonEthContract.connect(tssSigner).setMaxSupply(initialSupply.add(supplyToAdd)); - - await expect( - zetaConnectorNonEthContract - .connect(tssSigner) - .onReceive( - randomSigner.address, - 1, - zetaReceiverMockContract.address, - supplyToAdd, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ).to.be.not.reverted; - - const finalSupply = await zetaTokenNonEthContract.totalSupply(); - - expect(finalSupply).to.eq(initialSupply.add(supplyToAdd)); - - await expect( - zetaConnectorNonEthContract - .connect(tssSigner) - .onReceive( - randomSigner.address, - 1, - zetaReceiverMockContract.address, - 1, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ) - .to.revertedWith("ExceedsMaxSupply") - .withArgs(initialSupply.add(supplyToAdd)); - - await expect( - zetaConnectorNonEthContract - .connect(tssSigner) - .onRevert( - randomSigner.address, - 1, - randomSigner.address, - 2, - 1000, - new ethers.utils.AbiCoder().encode(["string"], ["hello"]), - ethers.constants.HashZero - ) - ) - .to.revertedWith("ExceedsMaxSupply") - .withArgs(initialSupply.add(supplyToAdd)); - }); - }); - }); - }); -}); diff --git a/test/ZetaInteractor.spec.ts b/test/ZetaInteractor.spec.ts deleted file mode 100644 index 44ed5070..00000000 --- a/test/ZetaInteractor.spec.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -import { ZetaInteractorMock } from "@typechain-types"; -import chai, { expect } from "chai"; -import { ethers } from "hardhat"; - -import { getZetaInteractorMock } from "../lib/contracts.helpers"; - -chai.should(); - -describe("ZetaInteractor tests", () => { - let zetaInteractorMock: ZetaInteractorMock; - const chainAId = 1; - const chainBId = 2; - - let accounts: SignerWithAddress[]; - let deployer: SignerWithAddress; - let crossChainContractB: SignerWithAddress; - let zetaConnector: SignerWithAddress; - - const encoder = new ethers.utils.AbiCoder(); - - beforeEach(async () => { - accounts = await ethers.getSigners(); - [deployer, crossChainContractB, zetaConnector] = accounts; - - zetaInteractorMock = await getZetaInteractorMock(zetaConnector.address); - - const encodedCrossChainAddressB = ethers.utils.solidityPack(["address"], [crossChainContractB.address]); - await (await zetaInteractorMock.setInteractorByChainId(chainBId, encodedCrossChainAddressB)).wait(); - }); - - describe("onCreate", () => { - it("Should revert if constructor param is zero address", async () => { - const Factory = await ethers.getContractFactory("ZetaInteractorMock"); - await expect(Factory.deploy(ethers.constants.AddressZero)).to.be.revertedWith("InvalidAddress"); - }); - - it("Should revert if the zetaTxSenderAddress it not in interactorsByChainId", async () => { - await expect( - zetaInteractorMock.connect(zetaConnector).onZetaMessage({ - destinationAddress: crossChainContractB.address, - message: encoder.encode(["address"], [crossChainContractB.address]), - sourceChainId: chainBId, - zetaTxSenderAddress: ethers.utils.solidityPack(["address"], [zetaInteractorMock.address]), - zetaValue: 0, - }) - ).to.be.revertedWith("InvalidZetaMessageCall"); - }); - }); - - describe("onZetaMessage", () => { - it("Should revert if the caller is not ZetaConnector", async () => { - await expect( - zetaInteractorMock.onZetaMessage({ - destinationAddress: crossChainContractB.address, - message: encoder.encode(["address"], [zetaInteractorMock.address]), - sourceChainId: chainBId, - zetaTxSenderAddress: ethers.utils.solidityPack(["address"], [zetaInteractorMock.address]), - zetaValue: 0, - }) - ) - .to.be.revertedWith("InvalidCaller") - .withArgs(deployer.address); - }); - - it("Should revert if the zetaTxSenderAddress it not in interactorsByChainId", async () => { - await expect( - zetaInteractorMock.connect(zetaConnector).onZetaMessage({ - destinationAddress: crossChainContractB.address, - message: encoder.encode(["address"], [crossChainContractB.address]), - sourceChainId: chainBId, - zetaTxSenderAddress: ethers.utils.solidityPack(["address"], [zetaInteractorMock.address]), - zetaValue: 0, - }) - ).to.be.revertedWith("InvalidZetaMessageCall"); - }); - }); - - describe("onZetaRevert", () => { - it("Should revert if the caller is not ZetaConnector", async () => { - await expect( - zetaInteractorMock.onZetaRevert({ - destinationAddress: ethers.utils.solidityPack(["address"], [crossChainContractB.address]), - destinationChainId: chainBId, - message: encoder.encode(["address"], [zetaInteractorMock.address]), - remainingZetaValue: 0, - sourceChainId: chainAId, - zetaTxSenderAddress: deployer.address, - }) - ) - .to.be.revertedWith("InvalidCaller") - .withArgs(deployer.address); - }); - }); - - describe("transferOwnership", () => { - it("Should transfer ownership", async () => { - const randomSigner = accounts[3]; - await zetaInteractorMock.transferOwnership(randomSigner.address); - await zetaInteractorMock.connect(randomSigner).acceptOwnership(); - await expect(await zetaInteractorMock.owner()).to.be.eq(randomSigner.address); - }); - - it("Should keep the ownership until accept", async () => { - const randomSigner = accounts[3]; - await zetaInteractorMock.transferOwnership(randomSigner.address); - await expect(await zetaInteractorMock.owner()).to.be.eq(deployer.address); - }); - - it("Should revert if old owner want to do some action", async () => { - const randomSigner = accounts[3]; - await zetaInteractorMock.transferOwnership(randomSigner.address); - await zetaInteractorMock.connect(randomSigner).acceptOwnership(); - await expect(zetaInteractorMock.transferOwnership(randomSigner.address)).to.be.revertedWith( - "Ownable: caller is not the owner" - ); - }); - }); -}); diff --git a/test/ZetaTokenConsumer.spec.ts b/test/ZetaTokenConsumer.spec.ts deleted file mode 100644 index 1b592e4b..00000000 --- a/test/ZetaTokenConsumer.spec.ts +++ /dev/null @@ -1,213 +0,0 @@ -import { MaxUint256 } from "@ethersproject/constants"; -import { parseEther, parseUnits } from "@ethersproject/units"; -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -import { - IERC20, - IERC20__factory, - UniswapV2Router02__factory, - ZetaTokenConsumer, - ZetaTokenConsumerUniV2, - ZetaTokenConsumerUniV3, -} from "@typechain-types"; -import chai, { expect } from "chai"; -import { BigNumber } from "ethers"; -import { ethers } from "hardhat"; -import { getNonZetaAddress } from "lib"; - -import { getExternalAddress } from "../lib/address.helpers"; -import { - deployZetaNonEth, - getZetaTokenConsumerUniV2Strategy, - getZetaTokenConsumerUniV3Strategy, -} from "../lib/contracts.helpers"; -import { parseZetaConsumerLog } from "./test.helpers"; - -chai.should(); - -describe("ZetaTokenConsumer tests", () => { - let uniswapV2RouterAddr: string; - let uniswapV3RouterAddr: string; - let USDCAddr: string; - - let zetaTokenConsumerUniV2: ZetaTokenConsumerUniV2; - let zetaTokenConsumerUniV3: ZetaTokenConsumerUniV3; - let zetaTokenNonEthAddress: string; - let zetaTokenNonEth: IERC20; - - let accounts: SignerWithAddress[]; - let tssUpdater: SignerWithAddress; - let tssSigner: SignerWithAddress; - let randomSigner: SignerWithAddress; - - const getNow = async () => { - const block = await ethers.provider.getBlock("latest"); - return block.timestamp; - }; - - const swapToken = async (signer: SignerWithAddress, tokenAddress: string, expectedAmount: BigNumber) => { - const uniswapRouter = UniswapV2Router02__factory.connect(uniswapV2RouterAddr, signer); - const WETH = await uniswapRouter.WETH(); - const path = [WETH, tokenAddress]; - const tx = await uniswapRouter - .connect(signer) - .swapETHForExactTokens(expectedAmount, path, signer.address, (await getNow()) + 360, { value: parseEther("10") }); - await tx.wait(); - }; - - beforeEach(async () => { - accounts = await ethers.getSigners(); - [tssUpdater, tssSigner, randomSigner] = accounts; - - zetaTokenNonEth = await deployZetaNonEth({ - args: [tssSigner.address, tssUpdater.address], - }); - - const DAI = getExternalAddress("dai", { - customNetworkName: "eth_mainnet", - customZetaNetwork: "mainnet", - }); - - USDCAddr = getExternalAddress("usdc", { - customNetworkName: "eth_mainnet", - customZetaNetwork: "mainnet", - }); - - uniswapV2RouterAddr = getNonZetaAddress("uniswapV2Router02", "eth_mainnet"); - - const UNI_FACTORY_V3 = getNonZetaAddress("uniswapV3Factory", "eth_mainnet"); - - const UNI_ROUTER_V3 = getNonZetaAddress("uniswapV3Router", "eth_mainnet"); - - const WETH9 = getNonZetaAddress("weth9", "eth_mainnet"); - - // For testing purposes we use an existing uni v3 pool - await swapToken(tssUpdater, DAI, parseEther("10000")); - await swapToken(randomSigner, DAI, parseEther("10000")); - await swapToken(randomSigner, DAI, parseEther("10000")); - await swapToken(randomSigner, DAI, parseEther("10000")); - await swapToken(randomSigner, DAI, parseEther("10000")); - - zetaTokenNonEthAddress = DAI; - zetaTokenNonEth = IERC20__factory.connect(zetaTokenNonEthAddress, tssSigner); - - zetaTokenConsumerUniV2 = await getZetaTokenConsumerUniV2Strategy({ - deployParams: [zetaTokenNonEthAddress, uniswapV2RouterAddr], - }); - - uniswapV3RouterAddr = UNI_ROUTER_V3; - zetaTokenConsumerUniV3 = await getZetaTokenConsumerUniV3Strategy({ - deployParams: [zetaTokenNonEthAddress, uniswapV3RouterAddr, UNI_FACTORY_V3, WETH9, 3000, 3000], - }); - }); - - describe("getZetaFromEth", () => { - const shouldGetZetaFromETH = async (zetaTokenConsumer: ZetaTokenConsumer) => { - const initialZetaBalance = await zetaTokenNonEth.balanceOf(randomSigner.address); - const tx = await zetaTokenConsumer.getZetaFromEth(randomSigner.address, 1, { value: parseEther("1") }); - - const result = await tx.wait(); - const eventNames = parseZetaConsumerLog(result.logs); - expect(eventNames.filter((e) => e === "EthExchangedForZeta")).to.have.lengthOf(1); - - const finalZetaBalance = await zetaTokenNonEth.balanceOf(randomSigner.address); - expect(finalZetaBalance).to.be.gt(initialZetaBalance); - }; - - it("Should get zeta from eth using UniV2", async () => { - const zetaTokenConsumer = zetaTokenConsumerUniV2.connect(randomSigner); - await shouldGetZetaFromETH(zetaTokenConsumer); - }); - - it("Should get zeta from eth using UniV3", async () => { - const zetaTokenConsumer = zetaTokenConsumerUniV3.connect(randomSigner); - await shouldGetZetaFromETH(zetaTokenConsumer); - }); - }); - - describe("getZetaFromToken", () => { - const shouldGetZetaFromToken = async (zetaTokenConsumer: ZetaTokenConsumer) => { - const USDCContract = IERC20__factory.connect(USDCAddr, randomSigner); - await swapToken(randomSigner, USDCAddr, parseUnits("10000", 6)); - - const initialZetaBalance = await zetaTokenNonEth.balanceOf(randomSigner.address); - const tx1 = await USDCContract.approve(zetaTokenConsumer.address, MaxUint256); - await tx1.wait(); - - const tx2 = await zetaTokenConsumer.getZetaFromToken(randomSigner.address, 1, USDCAddr, parseUnits("100", 6)); - const result = await tx2.wait(); - - const eventNames = parseZetaConsumerLog(result.logs); - expect(eventNames.filter((e) => e === "TokenExchangedForZeta")).to.have.lengthOf(1); - - const finalZetaBalance = await zetaTokenNonEth.balanceOf(randomSigner.address); - expect(finalZetaBalance).to.be.gt(initialZetaBalance); - }; - - it("Should get zeta from token using UniV2", async () => { - const zetaTokenConsumer = zetaTokenConsumerUniV2.connect(randomSigner); - await shouldGetZetaFromToken(zetaTokenConsumer); - }); - - it("Should get zeta from token using UniV3", async () => { - const zetaTokenConsumer = zetaTokenConsumerUniV3.connect(randomSigner); - await shouldGetZetaFromToken(zetaTokenConsumer); - }); - }); - - describe("getEthFromZeta", () => { - const shouldGetETHFromZeta = async (zetaTokenConsumer: ZetaTokenConsumer) => { - const initialEthBalance = await ethers.provider.getBalance(randomSigner.address); - const tx1 = await zetaTokenNonEth.connect(randomSigner).approve(zetaTokenConsumer.address, MaxUint256); - await tx1.wait(); - - const tx2 = await zetaTokenConsumer.getEthFromZeta(randomSigner.address, 1, parseUnits("5000", 18)); - const result = await tx2.wait(); - - const eventNames = parseZetaConsumerLog(result.logs); - expect(eventNames.filter((e) => e === "ZetaExchangedForEth")).to.have.lengthOf(1); - - const finalEthBalance = await ethers.provider.getBalance(randomSigner.address); - expect(finalEthBalance).to.be.gt(initialEthBalance); - }; - - it("Should get eth from zeta using UniV2", async () => { - const zetaTokenConsumer = zetaTokenConsumerUniV2.connect(randomSigner); - await shouldGetETHFromZeta(zetaTokenConsumer); - }); - - it("Should get eth from zeta using UniV3", async () => { - const zetaTokenConsumer = zetaTokenConsumerUniV3.connect(randomSigner); - - await shouldGetETHFromZeta(zetaTokenConsumer); - }); - }); - - describe("getTokenFromZeta", () => { - const shouldGetTokenFromZeta = async (zetaTokenConsumer: ZetaTokenConsumer) => { - const USDCContract = IERC20__factory.connect(USDCAddr, randomSigner); - - const initialTokenBalance = await USDCContract.balanceOf(randomSigner.address); - const tx1 = await zetaTokenNonEth.connect(randomSigner).approve(zetaTokenConsumer.address, MaxUint256); - await tx1.wait(); - - const tx2 = await zetaTokenConsumer.getTokenFromZeta(randomSigner.address, 1, USDCAddr, parseUnits("5000", 18)); - const result = await tx2.wait(); - - const eventNames = parseZetaConsumerLog(result.logs); - expect(eventNames.filter((e) => e === "ZetaExchangedForToken")).to.have.lengthOf(1); - - const finalTokenBalance = await USDCContract.balanceOf(randomSigner.address); - expect(finalTokenBalance).to.be.gt(initialTokenBalance); - }; - - it("Should get token from zeta using UniV2", async () => { - const zetaTokenConsumer = zetaTokenConsumerUniV2.connect(randomSigner); - await shouldGetTokenFromZeta(zetaTokenConsumer); - }); - - it("Should get token from zeta using UniV3", async () => { - const zetaTokenConsumer = zetaTokenConsumerUniV3.connect(randomSigner); - await shouldGetTokenFromZeta(zetaTokenConsumer); - }); - }); -}); diff --git a/test/test.helpers.ts b/test/test.helpers.ts deleted file mode 100644 index 006c5dc0..00000000 --- a/test/test.helpers.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ZetaTokenConsumer__factory } from "@typechain-types"; -import { BigNumber, ContractReceipt } from "ethers"; - -export const parseZetaConsumerLog = (logs: ContractReceipt["logs"]) => { - const iface = ZetaTokenConsumer__factory.createInterface(); - - const eventNames = logs.map((log) => { - try { - const parsedLog = iface.parseLog(log); - - return parsedLog.name; - } catch (e) { - return "NO_ZETA_LOG"; - } - }); - - return eventNames; -}; diff --git a/typechain-types/contracts/evm/testing/AttackerContract.sol/AttackerContract.ts b/typechain-types/contracts/evm/testing/AttackerContract.sol/AttackerContract.ts new file mode 100644 index 00000000..5e8cc96a --- /dev/null +++ b/typechain-types/contracts/evm/testing/AttackerContract.sol/AttackerContract.ts @@ -0,0 +1,214 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import type { FunctionFragment, Result } from "@ethersproject/abi"; +import type { Listener, Provider } from "@ethersproject/providers"; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, + PromiseOrValue, +} from "../../../../common"; + +export interface AttackerContractInterface extends utils.Interface { + functions: { + "balanceOf(address)": FunctionFragment; + "transfer(address,uint256)": FunctionFragment; + "transferFrom(address,address,uint256)": FunctionFragment; + "victimContractAddress()": FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | "balanceOf" + | "transfer" + | "transferFrom" + | "victimContractAddress" + ): FunctionFragment; + + encodeFunctionData( + functionFragment: "balanceOf", + values: [PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "transfer", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "transferFrom", + values: [ + PromiseOrValue, + PromiseOrValue, + PromiseOrValue + ] + ): string; + encodeFunctionData( + functionFragment: "victimContractAddress", + values?: undefined + ): string; + + decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "transfer", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "transferFrom", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "victimContractAddress", + data: BytesLike + ): Result; + + events: {}; +} + +export interface AttackerContract extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: AttackerContractInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + balanceOf( + account: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transfer( + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transferFrom( + from: PromiseOrValue, + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + victimContractAddress(overrides?: CallOverrides): Promise<[string]>; + }; + + balanceOf( + account: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transfer( + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transferFrom( + from: PromiseOrValue, + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + victimContractAddress(overrides?: CallOverrides): Promise; + + callStatic: { + balanceOf( + account: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + transfer( + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + transferFrom( + from: PromiseOrValue, + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + victimContractAddress(overrides?: CallOverrides): Promise; + }; + + filters: {}; + + estimateGas: { + balanceOf( + account: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transfer( + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transferFrom( + from: PromiseOrValue, + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + victimContractAddress(overrides?: CallOverrides): Promise; + }; + + populateTransaction: { + balanceOf( + account: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transfer( + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transferFrom( + from: PromiseOrValue, + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + victimContractAddress( + overrides?: CallOverrides + ): Promise; + }; +} diff --git a/typechain-types/contracts/evm/testing/AttackerContract.sol/Victim.ts b/typechain-types/contracts/evm/testing/AttackerContract.sol/Victim.ts new file mode 100644 index 00000000..57ce0ddc --- /dev/null +++ b/typechain-types/contracts/evm/testing/AttackerContract.sol/Victim.ts @@ -0,0 +1,168 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import type { FunctionFragment, Result } from "@ethersproject/abi"; +import type { Listener, Provider } from "@ethersproject/providers"; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, + PromiseOrValue, +} from "../../../../common"; + +export interface VictimInterface extends utils.Interface { + functions: { + "deposit(bytes,address,uint256,bytes)": FunctionFragment; + "withdraw(address,address,uint256)": FunctionFragment; + }; + + getFunction(nameOrSignatureOrTopic: "deposit" | "withdraw"): FunctionFragment; + + encodeFunctionData( + functionFragment: "deposit", + values: [ + PromiseOrValue, + PromiseOrValue, + PromiseOrValue, + PromiseOrValue + ] + ): string; + encodeFunctionData( + functionFragment: "withdraw", + values: [ + PromiseOrValue, + PromiseOrValue, + PromiseOrValue + ] + ): string; + + decodeFunctionResult(functionFragment: "deposit", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "withdraw", data: BytesLike): Result; + + events: {}; +} + +export interface Victim extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: VictimInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + deposit( + recipient: PromiseOrValue, + asset: PromiseOrValue, + amount: PromiseOrValue, + message: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + withdraw( + recipient: PromiseOrValue, + asset: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + }; + + deposit( + recipient: PromiseOrValue, + asset: PromiseOrValue, + amount: PromiseOrValue, + message: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + withdraw( + recipient: PromiseOrValue, + asset: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + callStatic: { + deposit( + recipient: PromiseOrValue, + asset: PromiseOrValue, + amount: PromiseOrValue, + message: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + withdraw( + recipient: PromiseOrValue, + asset: PromiseOrValue, + amount: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + }; + + filters: {}; + + estimateGas: { + deposit( + recipient: PromiseOrValue, + asset: PromiseOrValue, + amount: PromiseOrValue, + message: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + withdraw( + recipient: PromiseOrValue, + asset: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + }; + + populateTransaction: { + deposit( + recipient: PromiseOrValue, + asset: PromiseOrValue, + amount: PromiseOrValue, + message: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + withdraw( + recipient: PromiseOrValue, + asset: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + }; +} diff --git a/typechain-types/contracts/evm/testing/AttackerContract.sol/index.ts b/typechain-types/contracts/evm/testing/AttackerContract.sol/index.ts new file mode 100644 index 00000000..9639989c --- /dev/null +++ b/typechain-types/contracts/evm/testing/AttackerContract.sol/index.ts @@ -0,0 +1,5 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export type { AttackerContract } from "./AttackerContract"; +export type { Victim } from "./Victim"; diff --git a/typechain-types/contracts/evm/testing/AttackerContract.ts b/typechain-types/contracts/evm/testing/AttackerContract.ts new file mode 100644 index 00000000..84984450 --- /dev/null +++ b/typechain-types/contracts/evm/testing/AttackerContract.ts @@ -0,0 +1,183 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import type { FunctionFragment, Result } from "@ethersproject/abi"; +import type { Listener, Provider } from "@ethersproject/providers"; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, + PromiseOrValue, +} from "../../../common"; + +export interface AttackerContractInterface extends utils.Interface { + functions: { + "attack(bytes4,bytes)": FunctionFragment; + "entered()": FunctionFragment; + "set(bytes4,bytes)": FunctionFragment; + "victimContractAddress()": FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | "attack" + | "entered" + | "set" + | "victimContractAddress" + ): FunctionFragment; + + encodeFunctionData( + functionFragment: "attack", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData(functionFragment: "entered", values?: undefined): string; + encodeFunctionData( + functionFragment: "set", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "victimContractAddress", + values?: undefined + ): string; + + decodeFunctionResult(functionFragment: "attack", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "entered", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "set", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "victimContractAddress", + data: BytesLike + ): Result; + + events: {}; +} + +export interface AttackerContract extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: AttackerContractInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + attack( + _methodSignature: PromiseOrValue, + _params: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + entered(overrides?: CallOverrides): Promise<[boolean]>; + + set( + _methodSignature: PromiseOrValue, + _params: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + victimContractAddress(overrides?: CallOverrides): Promise<[string]>; + }; + + attack( + _methodSignature: PromiseOrValue, + _params: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + entered(overrides?: CallOverrides): Promise; + + set( + _methodSignature: PromiseOrValue, + _params: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + victimContractAddress(overrides?: CallOverrides): Promise; + + callStatic: { + attack( + _methodSignature: PromiseOrValue, + _params: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + entered(overrides?: CallOverrides): Promise; + + set( + _methodSignature: PromiseOrValue, + _params: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + victimContractAddress(overrides?: CallOverrides): Promise; + }; + + filters: {}; + + estimateGas: { + attack( + _methodSignature: PromiseOrValue, + _params: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + entered(overrides?: CallOverrides): Promise; + + set( + _methodSignature: PromiseOrValue, + _params: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + victimContractAddress(overrides?: CallOverrides): Promise; + }; + + populateTransaction: { + attack( + _methodSignature: PromiseOrValue, + _params: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + entered(overrides?: CallOverrides): Promise; + + set( + _methodSignature: PromiseOrValue, + _params: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + victimContractAddress( + overrides?: CallOverrides + ): Promise; + }; +} diff --git a/typechain-types/contracts/evm/testing/ERC20Mock.ts b/typechain-types/contracts/evm/testing/ERC20Mock.ts new file mode 100644 index 00000000..1a3a6ec3 --- /dev/null +++ b/typechain-types/contracts/evm/testing/ERC20Mock.ts @@ -0,0 +1,464 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import type { + FunctionFragment, + Result, + EventFragment, +} from "@ethersproject/abi"; +import type { Listener, Provider } from "@ethersproject/providers"; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, + PromiseOrValue, +} from "../../../common"; + +export interface ERC20MockInterface extends utils.Interface { + functions: { + "allowance(address,address)": FunctionFragment; + "approve(address,uint256)": FunctionFragment; + "balanceOf(address)": FunctionFragment; + "decimals()": FunctionFragment; + "decreaseAllowance(address,uint256)": FunctionFragment; + "increaseAllowance(address,uint256)": FunctionFragment; + "name()": FunctionFragment; + "symbol()": FunctionFragment; + "totalSupply()": FunctionFragment; + "transfer(address,uint256)": FunctionFragment; + "transferFrom(address,address,uint256)": FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | "allowance" + | "approve" + | "balanceOf" + | "decimals" + | "decreaseAllowance" + | "increaseAllowance" + | "name" + | "symbol" + | "totalSupply" + | "transfer" + | "transferFrom" + ): FunctionFragment; + + encodeFunctionData( + functionFragment: "allowance", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "approve", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "balanceOf", + values: [PromiseOrValue] + ): string; + encodeFunctionData(functionFragment: "decimals", values?: undefined): string; + encodeFunctionData( + functionFragment: "decreaseAllowance", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "increaseAllowance", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData(functionFragment: "name", values?: undefined): string; + encodeFunctionData(functionFragment: "symbol", values?: undefined): string; + encodeFunctionData( + functionFragment: "totalSupply", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "transfer", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "transferFrom", + values: [ + PromiseOrValue, + PromiseOrValue, + PromiseOrValue + ] + ): string; + + decodeFunctionResult(functionFragment: "allowance", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "decreaseAllowance", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "increaseAllowance", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "symbol", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "totalSupply", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "transfer", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "transferFrom", + data: BytesLike + ): Result; + + events: { + "Approval(address,address,uint256)": EventFragment; + "Transfer(address,address,uint256)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "Approval"): EventFragment; + getEvent(nameOrSignatureOrTopic: "Transfer"): EventFragment; +} + +export interface ApprovalEventObject { + owner: string; + spender: string; + value: BigNumber; +} +export type ApprovalEvent = TypedEvent< + [string, string, BigNumber], + ApprovalEventObject +>; + +export type ApprovalEventFilter = TypedEventFilter; + +export interface TransferEventObject { + from: string; + to: string; + value: BigNumber; +} +export type TransferEvent = TypedEvent< + [string, string, BigNumber], + TransferEventObject +>; + +export type TransferEventFilter = TypedEventFilter; + +export interface ERC20Mock extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: ERC20MockInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + allowance( + owner: PromiseOrValue, + spender: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + approve( + spender: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + balanceOf( + account: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + decimals(overrides?: CallOverrides): Promise<[number]>; + + decreaseAllowance( + spender: PromiseOrValue, + subtractedValue: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + increaseAllowance( + spender: PromiseOrValue, + addedValue: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + name(overrides?: CallOverrides): Promise<[string]>; + + symbol(overrides?: CallOverrides): Promise<[string]>; + + totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; + + transfer( + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transferFrom( + from: PromiseOrValue, + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + }; + + allowance( + owner: PromiseOrValue, + spender: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + approve( + spender: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + balanceOf( + account: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance( + spender: PromiseOrValue, + subtractedValue: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + increaseAllowance( + spender: PromiseOrValue, + addedValue: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer( + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transferFrom( + from: PromiseOrValue, + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + callStatic: { + allowance( + owner: PromiseOrValue, + spender: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + approve( + spender: PromiseOrValue, + amount: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + balanceOf( + account: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance( + spender: PromiseOrValue, + subtractedValue: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + increaseAllowance( + spender: PromiseOrValue, + addedValue: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer( + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + transferFrom( + from: PromiseOrValue, + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + }; + + filters: { + "Approval(address,address,uint256)"( + owner?: PromiseOrValue | null, + spender?: PromiseOrValue | null, + value?: null + ): ApprovalEventFilter; + Approval( + owner?: PromiseOrValue | null, + spender?: PromiseOrValue | null, + value?: null + ): ApprovalEventFilter; + + "Transfer(address,address,uint256)"( + from?: PromiseOrValue | null, + to?: PromiseOrValue | null, + value?: null + ): TransferEventFilter; + Transfer( + from?: PromiseOrValue | null, + to?: PromiseOrValue | null, + value?: null + ): TransferEventFilter; + }; + + estimateGas: { + allowance( + owner: PromiseOrValue, + spender: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + approve( + spender: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + balanceOf( + account: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance( + spender: PromiseOrValue, + subtractedValue: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + increaseAllowance( + spender: PromiseOrValue, + addedValue: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer( + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transferFrom( + from: PromiseOrValue, + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + }; + + populateTransaction: { + allowance( + owner: PromiseOrValue, + spender: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + approve( + spender: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + balanceOf( + account: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance( + spender: PromiseOrValue, + subtractedValue: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + increaseAllowance( + spender: PromiseOrValue, + addedValue: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + name(overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer( + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + transferFrom( + from: PromiseOrValue, + to: PromiseOrValue, + amount: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + }; +} diff --git a/typechain-types/contracts/evm/testing/index.ts b/typechain-types/contracts/evm/testing/index.ts index ae63ef88..4005de59 100644 --- a/typechain-types/contracts/evm/testing/index.ts +++ b/typechain-types/contracts/evm/testing/index.ts @@ -1,7 +1,10 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ +import type * as attackerContractSol from "./AttackerContract.sol"; +export type { attackerContractSol }; import type * as testUniswapV3ContractsSol from "./TestUniswapV3Contracts.sol"; export type { testUniswapV3ContractsSol }; +export type { ERC20Mock } from "./ERC20Mock"; export type { ZetaInteractorMock } from "./ZetaInteractorMock"; export type { ZetaReceiverMock } from "./ZetaReceiverMock"; diff --git a/typechain-types/contracts/zevm/index.ts b/typechain-types/contracts/zevm/index.ts index 80441402..8962bad7 100644 --- a/typechain-types/contracts/zevm/index.ts +++ b/typechain-types/contracts/zevm/index.ts @@ -13,3 +13,5 @@ import type * as zrc20Sol from "./ZRC20.sol"; export type { zrc20Sol }; import type * as interfaces from "./interfaces"; export type { interfaces }; +import type * as testing from "./testing"; +export type { testing }; diff --git a/typechain-types/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract.ts b/typechain-types/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract.ts new file mode 100644 index 00000000..351c8e37 --- /dev/null +++ b/typechain-types/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract.ts @@ -0,0 +1,553 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import type { + FunctionFragment, + Result, + EventFragment, +} from "@ethersproject/abi"; +import type { Listener, Provider } from "@ethersproject/providers"; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, + PromiseOrValue, +} from "../../../../common"; + +export interface MockSystemContractInterface extends utils.Interface { + functions: { + "gasCoinZRC20ByChainId(uint256)": FunctionFragment; + "gasPriceByChainId(uint256)": FunctionFragment; + "gasZetaPoolByChainId(uint256)": FunctionFragment; + "onCrossChainCall(address,address,uint256,bytes)": FunctionFragment; + "setGasCoinZRC20(uint256,address)": FunctionFragment; + "setGasPrice(uint256,uint256)": FunctionFragment; + "setWZETAContractAddress(address)": FunctionFragment; + "uniswapv2FactoryAddress()": FunctionFragment; + "uniswapv2PairFor(address,address,address)": FunctionFragment; + "uniswapv2Router02Address()": FunctionFragment; + "wZetaContractAddress()": FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | "gasCoinZRC20ByChainId" + | "gasPriceByChainId" + | "gasZetaPoolByChainId" + | "onCrossChainCall" + | "setGasCoinZRC20" + | "setGasPrice" + | "setWZETAContractAddress" + | "uniswapv2FactoryAddress" + | "uniswapv2PairFor" + | "uniswapv2Router02Address" + | "wZetaContractAddress" + ): FunctionFragment; + + encodeFunctionData( + functionFragment: "gasCoinZRC20ByChainId", + values: [PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "gasPriceByChainId", + values: [PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "gasZetaPoolByChainId", + values: [PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "onCrossChainCall", + values: [ + PromiseOrValue, + PromiseOrValue, + PromiseOrValue, + PromiseOrValue + ] + ): string; + encodeFunctionData( + functionFragment: "setGasCoinZRC20", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "setGasPrice", + values: [PromiseOrValue, PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "setWZETAContractAddress", + values: [PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "uniswapv2FactoryAddress", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "uniswapv2PairFor", + values: [ + PromiseOrValue, + PromiseOrValue, + PromiseOrValue + ] + ): string; + encodeFunctionData( + functionFragment: "uniswapv2Router02Address", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "wZetaContractAddress", + values?: undefined + ): string; + + decodeFunctionResult( + functionFragment: "gasCoinZRC20ByChainId", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "gasPriceByChainId", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "gasZetaPoolByChainId", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "onCrossChainCall", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setGasCoinZRC20", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setGasPrice", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setWZETAContractAddress", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "uniswapv2FactoryAddress", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "uniswapv2PairFor", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "uniswapv2Router02Address", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "wZetaContractAddress", + data: BytesLike + ): Result; + + events: { + "SetGasCoin(uint256,address)": EventFragment; + "SetGasPrice(uint256,uint256)": EventFragment; + "SetGasZetaPool(uint256,address)": EventFragment; + "SetWZeta(address)": EventFragment; + "SystemContractDeployed()": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "SetGasCoin"): EventFragment; + getEvent(nameOrSignatureOrTopic: "SetGasPrice"): EventFragment; + getEvent(nameOrSignatureOrTopic: "SetGasZetaPool"): EventFragment; + getEvent(nameOrSignatureOrTopic: "SetWZeta"): EventFragment; + getEvent(nameOrSignatureOrTopic: "SystemContractDeployed"): EventFragment; +} + +export interface SetGasCoinEventObject { + arg0: BigNumber; + arg1: string; +} +export type SetGasCoinEvent = TypedEvent< + [BigNumber, string], + SetGasCoinEventObject +>; + +export type SetGasCoinEventFilter = TypedEventFilter; + +export interface SetGasPriceEventObject { + arg0: BigNumber; + arg1: BigNumber; +} +export type SetGasPriceEvent = TypedEvent< + [BigNumber, BigNumber], + SetGasPriceEventObject +>; + +export type SetGasPriceEventFilter = TypedEventFilter; + +export interface SetGasZetaPoolEventObject { + arg0: BigNumber; + arg1: string; +} +export type SetGasZetaPoolEvent = TypedEvent< + [BigNumber, string], + SetGasZetaPoolEventObject +>; + +export type SetGasZetaPoolEventFilter = TypedEventFilter; + +export interface SetWZetaEventObject { + arg0: string; +} +export type SetWZetaEvent = TypedEvent<[string], SetWZetaEventObject>; + +export type SetWZetaEventFilter = TypedEventFilter; + +export interface SystemContractDeployedEventObject {} +export type SystemContractDeployedEvent = TypedEvent< + [], + SystemContractDeployedEventObject +>; + +export type SystemContractDeployedEventFilter = + TypedEventFilter; + +export interface MockSystemContract extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: MockSystemContractInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + gasCoinZRC20ByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[string]>; + + gasPriceByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + gasZetaPoolByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[string]>; + + onCrossChainCall( + target: PromiseOrValue, + zrc20: PromiseOrValue, + amount: PromiseOrValue, + message: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setGasCoinZRC20( + chainID: PromiseOrValue, + zrc20: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setGasPrice( + chainID: PromiseOrValue, + price: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setWZETAContractAddress( + addr: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + uniswapv2FactoryAddress(overrides?: CallOverrides): Promise<[string]>; + + uniswapv2PairFor( + factory: PromiseOrValue, + tokenA: PromiseOrValue, + tokenB: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[string] & { pair: string }>; + + uniswapv2Router02Address(overrides?: CallOverrides): Promise<[string]>; + + wZetaContractAddress(overrides?: CallOverrides): Promise<[string]>; + }; + + gasCoinZRC20ByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + gasPriceByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + gasZetaPoolByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + onCrossChainCall( + target: PromiseOrValue, + zrc20: PromiseOrValue, + amount: PromiseOrValue, + message: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setGasCoinZRC20( + chainID: PromiseOrValue, + zrc20: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setGasPrice( + chainID: PromiseOrValue, + price: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setWZETAContractAddress( + addr: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + uniswapv2FactoryAddress(overrides?: CallOverrides): Promise; + + uniswapv2PairFor( + factory: PromiseOrValue, + tokenA: PromiseOrValue, + tokenB: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + uniswapv2Router02Address(overrides?: CallOverrides): Promise; + + wZetaContractAddress(overrides?: CallOverrides): Promise; + + callStatic: { + gasCoinZRC20ByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + gasPriceByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + gasZetaPoolByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + onCrossChainCall( + target: PromiseOrValue, + zrc20: PromiseOrValue, + amount: PromiseOrValue, + message: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + setGasCoinZRC20( + chainID: PromiseOrValue, + zrc20: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + setGasPrice( + chainID: PromiseOrValue, + price: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + setWZETAContractAddress( + addr: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + uniswapv2FactoryAddress(overrides?: CallOverrides): Promise; + + uniswapv2PairFor( + factory: PromiseOrValue, + tokenA: PromiseOrValue, + tokenB: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + uniswapv2Router02Address(overrides?: CallOverrides): Promise; + + wZetaContractAddress(overrides?: CallOverrides): Promise; + }; + + filters: { + "SetGasCoin(uint256,address)"( + arg0?: null, + arg1?: null + ): SetGasCoinEventFilter; + SetGasCoin(arg0?: null, arg1?: null): SetGasCoinEventFilter; + + "SetGasPrice(uint256,uint256)"( + arg0?: null, + arg1?: null + ): SetGasPriceEventFilter; + SetGasPrice(arg0?: null, arg1?: null): SetGasPriceEventFilter; + + "SetGasZetaPool(uint256,address)"( + arg0?: null, + arg1?: null + ): SetGasZetaPoolEventFilter; + SetGasZetaPool(arg0?: null, arg1?: null): SetGasZetaPoolEventFilter; + + "SetWZeta(address)"(arg0?: null): SetWZetaEventFilter; + SetWZeta(arg0?: null): SetWZetaEventFilter; + + "SystemContractDeployed()"(): SystemContractDeployedEventFilter; + SystemContractDeployed(): SystemContractDeployedEventFilter; + }; + + estimateGas: { + gasCoinZRC20ByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + gasPriceByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + gasZetaPoolByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + onCrossChainCall( + target: PromiseOrValue, + zrc20: PromiseOrValue, + amount: PromiseOrValue, + message: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setGasCoinZRC20( + chainID: PromiseOrValue, + zrc20: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setGasPrice( + chainID: PromiseOrValue, + price: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setWZETAContractAddress( + addr: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + uniswapv2FactoryAddress(overrides?: CallOverrides): Promise; + + uniswapv2PairFor( + factory: PromiseOrValue, + tokenA: PromiseOrValue, + tokenB: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + uniswapv2Router02Address(overrides?: CallOverrides): Promise; + + wZetaContractAddress(overrides?: CallOverrides): Promise; + }; + + populateTransaction: { + gasCoinZRC20ByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + gasPriceByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + gasZetaPoolByChainId( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + onCrossChainCall( + target: PromiseOrValue, + zrc20: PromiseOrValue, + amount: PromiseOrValue, + message: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setGasCoinZRC20( + chainID: PromiseOrValue, + zrc20: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setGasPrice( + chainID: PromiseOrValue, + price: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + setWZETAContractAddress( + addr: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + uniswapv2FactoryAddress( + overrides?: CallOverrides + ): Promise; + + uniswapv2PairFor( + factory: PromiseOrValue, + tokenA: PromiseOrValue, + tokenB: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + uniswapv2Router02Address( + overrides?: CallOverrides + ): Promise; + + wZetaContractAddress( + overrides?: CallOverrides + ): Promise; + }; +} diff --git a/typechain-types/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors.ts b/typechain-types/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors.ts new file mode 100644 index 00000000..f0d2d164 --- /dev/null +++ b/typechain-types/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors.ts @@ -0,0 +1,56 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { BaseContract, Signer, utils } from "ethers"; + +import type { Listener, Provider } from "@ethersproject/providers"; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, + PromiseOrValue, +} from "../../../../common"; + +export interface SystemContractErrorsInterface extends utils.Interface { + functions: {}; + + events: {}; +} + +export interface SystemContractErrors extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: SystemContractErrorsInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: {}; + + callStatic: {}; + + filters: {}; + + estimateGas: {}; + + populateTransaction: {}; +} diff --git a/typechain-types/contracts/zevm/testing/MockSystemContract.sol/index.ts b/typechain-types/contracts/zevm/testing/MockSystemContract.sol/index.ts new file mode 100644 index 00000000..da3a6f9a --- /dev/null +++ b/typechain-types/contracts/zevm/testing/MockSystemContract.sol/index.ts @@ -0,0 +1,5 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export type { MockSystemContract } from "./MockSystemContract"; +export type { SystemContractErrors } from "./SystemContractErrors"; diff --git a/typechain-types/contracts/zevm/testing/index.ts b/typechain-types/contracts/zevm/testing/index.ts new file mode 100644 index 00000000..aeb46272 --- /dev/null +++ b/typechain-types/contracts/zevm/testing/index.ts @@ -0,0 +1,5 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type * as mockSystemContractSol from "./MockSystemContract.sol"; +export type { mockSystemContractSol }; diff --git a/typechain-types/factories/contracts/evm/ERC20Custody__factory.ts b/typechain-types/factories/contracts/evm/ERC20Custody__factory.ts index 571fce4d..d8c2695c 100644 --- a/typechain-types/factories/contracts/evm/ERC20Custody__factory.ts +++ b/typechain-types/factories/contracts/evm/ERC20Custody__factory.ts @@ -459,7 +459,7 @@ const _abi = [ ] as const; const _bytecode = - "0x60c06040523480156200001157600080fd5b50604051620021e9380380620021e9833981810160405281019062000037919062000156565b6001600081905550846001806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826003819055508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508160808181525050505050505062000283565b600081519050620001228162000235565b92915050565b60008151905062000139816200024f565b92915050565b600081519050620001508162000269565b92915050565b600080600080600060a0868803121562000175576200017462000230565b5b6000620001858882890162000111565b9550506020620001988882890162000111565b9450506040620001ab888289016200013f565b9350506060620001be888289016200013f565b9250506080620001d18882890162000128565b9150509295509295909350565b6000620001eb8262000206565b9050919050565b6000620001ff82620001de565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600080fd5b6200024081620001de565b81146200024c57600080fd5b50565b6200025a81620001f2565b81146200026657600080fd5b50565b620002748162000226565b81146200028057600080fd5b50565b60805160a05160601c611f28620002c160003960008181610e1301528181610e7a015261107601526000818161042e0152610c7a0152611f286000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80639b19251a11610097578063e5408cfa11610066578063e5408cfa1461024d578063e609055e1461026b578063e8f9cb3a14610287578063ed11692b146102a557610100565b80639b19251a146101c9578063d936547e146101e5578063d9caed1214610215578063de2f6c5e1461023157610100565b80637bdaded3116100d35780637bdaded3146101695780638456cb5914610187578063950837aa146101915780639a590427146101ad57610100565b80633f4ba83a1461010557806353ee30a31461010f57806354b61e811461012d5780635c975abb1461014b575b600080fd5b61010d6102af565b005b6101176103cf565b6040516101249190611a4d565b60405180910390f35b6101356103f3565b6040516101429190611a4d565b60405180910390f35b610153610419565b6040516101609190611ac8565b60405180910390f35b61017161042c565b60405161017e9190611be9565b60405180910390f35b61018f610450565b005b6101ab60048036038101906101a691906116fc565b6105f7565b005b6101c760048036038101906101c29190611850565b61075e565b005b6101e360048036038101906101de9190611850565b610881565b005b6101ff60048036038101906101fa9190611850565b6109a4565b60405161020c9190611ac8565b60405180910390f35b61022f600480360381019061022a9190611729565b6109c4565b005b61024b6004803603810190610246919061187d565b610bb8565b005b610255610d13565b6040516102629190611be9565b60405180910390f35b610285600480360381019061028091906117a9565b610d19565b005b61028f611074565b60405161029c9190611b2c565b60405180910390f35b6102ad611098565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610335576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900460ff1661037b576040517f6cd6020100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600160006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336040516103c59190611a4d565b60405180910390a1565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900460ff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104d6576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900460ff161561051d576040517f1309a56300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156105a4576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018060006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516105ed9190611a4d565b60405180910390a1565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461067d576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156106e4576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcd2958db8285a532edf298cbe1aa28ea3fb5ec82461253f9a8c1477924e29947816040516107539190611a4d565b60405180910390a150565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107e3576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f51085ddf9ebdded84b76e829eb58c4078e4b5bdf97d9a94723f336039da4679160405160405180910390a250565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610906576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167faab7954e9d246b167ef88aeddad35209ca2489d95a8aeb59e288d9b19fae5a5460405160405180910390a250565b60046020528060005260406000206000915054906101000a900460ff1681565b6109cc61123f565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a51576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900460ff1615610a98576040517f1309a56300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610b1b576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b4683828473ffffffffffffffffffffffffffffffffffffffff1661128f9092919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb83604051610ba39190611be9565b60405180910390a3610bb3611315565b505050565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3d576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000811415610c78576040517faf13986d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000000811115610cd2576040517fc1be451300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806003819055507f6d2d8e313fbaf76898bb9fa55e4b52525e49c7d7182d0874f97bd9076e81d52381604051610d089190611be9565b60405180910390a150565b60035481565b610d2161123f565b600160009054906101000a900460ff1615610d68576040517f1309a56300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610deb576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060035414158015610e4b5750600073ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1614155b15610ec057610ebf3360018054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1661131f909392919063ffffffff16565b5b60008473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610efb9190611a4d565b60206040518083038186803b158015610f1357600080fd5b505afa158015610f27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4b91906118aa565b9050610f7a3330868873ffffffffffffffffffffffffffffffffffffffff1661131f909392919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff167f1dafa057cc5c3bccb5ad974129a2bccd3c74002d9dfd7062404ba9523b18d6ae8888848973ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610fee9190611a4d565b60206040518083038186803b15801561100657600080fd5b505afa15801561101a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103e91906118aa565b6110489190611c47565b878760405161105b959493929190611ae3565b60405180910390a25061106c611315565b505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461111e576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156111a5576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f39ac266bfc011581be62c138d96e4e8782812013bb66fffb4cd207f4bfee3777336040516112359190611a4d565b60405180910390a1565b60026000541415611285576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127c90611bc9565b60405180910390fd5b6002600081905550565b6113108363a9059cbb60e01b84846040516024016112ae929190611a9f565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506113a8565b505050565b6001600081905550565b6113a2846323b872dd60e01b85858560405160240161134093929190611a68565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506113a8565b50505050565b600061140a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661146f9092919063ffffffff16565b905060008151111561146a578080602001905181019061142a919061177c565b611469576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146090611ba9565b60405180910390fd5b5b505050565b606061147e8484600085611487565b90509392505050565b6060824710156114cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c390611b69565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114f59190611a36565b60006040518083038185875af1925050503d8060008114611532576040519150601f19603f3d011682016040523d82523d6000602084013e611537565b606091505b509150915061154887838387611554565b92505050949350505050565b606083156115b7576000835114156115af5761156f856115ca565b6115ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a590611b89565b60405180910390fd5b5b8290506115c2565b6115c183836115ed565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000825111156116005781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116349190611b47565b60405180910390fd5b60008135905061164c81611e96565b92915050565b60008151905061166181611ead565b92915050565b60008083601f84011261167d5761167c611d81565b5b8235905067ffffffffffffffff81111561169a57611699611d7c565b5b6020830191508360018202830111156116b6576116b5611d86565b5b9250929050565b6000813590506116cc81611ec4565b92915050565b6000813590506116e181611edb565b92915050565b6000815190506116f681611edb565b92915050565b60006020828403121561171257611711611d90565b5b60006117208482850161163d565b91505092915050565b60008060006060848603121561174257611741611d90565b5b60006117508682870161163d565b9350506020611761868287016116bd565b9250506040611772868287016116d2565b9150509250925092565b60006020828403121561179257611791611d90565b5b60006117a084828501611652565b91505092915050565b600080600080600080608087890312156117c6576117c5611d90565b5b600087013567ffffffffffffffff8111156117e4576117e3611d8b565b5b6117f089828a01611667565b9650965050602061180389828a016116bd565b945050604061181489828a016116d2565b935050606087013567ffffffffffffffff81111561183557611834611d8b565b5b61184189828a01611667565b92509250509295509295509295565b60006020828403121561186657611865611d90565b5b6000611874848285016116bd565b91505092915050565b60006020828403121561189357611892611d90565b5b60006118a1848285016116d2565b91505092915050565b6000602082840312156118c0576118bf611d90565b5b60006118ce848285016116e7565b91505092915050565b6118e081611c7b565b82525050565b6118ef81611c8d565b82525050565b60006119018385611c1a565b935061190e838584611d0b565b61191783611d95565b840190509392505050565b600061192d82611c04565b6119378185611c2b565b9350611947818560208601611d1a565b80840191505092915050565b61195c81611cd5565b82525050565b600061196d82611c0f565b6119778185611c36565b9350611987818560208601611d1a565b61199081611d95565b840191505092915050565b60006119a8602683611c36565b91506119b382611da6565b604082019050919050565b60006119cb601d83611c36565b91506119d682611df5565b602082019050919050565b60006119ee602a83611c36565b91506119f982611e1e565b604082019050919050565b6000611a11601f83611c36565b9150611a1c82611e6d565b602082019050919050565b611a3081611ccb565b82525050565b6000611a428284611922565b915081905092915050565b6000602082019050611a6260008301846118d7565b92915050565b6000606082019050611a7d60008301866118d7565b611a8a60208301856118d7565b611a976040830184611a27565b949350505050565b6000604082019050611ab460008301856118d7565b611ac16020830184611a27565b9392505050565b6000602082019050611add60008301846118e6565b92915050565b60006060820190508181036000830152611afe8187896118f5565b9050611b0d6020830186611a27565b8181036040830152611b208184866118f5565b90509695505050505050565b6000602082019050611b416000830184611953565b92915050565b60006020820190508181036000830152611b618184611962565b905092915050565b60006020820190508181036000830152611b828161199b565b9050919050565b60006020820190508181036000830152611ba2816119be565b9050919050565b60006020820190508181036000830152611bc2816119e1565b9050919050565b60006020820190508181036000830152611be281611a04565b9050919050565b6000602082019050611bfe6000830184611a27565b92915050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b6000611c5282611ccb565b9150611c5d83611ccb565b925082821015611c7057611c6f611d4d565b5b828203905092915050565b6000611c8682611cab565b9050919050565b60008115159050919050565b6000611ca482611c7b565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611ce082611ce7565b9050919050565b6000611cf282611cf9565b9050919050565b6000611d0482611cab565b9050919050565b82818337600083830152505050565b60005b83811015611d38578082015181840152602081019050611d1d565b83811115611d47576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b611e9f81611c7b565b8114611eaa57600080fd5b50565b611eb681611c8d565b8114611ec157600080fd5b50565b611ecd81611c99565b8114611ed857600080fd5b50565b611ee481611ccb565b8114611eef57600080fd5b5056fea26469706673582212205e3db0f8408347f6a8d41b88dee6d3aee78db90b629cce50ac838c21a061981164736f6c63430008070033"; + "0x60c06040523480156200001157600080fd5b50604051620021a0380380620021a0833981810160405281019062000037919062000156565b6001600081905550846001806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826003819055508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508160808181525050505050505062000283565b600081519050620001228162000235565b92915050565b60008151905062000139816200024f565b92915050565b600081519050620001508162000269565b92915050565b600080600080600060a0868803121562000175576200017462000230565b5b6000620001858882890162000111565b9550506020620001988882890162000111565b9450506040620001ab888289016200013f565b9350506060620001be888289016200013f565b9250506080620001d18882890162000128565b9150509295509295909350565b6000620001eb8262000206565b9050919050565b6000620001ff82620001de565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600080fd5b6200024081620001de565b81146200024c57600080fd5b50565b6200025a81620001f2565b81146200026657600080fd5b50565b620002748162000226565b81146200028057600080fd5b50565b60805160a05160601c611edf620002c160003960008181610dca01528181610e31015261102d01526000818161042d0152610c310152611edf6000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80639b19251a11610097578063e5408cfa11610066578063e5408cfa1461024d578063e609055e1461026b578063e8f9cb3a14610287578063ed11692b146102a557610100565b80639b19251a146101c9578063d936547e146101e5578063d9caed1214610215578063de2f6c5e1461023157610100565b80637bdaded3116100d35780637bdaded3146101695780638456cb5914610187578063950837aa146101915780639a590427146101ad57610100565b80633f4ba83a1461010557806353ee30a31461010f57806354b61e811461012d5780635c975abb1461014b575b600080fd5b61010d6102af565b005b6101176103ce565b6040516101249190611a04565b60405180910390f35b6101356103f2565b6040516101429190611a04565b60405180910390f35b610153610418565b6040516101609190611a7f565b60405180910390f35b61017161042b565b60405161017e9190611ba0565b60405180910390f35b61018f61044f565b005b6101ab60048036038101906101a691906116b3565b6105f5565b005b6101c760048036038101906101c29190611807565b61075c565b005b6101e360048036038101906101de9190611807565b61087f565b005b6101ff60048036038101906101fa9190611807565b6109a2565b60405161020c9190611a7f565b60405180910390f35b61022f600480360381019061022a91906116e0565b6109c2565b005b61024b60048036038101906102469190611834565b610b6f565b005b610255610cca565b6040516102629190611ba0565b60405180910390f35b61028560048036038101906102809190611760565b610cd0565b005b61028f61102b565b60405161029c9190611ae3565b60405180910390f35b6102ad61104f565b005b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610334576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900460ff1661037a576040517f6cd6020100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600160006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336040516103c49190611a04565b60405180910390a1565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900460ff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104d4576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900460ff161561051b576040517f1309a56300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156105a2576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018060006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516105eb9190611a04565b60405180910390a1565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461067b576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156106e2576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcd2958db8285a532edf298cbe1aa28ea3fb5ec82461253f9a8c1477924e29947816040516107519190611a04565b60405180910390a150565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107e1576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f51085ddf9ebdded84b76e829eb58c4078e4b5bdf97d9a94723f336039da4679160405160405180910390a250565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610904576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167faab7954e9d246b167ef88aeddad35209ca2489d95a8aeb59e288d9b19fae5a5460405160405180910390a250565b60046020528060005260406000206000915054906101000a900460ff1681565b6109ca6111f6565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610ad2576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610afd83828473ffffffffffffffffffffffffffffffffffffffff166112469092919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb83604051610b5a9190611ba0565b60405180910390a3610b6a6112cc565b505050565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bf4576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000811415610c2f576040517faf13986d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000000811115610c89576040517fc1be451300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806003819055507f6d2d8e313fbaf76898bb9fa55e4b52525e49c7d7182d0874f97bd9076e81d52381604051610cbf9190611ba0565b60405180910390a150565b60035481565b610cd86111f6565b600160009054906101000a900460ff1615610d1f576040517f1309a56300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610da2576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060035414158015610e025750600073ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1614155b15610e7757610e763360018054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166112d6909392919063ffffffff16565b5b60008473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610eb29190611a04565b60206040518083038186803b158015610eca57600080fd5b505afa158015610ede573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f029190611861565b9050610f313330868873ffffffffffffffffffffffffffffffffffffffff166112d6909392919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff167f1dafa057cc5c3bccb5ad974129a2bccd3c74002d9dfd7062404ba9523b18d6ae8888848973ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610fa59190611a04565b60206040518083038186803b158015610fbd57600080fd5b505afa158015610fd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff59190611861565b610fff9190611bfe565b8787604051611012959493929190611a9a565b60405180910390a2506110236112cc565b505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146110d5576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561115c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f39ac266bfc011581be62c138d96e4e8782812013bb66fffb4cd207f4bfee3777336040516111ec9190611a04565b60405180910390a1565b6002600054141561123c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123390611b80565b60405180910390fd5b6002600081905550565b6112c78363a9059cbb60e01b8484604051602401611265929190611a56565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061135f565b505050565b6001600081905550565b611359846323b872dd60e01b8585856040516024016112f793929190611a1f565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061135f565b50505050565b60006113c1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166114269092919063ffffffff16565b905060008151111561142157808060200190518101906113e19190611733565b611420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141790611b60565b60405180910390fd5b5b505050565b6060611435848460008561143e565b90509392505050565b606082471015611483576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147a90611b20565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114ac91906119ed565b60006040518083038185875af1925050503d80600081146114e9576040519150601f19603f3d011682016040523d82523d6000602084013e6114ee565b606091505b50915091506114ff8783838761150b565b92505050949350505050565b6060831561156e576000835114156115665761152685611581565b611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155c90611b40565b60405180910390fd5b5b829050611579565b61157883836115a4565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000825111156115b75781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115eb9190611afe565b60405180910390fd5b60008135905061160381611e4d565b92915050565b60008151905061161881611e64565b92915050565b60008083601f84011261163457611633611d38565b5b8235905067ffffffffffffffff81111561165157611650611d33565b5b60208301915083600182028301111561166d5761166c611d3d565b5b9250929050565b60008135905061168381611e7b565b92915050565b60008135905061169881611e92565b92915050565b6000815190506116ad81611e92565b92915050565b6000602082840312156116c9576116c8611d47565b5b60006116d7848285016115f4565b91505092915050565b6000806000606084860312156116f9576116f8611d47565b5b6000611707868287016115f4565b935050602061171886828701611674565b925050604061172986828701611689565b9150509250925092565b60006020828403121561174957611748611d47565b5b600061175784828501611609565b91505092915050565b6000806000806000806080878903121561177d5761177c611d47565b5b600087013567ffffffffffffffff81111561179b5761179a611d42565b5b6117a789828a0161161e565b965096505060206117ba89828a01611674565b94505060406117cb89828a01611689565b935050606087013567ffffffffffffffff8111156117ec576117eb611d42565b5b6117f889828a0161161e565b92509250509295509295509295565b60006020828403121561181d5761181c611d47565b5b600061182b84828501611674565b91505092915050565b60006020828403121561184a57611849611d47565b5b600061185884828501611689565b91505092915050565b60006020828403121561187757611876611d47565b5b60006118858482850161169e565b91505092915050565b61189781611c32565b82525050565b6118a681611c44565b82525050565b60006118b88385611bd1565b93506118c5838584611cc2565b6118ce83611d4c565b840190509392505050565b60006118e482611bbb565b6118ee8185611be2565b93506118fe818560208601611cd1565b80840191505092915050565b61191381611c8c565b82525050565b600061192482611bc6565b61192e8185611bed565b935061193e818560208601611cd1565b61194781611d4c565b840191505092915050565b600061195f602683611bed565b915061196a82611d5d565b604082019050919050565b6000611982601d83611bed565b915061198d82611dac565b602082019050919050565b60006119a5602a83611bed565b91506119b082611dd5565b604082019050919050565b60006119c8601f83611bed565b91506119d382611e24565b602082019050919050565b6119e781611c82565b82525050565b60006119f982846118d9565b915081905092915050565b6000602082019050611a19600083018461188e565b92915050565b6000606082019050611a34600083018661188e565b611a41602083018561188e565b611a4e60408301846119de565b949350505050565b6000604082019050611a6b600083018561188e565b611a7860208301846119de565b9392505050565b6000602082019050611a94600083018461189d565b92915050565b60006060820190508181036000830152611ab58187896118ac565b9050611ac460208301866119de565b8181036040830152611ad78184866118ac565b90509695505050505050565b6000602082019050611af8600083018461190a565b92915050565b60006020820190508181036000830152611b188184611919565b905092915050565b60006020820190508181036000830152611b3981611952565b9050919050565b60006020820190508181036000830152611b5981611975565b9050919050565b60006020820190508181036000830152611b7981611998565b9050919050565b60006020820190508181036000830152611b99816119bb565b9050919050565b6000602082019050611bb560008301846119de565b92915050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b6000611c0982611c82565b9150611c1483611c82565b925082821015611c2757611c26611d04565b5b828203905092915050565b6000611c3d82611c62565b9050919050565b60008115159050919050565b6000611c5b82611c32565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611c9782611c9e565b9050919050565b6000611ca982611cb0565b9050919050565b6000611cbb82611c62565b9050919050565b82818337600083830152505050565b60005b83811015611cef578082015181840152602081019050611cd4565b83811115611cfe576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b611e5681611c32565b8114611e6157600080fd5b50565b611e6d81611c44565b8114611e7857600080fd5b50565b611e8481611c50565b8114611e8f57600080fd5b50565b611e9b81611c82565b8114611ea657600080fd5b5056fea26469706673582212205768544075d85a56b1d380f8fcc0c8829b8a656c656277c25c81c31608d9e4ef64736f6c63430008070033"; type ERC20CustodyConstructorParams = | [signer?: Signer] diff --git a/typechain-types/factories/contracts/evm/testing/AttackerContract.sol/AttackerContract__factory.ts b/typechain-types/factories/contracts/evm/testing/AttackerContract.sol/AttackerContract__factory.ts new file mode 100644 index 00000000..ac4ab406 --- /dev/null +++ b/typechain-types/factories/contracts/evm/testing/AttackerContract.sol/AttackerContract__factory.ts @@ -0,0 +1,196 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + Signer, + utils, + Contract, + ContractFactory, + BigNumberish, + Overrides, +} from "ethers"; +import type { Provider, TransactionRequest } from "@ethersproject/providers"; +import type { PromiseOrValue } from "../../../../../common"; +import type { + AttackerContract, + AttackerContractInterface, +} from "../../../../../contracts/evm/testing/AttackerContract.sol/AttackerContract"; + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "victimContractAddress_", + type: "address", + }, + { + internalType: "address", + name: "wzeta", + type: "address", + }, + { + internalType: "uint256", + name: "victimMethod", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "victimContractAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, +] as const; + +const _bytecode = + "0x60806040523480156200001157600080fd5b50604051620009ae380380620009ae8339818101604052810190620000379190620001a0565b826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401620000f492919062000250565b602060405180830381600087803b1580156200010f57600080fd5b505af115801562000124573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200014a9190620001fc565b50806001819055505050506200031a565b6000815190506200016c81620002cc565b92915050565b6000815190506200018381620002e6565b92915050565b6000815190506200019a8162000300565b92915050565b600080600060608486031215620001bc57620001bb620002c7565b5b6000620001cc868287016200015b565b9350506020620001df868287016200015b565b9250506040620001f28682870162000189565b9150509250925092565b600060208284031215620002155762000214620002c7565b5b6000620002258482850162000172565b91505092915050565b62000239816200027d565b82525050565b6200024a81620002bd565b82525050565b60006040820190506200026760008301856200022e565b6200027660208301846200023f565b9392505050565b60006200028a826200029d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600080fd5b620002d7816200027d565b8114620002e357600080fd5b50565b620002f18162000291565b8114620002fd57600080fd5b50565b6200030b81620002bd565b81146200031757600080fd5b50565b610684806200032a6000396000f3fe6080604052600436106100435760003560e01c806323b872dd1461004f57806370a082311461008c57806389bc0bb7146100c9578063a9059cbb146100f45761004a565b3661004a57005b600080fd5b34801561005b57600080fd5b506100766004803603810190610071919061034c565b610131565b60405161008391906104b3565b60405180910390f35b34801561009857600080fd5b506100b360048036038101906100ae919061031f565b610146565b6040516100c0919061051d565b60405180910390f35b3480156100d557600080fd5b506100de610159565b6040516100eb9190610461565b60405180910390f35b34801561010057600080fd5b5061011b6004803603810190610116919061039f565b61017d565b60405161012891906104b3565b60405180910390f35b600061013b610191565b600190509392505050565b6000610150610191565b60009050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610187610191565b6001905092915050565b6001805414156101a8576101a36101bf565b6101bd565b600260015414156101bc576101bb61024f565b5b5b565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e609055e3060006040518363ffffffff1660e01b815260040161021b9291906104ce565b600060405180830381600087803b15801561023557600080fd5b505af1158015610249573d6000803e3d6000fd5b50505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9caed1273f39fd6e51aad88f6f4ce6ab8827279cfffb922663060006040518463ffffffff1660e01b81526004016102c19392919061047c565b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b50505050565b60008135905061030481610620565b92915050565b60008135905061031981610637565b92915050565b600060208284031215610335576103346105a3565b5b6000610343848285016102f5565b91505092915050565b600080600060608486031215610365576103646105a3565b5b6000610373868287016102f5565b9350506020610384868287016102f5565b92505060406103958682870161030a565b9150509250925092565b600080604083850312156103b6576103b56105a3565b5b60006103c4858286016102f5565b92505060206103d58582860161030a565b9150509250929050565b6103e881610549565b82525050565b6103f78161055b565b82525050565b61040681610591565b82525050565b6000610419600483610538565b9150610424826105a8565b602082019050919050565b600061043c602a83610538565b9150610447826105d1565b604082019050919050565b61045b81610587565b82525050565b600060208201905061047660008301846103df565b92915050565b600060608201905061049160008301866103df565b61049e60208301856103df565b6104ab60408301846103fd565b949350505050565b60006020820190506104c860008301846103ee565b92915050565b600060808201905081810360008301526104e78161042f565b90506104f660208301856103df565b61050360408301846103fd565b81810360608301526105148161040c565b90509392505050565b60006020820190506105326000830184610452565b92915050565b600082825260208201905092915050565b600061055482610567565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061059c82610587565b9050919050565b600080fd5b7f3078303000000000000000000000000000000000000000000000000000000000600082015250565b7f307866333946643665353161616438384636463463653661423838323732373960008201527f6366664662393232363600000000000000000000000000000000000000000000602082015250565b61062981610549565b811461063457600080fd5b50565b61064081610587565b811461064b57600080fd5b5056fea264697066735822122075954d652b0eb8d814b91524c47a04c537d638cec0eda3ca0e4ee67767e1a37064736f6c63430008070033"; + +type AttackerContractConstructorParams = + | [signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: AttackerContractConstructorParams +): xs is ConstructorParameters => xs.length > 1; + +export class AttackerContract__factory extends ContractFactory { + constructor(...args: AttackerContractConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + } + + override deploy( + victimContractAddress_: PromiseOrValue, + wzeta: PromiseOrValue, + victimMethod: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise { + return super.deploy( + victimContractAddress_, + wzeta, + victimMethod, + overrides || {} + ) as Promise; + } + override getDeployTransaction( + victimContractAddress_: PromiseOrValue, + wzeta: PromiseOrValue, + victimMethod: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): TransactionRequest { + return super.getDeployTransaction( + victimContractAddress_, + wzeta, + victimMethod, + overrides || {} + ); + } + override attach(address: string): AttackerContract { + return super.attach(address) as AttackerContract; + } + override connect(signer: Signer): AttackerContract__factory { + return super.connect(signer) as AttackerContract__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): AttackerContractInterface { + return new utils.Interface(_abi) as AttackerContractInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): AttackerContract { + return new Contract(address, _abi, signerOrProvider) as AttackerContract; + } +} diff --git a/typechain-types/factories/contracts/evm/testing/AttackerContract.sol/Victim__factory.ts b/typechain-types/factories/contracts/evm/testing/AttackerContract.sol/Victim__factory.ts new file mode 100644 index 00000000..f5c1ecf7 --- /dev/null +++ b/typechain-types/factories/contracts/evm/testing/AttackerContract.sol/Victim__factory.ts @@ -0,0 +1,74 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from "ethers"; +import type { Provider } from "@ethersproject/providers"; +import type { + Victim, + VictimInterface, +} from "../../../../../contracts/evm/testing/AttackerContract.sol/Victim"; + +const _abi = [ + { + inputs: [ + { + internalType: "bytes", + name: "recipient", + type: "bytes", + }, + { + internalType: "address", + name: "asset", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + internalType: "bytes", + name: "message", + type: "bytes", + }, + ], + name: "deposit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "address", + name: "asset", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class Victim__factory { + static readonly abi = _abi; + static createInterface(): VictimInterface { + return new utils.Interface(_abi) as VictimInterface; + } + static connect(address: string, signerOrProvider: Signer | Provider): Victim { + return new Contract(address, _abi, signerOrProvider) as Victim; + } +} diff --git a/typechain-types/factories/contracts/evm/testing/AttackerContract.sol/index.ts b/typechain-types/factories/contracts/evm/testing/AttackerContract.sol/index.ts new file mode 100644 index 00000000..61a3ee2a --- /dev/null +++ b/typechain-types/factories/contracts/evm/testing/AttackerContract.sol/index.ts @@ -0,0 +1,5 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export { AttackerContract__factory } from "./AttackerContract__factory"; +export { Victim__factory } from "./Victim__factory"; diff --git a/typechain-types/factories/contracts/evm/testing/AttackerContract__factory.ts b/typechain-types/factories/contracts/evm/testing/AttackerContract__factory.ts new file mode 100644 index 00000000..0272e20a --- /dev/null +++ b/typechain-types/factories/contracts/evm/testing/AttackerContract__factory.ts @@ -0,0 +1,149 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; +import type { Provider, TransactionRequest } from "@ethersproject/providers"; +import type { PromiseOrValue } from "../../../../common"; +import type { + AttackerContract, + AttackerContractInterface, +} from "../../../../contracts/evm/testing/AttackerContract"; + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "victimContractAddress_", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + stateMutability: "nonpayable", + type: "fallback", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_methodSignature", + type: "bytes4", + }, + { + internalType: "bytes", + name: "_params", + type: "bytes", + }, + ], + name: "attack", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "entered", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_methodSignature", + type: "bytes4", + }, + { + internalType: "bytes", + name: "_params", + type: "bytes", + }, + ], + name: "set", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "victimContractAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, +] as const; + +const _bytecode = + "0x608060405234801561001057600080fd5b50604051610f12380380610f128339818101604052810190610032919061008d565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600081519050610087816100f1565b92915050565b6000602082840312156100a3576100a26100ec565b5b60006100b184828501610078565b91505092915050565b60006100c5826100cc565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6100fa816100ba565b811461010557600080fd5b50565b610dfb806101176000396000f3fe6080604052600436106100435760003560e01c8063189e33ea14610222578063526569061461024b57806389bc0bb714610274578063a77f05e91461029f5761004a565b3661004a57005b34801561005657600080fd5b506100956040518060400160405280600e81526020017f41747461636b696e672e41312e2e0000000000000000000000000000000000008152506102ca565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600060149054906101000a900460e01b60016040516024016100f19190610a4f565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161015b91906109e0565b6000604051808303816000865af19150503d8060008114610198576040519150601f19603f3d011682016040523d82523d6000602084013e61019d565b606091505b505090506101df6040518060400160405280600e81526020017f41747461636b696e672e41322e2e0000000000000000000000000000000000008152506102ca565b8061021f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021690610ab3565b60405180910390fd5b50005b34801561022e57600080fd5b50610249600480360381019061024491906107da565b610363565b005b34801561025757600080fd5b50610272600480360381019061026d91906107da565b610619565b005b34801561028057600080fd5b50610289610652565b60405161029691906109f7565b60405180910390f35b3480156102ab57600080fd5b506102b4610676565b6040516102c19190610a12565b60405180910390f35b610360816040516024016102de9190610a71565b6040516020818303038152906040527f41304fac000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610689565b50565b6103a16040518060400160405280600c81526020017f41747461636b696e672e2e2e00000000000000000000000000000000000000008152506102ca565b600260009054906101000a900460ff16156103f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103e890610a93565b60405180910390fd5b6001600260006101000a81548160ff02191690831515021790555081600060146101000a81548163ffffffff021916908360e01c021790555080600190805190602001906104409291906106b2565b5061047f6040518060400160405280600d81526020017f41747461636b696e67322e2e2e000000000000000000000000000000000000008152506102ca565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1683836040516024016104cb9190610a2d565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161053591906109e0565b6000604051808303816000865af19150503d8060008114610572576040519150601f19603f3d011682016040523d82523d6000602084013e610577565b606091505b505090506105b96040518060400160405280600d81526020017f41747461636b696e67332e2e2e000000000000000000000000000000000000008152506102ca565b806105f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f090610ad3565b60405180910390fd5b6000600260006101000a81548160ff021916908315150217905550505050565b81600060146101000a81548163ffffffff021916908360e01c0217905550806001908051906020019061064d9291906106b2565b505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900460ff1681565b60008151905060006a636f6e736f6c652e6c6f679050602083016000808483855afa5050505050565b8280546106be90610c4d565b90600052602060002090601f0160209004810192826106e05760008555610727565b82601f106106f957805160ff1916838001178555610727565b82800160010185558215610727579182015b8281111561072657825182559160200191906001019061070b565b5b5090506107349190610738565b5090565b5b80821115610751576000816000905550600101610739565b5090565b600061076861076384610b18565b610af3565b90508281526020810184848401111561078457610783610d13565b5b61078f848285610c0b565b509392505050565b6000813590506107a681610dae565b92915050565b600082601f8301126107c1576107c0610d0e565b5b81356107d1848260208601610755565b91505092915050565b600080604083850312156107f1576107f0610d1d565b5b60006107ff85828601610797565b925050602083013567ffffffffffffffff8111156108205761081f610d18565b5b61082c858286016107ac565b9150509250929050565b61083f81610ba1565b82525050565b61084e81610bb3565b82525050565b600061085f82610b5e565b6108698185610b74565b9350610879818560208601610c1a565b61088281610d22565b840191505092915050565b600061089882610b5e565b6108a28185610b85565b93506108b2818560208601610c1a565b80840191505092915050565b600081546108cb81610c4d565b6108d58186610b74565b945060018216600081146108f0576001811461090257610935565b60ff1983168652602086019350610935565b61090b85610b49565b60005b8381101561092d5781548189015260018201915060208101905061090e565b808801955050505b50505092915050565b600061094982610b69565b6109538185610b90565b9350610963818560208601610c1a565b61096c81610d22565b840191505092915050565b6000610984601883610b90565b915061098f82610d33565b602082019050919050565b60006109a7601683610b90565b91506109b282610d5c565b602082019050919050565b60006109ca601383610b90565b91506109d582610d85565b602082019050919050565b60006109ec828461088d565b915081905092915050565b6000602082019050610a0c6000830184610836565b92915050565b6000602082019050610a276000830184610845565b92915050565b60006020820190508181036000830152610a478184610854565b905092915050565b60006020820190508181036000830152610a6981846108be565b905092915050565b60006020820190508181036000830152610a8b818461093e565b905092915050565b60006020820190508181036000830152610aac81610977565b9050919050565b60006020820190508181036000830152610acc8161099a565b9050919050565b60006020820190508181036000830152610aec816109bd565b9050919050565b6000610afd610b0e565b9050610b098282610c7f565b919050565b6000604051905090565b600067ffffffffffffffff821115610b3357610b32610cdf565b5b610b3c82610d22565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b6000610bac82610beb565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b82818337600083830152505050565b60005b83811015610c38578082015181840152602081019050610c1d565b83811115610c47576000848401525b50505050565b60006002820490506001821680610c6557607f821691505b60208210811415610c7957610c78610cb0565b5b50919050565b610c8882610d22565b810181811067ffffffffffffffff82111715610ca757610ca6610cdf565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f5265656e7472616e742063616c6c206465746563746564210000000000000000600082015250565b7f5265656e7472616e742063616c6c206661696c65642100000000000000000000600082015250565b7f4d6574686f642063616c6c206661696c65642100000000000000000000000000600082015250565b610db781610bbf565b8114610dc257600080fd5b5056fea26469706673582212203cad3a1adfdea950bfbfbe387cff44c920316b14efffb7361f9bdd2f0793977864736f6c63430008070033"; + +type AttackerContractConstructorParams = + | [signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: AttackerContractConstructorParams +): xs is ConstructorParameters => xs.length > 1; + +export class AttackerContract__factory extends ContractFactory { + constructor(...args: AttackerContractConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + } + + override deploy( + victimContractAddress_: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise { + return super.deploy( + victimContractAddress_, + overrides || {} + ) as Promise; + } + override getDeployTransaction( + victimContractAddress_: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): TransactionRequest { + return super.getDeployTransaction(victimContractAddress_, overrides || {}); + } + override attach(address: string): AttackerContract { + return super.attach(address) as AttackerContract; + } + override connect(signer: Signer): AttackerContract__factory { + return super.connect(signer) as AttackerContract__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): AttackerContractInterface { + return new utils.Interface(_abi) as AttackerContractInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): AttackerContract { + return new Contract(address, _abi, signerOrProvider) as AttackerContract; + } +} diff --git a/typechain-types/factories/contracts/evm/testing/ERC20Mock__factory.ts b/typechain-types/factories/contracts/evm/testing/ERC20Mock__factory.ts new file mode 100644 index 00000000..342357d0 --- /dev/null +++ b/typechain-types/factories/contracts/evm/testing/ERC20Mock__factory.ts @@ -0,0 +1,386 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + Signer, + utils, + Contract, + ContractFactory, + BigNumberish, + Overrides, +} from "ethers"; +import type { Provider, TransactionRequest } from "@ethersproject/providers"; +import type { PromiseOrValue } from "../../../../common"; +import type { + ERC20Mock, + ERC20MockInterface, +} from "../../../../contracts/evm/testing/ERC20Mock"; + +const _abi = [ + { + inputs: [ + { + internalType: "string", + name: "name", + type: "string", + }, + { + internalType: "string", + name: "symbol", + type: "string", + }, + { + internalType: "address", + name: "creator", + type: "address", + }, + { + internalType: "uint256", + name: "initialSupply", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + 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: 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", + }, + { + 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: "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: "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: [ + { + 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: [], + 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: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +const _bytecode = + "0x60806040523480156200001157600080fd5b5060405162001beb38038062001beb833981810160405281019062000037919062000393565b838381600390805190602001906200005192919062000237565b5080600490805190602001906200006a92919062000237565b505050620000ac8262000082620000b660201b60201c565b60ff16600a620000939190620005e2565b83620000a091906200071f565b620000bf60201b60201c565b505050506200097c565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141562000132576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162000129906200047b565b60405180910390fd5b62000146600083836200022d60201b60201c565b80600260008282546200015a91906200052a565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200020d91906200049d565b60405180910390a362000229600083836200023260201b60201c565b5050565b505050565b505050565b8280546200024590620007f4565b90600052602060002090601f016020900481019282620002695760008555620002b5565b82601f106200028457805160ff1916838001178555620002b5565b82800160010185558215620002b5579182015b82811115620002b457825182559160200191906001019062000297565b5b509050620002c49190620002c8565b5090565b5b80821115620002e3576000816000905550600101620002c9565b5090565b6000620002fe620002f884620004e3565b620004ba565b9050828152602081018484840111156200031d576200031c620008f2565b5b6200032a848285620007be565b509392505050565b600081519050620003438162000948565b92915050565b600082601f830112620003615762000360620008ed565b5b815162000373848260208601620002e7565b91505092915050565b6000815190506200038d8162000962565b92915050565b60008060008060808587031215620003b057620003af620008fc565b5b600085015167ffffffffffffffff811115620003d157620003d0620008f7565b5b620003df8782880162000349565b945050602085015167ffffffffffffffff811115620004035762000402620008f7565b5b620004118782880162000349565b9350506040620004248782880162000332565b925050606062000437878288016200037c565b91505092959194509250565b600062000452601f8362000519565b91506200045f826200091f565b602082019050919050565b6200047581620007b4565b82525050565b60006020820190508181036000830152620004968162000443565b9050919050565b6000602082019050620004b460008301846200046a565b92915050565b6000620004c6620004d9565b9050620004d482826200082a565b919050565b6000604051905090565b600067ffffffffffffffff821115620005015762000500620008be565b5b6200050c8262000901565b9050602081019050919050565b600082825260208201905092915050565b60006200053782620007b4565b91506200054483620007b4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156200057c576200057b62000860565b5b828201905092915050565b6000808291508390505b6001851115620005d957808604811115620005b157620005b062000860565b5b6001851615620005c15780820291505b8081029050620005d18562000912565b945062000591565b94509492505050565b6000620005ef82620007b4565b9150620005fc83620007b4565b92506200062b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000633565b905092915050565b60008262000645576001905062000718565b8162000655576000905062000718565b81600181146200066e57600281146200067957620006af565b600191505062000718565b60ff8411156200068e576200068d62000860565b5b8360020a915084821115620006a857620006a762000860565b5b5062000718565b5060208310610133831016604e8410600b8410161715620006e95782820a905083811115620006e357620006e262000860565b5b62000718565b620006f8848484600162000587565b9250905081840481111562000712576200071162000860565b5b81810290505b9392505050565b60006200072c82620007b4565b91506200073983620007b4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161562000775576200077462000860565b5b828202905092915050565b60006200078d8262000794565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015620007de578082015181840152602081019050620007c1565b83811115620007ee576000848401525b50505050565b600060028204905060018216806200080d57607f821691505b602082108114156200082457620008236200088f565b5b50919050565b620008358262000901565b810181811067ffffffffffffffff82111715620008575762000856620008be565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b620009538162000780565b81146200095f57600080fd5b50565b6200096d81620007b4565b81146200097957600080fd5b50565b61125f806200098c6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610d20565b60405180910390f35b6100e660048036038101906100e19190610b6a565b610308565b6040516100f39190610d05565b60405180910390f35b61010461032b565b6040516101119190610e22565b60405180910390f35b610134600480360381019061012f9190610b17565b610335565b6040516101419190610d05565b60405180910390f35b610152610364565b60405161015f9190610e3d565b60405180910390f35b610182600480360381019061017d9190610b6a565b61036d565b60405161018f9190610d05565b60405180910390f35b6101b260048036038101906101ad9190610aaa565b6103a4565b6040516101bf9190610e22565b60405180910390f35b6101d06103ec565b6040516101dd9190610d20565b60405180910390f35b61020060048036038101906101fb9190610b6a565b61047e565b60405161020d9190610d05565b60405180910390f35b610230600480360381019061022b9190610b6a565b6104f5565b60405161023d9190610d05565b60405180910390f35b610260600480360381019061025b9190610ad7565b610518565b60405161026d9190610e22565b60405180910390f35b60606003805461028590610f52565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610f52565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b60008061031361059f565b90506103208185856105a7565b600191505092915050565b6000600254905090565b60008061034061059f565b905061034d858285610772565b6103588585856107fe565b60019150509392505050565b60006012905090565b60008061037861059f565b905061039981858561038a8589610518565b6103949190610e74565b6105a7565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546103fb90610f52565b80601f016020809104026020016040519081016040528092919081815260200182805461042790610f52565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60008061048961059f565b905060006104978286610518565b9050838110156104dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d390610e02565b60405180910390fd5b6104e982868684036105a7565b60019250505092915050565b60008061050061059f565b905061050d8185856107fe565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610617576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060e90610de2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610687576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067e90610d62565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107659190610e22565b60405180910390a3505050565b600061077e8484610518565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107f857818110156107ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e190610d82565b60405180910390fd5b6107f784848484036105a7565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561086e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086590610dc2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156108de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d590610d42565b60405180910390fd5b6108e9838383610a76565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561096f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096690610da2565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a5d9190610e22565b60405180910390a3610a70848484610a7b565b50505050565b505050565b505050565b600081359050610a8f816111fb565b92915050565b600081359050610aa481611212565b92915050565b600060208284031215610ac057610abf610fe2565b5b6000610ace84828501610a80565b91505092915050565b60008060408385031215610aee57610aed610fe2565b5b6000610afc85828601610a80565b9250506020610b0d85828601610a80565b9150509250929050565b600080600060608486031215610b3057610b2f610fe2565b5b6000610b3e86828701610a80565b9350506020610b4f86828701610a80565b9250506040610b6086828701610a95565b9150509250925092565b60008060408385031215610b8157610b80610fe2565b5b6000610b8f85828601610a80565b9250506020610ba085828601610a95565b9150509250929050565b610bb381610edc565b82525050565b6000610bc482610e58565b610bce8185610e63565b9350610bde818560208601610f1f565b610be781610fe7565b840191505092915050565b6000610bff602383610e63565b9150610c0a82610ff8565b604082019050919050565b6000610c22602283610e63565b9150610c2d82611047565b604082019050919050565b6000610c45601d83610e63565b9150610c5082611096565b602082019050919050565b6000610c68602683610e63565b9150610c73826110bf565b604082019050919050565b6000610c8b602583610e63565b9150610c968261110e565b604082019050919050565b6000610cae602483610e63565b9150610cb98261115d565b604082019050919050565b6000610cd1602583610e63565b9150610cdc826111ac565b604082019050919050565b610cf081610f08565b82525050565b610cff81610f12565b82525050565b6000602082019050610d1a6000830184610baa565b92915050565b60006020820190508181036000830152610d3a8184610bb9565b905092915050565b60006020820190508181036000830152610d5b81610bf2565b9050919050565b60006020820190508181036000830152610d7b81610c15565b9050919050565b60006020820190508181036000830152610d9b81610c38565b9050919050565b60006020820190508181036000830152610dbb81610c5b565b9050919050565b60006020820190508181036000830152610ddb81610c7e565b9050919050565b60006020820190508181036000830152610dfb81610ca1565b9050919050565b60006020820190508181036000830152610e1b81610cc4565b9050919050565b6000602082019050610e376000830184610ce7565b92915050565b6000602082019050610e526000830184610cf6565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610e7f82610f08565b9150610e8a83610f08565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610ebf57610ebe610f84565b5b828201905092915050565b6000610ed582610ee8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015610f3d578082015181840152602081019050610f22565b83811115610f4c576000848401525b50505050565b60006002820490506001821680610f6a57607f821691505b60208210811415610f7e57610f7d610fb3565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61120481610eca565b811461120f57600080fd5b50565b61121b81610f08565b811461122657600080fd5b5056fea26469706673582212206e7d4645203c528cb4c5c20b28a6d1615134cd17e709cf6083e931dfc154394964736f6c63430008070033"; + +type ERC20MockConstructorParams = + | [signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: ERC20MockConstructorParams +): xs is ConstructorParameters => xs.length > 1; + +export class ERC20Mock__factory extends ContractFactory { + constructor(...args: ERC20MockConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + } + + override deploy( + name: PromiseOrValue, + symbol: PromiseOrValue, + creator: PromiseOrValue, + initialSupply: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise { + return super.deploy( + name, + symbol, + creator, + initialSupply, + overrides || {} + ) as Promise; + } + override getDeployTransaction( + name: PromiseOrValue, + symbol: PromiseOrValue, + creator: PromiseOrValue, + initialSupply: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): TransactionRequest { + return super.getDeployTransaction( + name, + symbol, + creator, + initialSupply, + overrides || {} + ); + } + override attach(address: string): ERC20Mock { + return super.attach(address) as ERC20Mock; + } + override connect(signer: Signer): ERC20Mock__factory { + return super.connect(signer) as ERC20Mock__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): ERC20MockInterface { + return new utils.Interface(_abi) as ERC20MockInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): ERC20Mock { + return new Contract(address, _abi, signerOrProvider) as ERC20Mock; + } +} diff --git a/typechain-types/factories/contracts/evm/testing/index.ts b/typechain-types/factories/contracts/evm/testing/index.ts index 32ab8513..d20dc41b 100644 --- a/typechain-types/factories/contracts/evm/testing/index.ts +++ b/typechain-types/factories/contracts/evm/testing/index.ts @@ -1,6 +1,8 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ +export * as attackerContractSol from "./AttackerContract.sol"; export * as testUniswapV3ContractsSol from "./TestUniswapV3Contracts.sol"; +export { ERC20Mock__factory } from "./ERC20Mock__factory"; export { ZetaInteractorMock__factory } from "./ZetaInteractorMock__factory"; export { ZetaReceiverMock__factory } from "./ZetaReceiverMock__factory"; diff --git a/typechain-types/factories/contracts/zevm/index.ts b/typechain-types/factories/contracts/zevm/index.ts index 05952015..4ce66036 100644 --- a/typechain-types/factories/contracts/zevm/index.ts +++ b/typechain-types/factories/contracts/zevm/index.ts @@ -7,3 +7,4 @@ export * as systemContractSol from "./SystemContract.sol"; export * as wzetaSol from "./WZETA.sol"; export * as zrc20Sol from "./ZRC20.sol"; export * as interfaces from "./interfaces"; +export * as testing from "./testing"; diff --git a/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract__factory.ts b/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract__factory.ts new file mode 100644 index 00000000..fc7bd1a8 --- /dev/null +++ b/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract__factory.ts @@ -0,0 +1,398 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; +import type { Provider, TransactionRequest } from "@ethersproject/providers"; +import type { PromiseOrValue } from "../../../../../common"; +import type { + MockSystemContract, + MockSystemContractInterface, +} from "../../../../../contracts/zevm/testing/MockSystemContract.sol/MockSystemContract"; + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "wzeta_", + type: "address", + }, + { + internalType: "address", + name: "uniswapv2Factory_", + type: "address", + }, + { + internalType: "address", + name: "uniswapv2Router02_", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "CallerIsNotFungibleModule", + type: "error", + }, + { + inputs: [], + name: "CantBeIdenticalAddresses", + type: "error", + }, + { + inputs: [], + name: "CantBeZeroAddress", + type: "error", + }, + { + inputs: [], + name: "InvalidTarget", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "", + type: "address", + }, + ], + name: "SetGasCoin", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "SetGasPrice", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "", + type: "address", + }, + ], + name: "SetGasZetaPool", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "", + type: "address", + }, + ], + name: "SetWZeta", + type: "event", + }, + { + anonymous: false, + inputs: [], + name: "SystemContractDeployed", + type: "event", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "gasCoinZRC20ByChainId", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "gasPriceByChainId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "gasZetaPoolByChainId", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "target", + type: "address", + }, + { + internalType: "address", + name: "zrc20", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + internalType: "bytes", + name: "message", + type: "bytes", + }, + ], + name: "onCrossChainCall", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + { + internalType: "address", + name: "zrc20", + type: "address", + }, + ], + name: "setGasCoinZRC20", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + { + internalType: "uint256", + name: "price", + type: "uint256", + }, + ], + name: "setGasPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "addr", + type: "address", + }, + ], + name: "setWZETAContractAddress", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "uniswapv2FactoryAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "factory", + type: "address", + }, + { + internalType: "address", + name: "tokenA", + type: "address", + }, + { + internalType: "address", + name: "tokenB", + type: "address", + }, + ], + name: "uniswapv2PairFor", + outputs: [ + { + internalType: "address", + name: "pair", + type: "address", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "uniswapv2Router02Address", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "wZetaContractAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; + +const _bytecode = + "0x60806040523480156200001157600080fd5b50604051620010d7380380620010d7833981810160405281019062000037919062000146565b82600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac560405160405180910390a1505050620001f5565b6000815190506200014081620001db565b92915050565b600080600060608486031215620001625762000161620001d6565b5b600062000172868287016200012f565b935050602062000185868287016200012f565b925050604062000198868287016200012f565b9150509250925092565b6000620001af82620001b6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b620001e681620001a2565b8114620001f257600080fd5b50565b610ed280620002056000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806397770dff1161007157806397770dff14610166578063a7cb050714610182578063c63585cc1461019e578063d7fd7afb146101ce578063d936a012146101fe578063ee2815ba1461021c576100a9565b80630be15547146100ae5780633c669d55146100de578063513a9c05146100fa578063569541b91461012a578063842da36d14610148575b600080fd5b6100c860048036038101906100c3919061094d565b610238565b6040516100d59190610bce565b60405180910390f35b6100f860048036038101906100f39190610898565b61026b565b005b610114600480360381019061010f919061094d565b6103b8565b6040516101219190610bce565b60405180910390f35b6101326103eb565b60405161013f9190610bce565b60405180910390f35b610150610411565b60405161015d9190610bce565b60405180910390f35b610180600480360381019061017b9190610818565b610437565b005b61019c600480360381019061019791906109ba565b6104d4565b005b6101b860048036038101906101b39190610845565b610528565b6040516101c59190610bce565b60405180910390f35b6101e860048036038101906101e3919061094d565b61059a565b6040516101f59190610c67565b60405180910390f35b6102066105b2565b6040516102139190610bce565b60405180910390f35b6102366004803603810190610231919061097a565b6105d8565b005b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405180606001604052806040518060200160405280600081525081526020013373ffffffffffffffffffffffffffffffffffffffff1681526020014681525090508473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87866040518363ffffffff1660e01b81526004016102ea929190610be9565b602060405180830381600087803b15801561030457600080fd5b505af1158015610318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033c9190610920565b508573ffffffffffffffffffffffffffffffffffffffff1663de43156e82878787876040518663ffffffff1660e01b815260040161037e959493929190610c12565b600060405180830381600087803b15801561039857600080fd5b505af11580156103ac573d6000803e3d6000fd5b50505050505050505050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516104c99190610bce565b60405180910390a150565b80600080848152602001908152602001600020819055507f49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d828260405161051c929190610cab565b60405180910390a15050565b60008060006105378585610667565b9150915085828260405160200161054f929190610b60565b60405160208183030381529060405280519060200120604051602001610576929190610b8c565b6040516020818303038152906040528051906020012060001c925050509392505050565b60006020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b806001600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d828260405161065b929190610c82565b60405180910390a15050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156106d0576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161061070a57828461070d565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561077c576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008135905061079281610e57565b92915050565b6000815190506107a781610e6e565b92915050565b60008083601f8401126107c3576107c2610dd3565b5b8235905067ffffffffffffffff8111156107e0576107df610dce565b5b6020830191508360018202830111156107fc576107fb610dd8565b5b9250929050565b60008135905061081281610e85565b92915050565b60006020828403121561082e5761082d610de2565b5b600061083c84828501610783565b91505092915050565b60008060006060848603121561085e5761085d610de2565b5b600061086c86828701610783565b935050602061087d86828701610783565b925050604061088e86828701610783565b9150509250925092565b6000806000806000608086880312156108b4576108b3610de2565b5b60006108c288828901610783565b95505060206108d388828901610783565b94505060406108e488828901610803565b935050606086013567ffffffffffffffff81111561090557610904610ddd565b5b610911888289016107ad565b92509250509295509295909350565b60006020828403121561093657610935610de2565b5b600061094484828501610798565b91505092915050565b60006020828403121561096357610962610de2565b5b600061097184828501610803565b91505092915050565b6000806040838503121561099157610990610de2565b5b600061099f85828601610803565b92505060206109b085828601610783565b9150509250929050565b600080604083850312156109d1576109d0610de2565b5b60006109df85828601610803565b92505060206109f085828601610803565b9150509250929050565b610a0381610d0c565b82525050565b610a1281610d0c565b82525050565b610a29610a2482610d0c565b610da0565b82525050565b610a40610a3b82610d2a565b610db2565b82525050565b6000610a528385610cf0565b9350610a5f838584610d5e565b610a6883610de7565b840190509392505050565b6000610a7e82610cd4565b610a888185610cdf565b9350610a98818560208601610d6d565b610aa181610de7565b840191505092915050565b6000610ab9602083610d01565b9150610ac482610e05565b602082019050919050565b6000610adc600183610d01565b9150610ae782610e2e565b600182019050919050565b60006060830160008301518482036000860152610b0f8282610a73565b9150506020830151610b2460208601826109fa565b506040830151610b376040860182610b42565b508091505092915050565b610b4b81610d54565b82525050565b610b5a81610d54565b82525050565b6000610b6c8285610a18565b601482019150610b7c8284610a18565b6014820191508190509392505050565b6000610b9782610acf565b9150610ba38285610a18565b601482019150610bb38284610a2f565b602082019150610bc282610aac565b91508190509392505050565b6000602082019050610be36000830184610a09565b92915050565b6000604082019050610bfe6000830185610a09565b610c0b6020830184610b51565b9392505050565b60006080820190508181036000830152610c2c8188610af2565b9050610c3b6020830187610a09565b610c486040830186610b51565b8181036060830152610c5b818486610a46565b90509695505050505050565b6000602082019050610c7c6000830184610b51565b92915050565b6000604082019050610c976000830185610b51565b610ca46020830184610a09565b9392505050565b6000604082019050610cc06000830185610b51565b610ccd6020830184610b51565b9392505050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000610d1782610d34565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610d8b578082015181840152602081019050610d70565b83811115610d9a576000848401525b50505050565b6000610dab82610dbc565b9050919050565b6000819050919050565b6000610dc782610df8565b9050919050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f600082015250565b7fff00000000000000000000000000000000000000000000000000000000000000600082015250565b610e6081610d0c565b8114610e6b57600080fd5b50565b610e7781610d1e565b8114610e8257600080fd5b50565b610e8e81610d54565b8114610e9957600080fd5b5056fea26469706673582212200ba12c9e6d9b24f4467c622d42302be9e9ceb57f7588e1dd2778bc19ae263c6b64736f6c63430008070033"; + +type MockSystemContractConstructorParams = + | [signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: MockSystemContractConstructorParams +): xs is ConstructorParameters => xs.length > 1; + +export class MockSystemContract__factory extends ContractFactory { + constructor(...args: MockSystemContractConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + } + + override deploy( + wzeta_: PromiseOrValue, + uniswapv2Factory_: PromiseOrValue, + uniswapv2Router02_: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise { + return super.deploy( + wzeta_, + uniswapv2Factory_, + uniswapv2Router02_, + overrides || {} + ) as Promise; + } + override getDeployTransaction( + wzeta_: PromiseOrValue, + uniswapv2Factory_: PromiseOrValue, + uniswapv2Router02_: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): TransactionRequest { + return super.getDeployTransaction( + wzeta_, + uniswapv2Factory_, + uniswapv2Router02_, + overrides || {} + ); + } + override attach(address: string): MockSystemContract { + return super.attach(address) as MockSystemContract; + } + override connect(signer: Signer): MockSystemContract__factory { + return super.connect(signer) as MockSystemContract__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): MockSystemContractInterface { + return new utils.Interface(_abi) as MockSystemContractInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): MockSystemContract { + return new Contract(address, _abi, signerOrProvider) as MockSystemContract; + } +} diff --git a/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors__factory.ts b/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors__factory.ts new file mode 100644 index 00000000..a5e39efb --- /dev/null +++ b/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors__factory.ts @@ -0,0 +1,50 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from "ethers"; +import type { Provider } from "@ethersproject/providers"; +import type { + SystemContractErrors, + SystemContractErrorsInterface, +} from "../../../../../contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors"; + +const _abi = [ + { + inputs: [], + name: "CallerIsNotFungibleModule", + type: "error", + }, + { + inputs: [], + name: "CantBeIdenticalAddresses", + type: "error", + }, + { + inputs: [], + name: "CantBeZeroAddress", + type: "error", + }, + { + inputs: [], + name: "InvalidTarget", + type: "error", + }, +] as const; + +export class SystemContractErrors__factory { + static readonly abi = _abi; + static createInterface(): SystemContractErrorsInterface { + return new utils.Interface(_abi) as SystemContractErrorsInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): SystemContractErrors { + return new Contract( + address, + _abi, + signerOrProvider + ) as SystemContractErrors; + } +} diff --git a/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/index.ts b/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/index.ts new file mode 100644 index 00000000..705440b4 --- /dev/null +++ b/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/index.ts @@ -0,0 +1,5 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export { MockSystemContract__factory } from "./MockSystemContract__factory"; +export { SystemContractErrors__factory } from "./SystemContractErrors__factory"; diff --git a/typechain-types/factories/contracts/zevm/testing/index.ts b/typechain-types/factories/contracts/zevm/testing/index.ts new file mode 100644 index 00000000..18b0d117 --- /dev/null +++ b/typechain-types/factories/contracts/zevm/testing/index.ts @@ -0,0 +1,4 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export * as mockSystemContractSol from "./MockSystemContract.sol"; diff --git a/typechain-types/hardhat.d.ts b/typechain-types/hardhat.d.ts index ee2e5d02..c9aca675 100644 --- a/typechain-types/hardhat.d.ts +++ b/typechain-types/hardhat.d.ts @@ -176,6 +176,18 @@ declare module "hardhat/types/runtime" { name: "ZetaNonEthInterface", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; + getContractFactory( + name: "AttackerContract", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "Victim", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "ERC20Mock", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; getContractFactory( name: "INonfungiblePositionManager", signerOrOptions?: ethers.Signer | FactoryOptions @@ -328,6 +340,14 @@ declare module "hardhat/types/runtime" { name: "SystemContractErrors", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; + getContractFactory( + name: "MockSystemContract", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "SystemContractErrors", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; getContractFactory( name: "WETH9", signerOrOptions?: ethers.Signer | FactoryOptions @@ -546,6 +566,21 @@ declare module "hardhat/types/runtime" { address: string, signer?: ethers.Signer ): Promise; + getContractAt( + name: "AttackerContract", + address: string, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "Victim", + address: string, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "ERC20Mock", + address: string, + signer?: ethers.Signer + ): Promise; getContractAt( name: "INonfungiblePositionManager", address: string, @@ -736,6 +771,16 @@ declare module "hardhat/types/runtime" { address: string, signer?: ethers.Signer ): Promise; + getContractAt( + name: "MockSystemContract", + address: string, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "SystemContractErrors", + address: string, + signer?: ethers.Signer + ): Promise; getContractAt( name: "WETH9", address: string, diff --git a/typechain-types/index.ts b/typechain-types/index.ts index 818d8c39..fcfd7da3 100644 --- a/typechain-types/index.ts +++ b/typechain-types/index.ts @@ -86,6 +86,12 @@ export type { ZetaTokenConsumer } from "./contracts/evm/interfaces/ZetaInterface export { ZetaTokenConsumer__factory } from "./factories/contracts/evm/interfaces/ZetaInterfaces.sol/ZetaTokenConsumer__factory"; export type { ZetaNonEthInterface } from "./contracts/evm/interfaces/ZetaNonEthInterface"; export { ZetaNonEthInterface__factory } from "./factories/contracts/evm/interfaces/ZetaNonEthInterface__factory"; +export type { AttackerContract } from "./contracts/evm/testing/AttackerContract.sol/AttackerContract"; +export { AttackerContract__factory } from "./factories/contracts/evm/testing/AttackerContract.sol/AttackerContract__factory"; +export type { Victim } from "./contracts/evm/testing/AttackerContract.sol/Victim"; +export { Victim__factory } from "./factories/contracts/evm/testing/AttackerContract.sol/Victim__factory"; +export type { ERC20Mock } from "./contracts/evm/testing/ERC20Mock"; +export { ERC20Mock__factory } from "./factories/contracts/evm/testing/ERC20Mock__factory"; export type { INonfungiblePositionManager } from "./contracts/evm/testing/TestUniswapV3Contracts.sol/INonfungiblePositionManager"; export { INonfungiblePositionManager__factory } from "./factories/contracts/evm/testing/TestUniswapV3Contracts.sol/INonfungiblePositionManager__factory"; export type { IPoolInitializer } from "./contracts/evm/testing/TestUniswapV3Contracts.sol/IPoolInitializer"; @@ -148,6 +154,8 @@ export type { SystemContract } from "./contracts/zevm/SystemContract.sol/SystemC export { SystemContract__factory } from "./factories/contracts/zevm/SystemContract.sol/SystemContract__factory"; export type { SystemContractErrors } from "./contracts/zevm/SystemContract.sol/SystemContractErrors"; export { SystemContractErrors__factory } from "./factories/contracts/zevm/SystemContract.sol/SystemContractErrors__factory"; +export type { MockSystemContract } from "./contracts/zevm/testing/MockSystemContract.sol/MockSystemContract"; +export { MockSystemContract__factory } from "./factories/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract__factory"; export type { ZRC20 } from "./contracts/zevm/ZRC20.sol/ZRC20"; export { ZRC20__factory } from "./factories/contracts/zevm/ZRC20.sol/ZRC20__factory"; export type { ZRC20Errors } from "./contracts/zevm/ZRC20.sol/ZRC20Errors"; From 9b37d543d0cbb2d48d2cdf3753b6d57c9fe81127 Mon Sep 17 00:00:00 2001 From: Andres Aiello Date: Fri, 3 Nov 2023 11:46:10 -0300 Subject: [PATCH 2/4] generate binding --- .../evm/erc20custody.sol/erc20custody.go | 2 +- .../attackercontract.sol/attackercontract.go | 318 +++++ .../testing/attackercontract.sol/victim.go | 223 ++++ .../evm/testing/erc20mock.sol/erc20mock.go | 802 +++++++++++ .../mocksystemcontract.go | 1176 +++++++++++++++++ .../systemcontracterrors.go | 181 +++ .../contracts/evm/testing/AttackerContract.ts | 183 --- .../evm/testing/AttackerContract__factory.ts | 149 --- 8 files changed, 2701 insertions(+), 333 deletions(-) create mode 100644 pkg/contracts/evm/testing/attackercontract.sol/attackercontract.go create mode 100644 pkg/contracts/evm/testing/attackercontract.sol/victim.go create mode 100644 pkg/contracts/evm/testing/erc20mock.sol/erc20mock.go create mode 100644 pkg/contracts/zevm/testing/mocksystemcontract.sol/mocksystemcontract.go create mode 100644 pkg/contracts/zevm/testing/mocksystemcontract.sol/systemcontracterrors.go delete mode 100644 typechain-types/contracts/evm/testing/AttackerContract.ts delete mode 100644 typechain-types/factories/contracts/evm/testing/AttackerContract__factory.ts diff --git a/pkg/contracts/evm/erc20custody.sol/erc20custody.go b/pkg/contracts/evm/erc20custody.sol/erc20custody.go index 9fdd2495..0564dfec 100644 --- a/pkg/contracts/evm/erc20custody.sol/erc20custody.go +++ b/pkg/contracts/evm/erc20custody.sol/erc20custody.go @@ -32,7 +32,7 @@ var ( // ERC20CustodyMetaData contains all meta data concerning the ERC20Custody contract. var ERC20CustodyMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"TSSAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"TSSAddressUpdater_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"zetaFee_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"zetaMaxFee_\",\"type\":\"uint256\"},{\"internalType\":\"contractIERC20\",\"name\":\"zeta_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTSSUpdater\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IsPaused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotPaused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroFee\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZetaMaxFeeExceeded\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"recipient\",\"type\":\"bytes\"},{\"indexed\":true,\"internalType\":\"contractIERC20\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"TSSAddressUpdater_\",\"type\":\"address\"}],\"name\":\"RenouncedTSSUpdater\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractIERC20\",\"name\":\"asset\",\"type\":\"address\"}],\"name\":\"Unwhitelisted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"TSSAddress_\",\"type\":\"address\"}],\"name\":\"UpdatedTSSAddress\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"zetaFee_\",\"type\":\"uint256\"}],\"name\":\"UpdatedZetaFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"contractIERC20\",\"name\":\"asset\",\"type\":\"address\"}],\"name\":\"Whitelisted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"contractIERC20\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"TSSAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TSSAddressUpdater\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"recipient\",\"type\":\"bytes\"},{\"internalType\":\"contractIERC20\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceTSSAddressUpdater\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"asset\",\"type\":\"address\"}],\"name\":\"unwhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"TSSAddress_\",\"type\":\"address\"}],\"name\":\"updateTSSAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"zetaFee_\",\"type\":\"uint256\"}],\"name\":\"updateZetaFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"asset\",\"type\":\"address\"}],\"name\":\"whitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"contractIERC20\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"zeta\",\"outputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"zetaFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"zetaMaxFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60c06040523480156200001157600080fd5b50604051620021e9380380620021e9833981810160405281019062000037919062000156565b6001600081905550846001806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826003819055508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508160808181525050505050505062000283565b600081519050620001228162000235565b92915050565b60008151905062000139816200024f565b92915050565b600081519050620001508162000269565b92915050565b600080600080600060a0868803121562000175576200017462000230565b5b6000620001858882890162000111565b9550506020620001988882890162000111565b9450506040620001ab888289016200013f565b9350506060620001be888289016200013f565b9250506080620001d18882890162000128565b9150509295509295909350565b6000620001eb8262000206565b9050919050565b6000620001ff82620001de565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600080fd5b6200024081620001de565b81146200024c57600080fd5b50565b6200025a81620001f2565b81146200026657600080fd5b50565b620002748162000226565b81146200028057600080fd5b50565b60805160a05160601c611f28620002c160003960008181610e1301528181610e7a015261107601526000818161042e0152610c7a0152611f286000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80639b19251a11610097578063e5408cfa11610066578063e5408cfa1461024d578063e609055e1461026b578063e8f9cb3a14610287578063ed11692b146102a557610100565b80639b19251a146101c9578063d936547e146101e5578063d9caed1214610215578063de2f6c5e1461023157610100565b80637bdaded3116100d35780637bdaded3146101695780638456cb5914610187578063950837aa146101915780639a590427146101ad57610100565b80633f4ba83a1461010557806353ee30a31461010f57806354b61e811461012d5780635c975abb1461014b575b600080fd5b61010d6102af565b005b6101176103cf565b6040516101249190611a4d565b60405180910390f35b6101356103f3565b6040516101429190611a4d565b60405180910390f35b610153610419565b6040516101609190611ac8565b60405180910390f35b61017161042c565b60405161017e9190611be9565b60405180910390f35b61018f610450565b005b6101ab60048036038101906101a691906116fc565b6105f7565b005b6101c760048036038101906101c29190611850565b61075e565b005b6101e360048036038101906101de9190611850565b610881565b005b6101ff60048036038101906101fa9190611850565b6109a4565b60405161020c9190611ac8565b60405180910390f35b61022f600480360381019061022a9190611729565b6109c4565b005b61024b6004803603810190610246919061187d565b610bb8565b005b610255610d13565b6040516102629190611be9565b60405180910390f35b610285600480360381019061028091906117a9565b610d19565b005b61028f611074565b60405161029c9190611b2c565b60405180910390f35b6102ad611098565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610335576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900460ff1661037b576040517f6cd6020100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600160006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336040516103c59190611a4d565b60405180910390a1565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900460ff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104d6576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900460ff161561051d576040517f1309a56300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156105a4576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018060006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516105ed9190611a4d565b60405180910390a1565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461067d576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156106e4576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcd2958db8285a532edf298cbe1aa28ea3fb5ec82461253f9a8c1477924e29947816040516107539190611a4d565b60405180910390a150565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107e3576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f51085ddf9ebdded84b76e829eb58c4078e4b5bdf97d9a94723f336039da4679160405160405180910390a250565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610906576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167faab7954e9d246b167ef88aeddad35209ca2489d95a8aeb59e288d9b19fae5a5460405160405180910390a250565b60046020528060005260406000206000915054906101000a900460ff1681565b6109cc61123f565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a51576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900460ff1615610a98576040517f1309a56300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610b1b576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b4683828473ffffffffffffffffffffffffffffffffffffffff1661128f9092919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb83604051610ba39190611be9565b60405180910390a3610bb3611315565b505050565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3d576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000811415610c78576040517faf13986d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000000811115610cd2576040517fc1be451300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806003819055507f6d2d8e313fbaf76898bb9fa55e4b52525e49c7d7182d0874f97bd9076e81d52381604051610d089190611be9565b60405180910390a150565b60035481565b610d2161123f565b600160009054906101000a900460ff1615610d68576040517f1309a56300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610deb576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060035414158015610e4b5750600073ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1614155b15610ec057610ebf3360018054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1661131f909392919063ffffffff16565b5b60008473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610efb9190611a4d565b60206040518083038186803b158015610f1357600080fd5b505afa158015610f27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4b91906118aa565b9050610f7a3330868873ffffffffffffffffffffffffffffffffffffffff1661131f909392919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff167f1dafa057cc5c3bccb5ad974129a2bccd3c74002d9dfd7062404ba9523b18d6ae8888848973ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610fee9190611a4d565b60206040518083038186803b15801561100657600080fd5b505afa15801561101a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103e91906118aa565b6110489190611c47565b878760405161105b959493929190611ae3565b60405180910390a25061106c611315565b505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461111e576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156111a5576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f39ac266bfc011581be62c138d96e4e8782812013bb66fffb4cd207f4bfee3777336040516112359190611a4d565b60405180910390a1565b60026000541415611285576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127c90611bc9565b60405180910390fd5b6002600081905550565b6113108363a9059cbb60e01b84846040516024016112ae929190611a9f565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506113a8565b505050565b6001600081905550565b6113a2846323b872dd60e01b85858560405160240161134093929190611a68565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506113a8565b50505050565b600061140a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661146f9092919063ffffffff16565b905060008151111561146a578080602001905181019061142a919061177c565b611469576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146090611ba9565b60405180910390fd5b5b505050565b606061147e8484600085611487565b90509392505050565b6060824710156114cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c390611b69565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114f59190611a36565b60006040518083038185875af1925050503d8060008114611532576040519150601f19603f3d011682016040523d82523d6000602084013e611537565b606091505b509150915061154887838387611554565b92505050949350505050565b606083156115b7576000835114156115af5761156f856115ca565b6115ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a590611b89565b60405180910390fd5b5b8290506115c2565b6115c183836115ed565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000825111156116005781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116349190611b47565b60405180910390fd5b60008135905061164c81611e96565b92915050565b60008151905061166181611ead565b92915050565b60008083601f84011261167d5761167c611d81565b5b8235905067ffffffffffffffff81111561169a57611699611d7c565b5b6020830191508360018202830111156116b6576116b5611d86565b5b9250929050565b6000813590506116cc81611ec4565b92915050565b6000813590506116e181611edb565b92915050565b6000815190506116f681611edb565b92915050565b60006020828403121561171257611711611d90565b5b60006117208482850161163d565b91505092915050565b60008060006060848603121561174257611741611d90565b5b60006117508682870161163d565b9350506020611761868287016116bd565b9250506040611772868287016116d2565b9150509250925092565b60006020828403121561179257611791611d90565b5b60006117a084828501611652565b91505092915050565b600080600080600080608087890312156117c6576117c5611d90565b5b600087013567ffffffffffffffff8111156117e4576117e3611d8b565b5b6117f089828a01611667565b9650965050602061180389828a016116bd565b945050604061181489828a016116d2565b935050606087013567ffffffffffffffff81111561183557611834611d8b565b5b61184189828a01611667565b92509250509295509295509295565b60006020828403121561186657611865611d90565b5b6000611874848285016116bd565b91505092915050565b60006020828403121561189357611892611d90565b5b60006118a1848285016116d2565b91505092915050565b6000602082840312156118c0576118bf611d90565b5b60006118ce848285016116e7565b91505092915050565b6118e081611c7b565b82525050565b6118ef81611c8d565b82525050565b60006119018385611c1a565b935061190e838584611d0b565b61191783611d95565b840190509392505050565b600061192d82611c04565b6119378185611c2b565b9350611947818560208601611d1a565b80840191505092915050565b61195c81611cd5565b82525050565b600061196d82611c0f565b6119778185611c36565b9350611987818560208601611d1a565b61199081611d95565b840191505092915050565b60006119a8602683611c36565b91506119b382611da6565b604082019050919050565b60006119cb601d83611c36565b91506119d682611df5565b602082019050919050565b60006119ee602a83611c36565b91506119f982611e1e565b604082019050919050565b6000611a11601f83611c36565b9150611a1c82611e6d565b602082019050919050565b611a3081611ccb565b82525050565b6000611a428284611922565b915081905092915050565b6000602082019050611a6260008301846118d7565b92915050565b6000606082019050611a7d60008301866118d7565b611a8a60208301856118d7565b611a976040830184611a27565b949350505050565b6000604082019050611ab460008301856118d7565b611ac16020830184611a27565b9392505050565b6000602082019050611add60008301846118e6565b92915050565b60006060820190508181036000830152611afe8187896118f5565b9050611b0d6020830186611a27565b8181036040830152611b208184866118f5565b90509695505050505050565b6000602082019050611b416000830184611953565b92915050565b60006020820190508181036000830152611b618184611962565b905092915050565b60006020820190508181036000830152611b828161199b565b9050919050565b60006020820190508181036000830152611ba2816119be565b9050919050565b60006020820190508181036000830152611bc2816119e1565b9050919050565b60006020820190508181036000830152611be281611a04565b9050919050565b6000602082019050611bfe6000830184611a27565b92915050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b6000611c5282611ccb565b9150611c5d83611ccb565b925082821015611c7057611c6f611d4d565b5b828203905092915050565b6000611c8682611cab565b9050919050565b60008115159050919050565b6000611ca482611c7b565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611ce082611ce7565b9050919050565b6000611cf282611cf9565b9050919050565b6000611d0482611cab565b9050919050565b82818337600083830152505050565b60005b83811015611d38578082015181840152602081019050611d1d565b83811115611d47576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b611e9f81611c7b565b8114611eaa57600080fd5b50565b611eb681611c8d565b8114611ec157600080fd5b50565b611ecd81611c99565b8114611ed857600080fd5b50565b611ee481611ccb565b8114611eef57600080fd5b5056fea26469706673582212205e3db0f8408347f6a8d41b88dee6d3aee78db90b629cce50ac838c21a061981164736f6c63430008070033", + Bin: "0x60c06040523480156200001157600080fd5b50604051620021a0380380620021a0833981810160405281019062000037919062000156565b6001600081905550846001806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826003819055508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508160808181525050505050505062000283565b600081519050620001228162000235565b92915050565b60008151905062000139816200024f565b92915050565b600081519050620001508162000269565b92915050565b600080600080600060a0868803121562000175576200017462000230565b5b6000620001858882890162000111565b9550506020620001988882890162000111565b9450506040620001ab888289016200013f565b9350506060620001be888289016200013f565b9250506080620001d18882890162000128565b9150509295509295909350565b6000620001eb8262000206565b9050919050565b6000620001ff82620001de565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600080fd5b6200024081620001de565b81146200024c57600080fd5b50565b6200025a81620001f2565b81146200026657600080fd5b50565b620002748162000226565b81146200028057600080fd5b50565b60805160a05160601c611edf620002c160003960008181610dca01528181610e31015261102d01526000818161042d0152610c310152611edf6000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80639b19251a11610097578063e5408cfa11610066578063e5408cfa1461024d578063e609055e1461026b578063e8f9cb3a14610287578063ed11692b146102a557610100565b80639b19251a146101c9578063d936547e146101e5578063d9caed1214610215578063de2f6c5e1461023157610100565b80637bdaded3116100d35780637bdaded3146101695780638456cb5914610187578063950837aa146101915780639a590427146101ad57610100565b80633f4ba83a1461010557806353ee30a31461010f57806354b61e811461012d5780635c975abb1461014b575b600080fd5b61010d6102af565b005b6101176103ce565b6040516101249190611a04565b60405180910390f35b6101356103f2565b6040516101429190611a04565b60405180910390f35b610153610418565b6040516101609190611a7f565b60405180910390f35b61017161042b565b60405161017e9190611ba0565b60405180910390f35b61018f61044f565b005b6101ab60048036038101906101a691906116b3565b6105f5565b005b6101c760048036038101906101c29190611807565b61075c565b005b6101e360048036038101906101de9190611807565b61087f565b005b6101ff60048036038101906101fa9190611807565b6109a2565b60405161020c9190611a7f565b60405180910390f35b61022f600480360381019061022a91906116e0565b6109c2565b005b61024b60048036038101906102469190611834565b610b6f565b005b610255610cca565b6040516102629190611ba0565b60405180910390f35b61028560048036038101906102809190611760565b610cd0565b005b61028f61102b565b60405161029c9190611ae3565b60405180910390f35b6102ad61104f565b005b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610334576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900460ff1661037a576040517f6cd6020100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600160006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336040516103c49190611a04565b60405180910390a1565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900460ff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104d4576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a900460ff161561051b576040517f1309a56300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156105a2576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018060006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516105eb9190611a04565b60405180910390a1565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461067b576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156106e2576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcd2958db8285a532edf298cbe1aa28ea3fb5ec82461253f9a8c1477924e29947816040516107519190611a04565b60405180910390a150565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107e1576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f51085ddf9ebdded84b76e829eb58c4078e4b5bdf97d9a94723f336039da4679160405160405180910390a250565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610904576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167faab7954e9d246b167ef88aeddad35209ca2489d95a8aeb59e288d9b19fae5a5460405160405180910390a250565b60046020528060005260406000206000915054906101000a900460ff1681565b6109ca6111f6565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610ad2576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610afd83828473ffffffffffffffffffffffffffffffffffffffff166112469092919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb83604051610b5a9190611ba0565b60405180910390a3610b6a6112cc565b505050565b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bf4576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000811415610c2f576040517faf13986d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000000811115610c89576040517fc1be451300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806003819055507f6d2d8e313fbaf76898bb9fa55e4b52525e49c7d7182d0874f97bd9076e81d52381604051610cbf9190611ba0565b60405180910390a150565b60035481565b610cd86111f6565b600160009054906101000a900460ff1615610d1f576040517f1309a56300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610da2576040517f584a793800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060035414158015610e025750600073ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1614155b15610e7757610e763360018054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166112d6909392919063ffffffff16565b5b60008473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610eb29190611a04565b60206040518083038186803b158015610eca57600080fd5b505afa158015610ede573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f029190611861565b9050610f313330868873ffffffffffffffffffffffffffffffffffffffff166112d6909392919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff167f1dafa057cc5c3bccb5ad974129a2bccd3c74002d9dfd7062404ba9523b18d6ae8888848973ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610fa59190611a04565b60206040518083038186803b158015610fbd57600080fd5b505afa158015610fd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff59190611861565b610fff9190611bfe565b8787604051611012959493929190611a9a565b60405180910390a2506110236112cc565b505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146110d5576040517e611fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660018054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561115c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f39ac266bfc011581be62c138d96e4e8782812013bb66fffb4cd207f4bfee3777336040516111ec9190611a04565b60405180910390a1565b6002600054141561123c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123390611b80565b60405180910390fd5b6002600081905550565b6112c78363a9059cbb60e01b8484604051602401611265929190611a56565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061135f565b505050565b6001600081905550565b611359846323b872dd60e01b8585856040516024016112f793929190611a1f565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061135f565b50505050565b60006113c1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166114269092919063ffffffff16565b905060008151111561142157808060200190518101906113e19190611733565b611420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141790611b60565b60405180910390fd5b5b505050565b6060611435848460008561143e565b90509392505050565b606082471015611483576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147a90611b20565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114ac91906119ed565b60006040518083038185875af1925050503d80600081146114e9576040519150601f19603f3d011682016040523d82523d6000602084013e6114ee565b606091505b50915091506114ff8783838761150b565b92505050949350505050565b6060831561156e576000835114156115665761152685611581565b611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155c90611b40565b60405180910390fd5b5b829050611579565b61157883836115a4565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000825111156115b75781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115eb9190611afe565b60405180910390fd5b60008135905061160381611e4d565b92915050565b60008151905061161881611e64565b92915050565b60008083601f84011261163457611633611d38565b5b8235905067ffffffffffffffff81111561165157611650611d33565b5b60208301915083600182028301111561166d5761166c611d3d565b5b9250929050565b60008135905061168381611e7b565b92915050565b60008135905061169881611e92565b92915050565b6000815190506116ad81611e92565b92915050565b6000602082840312156116c9576116c8611d47565b5b60006116d7848285016115f4565b91505092915050565b6000806000606084860312156116f9576116f8611d47565b5b6000611707868287016115f4565b935050602061171886828701611674565b925050604061172986828701611689565b9150509250925092565b60006020828403121561174957611748611d47565b5b600061175784828501611609565b91505092915050565b6000806000806000806080878903121561177d5761177c611d47565b5b600087013567ffffffffffffffff81111561179b5761179a611d42565b5b6117a789828a0161161e565b965096505060206117ba89828a01611674565b94505060406117cb89828a01611689565b935050606087013567ffffffffffffffff8111156117ec576117eb611d42565b5b6117f889828a0161161e565b92509250509295509295509295565b60006020828403121561181d5761181c611d47565b5b600061182b84828501611674565b91505092915050565b60006020828403121561184a57611849611d47565b5b600061185884828501611689565b91505092915050565b60006020828403121561187757611876611d47565b5b60006118858482850161169e565b91505092915050565b61189781611c32565b82525050565b6118a681611c44565b82525050565b60006118b88385611bd1565b93506118c5838584611cc2565b6118ce83611d4c565b840190509392505050565b60006118e482611bbb565b6118ee8185611be2565b93506118fe818560208601611cd1565b80840191505092915050565b61191381611c8c565b82525050565b600061192482611bc6565b61192e8185611bed565b935061193e818560208601611cd1565b61194781611d4c565b840191505092915050565b600061195f602683611bed565b915061196a82611d5d565b604082019050919050565b6000611982601d83611bed565b915061198d82611dac565b602082019050919050565b60006119a5602a83611bed565b91506119b082611dd5565b604082019050919050565b60006119c8601f83611bed565b91506119d382611e24565b602082019050919050565b6119e781611c82565b82525050565b60006119f982846118d9565b915081905092915050565b6000602082019050611a19600083018461188e565b92915050565b6000606082019050611a34600083018661188e565b611a41602083018561188e565b611a4e60408301846119de565b949350505050565b6000604082019050611a6b600083018561188e565b611a7860208301846119de565b9392505050565b6000602082019050611a94600083018461189d565b92915050565b60006060820190508181036000830152611ab58187896118ac565b9050611ac460208301866119de565b8181036040830152611ad78184866118ac565b90509695505050505050565b6000602082019050611af8600083018461190a565b92915050565b60006020820190508181036000830152611b188184611919565b905092915050565b60006020820190508181036000830152611b3981611952565b9050919050565b60006020820190508181036000830152611b5981611975565b9050919050565b60006020820190508181036000830152611b7981611998565b9050919050565b60006020820190508181036000830152611b99816119bb565b9050919050565b6000602082019050611bb560008301846119de565b92915050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b6000611c0982611c82565b9150611c1483611c82565b925082821015611c2757611c26611d04565b5b828203905092915050565b6000611c3d82611c62565b9050919050565b60008115159050919050565b6000611c5b82611c32565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611c9782611c9e565b9050919050565b6000611ca982611cb0565b9050919050565b6000611cbb82611c62565b9050919050565b82818337600083830152505050565b60005b83811015611cef578082015181840152602081019050611cd4565b83811115611cfe576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b611e5681611c32565b8114611e6157600080fd5b50565b611e6d81611c44565b8114611e7857600080fd5b50565b611e8481611c50565b8114611e8f57600080fd5b50565b611e9b81611c82565b8114611ea657600080fd5b5056fea26469706673582212205768544075d85a56b1d380f8fcc0c8829b8a656c656277c25c81c31608d9e4ef64736f6c63430008070033", } // ERC20CustodyABI is the input ABI used to generate the binding from. diff --git a/pkg/contracts/evm/testing/attackercontract.sol/attackercontract.go b/pkg/contracts/evm/testing/attackercontract.sol/attackercontract.go new file mode 100644 index 00000000..7c7840ec --- /dev/null +++ b/pkg/contracts/evm/testing/attackercontract.sol/attackercontract.go @@ -0,0 +1,318 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package attackercontract + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// AttackerContractMetaData contains all meta data concerning the AttackerContract contract. +var AttackerContractMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"victimContractAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"wzeta\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"victimMethod\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"victimContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", + Bin: "0x60806040523480156200001157600080fd5b50604051620009ae380380620009ae8339818101604052810190620000379190620001a0565b826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401620000f492919062000250565b602060405180830381600087803b1580156200010f57600080fd5b505af115801562000124573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200014a9190620001fc565b50806001819055505050506200031a565b6000815190506200016c81620002cc565b92915050565b6000815190506200018381620002e6565b92915050565b6000815190506200019a8162000300565b92915050565b600080600060608486031215620001bc57620001bb620002c7565b5b6000620001cc868287016200015b565b9350506020620001df868287016200015b565b9250506040620001f28682870162000189565b9150509250925092565b600060208284031215620002155762000214620002c7565b5b6000620002258482850162000172565b91505092915050565b62000239816200027d565b82525050565b6200024a81620002bd565b82525050565b60006040820190506200026760008301856200022e565b6200027660208301846200023f565b9392505050565b60006200028a826200029d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600080fd5b620002d7816200027d565b8114620002e357600080fd5b50565b620002f18162000291565b8114620002fd57600080fd5b50565b6200030b81620002bd565b81146200031757600080fd5b50565b610684806200032a6000396000f3fe6080604052600436106100435760003560e01c806323b872dd1461004f57806370a082311461008c57806389bc0bb7146100c9578063a9059cbb146100f45761004a565b3661004a57005b600080fd5b34801561005b57600080fd5b506100766004803603810190610071919061034c565b610131565b60405161008391906104b3565b60405180910390f35b34801561009857600080fd5b506100b360048036038101906100ae919061031f565b610146565b6040516100c0919061051d565b60405180910390f35b3480156100d557600080fd5b506100de610159565b6040516100eb9190610461565b60405180910390f35b34801561010057600080fd5b5061011b6004803603810190610116919061039f565b61017d565b60405161012891906104b3565b60405180910390f35b600061013b610191565b600190509392505050565b6000610150610191565b60009050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610187610191565b6001905092915050565b6001805414156101a8576101a36101bf565b6101bd565b600260015414156101bc576101bb61024f565b5b5b565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e609055e3060006040518363ffffffff1660e01b815260040161021b9291906104ce565b600060405180830381600087803b15801561023557600080fd5b505af1158015610249573d6000803e3d6000fd5b50505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9caed1273f39fd6e51aad88f6f4ce6ab8827279cfffb922663060006040518463ffffffff1660e01b81526004016102c19392919061047c565b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b50505050565b60008135905061030481610620565b92915050565b60008135905061031981610637565b92915050565b600060208284031215610335576103346105a3565b5b6000610343848285016102f5565b91505092915050565b600080600060608486031215610365576103646105a3565b5b6000610373868287016102f5565b9350506020610384868287016102f5565b92505060406103958682870161030a565b9150509250925092565b600080604083850312156103b6576103b56105a3565b5b60006103c4858286016102f5565b92505060206103d58582860161030a565b9150509250929050565b6103e881610549565b82525050565b6103f78161055b565b82525050565b61040681610591565b82525050565b6000610419600483610538565b9150610424826105a8565b602082019050919050565b600061043c602a83610538565b9150610447826105d1565b604082019050919050565b61045b81610587565b82525050565b600060208201905061047660008301846103df565b92915050565b600060608201905061049160008301866103df565b61049e60208301856103df565b6104ab60408301846103fd565b949350505050565b60006020820190506104c860008301846103ee565b92915050565b600060808201905081810360008301526104e78161042f565b90506104f660208301856103df565b61050360408301846103fd565b81810360608301526105148161040c565b90509392505050565b60006020820190506105326000830184610452565b92915050565b600082825260208201905092915050565b600061055482610567565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061059c82610587565b9050919050565b600080fd5b7f3078303000000000000000000000000000000000000000000000000000000000600082015250565b7f307866333946643665353161616438384636463463653661423838323732373960008201527f6366664662393232363600000000000000000000000000000000000000000000602082015250565b61062981610549565b811461063457600080fd5b50565b61064081610587565b811461064b57600080fd5b5056fea264697066735822122075954d652b0eb8d814b91524c47a04c537d638cec0eda3ca0e4ee67767e1a37064736f6c63430008070033", +} + +// AttackerContractABI is the input ABI used to generate the binding from. +// Deprecated: Use AttackerContractMetaData.ABI instead. +var AttackerContractABI = AttackerContractMetaData.ABI + +// AttackerContractBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use AttackerContractMetaData.Bin instead. +var AttackerContractBin = AttackerContractMetaData.Bin + +// DeployAttackerContract deploys a new Ethereum contract, binding an instance of AttackerContract to it. +func DeployAttackerContract(auth *bind.TransactOpts, backend bind.ContractBackend, victimContractAddress_ common.Address, wzeta common.Address, victimMethod *big.Int) (common.Address, *types.Transaction, *AttackerContract, error) { + parsed, err := AttackerContractMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(AttackerContractBin), backend, victimContractAddress_, wzeta, victimMethod) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &AttackerContract{AttackerContractCaller: AttackerContractCaller{contract: contract}, AttackerContractTransactor: AttackerContractTransactor{contract: contract}, AttackerContractFilterer: AttackerContractFilterer{contract: contract}}, nil +} + +// AttackerContract is an auto generated Go binding around an Ethereum contract. +type AttackerContract struct { + AttackerContractCaller // Read-only binding to the contract + AttackerContractTransactor // Write-only binding to the contract + AttackerContractFilterer // Log filterer for contract events +} + +// AttackerContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type AttackerContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// AttackerContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type AttackerContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// AttackerContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type AttackerContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// AttackerContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type AttackerContractSession struct { + Contract *AttackerContract // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// AttackerContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type AttackerContractCallerSession struct { + Contract *AttackerContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// AttackerContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type AttackerContractTransactorSession struct { + Contract *AttackerContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// AttackerContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type AttackerContractRaw struct { + Contract *AttackerContract // Generic contract binding to access the raw methods on +} + +// AttackerContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type AttackerContractCallerRaw struct { + Contract *AttackerContractCaller // Generic read-only contract binding to access the raw methods on +} + +// AttackerContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type AttackerContractTransactorRaw struct { + Contract *AttackerContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewAttackerContract creates a new instance of AttackerContract, bound to a specific deployed contract. +func NewAttackerContract(address common.Address, backend bind.ContractBackend) (*AttackerContract, error) { + contract, err := bindAttackerContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &AttackerContract{AttackerContractCaller: AttackerContractCaller{contract: contract}, AttackerContractTransactor: AttackerContractTransactor{contract: contract}, AttackerContractFilterer: AttackerContractFilterer{contract: contract}}, nil +} + +// NewAttackerContractCaller creates a new read-only instance of AttackerContract, bound to a specific deployed contract. +func NewAttackerContractCaller(address common.Address, caller bind.ContractCaller) (*AttackerContractCaller, error) { + contract, err := bindAttackerContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &AttackerContractCaller{contract: contract}, nil +} + +// NewAttackerContractTransactor creates a new write-only instance of AttackerContract, bound to a specific deployed contract. +func NewAttackerContractTransactor(address common.Address, transactor bind.ContractTransactor) (*AttackerContractTransactor, error) { + contract, err := bindAttackerContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &AttackerContractTransactor{contract: contract}, nil +} + +// NewAttackerContractFilterer creates a new log filterer instance of AttackerContract, bound to a specific deployed contract. +func NewAttackerContractFilterer(address common.Address, filterer bind.ContractFilterer) (*AttackerContractFilterer, error) { + contract, err := bindAttackerContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &AttackerContractFilterer{contract: contract}, nil +} + +// bindAttackerContract binds a generic wrapper to an already deployed contract. +func bindAttackerContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := AttackerContractMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_AttackerContract *AttackerContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _AttackerContract.Contract.AttackerContractCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_AttackerContract *AttackerContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _AttackerContract.Contract.AttackerContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_AttackerContract *AttackerContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _AttackerContract.Contract.AttackerContractTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_AttackerContract *AttackerContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _AttackerContract.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_AttackerContract *AttackerContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _AttackerContract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_AttackerContract *AttackerContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _AttackerContract.Contract.contract.Transact(opts, method, params...) +} + +// VictimContractAddress is a free data retrieval call binding the contract method 0x89bc0bb7. +// +// Solidity: function victimContractAddress() view returns(address) +func (_AttackerContract *AttackerContractCaller) VictimContractAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _AttackerContract.contract.Call(opts, &out, "victimContractAddress") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// VictimContractAddress is a free data retrieval call binding the contract method 0x89bc0bb7. +// +// Solidity: function victimContractAddress() view returns(address) +func (_AttackerContract *AttackerContractSession) VictimContractAddress() (common.Address, error) { + return _AttackerContract.Contract.VictimContractAddress(&_AttackerContract.CallOpts) +} + +// VictimContractAddress is a free data retrieval call binding the contract method 0x89bc0bb7. +// +// Solidity: function victimContractAddress() view returns(address) +func (_AttackerContract *AttackerContractCallerSession) VictimContractAddress() (common.Address, error) { + return _AttackerContract.Contract.VictimContractAddress(&_AttackerContract.CallOpts) +} + +// BalanceOf is a paid mutator transaction binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) returns(uint256) +func (_AttackerContract *AttackerContractTransactor) BalanceOf(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { + return _AttackerContract.contract.Transact(opts, "balanceOf", account) +} + +// BalanceOf is a paid mutator transaction binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) returns(uint256) +func (_AttackerContract *AttackerContractSession) BalanceOf(account common.Address) (*types.Transaction, error) { + return _AttackerContract.Contract.BalanceOf(&_AttackerContract.TransactOpts, account) +} + +// BalanceOf is a paid mutator transaction binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) returns(uint256) +func (_AttackerContract *AttackerContractTransactorSession) BalanceOf(account common.Address) (*types.Transaction, error) { + return _AttackerContract.Contract.BalanceOf(&_AttackerContract.TransactOpts, account) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_AttackerContract *AttackerContractTransactor) Transfer(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _AttackerContract.contract.Transact(opts, "transfer", to, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_AttackerContract *AttackerContractSession) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _AttackerContract.Contract.Transfer(&_AttackerContract.TransactOpts, to, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_AttackerContract *AttackerContractTransactorSession) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _AttackerContract.Contract.Transfer(&_AttackerContract.TransactOpts, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_AttackerContract *AttackerContractTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _AttackerContract.contract.Transact(opts, "transferFrom", from, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_AttackerContract *AttackerContractSession) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _AttackerContract.Contract.TransferFrom(&_AttackerContract.TransactOpts, from, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_AttackerContract *AttackerContractTransactorSession) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _AttackerContract.Contract.TransferFrom(&_AttackerContract.TransactOpts, from, to, amount) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_AttackerContract *AttackerContractTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { + return _AttackerContract.contract.RawTransact(opts, nil) // calldata is disallowed for receive function +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_AttackerContract *AttackerContractSession) Receive() (*types.Transaction, error) { + return _AttackerContract.Contract.Receive(&_AttackerContract.TransactOpts) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_AttackerContract *AttackerContractTransactorSession) Receive() (*types.Transaction, error) { + return _AttackerContract.Contract.Receive(&_AttackerContract.TransactOpts) +} diff --git a/pkg/contracts/evm/testing/attackercontract.sol/victim.go b/pkg/contracts/evm/testing/attackercontract.sol/victim.go new file mode 100644 index 00000000..1aa58727 --- /dev/null +++ b/pkg/contracts/evm/testing/attackercontract.sol/victim.go @@ -0,0 +1,223 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package attackercontract + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// VictimMetaData contains all meta data concerning the Victim contract. +var VictimMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"recipient\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// VictimABI is the input ABI used to generate the binding from. +// Deprecated: Use VictimMetaData.ABI instead. +var VictimABI = VictimMetaData.ABI + +// Victim is an auto generated Go binding around an Ethereum contract. +type Victim struct { + VictimCaller // Read-only binding to the contract + VictimTransactor // Write-only binding to the contract + VictimFilterer // Log filterer for contract events +} + +// VictimCaller is an auto generated read-only Go binding around an Ethereum contract. +type VictimCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// VictimTransactor is an auto generated write-only Go binding around an Ethereum contract. +type VictimTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// VictimFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type VictimFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// VictimSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type VictimSession struct { + Contract *Victim // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// VictimCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type VictimCallerSession struct { + Contract *VictimCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// VictimTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type VictimTransactorSession struct { + Contract *VictimTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// VictimRaw is an auto generated low-level Go binding around an Ethereum contract. +type VictimRaw struct { + Contract *Victim // Generic contract binding to access the raw methods on +} + +// VictimCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type VictimCallerRaw struct { + Contract *VictimCaller // Generic read-only contract binding to access the raw methods on +} + +// VictimTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type VictimTransactorRaw struct { + Contract *VictimTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewVictim creates a new instance of Victim, bound to a specific deployed contract. +func NewVictim(address common.Address, backend bind.ContractBackend) (*Victim, error) { + contract, err := bindVictim(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Victim{VictimCaller: VictimCaller{contract: contract}, VictimTransactor: VictimTransactor{contract: contract}, VictimFilterer: VictimFilterer{contract: contract}}, nil +} + +// NewVictimCaller creates a new read-only instance of Victim, bound to a specific deployed contract. +func NewVictimCaller(address common.Address, caller bind.ContractCaller) (*VictimCaller, error) { + contract, err := bindVictim(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &VictimCaller{contract: contract}, nil +} + +// NewVictimTransactor creates a new write-only instance of Victim, bound to a specific deployed contract. +func NewVictimTransactor(address common.Address, transactor bind.ContractTransactor) (*VictimTransactor, error) { + contract, err := bindVictim(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &VictimTransactor{contract: contract}, nil +} + +// NewVictimFilterer creates a new log filterer instance of Victim, bound to a specific deployed contract. +func NewVictimFilterer(address common.Address, filterer bind.ContractFilterer) (*VictimFilterer, error) { + contract, err := bindVictim(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &VictimFilterer{contract: contract}, nil +} + +// bindVictim binds a generic wrapper to an already deployed contract. +func bindVictim(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := VictimMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Victim *VictimRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Victim.Contract.VictimCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Victim *VictimRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Victim.Contract.VictimTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Victim *VictimRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Victim.Contract.VictimTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Victim *VictimCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Victim.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Victim *VictimTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Victim.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Victim *VictimTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Victim.Contract.contract.Transact(opts, method, params...) +} + +// Deposit is a paid mutator transaction binding the contract method 0xe609055e. +// +// Solidity: function deposit(bytes recipient, address asset, uint256 amount, bytes message) returns() +func (_Victim *VictimTransactor) Deposit(opts *bind.TransactOpts, recipient []byte, asset common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _Victim.contract.Transact(opts, "deposit", recipient, asset, amount, message) +} + +// Deposit is a paid mutator transaction binding the contract method 0xe609055e. +// +// Solidity: function deposit(bytes recipient, address asset, uint256 amount, bytes message) returns() +func (_Victim *VictimSession) Deposit(recipient []byte, asset common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _Victim.Contract.Deposit(&_Victim.TransactOpts, recipient, asset, amount, message) +} + +// Deposit is a paid mutator transaction binding the contract method 0xe609055e. +// +// Solidity: function deposit(bytes recipient, address asset, uint256 amount, bytes message) returns() +func (_Victim *VictimTransactorSession) Deposit(recipient []byte, asset common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _Victim.Contract.Deposit(&_Victim.TransactOpts, recipient, asset, amount, message) +} + +// Withdraw is a paid mutator transaction binding the contract method 0xd9caed12. +// +// Solidity: function withdraw(address recipient, address asset, uint256 amount) returns() +func (_Victim *VictimTransactor) Withdraw(opts *bind.TransactOpts, recipient common.Address, asset common.Address, amount *big.Int) (*types.Transaction, error) { + return _Victim.contract.Transact(opts, "withdraw", recipient, asset, amount) +} + +// Withdraw is a paid mutator transaction binding the contract method 0xd9caed12. +// +// Solidity: function withdraw(address recipient, address asset, uint256 amount) returns() +func (_Victim *VictimSession) Withdraw(recipient common.Address, asset common.Address, amount *big.Int) (*types.Transaction, error) { + return _Victim.Contract.Withdraw(&_Victim.TransactOpts, recipient, asset, amount) +} + +// Withdraw is a paid mutator transaction binding the contract method 0xd9caed12. +// +// Solidity: function withdraw(address recipient, address asset, uint256 amount) returns() +func (_Victim *VictimTransactorSession) Withdraw(recipient common.Address, asset common.Address, amount *big.Int) (*types.Transaction, error) { + return _Victim.Contract.Withdraw(&_Victim.TransactOpts, recipient, asset, amount) +} diff --git a/pkg/contracts/evm/testing/erc20mock.sol/erc20mock.go b/pkg/contracts/evm/testing/erc20mock.sol/erc20mock.go new file mode 100644 index 00000000..cd791a51 --- /dev/null +++ b/pkg/contracts/evm/testing/erc20mock.sol/erc20mock.go @@ -0,0 +1,802 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package erc20mock + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// ERC20MockMetaData contains all meta data concerning the ERC20Mock contract. +var ERC20MockMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialSupply\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"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\":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\"},{\"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\":\"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\":\"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\":[{\"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\":[],\"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\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x60806040523480156200001157600080fd5b5060405162001beb38038062001beb833981810160405281019062000037919062000393565b838381600390805190602001906200005192919062000237565b5080600490805190602001906200006a92919062000237565b505050620000ac8262000082620000b660201b60201c565b60ff16600a620000939190620005e2565b83620000a091906200071f565b620000bf60201b60201c565b505050506200097c565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141562000132576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162000129906200047b565b60405180910390fd5b62000146600083836200022d60201b60201c565b80600260008282546200015a91906200052a565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200020d91906200049d565b60405180910390a362000229600083836200023260201b60201c565b5050565b505050565b505050565b8280546200024590620007f4565b90600052602060002090601f016020900481019282620002695760008555620002b5565b82601f106200028457805160ff1916838001178555620002b5565b82800160010185558215620002b5579182015b82811115620002b457825182559160200191906001019062000297565b5b509050620002c49190620002c8565b5090565b5b80821115620002e3576000816000905550600101620002c9565b5090565b6000620002fe620002f884620004e3565b620004ba565b9050828152602081018484840111156200031d576200031c620008f2565b5b6200032a848285620007be565b509392505050565b600081519050620003438162000948565b92915050565b600082601f830112620003615762000360620008ed565b5b815162000373848260208601620002e7565b91505092915050565b6000815190506200038d8162000962565b92915050565b60008060008060808587031215620003b057620003af620008fc565b5b600085015167ffffffffffffffff811115620003d157620003d0620008f7565b5b620003df8782880162000349565b945050602085015167ffffffffffffffff811115620004035762000402620008f7565b5b620004118782880162000349565b9350506040620004248782880162000332565b925050606062000437878288016200037c565b91505092959194509250565b600062000452601f8362000519565b91506200045f826200091f565b602082019050919050565b6200047581620007b4565b82525050565b60006020820190508181036000830152620004968162000443565b9050919050565b6000602082019050620004b460008301846200046a565b92915050565b6000620004c6620004d9565b9050620004d482826200082a565b919050565b6000604051905090565b600067ffffffffffffffff821115620005015762000500620008be565b5b6200050c8262000901565b9050602081019050919050565b600082825260208201905092915050565b60006200053782620007b4565b91506200054483620007b4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156200057c576200057b62000860565b5b828201905092915050565b6000808291508390505b6001851115620005d957808604811115620005b157620005b062000860565b5b6001851615620005c15780820291505b8081029050620005d18562000912565b945062000591565b94509492505050565b6000620005ef82620007b4565b9150620005fc83620007b4565b92506200062b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000633565b905092915050565b60008262000645576001905062000718565b8162000655576000905062000718565b81600181146200066e57600281146200067957620006af565b600191505062000718565b60ff8411156200068e576200068d62000860565b5b8360020a915084821115620006a857620006a762000860565b5b5062000718565b5060208310610133831016604e8410600b8410161715620006e95782820a905083811115620006e357620006e262000860565b5b62000718565b620006f8848484600162000587565b9250905081840481111562000712576200071162000860565b5b81810290505b9392505050565b60006200072c82620007b4565b91506200073983620007b4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161562000775576200077462000860565b5b828202905092915050565b60006200078d8262000794565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015620007de578082015181840152602081019050620007c1565b83811115620007ee576000848401525b50505050565b600060028204905060018216806200080d57607f821691505b602082108114156200082457620008236200088f565b5b50919050565b620008358262000901565b810181811067ffffffffffffffff82111715620008575762000856620008be565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b620009538162000780565b81146200095f57600080fd5b50565b6200096d81620007b4565b81146200097957600080fd5b50565b61125f806200098c6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610d20565b60405180910390f35b6100e660048036038101906100e19190610b6a565b610308565b6040516100f39190610d05565b60405180910390f35b61010461032b565b6040516101119190610e22565b60405180910390f35b610134600480360381019061012f9190610b17565b610335565b6040516101419190610d05565b60405180910390f35b610152610364565b60405161015f9190610e3d565b60405180910390f35b610182600480360381019061017d9190610b6a565b61036d565b60405161018f9190610d05565b60405180910390f35b6101b260048036038101906101ad9190610aaa565b6103a4565b6040516101bf9190610e22565b60405180910390f35b6101d06103ec565b6040516101dd9190610d20565b60405180910390f35b61020060048036038101906101fb9190610b6a565b61047e565b60405161020d9190610d05565b60405180910390f35b610230600480360381019061022b9190610b6a565b6104f5565b60405161023d9190610d05565b60405180910390f35b610260600480360381019061025b9190610ad7565b610518565b60405161026d9190610e22565b60405180910390f35b60606003805461028590610f52565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610f52565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b60008061031361059f565b90506103208185856105a7565b600191505092915050565b6000600254905090565b60008061034061059f565b905061034d858285610772565b6103588585856107fe565b60019150509392505050565b60006012905090565b60008061037861059f565b905061039981858561038a8589610518565b6103949190610e74565b6105a7565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546103fb90610f52565b80601f016020809104026020016040519081016040528092919081815260200182805461042790610f52565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60008061048961059f565b905060006104978286610518565b9050838110156104dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d390610e02565b60405180910390fd5b6104e982868684036105a7565b60019250505092915050565b60008061050061059f565b905061050d8185856107fe565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610617576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060e90610de2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610687576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067e90610d62565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107659190610e22565b60405180910390a3505050565b600061077e8484610518565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107f857818110156107ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107e190610d82565b60405180910390fd5b6107f784848484036105a7565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561086e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086590610dc2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156108de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d590610d42565b60405180910390fd5b6108e9838383610a76565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561096f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096690610da2565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a5d9190610e22565b60405180910390a3610a70848484610a7b565b50505050565b505050565b505050565b600081359050610a8f816111fb565b92915050565b600081359050610aa481611212565b92915050565b600060208284031215610ac057610abf610fe2565b5b6000610ace84828501610a80565b91505092915050565b60008060408385031215610aee57610aed610fe2565b5b6000610afc85828601610a80565b9250506020610b0d85828601610a80565b9150509250929050565b600080600060608486031215610b3057610b2f610fe2565b5b6000610b3e86828701610a80565b9350506020610b4f86828701610a80565b9250506040610b6086828701610a95565b9150509250925092565b60008060408385031215610b8157610b80610fe2565b5b6000610b8f85828601610a80565b9250506020610ba085828601610a95565b9150509250929050565b610bb381610edc565b82525050565b6000610bc482610e58565b610bce8185610e63565b9350610bde818560208601610f1f565b610be781610fe7565b840191505092915050565b6000610bff602383610e63565b9150610c0a82610ff8565b604082019050919050565b6000610c22602283610e63565b9150610c2d82611047565b604082019050919050565b6000610c45601d83610e63565b9150610c5082611096565b602082019050919050565b6000610c68602683610e63565b9150610c73826110bf565b604082019050919050565b6000610c8b602583610e63565b9150610c968261110e565b604082019050919050565b6000610cae602483610e63565b9150610cb98261115d565b604082019050919050565b6000610cd1602583610e63565b9150610cdc826111ac565b604082019050919050565b610cf081610f08565b82525050565b610cff81610f12565b82525050565b6000602082019050610d1a6000830184610baa565b92915050565b60006020820190508181036000830152610d3a8184610bb9565b905092915050565b60006020820190508181036000830152610d5b81610bf2565b9050919050565b60006020820190508181036000830152610d7b81610c15565b9050919050565b60006020820190508181036000830152610d9b81610c38565b9050919050565b60006020820190508181036000830152610dbb81610c5b565b9050919050565b60006020820190508181036000830152610ddb81610c7e565b9050919050565b60006020820190508181036000830152610dfb81610ca1565b9050919050565b60006020820190508181036000830152610e1b81610cc4565b9050919050565b6000602082019050610e376000830184610ce7565b92915050565b6000602082019050610e526000830184610cf6565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610e7f82610f08565b9150610e8a83610f08565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610ebf57610ebe610f84565b5b828201905092915050565b6000610ed582610ee8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015610f3d578082015181840152602081019050610f22565b83811115610f4c576000848401525b50505050565b60006002820490506001821680610f6a57607f821691505b60208210811415610f7e57610f7d610fb3565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61120481610eca565b811461120f57600080fd5b50565b61121b81610f08565b811461122657600080fd5b5056fea26469706673582212206e7d4645203c528cb4c5c20b28a6d1615134cd17e709cf6083e931dfc154394964736f6c63430008070033", +} + +// ERC20MockABI is the input ABI used to generate the binding from. +// Deprecated: Use ERC20MockMetaData.ABI instead. +var ERC20MockABI = ERC20MockMetaData.ABI + +// ERC20MockBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use ERC20MockMetaData.Bin instead. +var ERC20MockBin = ERC20MockMetaData.Bin + +// DeployERC20Mock deploys a new Ethereum contract, binding an instance of ERC20Mock to it. +func DeployERC20Mock(auth *bind.TransactOpts, backend bind.ContractBackend, name string, symbol string, creator common.Address, initialSupply *big.Int) (common.Address, *types.Transaction, *ERC20Mock, error) { + parsed, err := ERC20MockMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(ERC20MockBin), backend, name, symbol, creator, initialSupply) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &ERC20Mock{ERC20MockCaller: ERC20MockCaller{contract: contract}, ERC20MockTransactor: ERC20MockTransactor{contract: contract}, ERC20MockFilterer: ERC20MockFilterer{contract: contract}}, nil +} + +// ERC20Mock is an auto generated Go binding around an Ethereum contract. +type ERC20Mock struct { + ERC20MockCaller // Read-only binding to the contract + ERC20MockTransactor // Write-only binding to the contract + ERC20MockFilterer // Log filterer for contract events +} + +// ERC20MockCaller is an auto generated read-only Go binding around an Ethereum contract. +type ERC20MockCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20MockTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ERC20MockTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20MockFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ERC20MockFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ERC20MockSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ERC20MockSession struct { + Contract *ERC20Mock // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC20MockCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ERC20MockCallerSession struct { + Contract *ERC20MockCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ERC20MockTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ERC20MockTransactorSession struct { + Contract *ERC20MockTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ERC20MockRaw is an auto generated low-level Go binding around an Ethereum contract. +type ERC20MockRaw struct { + Contract *ERC20Mock // Generic contract binding to access the raw methods on +} + +// ERC20MockCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ERC20MockCallerRaw struct { + Contract *ERC20MockCaller // Generic read-only contract binding to access the raw methods on +} + +// ERC20MockTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ERC20MockTransactorRaw struct { + Contract *ERC20MockTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewERC20Mock creates a new instance of ERC20Mock, bound to a specific deployed contract. +func NewERC20Mock(address common.Address, backend bind.ContractBackend) (*ERC20Mock, error) { + contract, err := bindERC20Mock(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ERC20Mock{ERC20MockCaller: ERC20MockCaller{contract: contract}, ERC20MockTransactor: ERC20MockTransactor{contract: contract}, ERC20MockFilterer: ERC20MockFilterer{contract: contract}}, nil +} + +// NewERC20MockCaller creates a new read-only instance of ERC20Mock, bound to a specific deployed contract. +func NewERC20MockCaller(address common.Address, caller bind.ContractCaller) (*ERC20MockCaller, error) { + contract, err := bindERC20Mock(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ERC20MockCaller{contract: contract}, nil +} + +// NewERC20MockTransactor creates a new write-only instance of ERC20Mock, bound to a specific deployed contract. +func NewERC20MockTransactor(address common.Address, transactor bind.ContractTransactor) (*ERC20MockTransactor, error) { + contract, err := bindERC20Mock(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ERC20MockTransactor{contract: contract}, nil +} + +// NewERC20MockFilterer creates a new log filterer instance of ERC20Mock, bound to a specific deployed contract. +func NewERC20MockFilterer(address common.Address, filterer bind.ContractFilterer) (*ERC20MockFilterer, error) { + contract, err := bindERC20Mock(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ERC20MockFilterer{contract: contract}, nil +} + +// bindERC20Mock binds a generic wrapper to an already deployed contract. +func bindERC20Mock(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ERC20MockMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ERC20Mock *ERC20MockRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20Mock.Contract.ERC20MockCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ERC20Mock *ERC20MockRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Mock.Contract.ERC20MockTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC20Mock *ERC20MockRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20Mock.Contract.ERC20MockTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ERC20Mock *ERC20MockCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20Mock.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ERC20Mock *ERC20MockTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Mock.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ERC20Mock *ERC20MockTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20Mock.Contract.contract.Transact(opts, method, params...) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_ERC20Mock *ERC20MockCaller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) { + var out []interface{} + err := _ERC20Mock.contract.Call(opts, &out, "allowance", owner, spender) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_ERC20Mock *ERC20MockSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _ERC20Mock.Contract.Allowance(&_ERC20Mock.CallOpts, owner, spender) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_ERC20Mock *ERC20MockCallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _ERC20Mock.Contract.Allowance(&_ERC20Mock.CallOpts, owner, spender) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_ERC20Mock *ERC20MockCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _ERC20Mock.contract.Call(opts, &out, "balanceOf", account) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_ERC20Mock *ERC20MockSession) BalanceOf(account common.Address) (*big.Int, error) { + return _ERC20Mock.Contract.BalanceOf(&_ERC20Mock.CallOpts, account) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_ERC20Mock *ERC20MockCallerSession) BalanceOf(account common.Address) (*big.Int, error) { + return _ERC20Mock.Contract.BalanceOf(&_ERC20Mock.CallOpts, account) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_ERC20Mock *ERC20MockCaller) Decimals(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _ERC20Mock.contract.Call(opts, &out, "decimals") + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_ERC20Mock *ERC20MockSession) Decimals() (uint8, error) { + return _ERC20Mock.Contract.Decimals(&_ERC20Mock.CallOpts) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_ERC20Mock *ERC20MockCallerSession) Decimals() (uint8, error) { + return _ERC20Mock.Contract.Decimals(&_ERC20Mock.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ERC20Mock *ERC20MockCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _ERC20Mock.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ERC20Mock *ERC20MockSession) Name() (string, error) { + return _ERC20Mock.Contract.Name(&_ERC20Mock.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ERC20Mock *ERC20MockCallerSession) Name() (string, error) { + return _ERC20Mock.Contract.Name(&_ERC20Mock.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ERC20Mock *ERC20MockCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _ERC20Mock.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ERC20Mock *ERC20MockSession) Symbol() (string, error) { + return _ERC20Mock.Contract.Symbol(&_ERC20Mock.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ERC20Mock *ERC20MockCallerSession) Symbol() (string, error) { + return _ERC20Mock.Contract.Symbol(&_ERC20Mock.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ERC20Mock *ERC20MockCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ERC20Mock.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ERC20Mock *ERC20MockSession) TotalSupply() (*big.Int, error) { + return _ERC20Mock.Contract.TotalSupply(&_ERC20Mock.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ERC20Mock *ERC20MockCallerSession) TotalSupply() (*big.Int, error) { + return _ERC20Mock.Contract.TotalSupply(&_ERC20Mock.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 amount) returns(bool) +func (_ERC20Mock *ERC20MockTransactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20Mock.contract.Transact(opts, "approve", spender, amount) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 amount) returns(bool) +func (_ERC20Mock *ERC20MockSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20Mock.Contract.Approve(&_ERC20Mock.TransactOpts, spender, amount) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 amount) returns(bool) +func (_ERC20Mock *ERC20MockTransactorSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20Mock.Contract.Approve(&_ERC20Mock.TransactOpts, spender, amount) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_ERC20Mock *ERC20MockTransactor) DecreaseAllowance(opts *bind.TransactOpts, spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _ERC20Mock.contract.Transact(opts, "decreaseAllowance", spender, subtractedValue) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_ERC20Mock *ERC20MockSession) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _ERC20Mock.Contract.DecreaseAllowance(&_ERC20Mock.TransactOpts, spender, subtractedValue) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_ERC20Mock *ERC20MockTransactorSession) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _ERC20Mock.Contract.DecreaseAllowance(&_ERC20Mock.TransactOpts, spender, subtractedValue) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_ERC20Mock *ERC20MockTransactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _ERC20Mock.contract.Transact(opts, "increaseAllowance", spender, addedValue) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_ERC20Mock *ERC20MockSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _ERC20Mock.Contract.IncreaseAllowance(&_ERC20Mock.TransactOpts, spender, addedValue) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_ERC20Mock *ERC20MockTransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _ERC20Mock.Contract.IncreaseAllowance(&_ERC20Mock.TransactOpts, spender, addedValue) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_ERC20Mock *ERC20MockTransactor) Transfer(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20Mock.contract.Transact(opts, "transfer", to, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_ERC20Mock *ERC20MockSession) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20Mock.Contract.Transfer(&_ERC20Mock.TransactOpts, to, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_ERC20Mock *ERC20MockTransactorSession) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20Mock.Contract.Transfer(&_ERC20Mock.TransactOpts, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_ERC20Mock *ERC20MockTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20Mock.contract.Transact(opts, "transferFrom", from, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_ERC20Mock *ERC20MockSession) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20Mock.Contract.TransferFrom(&_ERC20Mock.TransactOpts, from, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_ERC20Mock *ERC20MockTransactorSession) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20Mock.Contract.TransferFrom(&_ERC20Mock.TransactOpts, from, to, amount) +} + +// ERC20MockApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ERC20Mock contract. +type ERC20MockApprovalIterator struct { + Event *ERC20MockApproval // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ERC20MockApprovalIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ERC20MockApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ERC20MockApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ERC20MockApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20MockApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20MockApproval represents a Approval event raised by the ERC20Mock contract. +type ERC20MockApproval struct { + Owner common.Address + Spender common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ERC20Mock *ERC20MockFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ERC20MockApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _ERC20Mock.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return &ERC20MockApprovalIterator{contract: _ERC20Mock.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ERC20Mock *ERC20MockFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ERC20MockApproval, owner []common.Address, spender []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _ERC20Mock.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ERC20MockApproval) + if err := _ERC20Mock.contract.UnpackLog(event, "Approval", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ERC20Mock *ERC20MockFilterer) ParseApproval(log types.Log) (*ERC20MockApproval, error) { + event := new(ERC20MockApproval) + if err := _ERC20Mock.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ERC20MockTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ERC20Mock contract. +type ERC20MockTransferIterator struct { + Event *ERC20MockTransfer // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ERC20MockTransferIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ERC20MockTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ERC20MockTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ERC20MockTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20MockTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20MockTransfer represents a Transfer event raised by the ERC20Mock contract. +type ERC20MockTransfer struct { + From common.Address + To common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ERC20Mock *ERC20MockFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ERC20MockTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _ERC20Mock.contract.FilterLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return &ERC20MockTransferIterator{contract: _ERC20Mock.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ERC20Mock *ERC20MockFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ERC20MockTransfer, from []common.Address, to []common.Address) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _ERC20Mock.contract.WatchLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ERC20MockTransfer) + if err := _ERC20Mock.contract.UnpackLog(event, "Transfer", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ERC20Mock *ERC20MockFilterer) ParseTransfer(log types.Log) (*ERC20MockTransfer, error) { + event := new(ERC20MockTransfer) + if err := _ERC20Mock.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/pkg/contracts/zevm/testing/mocksystemcontract.sol/mocksystemcontract.go b/pkg/contracts/zevm/testing/mocksystemcontract.sol/mocksystemcontract.go new file mode 100644 index 00000000..36ed95d4 --- /dev/null +++ b/pkg/contracts/zevm/testing/mocksystemcontract.sol/mocksystemcontract.go @@ -0,0 +1,1176 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package mocksystemcontract + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// MockSystemContractMetaData contains all meta data concerning the MockSystemContract contract. +var MockSystemContractMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wzeta_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"uniswapv2Factory_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"uniswapv2Router02_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerIsNotFungibleModule\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CantBeIdenticalAddresses\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CantBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTarget\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SetGasCoin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"SetGasPrice\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SetGasZetaPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SetWZeta\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"SystemContractDeployed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"gasCoinZRC20ByChainId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"gasPriceByChainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"gasZetaPoolByChainId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCrossChainCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"}],\"name\":\"setGasCoinZRC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setGasPrice\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setWZETAContractAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapv2FactoryAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"}],\"name\":\"uniswapv2PairFor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"pair\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapv2Router02Address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wZetaContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + Bin: "0x60806040523480156200001157600080fd5b50604051620010d7380380620010d7833981810160405281019062000037919062000146565b82600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac560405160405180910390a1505050620001f5565b6000815190506200014081620001db565b92915050565b600080600060608486031215620001625762000161620001d6565b5b600062000172868287016200012f565b935050602062000185868287016200012f565b925050604062000198868287016200012f565b9150509250925092565b6000620001af82620001b6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b620001e681620001a2565b8114620001f257600080fd5b50565b610ed280620002056000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806397770dff1161007157806397770dff14610166578063a7cb050714610182578063c63585cc1461019e578063d7fd7afb146101ce578063d936a012146101fe578063ee2815ba1461021c576100a9565b80630be15547146100ae5780633c669d55146100de578063513a9c05146100fa578063569541b91461012a578063842da36d14610148575b600080fd5b6100c860048036038101906100c3919061094d565b610238565b6040516100d59190610bce565b60405180910390f35b6100f860048036038101906100f39190610898565b61026b565b005b610114600480360381019061010f919061094d565b6103b8565b6040516101219190610bce565b60405180910390f35b6101326103eb565b60405161013f9190610bce565b60405180910390f35b610150610411565b60405161015d9190610bce565b60405180910390f35b610180600480360381019061017b9190610818565b610437565b005b61019c600480360381019061019791906109ba565b6104d4565b005b6101b860048036038101906101b39190610845565b610528565b6040516101c59190610bce565b60405180910390f35b6101e860048036038101906101e3919061094d565b61059a565b6040516101f59190610c67565b60405180910390f35b6102066105b2565b6040516102139190610bce565b60405180910390f35b6102366004803603810190610231919061097a565b6105d8565b005b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405180606001604052806040518060200160405280600081525081526020013373ffffffffffffffffffffffffffffffffffffffff1681526020014681525090508473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87866040518363ffffffff1660e01b81526004016102ea929190610be9565b602060405180830381600087803b15801561030457600080fd5b505af1158015610318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033c9190610920565b508573ffffffffffffffffffffffffffffffffffffffff1663de43156e82878787876040518663ffffffff1660e01b815260040161037e959493929190610c12565b600060405180830381600087803b15801561039857600080fd5b505af11580156103ac573d6000803e3d6000fd5b50505050505050505050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516104c99190610bce565b60405180910390a150565b80600080848152602001908152602001600020819055507f49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d828260405161051c929190610cab565b60405180910390a15050565b60008060006105378585610667565b9150915085828260405160200161054f929190610b60565b60405160208183030381529060405280519060200120604051602001610576929190610b8c565b6040516020818303038152906040528051906020012060001c925050509392505050565b60006020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b806001600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d828260405161065b929190610c82565b60405180910390a15050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156106d0576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161061070a57828461070d565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561077c576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008135905061079281610e57565b92915050565b6000815190506107a781610e6e565b92915050565b60008083601f8401126107c3576107c2610dd3565b5b8235905067ffffffffffffffff8111156107e0576107df610dce565b5b6020830191508360018202830111156107fc576107fb610dd8565b5b9250929050565b60008135905061081281610e85565b92915050565b60006020828403121561082e5761082d610de2565b5b600061083c84828501610783565b91505092915050565b60008060006060848603121561085e5761085d610de2565b5b600061086c86828701610783565b935050602061087d86828701610783565b925050604061088e86828701610783565b9150509250925092565b6000806000806000608086880312156108b4576108b3610de2565b5b60006108c288828901610783565b95505060206108d388828901610783565b94505060406108e488828901610803565b935050606086013567ffffffffffffffff81111561090557610904610ddd565b5b610911888289016107ad565b92509250509295509295909350565b60006020828403121561093657610935610de2565b5b600061094484828501610798565b91505092915050565b60006020828403121561096357610962610de2565b5b600061097184828501610803565b91505092915050565b6000806040838503121561099157610990610de2565b5b600061099f85828601610803565b92505060206109b085828601610783565b9150509250929050565b600080604083850312156109d1576109d0610de2565b5b60006109df85828601610803565b92505060206109f085828601610803565b9150509250929050565b610a0381610d0c565b82525050565b610a1281610d0c565b82525050565b610a29610a2482610d0c565b610da0565b82525050565b610a40610a3b82610d2a565b610db2565b82525050565b6000610a528385610cf0565b9350610a5f838584610d5e565b610a6883610de7565b840190509392505050565b6000610a7e82610cd4565b610a888185610cdf565b9350610a98818560208601610d6d565b610aa181610de7565b840191505092915050565b6000610ab9602083610d01565b9150610ac482610e05565b602082019050919050565b6000610adc600183610d01565b9150610ae782610e2e565b600182019050919050565b60006060830160008301518482036000860152610b0f8282610a73565b9150506020830151610b2460208601826109fa565b506040830151610b376040860182610b42565b508091505092915050565b610b4b81610d54565b82525050565b610b5a81610d54565b82525050565b6000610b6c8285610a18565b601482019150610b7c8284610a18565b6014820191508190509392505050565b6000610b9782610acf565b9150610ba38285610a18565b601482019150610bb38284610a2f565b602082019150610bc282610aac565b91508190509392505050565b6000602082019050610be36000830184610a09565b92915050565b6000604082019050610bfe6000830185610a09565b610c0b6020830184610b51565b9392505050565b60006080820190508181036000830152610c2c8188610af2565b9050610c3b6020830187610a09565b610c486040830186610b51565b8181036060830152610c5b818486610a46565b90509695505050505050565b6000602082019050610c7c6000830184610b51565b92915050565b6000604082019050610c976000830185610b51565b610ca46020830184610a09565b9392505050565b6000604082019050610cc06000830185610b51565b610ccd6020830184610b51565b9392505050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000610d1782610d34565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610d8b578082015181840152602081019050610d70565b83811115610d9a576000848401525b50505050565b6000610dab82610dbc565b9050919050565b6000819050919050565b6000610dc782610df8565b9050919050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f600082015250565b7fff00000000000000000000000000000000000000000000000000000000000000600082015250565b610e6081610d0c565b8114610e6b57600080fd5b50565b610e7781610d1e565b8114610e8257600080fd5b50565b610e8e81610d54565b8114610e9957600080fd5b5056fea26469706673582212200ba12c9e6d9b24f4467c622d42302be9e9ceb57f7588e1dd2778bc19ae263c6b64736f6c63430008070033", +} + +// MockSystemContractABI is the input ABI used to generate the binding from. +// Deprecated: Use MockSystemContractMetaData.ABI instead. +var MockSystemContractABI = MockSystemContractMetaData.ABI + +// MockSystemContractBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use MockSystemContractMetaData.Bin instead. +var MockSystemContractBin = MockSystemContractMetaData.Bin + +// DeployMockSystemContract deploys a new Ethereum contract, binding an instance of MockSystemContract to it. +func DeployMockSystemContract(auth *bind.TransactOpts, backend bind.ContractBackend, wzeta_ common.Address, uniswapv2Factory_ common.Address, uniswapv2Router02_ common.Address) (common.Address, *types.Transaction, *MockSystemContract, error) { + parsed, err := MockSystemContractMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(MockSystemContractBin), backend, wzeta_, uniswapv2Factory_, uniswapv2Router02_) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &MockSystemContract{MockSystemContractCaller: MockSystemContractCaller{contract: contract}, MockSystemContractTransactor: MockSystemContractTransactor{contract: contract}, MockSystemContractFilterer: MockSystemContractFilterer{contract: contract}}, nil +} + +// MockSystemContract is an auto generated Go binding around an Ethereum contract. +type MockSystemContract struct { + MockSystemContractCaller // Read-only binding to the contract + MockSystemContractTransactor // Write-only binding to the contract + MockSystemContractFilterer // Log filterer for contract events +} + +// MockSystemContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type MockSystemContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockSystemContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type MockSystemContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockSystemContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type MockSystemContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockSystemContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type MockSystemContractSession struct { + Contract *MockSystemContract // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// MockSystemContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type MockSystemContractCallerSession struct { + Contract *MockSystemContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// MockSystemContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type MockSystemContractTransactorSession struct { + Contract *MockSystemContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// MockSystemContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type MockSystemContractRaw struct { + Contract *MockSystemContract // Generic contract binding to access the raw methods on +} + +// MockSystemContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type MockSystemContractCallerRaw struct { + Contract *MockSystemContractCaller // Generic read-only contract binding to access the raw methods on +} + +// MockSystemContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type MockSystemContractTransactorRaw struct { + Contract *MockSystemContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewMockSystemContract creates a new instance of MockSystemContract, bound to a specific deployed contract. +func NewMockSystemContract(address common.Address, backend bind.ContractBackend) (*MockSystemContract, error) { + contract, err := bindMockSystemContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &MockSystemContract{MockSystemContractCaller: MockSystemContractCaller{contract: contract}, MockSystemContractTransactor: MockSystemContractTransactor{contract: contract}, MockSystemContractFilterer: MockSystemContractFilterer{contract: contract}}, nil +} + +// NewMockSystemContractCaller creates a new read-only instance of MockSystemContract, bound to a specific deployed contract. +func NewMockSystemContractCaller(address common.Address, caller bind.ContractCaller) (*MockSystemContractCaller, error) { + contract, err := bindMockSystemContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &MockSystemContractCaller{contract: contract}, nil +} + +// NewMockSystemContractTransactor creates a new write-only instance of MockSystemContract, bound to a specific deployed contract. +func NewMockSystemContractTransactor(address common.Address, transactor bind.ContractTransactor) (*MockSystemContractTransactor, error) { + contract, err := bindMockSystemContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &MockSystemContractTransactor{contract: contract}, nil +} + +// NewMockSystemContractFilterer creates a new log filterer instance of MockSystemContract, bound to a specific deployed contract. +func NewMockSystemContractFilterer(address common.Address, filterer bind.ContractFilterer) (*MockSystemContractFilterer, error) { + contract, err := bindMockSystemContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &MockSystemContractFilterer{contract: contract}, nil +} + +// bindMockSystemContract binds a generic wrapper to an already deployed contract. +func bindMockSystemContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := MockSystemContractMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_MockSystemContract *MockSystemContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _MockSystemContract.Contract.MockSystemContractCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_MockSystemContract *MockSystemContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _MockSystemContract.Contract.MockSystemContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_MockSystemContract *MockSystemContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _MockSystemContract.Contract.MockSystemContractTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_MockSystemContract *MockSystemContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _MockSystemContract.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_MockSystemContract *MockSystemContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _MockSystemContract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_MockSystemContract *MockSystemContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _MockSystemContract.Contract.contract.Transact(opts, method, params...) +} + +// GasCoinZRC20ByChainId is a free data retrieval call binding the contract method 0x0be15547. +// +// Solidity: function gasCoinZRC20ByChainId(uint256 ) view returns(address) +func (_MockSystemContract *MockSystemContractCaller) GasCoinZRC20ByChainId(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { + var out []interface{} + err := _MockSystemContract.contract.Call(opts, &out, "gasCoinZRC20ByChainId", arg0) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GasCoinZRC20ByChainId is a free data retrieval call binding the contract method 0x0be15547. +// +// Solidity: function gasCoinZRC20ByChainId(uint256 ) view returns(address) +func (_MockSystemContract *MockSystemContractSession) GasCoinZRC20ByChainId(arg0 *big.Int) (common.Address, error) { + return _MockSystemContract.Contract.GasCoinZRC20ByChainId(&_MockSystemContract.CallOpts, arg0) +} + +// GasCoinZRC20ByChainId is a free data retrieval call binding the contract method 0x0be15547. +// +// Solidity: function gasCoinZRC20ByChainId(uint256 ) view returns(address) +func (_MockSystemContract *MockSystemContractCallerSession) GasCoinZRC20ByChainId(arg0 *big.Int) (common.Address, error) { + return _MockSystemContract.Contract.GasCoinZRC20ByChainId(&_MockSystemContract.CallOpts, arg0) +} + +// GasPriceByChainId is a free data retrieval call binding the contract method 0xd7fd7afb. +// +// Solidity: function gasPriceByChainId(uint256 ) view returns(uint256) +func (_MockSystemContract *MockSystemContractCaller) GasPriceByChainId(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error) { + var out []interface{} + err := _MockSystemContract.contract.Call(opts, &out, "gasPriceByChainId", arg0) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GasPriceByChainId is a free data retrieval call binding the contract method 0xd7fd7afb. +// +// Solidity: function gasPriceByChainId(uint256 ) view returns(uint256) +func (_MockSystemContract *MockSystemContractSession) GasPriceByChainId(arg0 *big.Int) (*big.Int, error) { + return _MockSystemContract.Contract.GasPriceByChainId(&_MockSystemContract.CallOpts, arg0) +} + +// GasPriceByChainId is a free data retrieval call binding the contract method 0xd7fd7afb. +// +// Solidity: function gasPriceByChainId(uint256 ) view returns(uint256) +func (_MockSystemContract *MockSystemContractCallerSession) GasPriceByChainId(arg0 *big.Int) (*big.Int, error) { + return _MockSystemContract.Contract.GasPriceByChainId(&_MockSystemContract.CallOpts, arg0) +} + +// GasZetaPoolByChainId is a free data retrieval call binding the contract method 0x513a9c05. +// +// Solidity: function gasZetaPoolByChainId(uint256 ) view returns(address) +func (_MockSystemContract *MockSystemContractCaller) GasZetaPoolByChainId(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { + var out []interface{} + err := _MockSystemContract.contract.Call(opts, &out, "gasZetaPoolByChainId", arg0) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GasZetaPoolByChainId is a free data retrieval call binding the contract method 0x513a9c05. +// +// Solidity: function gasZetaPoolByChainId(uint256 ) view returns(address) +func (_MockSystemContract *MockSystemContractSession) GasZetaPoolByChainId(arg0 *big.Int) (common.Address, error) { + return _MockSystemContract.Contract.GasZetaPoolByChainId(&_MockSystemContract.CallOpts, arg0) +} + +// GasZetaPoolByChainId is a free data retrieval call binding the contract method 0x513a9c05. +// +// Solidity: function gasZetaPoolByChainId(uint256 ) view returns(address) +func (_MockSystemContract *MockSystemContractCallerSession) GasZetaPoolByChainId(arg0 *big.Int) (common.Address, error) { + return _MockSystemContract.Contract.GasZetaPoolByChainId(&_MockSystemContract.CallOpts, arg0) +} + +// Uniswapv2FactoryAddress is a free data retrieval call binding the contract method 0xd936a012. +// +// Solidity: function uniswapv2FactoryAddress() view returns(address) +func (_MockSystemContract *MockSystemContractCaller) Uniswapv2FactoryAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _MockSystemContract.contract.Call(opts, &out, "uniswapv2FactoryAddress") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Uniswapv2FactoryAddress is a free data retrieval call binding the contract method 0xd936a012. +// +// Solidity: function uniswapv2FactoryAddress() view returns(address) +func (_MockSystemContract *MockSystemContractSession) Uniswapv2FactoryAddress() (common.Address, error) { + return _MockSystemContract.Contract.Uniswapv2FactoryAddress(&_MockSystemContract.CallOpts) +} + +// Uniswapv2FactoryAddress is a free data retrieval call binding the contract method 0xd936a012. +// +// Solidity: function uniswapv2FactoryAddress() view returns(address) +func (_MockSystemContract *MockSystemContractCallerSession) Uniswapv2FactoryAddress() (common.Address, error) { + return _MockSystemContract.Contract.Uniswapv2FactoryAddress(&_MockSystemContract.CallOpts) +} + +// Uniswapv2PairFor is a free data retrieval call binding the contract method 0xc63585cc. +// +// Solidity: function uniswapv2PairFor(address factory, address tokenA, address tokenB) pure returns(address pair) +func (_MockSystemContract *MockSystemContractCaller) Uniswapv2PairFor(opts *bind.CallOpts, factory common.Address, tokenA common.Address, tokenB common.Address) (common.Address, error) { + var out []interface{} + err := _MockSystemContract.contract.Call(opts, &out, "uniswapv2PairFor", factory, tokenA, tokenB) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Uniswapv2PairFor is a free data retrieval call binding the contract method 0xc63585cc. +// +// Solidity: function uniswapv2PairFor(address factory, address tokenA, address tokenB) pure returns(address pair) +func (_MockSystemContract *MockSystemContractSession) Uniswapv2PairFor(factory common.Address, tokenA common.Address, tokenB common.Address) (common.Address, error) { + return _MockSystemContract.Contract.Uniswapv2PairFor(&_MockSystemContract.CallOpts, factory, tokenA, tokenB) +} + +// Uniswapv2PairFor is a free data retrieval call binding the contract method 0xc63585cc. +// +// Solidity: function uniswapv2PairFor(address factory, address tokenA, address tokenB) pure returns(address pair) +func (_MockSystemContract *MockSystemContractCallerSession) Uniswapv2PairFor(factory common.Address, tokenA common.Address, tokenB common.Address) (common.Address, error) { + return _MockSystemContract.Contract.Uniswapv2PairFor(&_MockSystemContract.CallOpts, factory, tokenA, tokenB) +} + +// Uniswapv2Router02Address is a free data retrieval call binding the contract method 0x842da36d. +// +// Solidity: function uniswapv2Router02Address() view returns(address) +func (_MockSystemContract *MockSystemContractCaller) Uniswapv2Router02Address(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _MockSystemContract.contract.Call(opts, &out, "uniswapv2Router02Address") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Uniswapv2Router02Address is a free data retrieval call binding the contract method 0x842da36d. +// +// Solidity: function uniswapv2Router02Address() view returns(address) +func (_MockSystemContract *MockSystemContractSession) Uniswapv2Router02Address() (common.Address, error) { + return _MockSystemContract.Contract.Uniswapv2Router02Address(&_MockSystemContract.CallOpts) +} + +// Uniswapv2Router02Address is a free data retrieval call binding the contract method 0x842da36d. +// +// Solidity: function uniswapv2Router02Address() view returns(address) +func (_MockSystemContract *MockSystemContractCallerSession) Uniswapv2Router02Address() (common.Address, error) { + return _MockSystemContract.Contract.Uniswapv2Router02Address(&_MockSystemContract.CallOpts) +} + +// WZetaContractAddress is a free data retrieval call binding the contract method 0x569541b9. +// +// Solidity: function wZetaContractAddress() view returns(address) +func (_MockSystemContract *MockSystemContractCaller) WZetaContractAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _MockSystemContract.contract.Call(opts, &out, "wZetaContractAddress") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// WZetaContractAddress is a free data retrieval call binding the contract method 0x569541b9. +// +// Solidity: function wZetaContractAddress() view returns(address) +func (_MockSystemContract *MockSystemContractSession) WZetaContractAddress() (common.Address, error) { + return _MockSystemContract.Contract.WZetaContractAddress(&_MockSystemContract.CallOpts) +} + +// WZetaContractAddress is a free data retrieval call binding the contract method 0x569541b9. +// +// Solidity: function wZetaContractAddress() view returns(address) +func (_MockSystemContract *MockSystemContractCallerSession) WZetaContractAddress() (common.Address, error) { + return _MockSystemContract.Contract.WZetaContractAddress(&_MockSystemContract.CallOpts) +} + +// OnCrossChainCall is a paid mutator transaction binding the contract method 0x3c669d55. +// +// Solidity: function onCrossChainCall(address target, address zrc20, uint256 amount, bytes message) returns() +func (_MockSystemContract *MockSystemContractTransactor) OnCrossChainCall(opts *bind.TransactOpts, target common.Address, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _MockSystemContract.contract.Transact(opts, "onCrossChainCall", target, zrc20, amount, message) +} + +// OnCrossChainCall is a paid mutator transaction binding the contract method 0x3c669d55. +// +// Solidity: function onCrossChainCall(address target, address zrc20, uint256 amount, bytes message) returns() +func (_MockSystemContract *MockSystemContractSession) OnCrossChainCall(target common.Address, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _MockSystemContract.Contract.OnCrossChainCall(&_MockSystemContract.TransactOpts, target, zrc20, amount, message) +} + +// OnCrossChainCall is a paid mutator transaction binding the contract method 0x3c669d55. +// +// Solidity: function onCrossChainCall(address target, address zrc20, uint256 amount, bytes message) returns() +func (_MockSystemContract *MockSystemContractTransactorSession) OnCrossChainCall(target common.Address, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _MockSystemContract.Contract.OnCrossChainCall(&_MockSystemContract.TransactOpts, target, zrc20, amount, message) +} + +// SetGasCoinZRC20 is a paid mutator transaction binding the contract method 0xee2815ba. +// +// Solidity: function setGasCoinZRC20(uint256 chainID, address zrc20) returns() +func (_MockSystemContract *MockSystemContractTransactor) SetGasCoinZRC20(opts *bind.TransactOpts, chainID *big.Int, zrc20 common.Address) (*types.Transaction, error) { + return _MockSystemContract.contract.Transact(opts, "setGasCoinZRC20", chainID, zrc20) +} + +// SetGasCoinZRC20 is a paid mutator transaction binding the contract method 0xee2815ba. +// +// Solidity: function setGasCoinZRC20(uint256 chainID, address zrc20) returns() +func (_MockSystemContract *MockSystemContractSession) SetGasCoinZRC20(chainID *big.Int, zrc20 common.Address) (*types.Transaction, error) { + return _MockSystemContract.Contract.SetGasCoinZRC20(&_MockSystemContract.TransactOpts, chainID, zrc20) +} + +// SetGasCoinZRC20 is a paid mutator transaction binding the contract method 0xee2815ba. +// +// Solidity: function setGasCoinZRC20(uint256 chainID, address zrc20) returns() +func (_MockSystemContract *MockSystemContractTransactorSession) SetGasCoinZRC20(chainID *big.Int, zrc20 common.Address) (*types.Transaction, error) { + return _MockSystemContract.Contract.SetGasCoinZRC20(&_MockSystemContract.TransactOpts, chainID, zrc20) +} + +// SetGasPrice is a paid mutator transaction binding the contract method 0xa7cb0507. +// +// Solidity: function setGasPrice(uint256 chainID, uint256 price) returns() +func (_MockSystemContract *MockSystemContractTransactor) SetGasPrice(opts *bind.TransactOpts, chainID *big.Int, price *big.Int) (*types.Transaction, error) { + return _MockSystemContract.contract.Transact(opts, "setGasPrice", chainID, price) +} + +// SetGasPrice is a paid mutator transaction binding the contract method 0xa7cb0507. +// +// Solidity: function setGasPrice(uint256 chainID, uint256 price) returns() +func (_MockSystemContract *MockSystemContractSession) SetGasPrice(chainID *big.Int, price *big.Int) (*types.Transaction, error) { + return _MockSystemContract.Contract.SetGasPrice(&_MockSystemContract.TransactOpts, chainID, price) +} + +// SetGasPrice is a paid mutator transaction binding the contract method 0xa7cb0507. +// +// Solidity: function setGasPrice(uint256 chainID, uint256 price) returns() +func (_MockSystemContract *MockSystemContractTransactorSession) SetGasPrice(chainID *big.Int, price *big.Int) (*types.Transaction, error) { + return _MockSystemContract.Contract.SetGasPrice(&_MockSystemContract.TransactOpts, chainID, price) +} + +// SetWZETAContractAddress is a paid mutator transaction binding the contract method 0x97770dff. +// +// Solidity: function setWZETAContractAddress(address addr) returns() +func (_MockSystemContract *MockSystemContractTransactor) SetWZETAContractAddress(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { + return _MockSystemContract.contract.Transact(opts, "setWZETAContractAddress", addr) +} + +// SetWZETAContractAddress is a paid mutator transaction binding the contract method 0x97770dff. +// +// Solidity: function setWZETAContractAddress(address addr) returns() +func (_MockSystemContract *MockSystemContractSession) SetWZETAContractAddress(addr common.Address) (*types.Transaction, error) { + return _MockSystemContract.Contract.SetWZETAContractAddress(&_MockSystemContract.TransactOpts, addr) +} + +// SetWZETAContractAddress is a paid mutator transaction binding the contract method 0x97770dff. +// +// Solidity: function setWZETAContractAddress(address addr) returns() +func (_MockSystemContract *MockSystemContractTransactorSession) SetWZETAContractAddress(addr common.Address) (*types.Transaction, error) { + return _MockSystemContract.Contract.SetWZETAContractAddress(&_MockSystemContract.TransactOpts, addr) +} + +// MockSystemContractSetGasCoinIterator is returned from FilterSetGasCoin and is used to iterate over the raw logs and unpacked data for SetGasCoin events raised by the MockSystemContract contract. +type MockSystemContractSetGasCoinIterator struct { + Event *MockSystemContractSetGasCoin // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *MockSystemContractSetGasCoinIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(MockSystemContractSetGasCoin) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(MockSystemContractSetGasCoin) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *MockSystemContractSetGasCoinIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *MockSystemContractSetGasCoinIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// MockSystemContractSetGasCoin represents a SetGasCoin event raised by the MockSystemContract contract. +type MockSystemContractSetGasCoin struct { + Arg0 *big.Int + Arg1 common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSetGasCoin is a free log retrieval operation binding the contract event 0xd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d. +// +// Solidity: event SetGasCoin(uint256 arg0, address arg1) +func (_MockSystemContract *MockSystemContractFilterer) FilterSetGasCoin(opts *bind.FilterOpts) (*MockSystemContractSetGasCoinIterator, error) { + + logs, sub, err := _MockSystemContract.contract.FilterLogs(opts, "SetGasCoin") + if err != nil { + return nil, err + } + return &MockSystemContractSetGasCoinIterator{contract: _MockSystemContract.contract, event: "SetGasCoin", logs: logs, sub: sub}, nil +} + +// WatchSetGasCoin is a free log subscription operation binding the contract event 0xd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d. +// +// Solidity: event SetGasCoin(uint256 arg0, address arg1) +func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasCoin(opts *bind.WatchOpts, sink chan<- *MockSystemContractSetGasCoin) (event.Subscription, error) { + + logs, sub, err := _MockSystemContract.contract.WatchLogs(opts, "SetGasCoin") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(MockSystemContractSetGasCoin) + if err := _MockSystemContract.contract.UnpackLog(event, "SetGasCoin", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSetGasCoin is a log parse operation binding the contract event 0xd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d. +// +// Solidity: event SetGasCoin(uint256 arg0, address arg1) +func (_MockSystemContract *MockSystemContractFilterer) ParseSetGasCoin(log types.Log) (*MockSystemContractSetGasCoin, error) { + event := new(MockSystemContractSetGasCoin) + if err := _MockSystemContract.contract.UnpackLog(event, "SetGasCoin", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// MockSystemContractSetGasPriceIterator is returned from FilterSetGasPrice and is used to iterate over the raw logs and unpacked data for SetGasPrice events raised by the MockSystemContract contract. +type MockSystemContractSetGasPriceIterator struct { + Event *MockSystemContractSetGasPrice // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *MockSystemContractSetGasPriceIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(MockSystemContractSetGasPrice) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(MockSystemContractSetGasPrice) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *MockSystemContractSetGasPriceIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *MockSystemContractSetGasPriceIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// MockSystemContractSetGasPrice represents a SetGasPrice event raised by the MockSystemContract contract. +type MockSystemContractSetGasPrice struct { + Arg0 *big.Int + Arg1 *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSetGasPrice is a free log retrieval operation binding the contract event 0x49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d. +// +// Solidity: event SetGasPrice(uint256 arg0, uint256 arg1) +func (_MockSystemContract *MockSystemContractFilterer) FilterSetGasPrice(opts *bind.FilterOpts) (*MockSystemContractSetGasPriceIterator, error) { + + logs, sub, err := _MockSystemContract.contract.FilterLogs(opts, "SetGasPrice") + if err != nil { + return nil, err + } + return &MockSystemContractSetGasPriceIterator{contract: _MockSystemContract.contract, event: "SetGasPrice", logs: logs, sub: sub}, nil +} + +// WatchSetGasPrice is a free log subscription operation binding the contract event 0x49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d. +// +// Solidity: event SetGasPrice(uint256 arg0, uint256 arg1) +func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasPrice(opts *bind.WatchOpts, sink chan<- *MockSystemContractSetGasPrice) (event.Subscription, error) { + + logs, sub, err := _MockSystemContract.contract.WatchLogs(opts, "SetGasPrice") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(MockSystemContractSetGasPrice) + if err := _MockSystemContract.contract.UnpackLog(event, "SetGasPrice", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSetGasPrice is a log parse operation binding the contract event 0x49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d. +// +// Solidity: event SetGasPrice(uint256 arg0, uint256 arg1) +func (_MockSystemContract *MockSystemContractFilterer) ParseSetGasPrice(log types.Log) (*MockSystemContractSetGasPrice, error) { + event := new(MockSystemContractSetGasPrice) + if err := _MockSystemContract.contract.UnpackLog(event, "SetGasPrice", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// MockSystemContractSetGasZetaPoolIterator is returned from FilterSetGasZetaPool and is used to iterate over the raw logs and unpacked data for SetGasZetaPool events raised by the MockSystemContract contract. +type MockSystemContractSetGasZetaPoolIterator struct { + Event *MockSystemContractSetGasZetaPool // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *MockSystemContractSetGasZetaPoolIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(MockSystemContractSetGasZetaPool) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(MockSystemContractSetGasZetaPool) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *MockSystemContractSetGasZetaPoolIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *MockSystemContractSetGasZetaPoolIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// MockSystemContractSetGasZetaPool represents a SetGasZetaPool event raised by the MockSystemContract contract. +type MockSystemContractSetGasZetaPool struct { + Arg0 *big.Int + Arg1 common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSetGasZetaPool is a free log retrieval operation binding the contract event 0x0ecec485166da6139b13bb7e033e9446e2d35348e80ebf1180d4afe2dba1704e. +// +// Solidity: event SetGasZetaPool(uint256 arg0, address arg1) +func (_MockSystemContract *MockSystemContractFilterer) FilterSetGasZetaPool(opts *bind.FilterOpts) (*MockSystemContractSetGasZetaPoolIterator, error) { + + logs, sub, err := _MockSystemContract.contract.FilterLogs(opts, "SetGasZetaPool") + if err != nil { + return nil, err + } + return &MockSystemContractSetGasZetaPoolIterator{contract: _MockSystemContract.contract, event: "SetGasZetaPool", logs: logs, sub: sub}, nil +} + +// WatchSetGasZetaPool is a free log subscription operation binding the contract event 0x0ecec485166da6139b13bb7e033e9446e2d35348e80ebf1180d4afe2dba1704e. +// +// Solidity: event SetGasZetaPool(uint256 arg0, address arg1) +func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasZetaPool(opts *bind.WatchOpts, sink chan<- *MockSystemContractSetGasZetaPool) (event.Subscription, error) { + + logs, sub, err := _MockSystemContract.contract.WatchLogs(opts, "SetGasZetaPool") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(MockSystemContractSetGasZetaPool) + if err := _MockSystemContract.contract.UnpackLog(event, "SetGasZetaPool", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSetGasZetaPool is a log parse operation binding the contract event 0x0ecec485166da6139b13bb7e033e9446e2d35348e80ebf1180d4afe2dba1704e. +// +// Solidity: event SetGasZetaPool(uint256 arg0, address arg1) +func (_MockSystemContract *MockSystemContractFilterer) ParseSetGasZetaPool(log types.Log) (*MockSystemContractSetGasZetaPool, error) { + event := new(MockSystemContractSetGasZetaPool) + if err := _MockSystemContract.contract.UnpackLog(event, "SetGasZetaPool", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// MockSystemContractSetWZetaIterator is returned from FilterSetWZeta and is used to iterate over the raw logs and unpacked data for SetWZeta events raised by the MockSystemContract contract. +type MockSystemContractSetWZetaIterator struct { + Event *MockSystemContractSetWZeta // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *MockSystemContractSetWZetaIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(MockSystemContractSetWZeta) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(MockSystemContractSetWZeta) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *MockSystemContractSetWZetaIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *MockSystemContractSetWZetaIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// MockSystemContractSetWZeta represents a SetWZeta event raised by the MockSystemContract contract. +type MockSystemContractSetWZeta struct { + Arg0 common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSetWZeta is a free log retrieval operation binding the contract event 0xdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e. +// +// Solidity: event SetWZeta(address arg0) +func (_MockSystemContract *MockSystemContractFilterer) FilterSetWZeta(opts *bind.FilterOpts) (*MockSystemContractSetWZetaIterator, error) { + + logs, sub, err := _MockSystemContract.contract.FilterLogs(opts, "SetWZeta") + if err != nil { + return nil, err + } + return &MockSystemContractSetWZetaIterator{contract: _MockSystemContract.contract, event: "SetWZeta", logs: logs, sub: sub}, nil +} + +// WatchSetWZeta is a free log subscription operation binding the contract event 0xdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e. +// +// Solidity: event SetWZeta(address arg0) +func (_MockSystemContract *MockSystemContractFilterer) WatchSetWZeta(opts *bind.WatchOpts, sink chan<- *MockSystemContractSetWZeta) (event.Subscription, error) { + + logs, sub, err := _MockSystemContract.contract.WatchLogs(opts, "SetWZeta") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(MockSystemContractSetWZeta) + if err := _MockSystemContract.contract.UnpackLog(event, "SetWZeta", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSetWZeta is a log parse operation binding the contract event 0xdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e. +// +// Solidity: event SetWZeta(address arg0) +func (_MockSystemContract *MockSystemContractFilterer) ParseSetWZeta(log types.Log) (*MockSystemContractSetWZeta, error) { + event := new(MockSystemContractSetWZeta) + if err := _MockSystemContract.contract.UnpackLog(event, "SetWZeta", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// MockSystemContractSystemContractDeployedIterator is returned from FilterSystemContractDeployed and is used to iterate over the raw logs and unpacked data for SystemContractDeployed events raised by the MockSystemContract contract. +type MockSystemContractSystemContractDeployedIterator struct { + Event *MockSystemContractSystemContractDeployed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *MockSystemContractSystemContractDeployedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(MockSystemContractSystemContractDeployed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(MockSystemContractSystemContractDeployed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *MockSystemContractSystemContractDeployedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *MockSystemContractSystemContractDeployedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// MockSystemContractSystemContractDeployed represents a SystemContractDeployed event raised by the MockSystemContract contract. +type MockSystemContractSystemContractDeployed struct { + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSystemContractDeployed is a free log retrieval operation binding the contract event 0x80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac5. +// +// Solidity: event SystemContractDeployed() +func (_MockSystemContract *MockSystemContractFilterer) FilterSystemContractDeployed(opts *bind.FilterOpts) (*MockSystemContractSystemContractDeployedIterator, error) { + + logs, sub, err := _MockSystemContract.contract.FilterLogs(opts, "SystemContractDeployed") + if err != nil { + return nil, err + } + return &MockSystemContractSystemContractDeployedIterator{contract: _MockSystemContract.contract, event: "SystemContractDeployed", logs: logs, sub: sub}, nil +} + +// WatchSystemContractDeployed is a free log subscription operation binding the contract event 0x80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac5. +// +// Solidity: event SystemContractDeployed() +func (_MockSystemContract *MockSystemContractFilterer) WatchSystemContractDeployed(opts *bind.WatchOpts, sink chan<- *MockSystemContractSystemContractDeployed) (event.Subscription, error) { + + logs, sub, err := _MockSystemContract.contract.WatchLogs(opts, "SystemContractDeployed") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(MockSystemContractSystemContractDeployed) + if err := _MockSystemContract.contract.UnpackLog(event, "SystemContractDeployed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSystemContractDeployed is a log parse operation binding the contract event 0x80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac5. +// +// Solidity: event SystemContractDeployed() +func (_MockSystemContract *MockSystemContractFilterer) ParseSystemContractDeployed(log types.Log) (*MockSystemContractSystemContractDeployed, error) { + event := new(MockSystemContractSystemContractDeployed) + if err := _MockSystemContract.contract.UnpackLog(event, "SystemContractDeployed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/pkg/contracts/zevm/testing/mocksystemcontract.sol/systemcontracterrors.go b/pkg/contracts/zevm/testing/mocksystemcontract.sol/systemcontracterrors.go new file mode 100644 index 00000000..c74dda67 --- /dev/null +++ b/pkg/contracts/zevm/testing/mocksystemcontract.sol/systemcontracterrors.go @@ -0,0 +1,181 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package mocksystemcontract + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// SystemContractErrorsMetaData contains all meta data concerning the SystemContractErrors contract. +var SystemContractErrorsMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"name\":\"CallerIsNotFungibleModule\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CantBeIdenticalAddresses\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CantBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTarget\",\"type\":\"error\"}]", +} + +// SystemContractErrorsABI is the input ABI used to generate the binding from. +// Deprecated: Use SystemContractErrorsMetaData.ABI instead. +var SystemContractErrorsABI = SystemContractErrorsMetaData.ABI + +// SystemContractErrors is an auto generated Go binding around an Ethereum contract. +type SystemContractErrors struct { + SystemContractErrorsCaller // Read-only binding to the contract + SystemContractErrorsTransactor // Write-only binding to the contract + SystemContractErrorsFilterer // Log filterer for contract events +} + +// SystemContractErrorsCaller is an auto generated read-only Go binding around an Ethereum contract. +type SystemContractErrorsCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SystemContractErrorsTransactor is an auto generated write-only Go binding around an Ethereum contract. +type SystemContractErrorsTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SystemContractErrorsFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type SystemContractErrorsFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SystemContractErrorsSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type SystemContractErrorsSession struct { + Contract *SystemContractErrors // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// SystemContractErrorsCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type SystemContractErrorsCallerSession struct { + Contract *SystemContractErrorsCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// SystemContractErrorsTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type SystemContractErrorsTransactorSession struct { + Contract *SystemContractErrorsTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// SystemContractErrorsRaw is an auto generated low-level Go binding around an Ethereum contract. +type SystemContractErrorsRaw struct { + Contract *SystemContractErrors // Generic contract binding to access the raw methods on +} + +// SystemContractErrorsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type SystemContractErrorsCallerRaw struct { + Contract *SystemContractErrorsCaller // Generic read-only contract binding to access the raw methods on +} + +// SystemContractErrorsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type SystemContractErrorsTransactorRaw struct { + Contract *SystemContractErrorsTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewSystemContractErrors creates a new instance of SystemContractErrors, bound to a specific deployed contract. +func NewSystemContractErrors(address common.Address, backend bind.ContractBackend) (*SystemContractErrors, error) { + contract, err := bindSystemContractErrors(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &SystemContractErrors{SystemContractErrorsCaller: SystemContractErrorsCaller{contract: contract}, SystemContractErrorsTransactor: SystemContractErrorsTransactor{contract: contract}, SystemContractErrorsFilterer: SystemContractErrorsFilterer{contract: contract}}, nil +} + +// NewSystemContractErrorsCaller creates a new read-only instance of SystemContractErrors, bound to a specific deployed contract. +func NewSystemContractErrorsCaller(address common.Address, caller bind.ContractCaller) (*SystemContractErrorsCaller, error) { + contract, err := bindSystemContractErrors(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &SystemContractErrorsCaller{contract: contract}, nil +} + +// NewSystemContractErrorsTransactor creates a new write-only instance of SystemContractErrors, bound to a specific deployed contract. +func NewSystemContractErrorsTransactor(address common.Address, transactor bind.ContractTransactor) (*SystemContractErrorsTransactor, error) { + contract, err := bindSystemContractErrors(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &SystemContractErrorsTransactor{contract: contract}, nil +} + +// NewSystemContractErrorsFilterer creates a new log filterer instance of SystemContractErrors, bound to a specific deployed contract. +func NewSystemContractErrorsFilterer(address common.Address, filterer bind.ContractFilterer) (*SystemContractErrorsFilterer, error) { + contract, err := bindSystemContractErrors(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &SystemContractErrorsFilterer{contract: contract}, nil +} + +// bindSystemContractErrors binds a generic wrapper to an already deployed contract. +func bindSystemContractErrors(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := SystemContractErrorsMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_SystemContractErrors *SystemContractErrorsRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _SystemContractErrors.Contract.SystemContractErrorsCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_SystemContractErrors *SystemContractErrorsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SystemContractErrors.Contract.SystemContractErrorsTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_SystemContractErrors *SystemContractErrorsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SystemContractErrors.Contract.SystemContractErrorsTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_SystemContractErrors *SystemContractErrorsCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _SystemContractErrors.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_SystemContractErrors *SystemContractErrorsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SystemContractErrors.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_SystemContractErrors *SystemContractErrorsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SystemContractErrors.Contract.contract.Transact(opts, method, params...) +} diff --git a/typechain-types/contracts/evm/testing/AttackerContract.ts b/typechain-types/contracts/evm/testing/AttackerContract.ts deleted file mode 100644 index 84984450..00000000 --- a/typechain-types/contracts/evm/testing/AttackerContract.ts +++ /dev/null @@ -1,183 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BigNumber, - BytesLike, - CallOverrides, - ContractTransaction, - Overrides, - PopulatedTransaction, - Signer, - utils, -} from "ethers"; -import type { FunctionFragment, Result } from "@ethersproject/abi"; -import type { Listener, Provider } from "@ethersproject/providers"; -import type { - TypedEventFilter, - TypedEvent, - TypedListener, - OnEvent, - PromiseOrValue, -} from "../../../common"; - -export interface AttackerContractInterface extends utils.Interface { - functions: { - "attack(bytes4,bytes)": FunctionFragment; - "entered()": FunctionFragment; - "set(bytes4,bytes)": FunctionFragment; - "victimContractAddress()": FunctionFragment; - }; - - getFunction( - nameOrSignatureOrTopic: - | "attack" - | "entered" - | "set" - | "victimContractAddress" - ): FunctionFragment; - - encodeFunctionData( - functionFragment: "attack", - values: [PromiseOrValue, PromiseOrValue] - ): string; - encodeFunctionData(functionFragment: "entered", values?: undefined): string; - encodeFunctionData( - functionFragment: "set", - values: [PromiseOrValue, PromiseOrValue] - ): string; - encodeFunctionData( - functionFragment: "victimContractAddress", - values?: undefined - ): string; - - decodeFunctionResult(functionFragment: "attack", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "entered", data: BytesLike): Result; - decodeFunctionResult(functionFragment: "set", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "victimContractAddress", - data: BytesLike - ): Result; - - events: {}; -} - -export interface AttackerContract extends BaseContract { - connect(signerOrProvider: Signer | Provider | string): this; - attach(addressOrName: string): this; - deployed(): Promise; - - interface: AttackerContractInterface; - - queryFilter( - event: TypedEventFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined - ): Promise>; - - listeners( - eventFilter?: TypedEventFilter - ): Array>; - listeners(eventName?: string): Array; - removeAllListeners( - eventFilter: TypedEventFilter - ): this; - removeAllListeners(eventName?: string): this; - off: OnEvent; - on: OnEvent; - once: OnEvent; - removeListener: OnEvent; - - functions: { - attack( - _methodSignature: PromiseOrValue, - _params: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - entered(overrides?: CallOverrides): Promise<[boolean]>; - - set( - _methodSignature: PromiseOrValue, - _params: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - victimContractAddress(overrides?: CallOverrides): Promise<[string]>; - }; - - attack( - _methodSignature: PromiseOrValue, - _params: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - entered(overrides?: CallOverrides): Promise; - - set( - _methodSignature: PromiseOrValue, - _params: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - victimContractAddress(overrides?: CallOverrides): Promise; - - callStatic: { - attack( - _methodSignature: PromiseOrValue, - _params: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - - entered(overrides?: CallOverrides): Promise; - - set( - _methodSignature: PromiseOrValue, - _params: PromiseOrValue, - overrides?: CallOverrides - ): Promise; - - victimContractAddress(overrides?: CallOverrides): Promise; - }; - - filters: {}; - - estimateGas: { - attack( - _methodSignature: PromiseOrValue, - _params: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - entered(overrides?: CallOverrides): Promise; - - set( - _methodSignature: PromiseOrValue, - _params: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - victimContractAddress(overrides?: CallOverrides): Promise; - }; - - populateTransaction: { - attack( - _methodSignature: PromiseOrValue, - _params: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - entered(overrides?: CallOverrides): Promise; - - set( - _methodSignature: PromiseOrValue, - _params: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise; - - victimContractAddress( - overrides?: CallOverrides - ): Promise; - }; -} diff --git a/typechain-types/factories/contracts/evm/testing/AttackerContract__factory.ts b/typechain-types/factories/contracts/evm/testing/AttackerContract__factory.ts deleted file mode 100644 index 0272e20a..00000000 --- a/typechain-types/factories/contracts/evm/testing/AttackerContract__factory.ts +++ /dev/null @@ -1,149 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; -import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { PromiseOrValue } from "../../../../common"; -import type { - AttackerContract, - AttackerContractInterface, -} from "../../../../contracts/evm/testing/AttackerContract"; - -const _abi = [ - { - inputs: [ - { - internalType: "address", - name: "victimContractAddress_", - type: "address", - }, - ], - stateMutability: "nonpayable", - type: "constructor", - }, - { - stateMutability: "nonpayable", - type: "fallback", - }, - { - inputs: [ - { - internalType: "bytes4", - name: "_methodSignature", - type: "bytes4", - }, - { - internalType: "bytes", - name: "_params", - type: "bytes", - }, - ], - name: "attack", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "entered", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes4", - name: "_methodSignature", - type: "bytes4", - }, - { - internalType: "bytes", - name: "_params", - type: "bytes", - }, - ], - name: "set", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "victimContractAddress", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - stateMutability: "payable", - type: "receive", - }, -] as const; - -const _bytecode = - "0x608060405234801561001057600080fd5b50604051610f12380380610f128339818101604052810190610032919061008d565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600081519050610087816100f1565b92915050565b6000602082840312156100a3576100a26100ec565b5b60006100b184828501610078565b91505092915050565b60006100c5826100cc565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6100fa816100ba565b811461010557600080fd5b50565b610dfb806101176000396000f3fe6080604052600436106100435760003560e01c8063189e33ea14610222578063526569061461024b57806389bc0bb714610274578063a77f05e91461029f5761004a565b3661004a57005b34801561005657600080fd5b506100956040518060400160405280600e81526020017f41747461636b696e672e41312e2e0000000000000000000000000000000000008152506102ca565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600060149054906101000a900460e01b60016040516024016100f19190610a4f565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161015b91906109e0565b6000604051808303816000865af19150503d8060008114610198576040519150601f19603f3d011682016040523d82523d6000602084013e61019d565b606091505b505090506101df6040518060400160405280600e81526020017f41747461636b696e672e41322e2e0000000000000000000000000000000000008152506102ca565b8061021f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021690610ab3565b60405180910390fd5b50005b34801561022e57600080fd5b50610249600480360381019061024491906107da565b610363565b005b34801561025757600080fd5b50610272600480360381019061026d91906107da565b610619565b005b34801561028057600080fd5b50610289610652565b60405161029691906109f7565b60405180910390f35b3480156102ab57600080fd5b506102b4610676565b6040516102c19190610a12565b60405180910390f35b610360816040516024016102de9190610a71565b6040516020818303038152906040527f41304fac000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610689565b50565b6103a16040518060400160405280600c81526020017f41747461636b696e672e2e2e00000000000000000000000000000000000000008152506102ca565b600260009054906101000a900460ff16156103f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103e890610a93565b60405180910390fd5b6001600260006101000a81548160ff02191690831515021790555081600060146101000a81548163ffffffff021916908360e01c021790555080600190805190602001906104409291906106b2565b5061047f6040518060400160405280600d81526020017f41747461636b696e67322e2e2e000000000000000000000000000000000000008152506102ca565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1683836040516024016104cb9190610a2d565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161053591906109e0565b6000604051808303816000865af19150503d8060008114610572576040519150601f19603f3d011682016040523d82523d6000602084013e610577565b606091505b505090506105b96040518060400160405280600d81526020017f41747461636b696e67332e2e2e000000000000000000000000000000000000008152506102ca565b806105f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f090610ad3565b60405180910390fd5b6000600260006101000a81548160ff021916908315150217905550505050565b81600060146101000a81548163ffffffff021916908360e01c0217905550806001908051906020019061064d9291906106b2565b505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900460ff1681565b60008151905060006a636f6e736f6c652e6c6f679050602083016000808483855afa5050505050565b8280546106be90610c4d565b90600052602060002090601f0160209004810192826106e05760008555610727565b82601f106106f957805160ff1916838001178555610727565b82800160010185558215610727579182015b8281111561072657825182559160200191906001019061070b565b5b5090506107349190610738565b5090565b5b80821115610751576000816000905550600101610739565b5090565b600061076861076384610b18565b610af3565b90508281526020810184848401111561078457610783610d13565b5b61078f848285610c0b565b509392505050565b6000813590506107a681610dae565b92915050565b600082601f8301126107c1576107c0610d0e565b5b81356107d1848260208601610755565b91505092915050565b600080604083850312156107f1576107f0610d1d565b5b60006107ff85828601610797565b925050602083013567ffffffffffffffff8111156108205761081f610d18565b5b61082c858286016107ac565b9150509250929050565b61083f81610ba1565b82525050565b61084e81610bb3565b82525050565b600061085f82610b5e565b6108698185610b74565b9350610879818560208601610c1a565b61088281610d22565b840191505092915050565b600061089882610b5e565b6108a28185610b85565b93506108b2818560208601610c1a565b80840191505092915050565b600081546108cb81610c4d565b6108d58186610b74565b945060018216600081146108f0576001811461090257610935565b60ff1983168652602086019350610935565b61090b85610b49565b60005b8381101561092d5781548189015260018201915060208101905061090e565b808801955050505b50505092915050565b600061094982610b69565b6109538185610b90565b9350610963818560208601610c1a565b61096c81610d22565b840191505092915050565b6000610984601883610b90565b915061098f82610d33565b602082019050919050565b60006109a7601683610b90565b91506109b282610d5c565b602082019050919050565b60006109ca601383610b90565b91506109d582610d85565b602082019050919050565b60006109ec828461088d565b915081905092915050565b6000602082019050610a0c6000830184610836565b92915050565b6000602082019050610a276000830184610845565b92915050565b60006020820190508181036000830152610a478184610854565b905092915050565b60006020820190508181036000830152610a6981846108be565b905092915050565b60006020820190508181036000830152610a8b818461093e565b905092915050565b60006020820190508181036000830152610aac81610977565b9050919050565b60006020820190508181036000830152610acc8161099a565b9050919050565b60006020820190508181036000830152610aec816109bd565b9050919050565b6000610afd610b0e565b9050610b098282610c7f565b919050565b6000604051905090565b600067ffffffffffffffff821115610b3357610b32610cdf565b5b610b3c82610d22565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b6000610bac82610beb565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b82818337600083830152505050565b60005b83811015610c38578082015181840152602081019050610c1d565b83811115610c47576000848401525b50505050565b60006002820490506001821680610c6557607f821691505b60208210811415610c7957610c78610cb0565b5b50919050565b610c8882610d22565b810181811067ffffffffffffffff82111715610ca757610ca6610cdf565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f5265656e7472616e742063616c6c206465746563746564210000000000000000600082015250565b7f5265656e7472616e742063616c6c206661696c65642100000000000000000000600082015250565b7f4d6574686f642063616c6c206661696c65642100000000000000000000000000600082015250565b610db781610bbf565b8114610dc257600080fd5b5056fea26469706673582212203cad3a1adfdea950bfbfbe387cff44c920316b14efffb7361f9bdd2f0793977864736f6c63430008070033"; - -type AttackerContractConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: AttackerContractConstructorParams -): xs is ConstructorParameters => xs.length > 1; - -export class AttackerContract__factory extends ContractFactory { - constructor(...args: AttackerContractConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override deploy( - victimContractAddress_: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): Promise { - return super.deploy( - victimContractAddress_, - overrides || {} - ) as Promise; - } - override getDeployTransaction( - victimContractAddress_: PromiseOrValue, - overrides?: Overrides & { from?: PromiseOrValue } - ): TransactionRequest { - return super.getDeployTransaction(victimContractAddress_, overrides || {}); - } - override attach(address: string): AttackerContract { - return super.attach(address) as AttackerContract; - } - override connect(signer: Signer): AttackerContract__factory { - return super.connect(signer) as AttackerContract__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): AttackerContractInterface { - return new utils.Interface(_abi) as AttackerContractInterface; - } - static connect( - address: string, - signerOrProvider: Signer | Provider - ): AttackerContract { - return new Contract(address, _abi, signerOrProvider) as AttackerContract; - } -} From f9ef4fcfecd03a3b70b5bed831bc42334b76e6de Mon Sep 17 00:00:00 2001 From: Andres Aiello Date: Fri, 3 Nov 2023 14:16:59 -0300 Subject: [PATCH 3/4] restore files --- test/ImmutableCreate2Factory.spec.ts | 128 ++++ test/Zeta.non-eth.spec.ts | 155 +++++ test/ZetaConnector.spec.ts | 855 +++++++++++++++++++++++++++ test/ZetaInteractor.spec.ts | 119 ++++ test/ZetaTokenConsumer.spec.ts | 213 +++++++ test/test.helpers.ts | 18 + 6 files changed, 1488 insertions(+) create mode 100644 test/ImmutableCreate2Factory.spec.ts create mode 100644 test/Zeta.non-eth.spec.ts create mode 100644 test/ZetaConnector.spec.ts create mode 100644 test/ZetaInteractor.spec.ts create mode 100644 test/ZetaTokenConsumer.spec.ts create mode 100644 test/test.helpers.ts diff --git a/test/ImmutableCreate2Factory.spec.ts b/test/ImmutableCreate2Factory.spec.ts new file mode 100644 index 00000000..3c713ed1 --- /dev/null +++ b/test/ImmutableCreate2Factory.spec.ts @@ -0,0 +1,128 @@ +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { + IERC20__factory, + ImmutableCreate2Factory, + ImmutableCreate2Factory__factory, + ZetaEth__factory, + ZetaInteractorMock__factory, +} from "@typechain-types"; +import chai, { expect } from "chai"; +import { parseEther } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { MAX_ETH_ADDRESS } from "../lib/contracts.constants"; +import { + buildBytecode, + buildCreate2Address, + deployContractToAddress, + isDeployed, + saltToHex, +} from "../lib/ImmutableCreate2Factory/ImmutableCreate2Factory.helpers"; + +chai.should(); + +describe("Deterministic deployment tests", () => { + let immutableCreate2: ImmutableCreate2Factory; + + let accounts: SignerWithAddress[]; + let signer: SignerWithAddress; + + beforeEach(async () => { + accounts = await ethers.getSigners(); + [signer] = accounts; + + const immutableCreate2Factory = new ImmutableCreate2Factory__factory(signer); + immutableCreate2 = await immutableCreate2Factory.deploy(); + }); + + describe("Deploy zeta token with deterministic deployment", () => { + it("Should deploy a contract", async () => { + const salthex = saltToHex("hola", signer.address); + const constructorTypes = ["address", "uint256"]; + const constructorArgs = [signer.address, "2100000000"]; + const contractBytecode = ZetaEth__factory.bytecode; + + const bytecode = buildBytecode(constructorTypes, constructorArgs, contractBytecode); + const expectedAddress = await immutableCreate2.findCreate2Address(salthex, bytecode); + + // Deploy contract + const { address } = await deployContractToAddress({ + constructorArgs: constructorArgs, + constructorTypes: constructorTypes, + contractBytecode: ZetaEth__factory.bytecode, + factoryAddress: immutableCreate2.address, + salt: salthex, + signer: signer, + }); + + expect(address).to.be.eq(expectedAddress); + + // Query if contract deployed at address + const success = await isDeployed(address, ethers.provider); + expect(success).to.be.true; + + const token = IERC20__factory.connect(address, signer); + const totalSup = await token.totalSupply(); + expect(totalSup.toString()).to.be.eq(parseEther(constructorArgs[1])); + }); + }); + + it("Should deploy with leading zeros", async () => { + let saltStr = "0"; + + let minAddress = MAX_ETH_ADDRESS; + let minAddressSalt = ""; + for (let i = 0; i < 3000; i++) { + const salthex = saltToHex(saltStr, signer.address); + const constructorTypes = ["address", "uint256"]; + const constructorArgs = [signer.address, "2100000000"]; + const contractBytecode = ZetaEth__factory.bytecode; + + const bytecode = buildBytecode(constructorTypes, constructorArgs, contractBytecode); + const expectedAddress = buildCreate2Address(salthex, bytecode, immutableCreate2.address); + if (expectedAddress < minAddress) { + minAddress = expectedAddress; + minAddressSalt = saltStr; + } + saltStr = i.toString(); + } + + expect(minAddress.substring(0, 4)).to.be.eq("0x00"); + }); + + it("Should generate same address offchain and onchain", async () => { + let saltStr = "0"; + + const salthex = saltToHex(saltStr, signer.address); + const constructorTypes = ["address", "uint256"]; + const constructorArgs = [signer.address, "2100000000"]; + const contractBytecode = ZetaEth__factory.bytecode; + + const bytecode = buildBytecode(constructorTypes, constructorArgs, contractBytecode); + const expectedAddress = await immutableCreate2.findCreate2Address(salthex, bytecode); + const expectedAddressOffchain = buildCreate2Address(salthex, bytecode, immutableCreate2.address); + expect(expectedAddress.toLocaleLowerCase()).to.be.eq(expectedAddressOffchain); + }); + + it("Should deploy and transfer ownership to deployer", async () => { + let saltStr = "0"; + + const salthex = saltToHex(saltStr, signer.address); + const constructorTypes = ["address"]; + const constructorArgs = [signer.address]; + + const { address } = await deployContractToAddress({ + constructorArgs: constructorArgs, + constructorTypes: constructorTypes, + contractBytecode: ZetaInteractorMock__factory.bytecode, + factoryAddress: immutableCreate2.address, + salt: salthex, + signer: signer, + transferOwner: true, + }); + + const contract = ZetaInteractorMock__factory.connect(address, signer); + await contract.acceptOwnership(); + expect(await contract.owner()).to.be.eq(signer.address); + }); +}); diff --git a/test/Zeta.non-eth.spec.ts b/test/Zeta.non-eth.spec.ts new file mode 100644 index 00000000..d007a020 --- /dev/null +++ b/test/Zeta.non-eth.spec.ts @@ -0,0 +1,155 @@ +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { ZetaConnectorNonEth, ZetaNonEth, ZetaReceiverMock } from "@typechain-types"; +import { expect } from "chai"; +import { parseEther } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { deployZetaConnectorNonEth, deployZetaNonEth, deployZetaReceiverMock } from "../lib/contracts.helpers"; + +describe("ZetaNonEth tests", () => { + let zetaTokenNonEthContract: ZetaNonEth; + let zetaReceiverMockContract: ZetaReceiverMock; + let zetaConnectorNonEthContract: ZetaConnectorNonEth; + let tssUpdater: SignerWithAddress; + let tssSigner: SignerWithAddress; + let randomSigner: SignerWithAddress; + let pauserSigner: SignerWithAddress; + + const tssUpdaterApproveConnectorNonEth = async () => { + await (await zetaTokenNonEthContract.approve(zetaConnectorNonEthContract.address, parseEther("100000"))).wait(); + }; + + const mint100kZetaNonEth = async (transferTo: string) => { + const zeta100k = parseEther("100000"); + + await ( + await zetaConnectorNonEthContract + .connect(tssSigner) + .onReceive(randomSigner.address, 1, transferTo, zeta100k, [], ethers.constants.HashZero) + ).wait(); + }; + + const transfer100kZetaNonEth = async (transferTo: string) => { + await mint100kZetaNonEth(tssUpdater.address); + + await (await zetaTokenNonEthContract.connect(tssUpdater).transfer(transferTo, 100_000)).wait(); + }; + + beforeEach(async () => { + const accounts = await ethers.getSigners(); + [tssUpdater, tssSigner, randomSigner, pauserSigner] = accounts; + + zetaTokenNonEthContract = await deployZetaNonEth({ + args: [tssSigner.address, tssUpdater.address], + }); + + zetaReceiverMockContract = await deployZetaReceiverMock(); + zetaConnectorNonEthContract = await deployZetaConnectorNonEth({ + args: [zetaTokenNonEthContract.address, tssSigner.address, tssUpdater.address, pauserSigner.address], + }); + + await zetaTokenNonEthContract.updateTssAndConnectorAddresses( + tssSigner.address, + zetaConnectorNonEthContract.address + ); + + await mint100kZetaNonEth(tssUpdater.address); + }); + + describe("updateTssAndConnectorAddresses", () => { + it("Should revert if the caller is not tssAddressUpdater or TSS", async () => { + expect( + zetaTokenNonEthContract + .connect(randomSigner) + .updateTssAndConnectorAddresses(randomSigner.address, zetaConnectorNonEthContract.address) + ).to.be.revertedWith(`CallerIsNotTssOrUpdater("${randomSigner.address}")`); + }); + + it("Should change the addresses if the caller is tssAddressUpdater", async () => { + await ( + await zetaTokenNonEthContract.updateTssAndConnectorAddresses(randomSigner.address, randomSigner.address) + ).wait(); + + expect(await zetaTokenNonEthContract.tssAddress()).to.equal(randomSigner.address); + expect(await zetaTokenNonEthContract.connectorAddress()).to.equal(randomSigner.address); + }); + + it("Should change the addresses if the caller is TSS", async () => { + await ( + await zetaTokenNonEthContract + .connect(tssSigner) + .updateTssAndConnectorAddresses(randomSigner.address, randomSigner.address) + ).wait(); + + expect(await zetaTokenNonEthContract.tssAddress()).to.equal(randomSigner.address); + expect(await zetaTokenNonEthContract.connectorAddress()).to.equal(randomSigner.address); + }); + }); + + describe("renounceTssAddressUpdater", () => { + it("Should revert if the caller is not tssAddressUpdater", async () => { + expect(zetaTokenNonEthContract.connect(randomSigner).renounceTssAddressUpdater()).to.be.revertedWith( + `CallerIsNotTssUpdater("${randomSigner.address}")` + ); + }); + + it("Should change tssAddressUpdater to tssAddress if the caller is tssAddressUpdater", async () => { + await (await zetaTokenNonEthContract.renounceTssAddressUpdater()).wait(); + + expect(await zetaTokenNonEthContract.tssAddressUpdater()).to.equal(tssSigner.address); + }); + }); + + describe("mint", () => { + it("Should revert if the caller is not the Connector contract", async () => { + expect( + zetaTokenNonEthContract.connect(randomSigner).mint(tssUpdater.address, 100_000, ethers.constants.AddressZero) + ).to.be.revertedWith(`CallerIsNotConnector("${randomSigner.address}")`); + }); + + it("Should emit `Minted` on success", async () => { + const zetaMintedFilter = zetaTokenNonEthContract.filters.Minted(); + + const tx = await zetaConnectorNonEthContract + .connect(tssSigner) + .onReceive( + randomSigner.address, + 1, + zetaReceiverMockContract.address, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ); + const receipt = await tx.wait(); + + const events = await zetaTokenNonEthContract.queryFilter(zetaMintedFilter, receipt.blockHash); + expect(events.length).to.equal(1); + }); + }); + + describe("burnFrom", () => { + it("Should revert if the caller is not the Connector contract", async () => { + expect(zetaTokenNonEthContract.connect(randomSigner).burnFrom(tssUpdater.address, 100_000)).to.be.revertedWith( + `CallerIsNotConnector("${randomSigner.address}")` + ); + }); + + it("Should emit `Burnt` on success", async () => { + await tssUpdaterApproveConnectorNonEth(); + const zetaBurntFilter = zetaTokenNonEthContract.filters.Burnt(); + + const tx = await zetaConnectorNonEthContract.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 1000, + }); + const receipt = await tx.wait(); + + const events = await zetaTokenNonEthContract.queryFilter(zetaBurntFilter, receipt.blockHash); + expect(events.length).to.equal(1); + }); + }); +}); diff --git a/test/ZetaConnector.spec.ts b/test/ZetaConnector.spec.ts new file mode 100644 index 00000000..380a8d67 --- /dev/null +++ b/test/ZetaConnector.spec.ts @@ -0,0 +1,855 @@ +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { + ZetaConnectorBase, + ZetaConnectorEth, + ZetaConnectorNonEth, + ZetaEth, + ZetaNonEth, + ZetaReceiverMock, +} from "@typechain-types"; +import { expect } from "chai"; +import { parseEther } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { + deployZetaConnectorBase, + deployZetaConnectorEth, + deployZetaConnectorNonEth, + deployZetaEth, + deployZetaNonEth, + deployZetaReceiverMock, +} from "../lib/contracts.helpers"; + +describe("ZetaConnector tests", () => { + let zetaTokenEthContract: ZetaEth; + let zetaTokenNonEthContract: ZetaNonEth; + let zetaConnectorBaseContract: ZetaConnectorBase; + let zetaConnectorEthContract: ZetaConnectorEth; + let zetaReceiverMockContract: ZetaReceiverMock; + let zetaConnectorNonEthContract: ZetaConnectorNonEth; + + let tssUpdater: SignerWithAddress; + let tssSigner: SignerWithAddress; + let randomSigner: SignerWithAddress; + let pauserSigner: SignerWithAddress; + + const tssUpdaterApproveConnectorEth = async () => { + await (await zetaTokenEthContract.approve(zetaConnectorEthContract.address, parseEther("100000"))).wait(); + }; + + const tssUpdaterApproveConnectorNonEth = async () => { + await (await zetaTokenNonEthContract.approve(zetaConnectorNonEthContract.address, parseEther("100000"))).wait(); + }; + + const transfer100kZetaEth = async (transferTo: string) => { + await (await zetaTokenEthContract.transfer(transferTo, 100_000)).wait(); + }; + + const mint100kZetaNonEth = async (transferTo: string) => { + const zeta100k = parseEther("100000"); + + await ( + await zetaConnectorNonEthContract + .connect(tssSigner) + .onReceive(randomSigner.address, 1, transferTo, zeta100k, [], ethers.constants.HashZero) + ).wait(); + }; + + const transfer100kZetaNonEth = async (transferTo: string) => { + await mint100kZetaNonEth(tssUpdater.address); + + await (await zetaTokenNonEthContract.connect(tssUpdater).transfer(transferTo, 100_000)).wait(); + }; + + beforeEach(async () => { + const accounts = await ethers.getSigners(); + [tssUpdater, tssSigner, randomSigner, pauserSigner] = accounts; + + zetaTokenEthContract = await deployZetaEth({ + args: [tssUpdater.address, 100_000], + }); + + zetaTokenNonEthContract = await deployZetaNonEth({ + args: [tssSigner.address, tssUpdater.address], + }); + + zetaReceiverMockContract = await deployZetaReceiverMock(); + zetaConnectorBaseContract = await deployZetaConnectorBase({ + args: [zetaTokenEthContract.address, tssSigner.address, tssUpdater.address, pauserSigner.address], + }); + zetaConnectorEthContract = await deployZetaConnectorEth({ + args: [zetaTokenEthContract.address, tssSigner.address, tssUpdater.address, pauserSigner.address], + }); + zetaConnectorNonEthContract = await deployZetaConnectorNonEth({ + args: [zetaTokenNonEthContract.address, tssSigner.address, tssUpdater.address, pauserSigner.address], + }); + + await zetaTokenNonEthContract.updateTssAndConnectorAddresses( + tssSigner.address, + zetaConnectorNonEthContract.address + ); + + await mint100kZetaNonEth(tssUpdater.address); + }); + + describe("ZetaConnector.base", () => { + describe("updateTssAddress", () => { + it("Should revert if the caller is not TSS or TSS updater", async () => { + await expect(zetaConnectorBaseContract.connect(randomSigner).updateTssAddress(randomSigner.address)) + .to.revertedWith("CallerIsNotTssOrUpdater") + .withArgs(randomSigner.address); + }); + + it("Should revert if the new TSS address is invalid", async () => { + await expect( + zetaConnectorBaseContract.updateTssAddress("0x0000000000000000000000000000000000000000") + ).to.revertedWith("InvalidAddress"); + }); + + it("Should change the TSS address if called by TSS", async () => { + await (await zetaConnectorBaseContract.connect(tssSigner).updateTssAddress(randomSigner.address)).wait(); + + const address = await zetaConnectorBaseContract.tssAddress(); + + expect(address).to.equal(randomSigner.address); + }); + + it("Should change the TSS address if called by TSS updater", async () => { + await (await zetaConnectorBaseContract.updateTssAddress(randomSigner.address)).wait(); + + const address = await zetaConnectorBaseContract.tssAddress(); + + expect(address).to.equal(randomSigner.address); + }); + }); + + describe("updatePauserAddress", () => { + it("Should revert if the caller is not the Pauser", async () => { + await expect(zetaConnectorBaseContract.connect(randomSigner).updatePauserAddress(randomSigner.address)) + .to.revertedWith("CallerIsNotPauser") + .withArgs(randomSigner.address); + }); + + it("Should revert if the new Pauser address is invalid", async () => { + await expect( + zetaConnectorBaseContract + .connect(pauserSigner) + .updatePauserAddress("0x0000000000000000000000000000000000000000") + ).to.revertedWith("InvalidAddress"); + }); + + it("Should change the Pauser address if called by Pauser", async () => { + await (await zetaConnectorBaseContract.connect(pauserSigner).updatePauserAddress(randomSigner.address)).wait(); + + const address = await zetaConnectorBaseContract.pauserAddress(); + + expect(address).to.equal(randomSigner.address); + }); + + it("Should emit `PauserAddressUpdated` on success", async () => { + const pauserAddressUpdatedFilter = zetaConnectorBaseContract.filters.PauserAddressUpdated(); + + const tx = await zetaConnectorBaseContract.connect(pauserSigner).updatePauserAddress(randomSigner.address); + const receipt = await tx.wait(); + + const address = await zetaConnectorBaseContract.pauserAddress(); + + expect(address).to.equal(randomSigner.address); + + const event = await zetaConnectorBaseContract.queryFilter(pauserAddressUpdatedFilter, receipt.blockHash); + expect(event.length).to.equal(1); + }); + }); + + describe("pause, unpause", () => { + it("Should revert if not called by the Pauser", async () => { + await expect(zetaConnectorBaseContract.connect(randomSigner).pause()) + .to.revertedWith("CallerIsNotPauser") + .withArgs(randomSigner.address); + + await expect(zetaConnectorBaseContract.connect(randomSigner).unpause()) + .to.revertedWith("CallerIsNotPauser") + .withArgs(randomSigner.address); + }); + + it("Should pause if called by the Pauser", async () => { + await (await zetaConnectorBaseContract.connect(pauserSigner).pause()).wait(); + const paused1 = await zetaConnectorBaseContract.paused(); + expect(paused1).to.equal(true); + + await (await zetaConnectorBaseContract.connect(pauserSigner).unpause()).wait(); + const paused2 = await zetaConnectorBaseContract.paused(); + expect(paused2).to.equal(false); + }); + }); + }); + + describe("ZetaConnector.eth", () => { + describe("send", () => { + it("Should revert if the contract is paused", async () => { + await (await zetaConnectorEthContract.connect(pauserSigner).pause()).wait(); + const paused1 = await zetaConnectorEthContract.paused(); + expect(paused1).to.equal(true); + + await expect( + zetaConnectorEthContract.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 1000, + }) + ).to.revertedWith("Pausable: paused"); + }); + + it("Should revert if the zetaTxSender has no enough zeta", async () => { + await ( + await zetaTokenEthContract.connect(randomSigner).approve(zetaConnectorEthContract.address, 100_000) + ).wait(); + + await expect( + zetaConnectorEthContract.connect(randomSigner).send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 1000, + }) + ).to.revertedWith("ERC20: transfer amount exceeds balance"); + }); + + it("Should revert if the zetaTxSender didn't allow ZetaConnector to spend Zeta token", async () => { + await expect( + zetaConnectorEthContract.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 1000, + }) + ).to.revertedWith("ERC20: insufficient allowance"); + }); + + it("Should transfer Zeta token from the zetaTxSender account to the Connector contract", async () => { + const initialBalanceDeployer = await zetaTokenEthContract.balanceOf(tssUpdater.address); + const initialBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); + + expect(initialBalanceDeployer.toString()).to.equal("100000000000000000000000"); + expect(initialBalanceConnector.toString()).to.equal("0"); + + await tssUpdaterApproveConnectorEth(); + + await ( + await zetaConnectorEthContract.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 1000, + }) + ).wait(); + + const finalBalanceDeployer = await zetaTokenEthContract.balanceOf(tssUpdater.address); + const finalBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); + + expect(finalBalanceDeployer.toString()).to.equal("99999999999999999999000"); + expect(finalBalanceConnector.toString()).to.equal("1000"); + }); + + it("Should emit `ZetaSent` on success", async () => { + const zetaSentFilter = zetaConnectorEthContract.filters.ZetaSent(); + + const tx = await zetaConnectorEthContract.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 0, + }); + const receipt = await tx.wait(); + const events = await zetaConnectorEthContract.queryFilter(zetaSentFilter, receipt.blockHash); + expect(events.length).to.equal(1); + }); + + it("Should emit `ZetaSent` with tx.origin as the first parameter", async () => { + const zetaSentFilter = zetaConnectorEthContract.filters.ZetaSent(); + + const tx = await zetaConnectorEthContract.connect(randomSigner).send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 0, + }); + + const receipt = await tx.wait(); + + const events = await zetaConnectorEthContract.queryFilter(zetaSentFilter, receipt.blockHash); + expect(events[0].args[0].toString()).to.equal(randomSigner.address); + }); + }); + + describe("onReceive", () => { + it("Should not revert if the contract is paused", async () => { + await (await zetaConnectorEthContract.connect(pauserSigner).pause()).wait(); + const paused1 = await zetaConnectorEthContract.paused(); + expect(paused1).to.equal(true); + + await expect( + zetaConnectorEthContract + .connect(tssSigner) + .onReceive( + tssUpdater.address, + 1, + zetaReceiverMockContract.address, + 0, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ).to.be.not.reverted; + }); + + it("Should revert if not called by TSS address", async () => { + await expect( + zetaConnectorEthContract.onReceive( + tssUpdater.address, + 1, + randomSigner.address, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ) + .to.revertedWith("CallerIsNotTss") + .withArgs(tssUpdater.address); + }); + + it("Should revert if Zeta transfer fails", async () => { + await expect( + zetaConnectorEthContract + .connect(tssSigner) + .onReceive( + randomSigner.address, + 1, + randomSigner.address, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ).to.revertedWith("ERC20: transfer amount exceeds balance"); + }); + + it("Should transfer to the receiver address", async () => { + await transfer100kZetaEth(zetaConnectorEthContract.address); + + const initialBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); + const initialBalanceReceiver = await zetaTokenEthContract.balanceOf(zetaReceiverMockContract.address); + expect(initialBalanceConnector.toString()).to.equal("100000"); + expect(initialBalanceReceiver.toString()).to.equal("0"); + + await ( + await zetaConnectorEthContract + .connect(tssSigner) + .onReceive( + randomSigner.address, + 1, + zetaReceiverMockContract.address, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ).wait(); + + const finalBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); + const finalBalanceReceiver = await zetaTokenEthContract.balanceOf(zetaReceiverMockContract.address); + + expect(finalBalanceConnector.toString()).to.equal("99000"); + expect(finalBalanceReceiver.toString()).to.equal("1000"); + }); + + it("Should emit `ZetaReceived` on success", async () => { + await transfer100kZetaEth(zetaConnectorEthContract.address); + + const zetaReceivedFilter = zetaConnectorEthContract.filters.ZetaReceived(); + + const tx = await zetaConnectorEthContract + .connect(tssSigner) + .onReceive( + randomSigner.address, + 1, + zetaReceiverMockContract.address, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ); + const receipt = await tx.wait(); + + const events = await zetaConnectorEthContract.queryFilter(zetaReceivedFilter, receipt.blockHash); + expect(events.length).to.equal(1); + }); + }); + + describe("onRevert", () => { + it("Should revert if the contract is paused", async () => { + await (await zetaConnectorEthContract.connect(pauserSigner).pause()).wait(); + const paused1 = await zetaConnectorEthContract.paused(); + expect(paused1).to.equal(true); + + await expect( + zetaConnectorEthContract.onRevert( + randomSigner.address, + 1, + randomSigner.address, + 2, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ).to.revertedWith("Pausable: paused"); + }); + + it("Should revert if not called by TSS address", async () => { + await expect( + zetaConnectorEthContract.onRevert( + randomSigner.address, + 1, + tssUpdater.address, + 1, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ) + .to.revertedWith("CallerIsNotTss") + .withArgs(tssUpdater.address); + }); + + it("Should transfer to the zetaTxSender address", async () => { + await transfer100kZetaEth(zetaConnectorEthContract.address); + + const initialBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); + const initialBalanceZetaTxSender = await zetaTokenEthContract.balanceOf(zetaReceiverMockContract.address); + expect(initialBalanceConnector.toString()).to.equal("100000"); + expect(initialBalanceZetaTxSender.toString()).to.equal("0"); + + await ( + await zetaConnectorEthContract + .connect(tssSigner) + .onRevert( + zetaReceiverMockContract.address, + 1, + randomSigner.address, + 1, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ).wait(); + + const finalBalanceConnector = await zetaTokenEthContract.balanceOf(zetaConnectorEthContract.address); + const finalBalanceZetaTxSender = await zetaTokenEthContract.balanceOf(zetaReceiverMockContract.address); + + expect(finalBalanceConnector.toString()).to.equal("99000"); + expect(finalBalanceZetaTxSender.toString()).to.equal("1000"); + }); + + it("Should emit `ZetaReverted` on success", async () => { + await transfer100kZetaEth(zetaConnectorEthContract.address); + + const zetaRevertedFilter = zetaConnectorEthContract.filters.ZetaReverted(); + + const tx = await zetaConnectorEthContract + .connect(tssSigner) + .onRevert( + zetaReceiverMockContract.address, + 1, + randomSigner.address, + 1, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ); + const receipt = await tx.wait(); + + const events = await zetaConnectorEthContract.queryFilter(zetaRevertedFilter, receipt.blockHash); + expect(events.length).to.equal(1); + }); + }); + }); + + describe("ZetaConnector.non-eth", () => { + describe("send", () => { + it("Should revert if the contract is paused", async () => { + await (await zetaConnectorNonEthContract.connect(pauserSigner).pause()).wait(); + const paused1 = await zetaConnectorNonEthContract.paused(); + expect(paused1).to.equal(true); + + await expect( + zetaConnectorNonEthContract.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 1000, + }) + ).to.revertedWith("Pausable: paused"); + }); + + it("Should revert if the zetaTxSender has no enough zeta", async () => { + await ( + await zetaTokenEthContract.connect(randomSigner).approve(zetaConnectorEthContract.address, 100_000) + ).wait(); + + await expect( + zetaConnectorNonEthContract.connect(randomSigner).send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 1000, + }) + ).to.revertedWith("ERC20: insufficient allowance"); + }); + + it("Should revert if the zetaTxSender didn't allow ZetaConnector to spend Zeta token", async () => { + await expect( + zetaConnectorNonEthContract.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 1000, + }) + ).to.revertedWith("ERC20: insufficient allowance"); + }); + + it("Should burn Zeta token from the zetaTxSender account", async () => { + const initialBalanceDeployer = await zetaTokenNonEthContract.balanceOf(tssUpdater.address); + expect(initialBalanceDeployer.toString()).to.equal(parseEther("100000")); + + await tssUpdaterApproveConnectorNonEth(); + + await ( + await zetaConnectorNonEthContract.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: parseEther("1"), + }) + ).wait(); + + const finalBalanceDeployer = await zetaTokenNonEthContract.balanceOf(tssUpdater.address); + expect(finalBalanceDeployer.toString()).to.equal(parseEther("99999")); + }); + + it("Should emit `ZetaSent` on success", async () => { + const zetaSentFilter = zetaConnectorNonEthContract.filters.ZetaSent(); + + const tx = await zetaConnectorNonEthContract.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 0, + }); + const receipt = await tx.wait(); + + const events = await zetaConnectorNonEthContract.queryFilter(zetaSentFilter, receipt.blockHash); + expect(events.length).to.equal(1); + }); + + it("Should emit `ZetaSent` with tx.origin as the first parameter", async () => { + const zetaSentFilter = zetaConnectorNonEthContract.filters.ZetaSent(); + + const tx = await zetaConnectorNonEthContract.connect(randomSigner).send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 0, + }); + const receipt = await tx.wait(); + + const events = await zetaConnectorNonEthContract.queryFilter(zetaSentFilter, receipt.blockHash); + expect(events[0].args[0].toString()).to.equal(randomSigner.address); + }); + }); + + describe("onReceive", () => { + it("Should not revert if the contract is paused", async () => { + await (await zetaConnectorNonEthContract.connect(pauserSigner).pause()).wait(); + const paused1 = await zetaConnectorNonEthContract.paused(); + expect(paused1).to.equal(true); + + await expect( + zetaConnectorNonEthContract + .connect(tssSigner) + .onReceive( + tssUpdater.address, + 1, + zetaReceiverMockContract.address, + 0, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ).to.be.not.reverted; + }); + + it("Should revert if not called by TSS address", async () => { + await expect( + zetaConnectorNonEthContract.onReceive( + tssUpdater.address, + 1, + randomSigner.address, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ) + .to.revertedWith("CallerIsNotTss") + .withArgs(tssUpdater.address); + }); + + it("Should revert if mint fails", async () => { + /** + * Update TSS and Connector addresses so minting fails + */ + await zetaTokenNonEthContract.updateTssAndConnectorAddresses(tssSigner.address, randomSigner.address); + + await expect( + zetaConnectorNonEthContract + .connect(tssSigner) + .onReceive( + randomSigner.address, + 1, + zetaReceiverMockContract.address, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ) + .to.revertedWith("CallerIsNotConnector") + .withArgs(zetaConnectorNonEthContract.address); + }); + + it("Should mint on the receiver address", async () => { + const initialBalanceReceiver = await zetaTokenNonEthContract.balanceOf(zetaReceiverMockContract.address); + expect(initialBalanceReceiver.toString()).to.equal("0"); + + await ( + await zetaConnectorNonEthContract + .connect(tssSigner) + .onReceive( + randomSigner.address, + 1, + zetaReceiverMockContract.address, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ).wait(); + + const finalBalanceReceiver = await zetaTokenNonEthContract.balanceOf(zetaReceiverMockContract.address); + + expect(finalBalanceReceiver.toString()).to.equal("1000"); + }); + + it("Should emit `ZetaReceived` on success", async () => { + const zetaReceivedFilter = zetaConnectorNonEthContract.filters.ZetaReceived(); + + const tx = await zetaConnectorNonEthContract + .connect(tssSigner) + .onReceive( + randomSigner.address, + 1, + zetaReceiverMockContract.address, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ); + const receipt = await tx.wait(); + + const events = await zetaConnectorNonEthContract.queryFilter(zetaReceivedFilter, receipt.blockHash); + expect(events.length).to.equal(1); + }); + }); + + describe("onRevert", () => { + it("Should revert if the contract is paused", async () => { + await (await zetaConnectorNonEthContract.connect(pauserSigner).pause()).wait(); + const paused1 = await zetaConnectorNonEthContract.paused(); + expect(paused1).to.equal(true); + + await expect( + zetaConnectorNonEthContract.onRevert( + randomSigner.address, + 1, + randomSigner.address, + 2, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ).to.revertedWith("Pausable: paused"); + }); + + it("Should revert if not called by TSS address", async () => { + await expect( + zetaConnectorNonEthContract.onRevert( + randomSigner.address, + 1, + tssUpdater.address, + 1, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ) + .to.revertedWith("CallerIsNotTss") + .withArgs(tssUpdater.address); + }); + + it("Should mint on the zetaTxSender address", async () => { + const initialBalanceZetaTxSender = await zetaTokenNonEthContract.balanceOf(zetaReceiverMockContract.address); + expect(initialBalanceZetaTxSender.toString()).to.equal("0"); + + await ( + await zetaConnectorNonEthContract + .connect(tssSigner) + .onRevert( + zetaReceiverMockContract.address, + 1, + randomSigner.address, + 1, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ).wait(); + + const finalBalanceZetaTxSender = await zetaTokenNonEthContract.balanceOf(zetaReceiverMockContract.address); + expect(finalBalanceZetaTxSender.toString()).to.equal("1000"); + }); + + it("Should emit `ZetaReverted` on success", async () => { + await transfer100kZetaNonEth(zetaConnectorNonEthContract.address); + + const zetaRevertedFilter = zetaConnectorNonEthContract.filters.ZetaReverted(); + + const tx = await zetaConnectorNonEthContract + .connect(tssSigner) + .onRevert( + zetaReceiverMockContract.address, + 1, + randomSigner.address, + 1, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ); + const receipt = await tx.wait(); + + const events = await zetaConnectorNonEthContract.queryFilter(zetaRevertedFilter, receipt.blockHash); + expect(events.length).to.equal(1); + }); + }); + + describe("MaxSupply", () => { + describe("setMaxSupply", () => { + it("Should revert if the caller is not the TSS address", async () => { + await expect(zetaConnectorNonEthContract.connect(randomSigner).setMaxSupply(0)) + .to.revertedWith("CallerIsNotTss") + .withArgs(randomSigner.address); + }); + + it("Should revert if want to mint more than MaxSupply", async () => { + await zetaConnectorNonEthContract.connect(tssSigner).setMaxSupply(999); + await expect( + zetaConnectorNonEthContract + .connect(tssSigner) + .onReceive( + randomSigner.address, + 1, + zetaReceiverMockContract.address, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ) + .to.revertedWith("ExceedsMaxSupply") + .withArgs(999); + }); + }); + + describe("onReceive, onRevert (mint)", () => { + it("Should mint if total supply + supply to add < max supply", async () => { + const supplyToAdd = 1000; + const initialSupply = await zetaTokenNonEthContract.totalSupply(); + + await zetaConnectorNonEthContract.connect(tssSigner).setMaxSupply(initialSupply.add(supplyToAdd)); + + await expect( + zetaConnectorNonEthContract + .connect(tssSigner) + .onReceive( + randomSigner.address, + 1, + zetaReceiverMockContract.address, + supplyToAdd, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ).to.be.not.reverted; + + const finalSupply = await zetaTokenNonEthContract.totalSupply(); + + expect(finalSupply).to.eq(initialSupply.add(supplyToAdd)); + + await expect( + zetaConnectorNonEthContract + .connect(tssSigner) + .onReceive( + randomSigner.address, + 1, + zetaReceiverMockContract.address, + 1, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ) + .to.revertedWith("ExceedsMaxSupply") + .withArgs(initialSupply.add(supplyToAdd)); + + await expect( + zetaConnectorNonEthContract + .connect(tssSigner) + .onRevert( + randomSigner.address, + 1, + randomSigner.address, + 2, + 1000, + new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + ethers.constants.HashZero + ) + ) + .to.revertedWith("ExceedsMaxSupply") + .withArgs(initialSupply.add(supplyToAdd)); + }); + }); + }); + }); +}); diff --git a/test/ZetaInteractor.spec.ts b/test/ZetaInteractor.spec.ts new file mode 100644 index 00000000..44ed5070 --- /dev/null +++ b/test/ZetaInteractor.spec.ts @@ -0,0 +1,119 @@ +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { ZetaInteractorMock } from "@typechain-types"; +import chai, { expect } from "chai"; +import { ethers } from "hardhat"; + +import { getZetaInteractorMock } from "../lib/contracts.helpers"; + +chai.should(); + +describe("ZetaInteractor tests", () => { + let zetaInteractorMock: ZetaInteractorMock; + const chainAId = 1; + const chainBId = 2; + + let accounts: SignerWithAddress[]; + let deployer: SignerWithAddress; + let crossChainContractB: SignerWithAddress; + let zetaConnector: SignerWithAddress; + + const encoder = new ethers.utils.AbiCoder(); + + beforeEach(async () => { + accounts = await ethers.getSigners(); + [deployer, crossChainContractB, zetaConnector] = accounts; + + zetaInteractorMock = await getZetaInteractorMock(zetaConnector.address); + + const encodedCrossChainAddressB = ethers.utils.solidityPack(["address"], [crossChainContractB.address]); + await (await zetaInteractorMock.setInteractorByChainId(chainBId, encodedCrossChainAddressB)).wait(); + }); + + describe("onCreate", () => { + it("Should revert if constructor param is zero address", async () => { + const Factory = await ethers.getContractFactory("ZetaInteractorMock"); + await expect(Factory.deploy(ethers.constants.AddressZero)).to.be.revertedWith("InvalidAddress"); + }); + + it("Should revert if the zetaTxSenderAddress it not in interactorsByChainId", async () => { + await expect( + zetaInteractorMock.connect(zetaConnector).onZetaMessage({ + destinationAddress: crossChainContractB.address, + message: encoder.encode(["address"], [crossChainContractB.address]), + sourceChainId: chainBId, + zetaTxSenderAddress: ethers.utils.solidityPack(["address"], [zetaInteractorMock.address]), + zetaValue: 0, + }) + ).to.be.revertedWith("InvalidZetaMessageCall"); + }); + }); + + describe("onZetaMessage", () => { + it("Should revert if the caller is not ZetaConnector", async () => { + await expect( + zetaInteractorMock.onZetaMessage({ + destinationAddress: crossChainContractB.address, + message: encoder.encode(["address"], [zetaInteractorMock.address]), + sourceChainId: chainBId, + zetaTxSenderAddress: ethers.utils.solidityPack(["address"], [zetaInteractorMock.address]), + zetaValue: 0, + }) + ) + .to.be.revertedWith("InvalidCaller") + .withArgs(deployer.address); + }); + + it("Should revert if the zetaTxSenderAddress it not in interactorsByChainId", async () => { + await expect( + zetaInteractorMock.connect(zetaConnector).onZetaMessage({ + destinationAddress: crossChainContractB.address, + message: encoder.encode(["address"], [crossChainContractB.address]), + sourceChainId: chainBId, + zetaTxSenderAddress: ethers.utils.solidityPack(["address"], [zetaInteractorMock.address]), + zetaValue: 0, + }) + ).to.be.revertedWith("InvalidZetaMessageCall"); + }); + }); + + describe("onZetaRevert", () => { + it("Should revert if the caller is not ZetaConnector", async () => { + await expect( + zetaInteractorMock.onZetaRevert({ + destinationAddress: ethers.utils.solidityPack(["address"], [crossChainContractB.address]), + destinationChainId: chainBId, + message: encoder.encode(["address"], [zetaInteractorMock.address]), + remainingZetaValue: 0, + sourceChainId: chainAId, + zetaTxSenderAddress: deployer.address, + }) + ) + .to.be.revertedWith("InvalidCaller") + .withArgs(deployer.address); + }); + }); + + describe("transferOwnership", () => { + it("Should transfer ownership", async () => { + const randomSigner = accounts[3]; + await zetaInteractorMock.transferOwnership(randomSigner.address); + await zetaInteractorMock.connect(randomSigner).acceptOwnership(); + await expect(await zetaInteractorMock.owner()).to.be.eq(randomSigner.address); + }); + + it("Should keep the ownership until accept", async () => { + const randomSigner = accounts[3]; + await zetaInteractorMock.transferOwnership(randomSigner.address); + await expect(await zetaInteractorMock.owner()).to.be.eq(deployer.address); + }); + + it("Should revert if old owner want to do some action", async () => { + const randomSigner = accounts[3]; + await zetaInteractorMock.transferOwnership(randomSigner.address); + await zetaInteractorMock.connect(randomSigner).acceptOwnership(); + await expect(zetaInteractorMock.transferOwnership(randomSigner.address)).to.be.revertedWith( + "Ownable: caller is not the owner" + ); + }); + }); +}); diff --git a/test/ZetaTokenConsumer.spec.ts b/test/ZetaTokenConsumer.spec.ts new file mode 100644 index 00000000..1b592e4b --- /dev/null +++ b/test/ZetaTokenConsumer.spec.ts @@ -0,0 +1,213 @@ +import { MaxUint256 } from "@ethersproject/constants"; +import { parseEther, parseUnits } from "@ethersproject/units"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { + IERC20, + IERC20__factory, + UniswapV2Router02__factory, + ZetaTokenConsumer, + ZetaTokenConsumerUniV2, + ZetaTokenConsumerUniV3, +} from "@typechain-types"; +import chai, { expect } from "chai"; +import { BigNumber } from "ethers"; +import { ethers } from "hardhat"; +import { getNonZetaAddress } from "lib"; + +import { getExternalAddress } from "../lib/address.helpers"; +import { + deployZetaNonEth, + getZetaTokenConsumerUniV2Strategy, + getZetaTokenConsumerUniV3Strategy, +} from "../lib/contracts.helpers"; +import { parseZetaConsumerLog } from "./test.helpers"; + +chai.should(); + +describe("ZetaTokenConsumer tests", () => { + let uniswapV2RouterAddr: string; + let uniswapV3RouterAddr: string; + let USDCAddr: string; + + let zetaTokenConsumerUniV2: ZetaTokenConsumerUniV2; + let zetaTokenConsumerUniV3: ZetaTokenConsumerUniV3; + let zetaTokenNonEthAddress: string; + let zetaTokenNonEth: IERC20; + + let accounts: SignerWithAddress[]; + let tssUpdater: SignerWithAddress; + let tssSigner: SignerWithAddress; + let randomSigner: SignerWithAddress; + + const getNow = async () => { + const block = await ethers.provider.getBlock("latest"); + return block.timestamp; + }; + + const swapToken = async (signer: SignerWithAddress, tokenAddress: string, expectedAmount: BigNumber) => { + const uniswapRouter = UniswapV2Router02__factory.connect(uniswapV2RouterAddr, signer); + const WETH = await uniswapRouter.WETH(); + const path = [WETH, tokenAddress]; + const tx = await uniswapRouter + .connect(signer) + .swapETHForExactTokens(expectedAmount, path, signer.address, (await getNow()) + 360, { value: parseEther("10") }); + await tx.wait(); + }; + + beforeEach(async () => { + accounts = await ethers.getSigners(); + [tssUpdater, tssSigner, randomSigner] = accounts; + + zetaTokenNonEth = await deployZetaNonEth({ + args: [tssSigner.address, tssUpdater.address], + }); + + const DAI = getExternalAddress("dai", { + customNetworkName: "eth_mainnet", + customZetaNetwork: "mainnet", + }); + + USDCAddr = getExternalAddress("usdc", { + customNetworkName: "eth_mainnet", + customZetaNetwork: "mainnet", + }); + + uniswapV2RouterAddr = getNonZetaAddress("uniswapV2Router02", "eth_mainnet"); + + const UNI_FACTORY_V3 = getNonZetaAddress("uniswapV3Factory", "eth_mainnet"); + + const UNI_ROUTER_V3 = getNonZetaAddress("uniswapV3Router", "eth_mainnet"); + + const WETH9 = getNonZetaAddress("weth9", "eth_mainnet"); + + // For testing purposes we use an existing uni v3 pool + await swapToken(tssUpdater, DAI, parseEther("10000")); + await swapToken(randomSigner, DAI, parseEther("10000")); + await swapToken(randomSigner, DAI, parseEther("10000")); + await swapToken(randomSigner, DAI, parseEther("10000")); + await swapToken(randomSigner, DAI, parseEther("10000")); + + zetaTokenNonEthAddress = DAI; + zetaTokenNonEth = IERC20__factory.connect(zetaTokenNonEthAddress, tssSigner); + + zetaTokenConsumerUniV2 = await getZetaTokenConsumerUniV2Strategy({ + deployParams: [zetaTokenNonEthAddress, uniswapV2RouterAddr], + }); + + uniswapV3RouterAddr = UNI_ROUTER_V3; + zetaTokenConsumerUniV3 = await getZetaTokenConsumerUniV3Strategy({ + deployParams: [zetaTokenNonEthAddress, uniswapV3RouterAddr, UNI_FACTORY_V3, WETH9, 3000, 3000], + }); + }); + + describe("getZetaFromEth", () => { + const shouldGetZetaFromETH = async (zetaTokenConsumer: ZetaTokenConsumer) => { + const initialZetaBalance = await zetaTokenNonEth.balanceOf(randomSigner.address); + const tx = await zetaTokenConsumer.getZetaFromEth(randomSigner.address, 1, { value: parseEther("1") }); + + const result = await tx.wait(); + const eventNames = parseZetaConsumerLog(result.logs); + expect(eventNames.filter((e) => e === "EthExchangedForZeta")).to.have.lengthOf(1); + + const finalZetaBalance = await zetaTokenNonEth.balanceOf(randomSigner.address); + expect(finalZetaBalance).to.be.gt(initialZetaBalance); + }; + + it("Should get zeta from eth using UniV2", async () => { + const zetaTokenConsumer = zetaTokenConsumerUniV2.connect(randomSigner); + await shouldGetZetaFromETH(zetaTokenConsumer); + }); + + it("Should get zeta from eth using UniV3", async () => { + const zetaTokenConsumer = zetaTokenConsumerUniV3.connect(randomSigner); + await shouldGetZetaFromETH(zetaTokenConsumer); + }); + }); + + describe("getZetaFromToken", () => { + const shouldGetZetaFromToken = async (zetaTokenConsumer: ZetaTokenConsumer) => { + const USDCContract = IERC20__factory.connect(USDCAddr, randomSigner); + await swapToken(randomSigner, USDCAddr, parseUnits("10000", 6)); + + const initialZetaBalance = await zetaTokenNonEth.balanceOf(randomSigner.address); + const tx1 = await USDCContract.approve(zetaTokenConsumer.address, MaxUint256); + await tx1.wait(); + + const tx2 = await zetaTokenConsumer.getZetaFromToken(randomSigner.address, 1, USDCAddr, parseUnits("100", 6)); + const result = await tx2.wait(); + + const eventNames = parseZetaConsumerLog(result.logs); + expect(eventNames.filter((e) => e === "TokenExchangedForZeta")).to.have.lengthOf(1); + + const finalZetaBalance = await zetaTokenNonEth.balanceOf(randomSigner.address); + expect(finalZetaBalance).to.be.gt(initialZetaBalance); + }; + + it("Should get zeta from token using UniV2", async () => { + const zetaTokenConsumer = zetaTokenConsumerUniV2.connect(randomSigner); + await shouldGetZetaFromToken(zetaTokenConsumer); + }); + + it("Should get zeta from token using UniV3", async () => { + const zetaTokenConsumer = zetaTokenConsumerUniV3.connect(randomSigner); + await shouldGetZetaFromToken(zetaTokenConsumer); + }); + }); + + describe("getEthFromZeta", () => { + const shouldGetETHFromZeta = async (zetaTokenConsumer: ZetaTokenConsumer) => { + const initialEthBalance = await ethers.provider.getBalance(randomSigner.address); + const tx1 = await zetaTokenNonEth.connect(randomSigner).approve(zetaTokenConsumer.address, MaxUint256); + await tx1.wait(); + + const tx2 = await zetaTokenConsumer.getEthFromZeta(randomSigner.address, 1, parseUnits("5000", 18)); + const result = await tx2.wait(); + + const eventNames = parseZetaConsumerLog(result.logs); + expect(eventNames.filter((e) => e === "ZetaExchangedForEth")).to.have.lengthOf(1); + + const finalEthBalance = await ethers.provider.getBalance(randomSigner.address); + expect(finalEthBalance).to.be.gt(initialEthBalance); + }; + + it("Should get eth from zeta using UniV2", async () => { + const zetaTokenConsumer = zetaTokenConsumerUniV2.connect(randomSigner); + await shouldGetETHFromZeta(zetaTokenConsumer); + }); + + it("Should get eth from zeta using UniV3", async () => { + const zetaTokenConsumer = zetaTokenConsumerUniV3.connect(randomSigner); + + await shouldGetETHFromZeta(zetaTokenConsumer); + }); + }); + + describe("getTokenFromZeta", () => { + const shouldGetTokenFromZeta = async (zetaTokenConsumer: ZetaTokenConsumer) => { + const USDCContract = IERC20__factory.connect(USDCAddr, randomSigner); + + const initialTokenBalance = await USDCContract.balanceOf(randomSigner.address); + const tx1 = await zetaTokenNonEth.connect(randomSigner).approve(zetaTokenConsumer.address, MaxUint256); + await tx1.wait(); + + const tx2 = await zetaTokenConsumer.getTokenFromZeta(randomSigner.address, 1, USDCAddr, parseUnits("5000", 18)); + const result = await tx2.wait(); + + const eventNames = parseZetaConsumerLog(result.logs); + expect(eventNames.filter((e) => e === "ZetaExchangedForToken")).to.have.lengthOf(1); + + const finalTokenBalance = await USDCContract.balanceOf(randomSigner.address); + expect(finalTokenBalance).to.be.gt(initialTokenBalance); + }; + + it("Should get token from zeta using UniV2", async () => { + const zetaTokenConsumer = zetaTokenConsumerUniV2.connect(randomSigner); + await shouldGetTokenFromZeta(zetaTokenConsumer); + }); + + it("Should get token from zeta using UniV3", async () => { + const zetaTokenConsumer = zetaTokenConsumerUniV3.connect(randomSigner); + await shouldGetTokenFromZeta(zetaTokenConsumer); + }); + }); +}); diff --git a/test/test.helpers.ts b/test/test.helpers.ts new file mode 100644 index 00000000..006c5dc0 --- /dev/null +++ b/test/test.helpers.ts @@ -0,0 +1,18 @@ +import { ZetaTokenConsumer__factory } from "@typechain-types"; +import { BigNumber, ContractReceipt } from "ethers"; + +export const parseZetaConsumerLog = (logs: ContractReceipt["logs"]) => { + const iface = ZetaTokenConsumer__factory.createInterface(); + + const eventNames = logs.map((log) => { + try { + const parsedLog = iface.parseLog(log); + + return parsedLog.name; + } catch (e) { + return "NO_ZETA_LOG"; + } + }); + + return eventNames; +}; From 7603c08edf025fa66a9e813d750a028423da3413 Mon Sep 17 00:00:00 2001 From: Andres Aiello Date: Mon, 6 Nov 2023 12:54:00 -0300 Subject: [PATCH 4/4] add connector zevm test --- ...onnectorZEVM.sol => ZetaConnectorZEVM.sol} | 4 +- ...temContract.sol => SystemContractMock.sol} | 2 +- .../systemcontracterrors.go | 2 +- .../systemcontractmock.go} | 482 +++++++++--------- .../wzeta.go | 2 +- .../zetaconnectorzevm.go | 10 +- .../zetainterfaces.go | 2 +- test/ConnectorZEVM.spec.ts | 135 +++++ test/ZRC20.spec.ts | 6 +- test/test.helpers.ts | 2 + .../WZETA.ts | 0 .../ZetaConnectorZEVM.ts | 0 .../index.ts | 0 typechain-types/contracts/zevm/index.ts | 4 +- .../SystemContractErrors.ts | 0 .../SystemContractMock.ts} | 6 +- .../index.ts | 2 +- .../contracts/zevm/testing/index.ts | 4 +- .../WZETA__factory.ts | 2 +- .../ZetaConnectorZEVM__factory.ts | 14 +- .../index.ts | 0 .../factories/contracts/zevm/index.ts | 2 +- .../SystemContractErrors__factory.ts | 2 +- .../SystemContractMock__factory.ts} | 36 +- .../index.ts | 2 +- .../factories/contracts/zevm/testing/index.ts | 2 +- typechain-types/hardhat.d.ts | 52 +- typechain-types/index.ts | 12 +- 28 files changed, 462 insertions(+), 325 deletions(-) rename contracts/zevm/{ConnectorZEVM.sol => ZetaConnectorZEVM.sol} (98%) rename contracts/zevm/testing/{MockSystemContract.sol => SystemContractMock.sol} (98%) rename pkg/contracts/zevm/testing/{mocksystemcontract.sol => systemcontractmock.sol}/systemcontracterrors.go (99%) rename pkg/contracts/zevm/testing/{mocksystemcontract.sol/mocksystemcontract.go => systemcontractmock.sol/systemcontractmock.go} (70%) rename pkg/contracts/zevm/{connectorzevm.sol => zetaconnectorzevm.sol}/wzeta.go (99%) rename pkg/contracts/zevm/{connectorzevm.sol => zetaconnectorzevm.sol}/zetaconnectorzevm.go (98%) rename pkg/contracts/zevm/{connectorzevm.sol => zetaconnectorzevm.sol}/zetainterfaces.go (99%) create mode 100644 test/ConnectorZEVM.spec.ts rename typechain-types/contracts/zevm/{ConnectorZEVM.sol => ZetaConnectorZEVM.sol}/WZETA.ts (100%) rename typechain-types/contracts/zevm/{ConnectorZEVM.sol => ZetaConnectorZEVM.sol}/ZetaConnectorZEVM.ts (100%) rename typechain-types/contracts/zevm/{ConnectorZEVM.sol => ZetaConnectorZEVM.sol}/index.ts (100%) rename typechain-types/contracts/zevm/testing/{MockSystemContract.sol => SystemContractMock.sol}/SystemContractErrors.ts (100%) rename typechain-types/contracts/zevm/testing/{MockSystemContract.sol/MockSystemContract.ts => SystemContractMock.sol/SystemContractMock.ts} (98%) rename typechain-types/contracts/zevm/testing/{MockSystemContract.sol => SystemContractMock.sol}/index.ts (71%) rename typechain-types/factories/contracts/zevm/{ConnectorZEVM.sol => ZetaConnectorZEVM.sol}/WZETA__factory.ts (95%) rename typechain-types/factories/contracts/zevm/{ConnectorZEVM.sol => ZetaConnectorZEVM.sol}/ZetaConnectorZEVM__factory.ts (96%) rename typechain-types/factories/contracts/zevm/{ConnectorZEVM.sol => ZetaConnectorZEVM.sol}/index.ts (100%) rename typechain-types/factories/contracts/zevm/testing/{MockSystemContract.sol => SystemContractMock.sol}/SystemContractErrors__factory.ts (94%) rename typechain-types/factories/contracts/zevm/testing/{MockSystemContract.sol/MockSystemContract__factory.ts => SystemContractMock.sol/SystemContractMock__factory.ts} (93%) rename typechain-types/factories/contracts/zevm/testing/{MockSystemContract.sol => SystemContractMock.sol}/index.ts (68%) diff --git a/contracts/zevm/ConnectorZEVM.sol b/contracts/zevm/ZetaConnectorZEVM.sol similarity index 98% rename from contracts/zevm/ConnectorZEVM.sol rename to contracts/zevm/ZetaConnectorZEVM.sol index 69d9d65e..85a83f3a 100644 --- a/contracts/zevm/ConnectorZEVM.sol +++ b/contracts/zevm/ZetaConnectorZEVM.sol @@ -76,8 +76,8 @@ contract ZetaConnectorZEVM is ZetaInterfaces { ); event SetWZETA(address wzeta_); - constructor(address _wzeta) { - wzeta = _wzeta; + constructor(address wzeta_) { + wzeta = wzeta_; } /// @dev Receive function to receive ZETA from WETH9.withdraw(). diff --git a/contracts/zevm/testing/MockSystemContract.sol b/contracts/zevm/testing/SystemContractMock.sol similarity index 98% rename from contracts/zevm/testing/MockSystemContract.sol rename to contracts/zevm/testing/SystemContractMock.sol index ba6ec765..f3c86a34 100644 --- a/contracts/zevm/testing/MockSystemContract.sol +++ b/contracts/zevm/testing/SystemContractMock.sol @@ -14,7 +14,7 @@ interface SystemContractErrors { error CantBeZeroAddress(); } -contract MockSystemContract is SystemContractErrors { +contract SystemContractMock is SystemContractErrors { mapping(uint256 => uint256) public gasPriceByChainId; mapping(uint256 => address) public gasCoinZRC20ByChainId; mapping(uint256 => address) public gasZetaPoolByChainId; diff --git a/pkg/contracts/zevm/testing/mocksystemcontract.sol/systemcontracterrors.go b/pkg/contracts/zevm/testing/systemcontractmock.sol/systemcontracterrors.go similarity index 99% rename from pkg/contracts/zevm/testing/mocksystemcontract.sol/systemcontracterrors.go rename to pkg/contracts/zevm/testing/systemcontractmock.sol/systemcontracterrors.go index c74dda67..9dabc5e8 100644 --- a/pkg/contracts/zevm/testing/mocksystemcontract.sol/systemcontracterrors.go +++ b/pkg/contracts/zevm/testing/systemcontractmock.sol/systemcontracterrors.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package mocksystemcontract +package systemcontractmock import ( "errors" diff --git a/pkg/contracts/zevm/testing/mocksystemcontract.sol/mocksystemcontract.go b/pkg/contracts/zevm/testing/systemcontractmock.sol/systemcontractmock.go similarity index 70% rename from pkg/contracts/zevm/testing/mocksystemcontract.sol/mocksystemcontract.go rename to pkg/contracts/zevm/testing/systemcontractmock.sol/systemcontractmock.go index 36ed95d4..884e14e6 100644 --- a/pkg/contracts/zevm/testing/mocksystemcontract.sol/mocksystemcontract.go +++ b/pkg/contracts/zevm/testing/systemcontractmock.sol/systemcontractmock.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package mocksystemcontract +package systemcontractmock import ( "errors" @@ -29,23 +29,23 @@ var ( _ = abi.ConvertType ) -// MockSystemContractMetaData contains all meta data concerning the MockSystemContract contract. -var MockSystemContractMetaData = &bind.MetaData{ +// SystemContractMockMetaData contains all meta data concerning the SystemContractMock contract. +var SystemContractMockMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wzeta_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"uniswapv2Factory_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"uniswapv2Router02_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerIsNotFungibleModule\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CantBeIdenticalAddresses\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CantBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTarget\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SetGasCoin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"SetGasPrice\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SetGasZetaPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SetWZeta\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"SystemContractDeployed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"gasCoinZRC20ByChainId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"gasPriceByChainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"gasZetaPoolByChainId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCrossChainCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"}],\"name\":\"setGasCoinZRC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setGasPrice\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setWZETAContractAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapv2FactoryAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"}],\"name\":\"uniswapv2PairFor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"pair\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapv2Router02Address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wZetaContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60806040523480156200001157600080fd5b50604051620010d7380380620010d7833981810160405281019062000037919062000146565b82600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac560405160405180910390a1505050620001f5565b6000815190506200014081620001db565b92915050565b600080600060608486031215620001625762000161620001d6565b5b600062000172868287016200012f565b935050602062000185868287016200012f565b925050604062000198868287016200012f565b9150509250925092565b6000620001af82620001b6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b620001e681620001a2565b8114620001f257600080fd5b50565b610ed280620002056000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806397770dff1161007157806397770dff14610166578063a7cb050714610182578063c63585cc1461019e578063d7fd7afb146101ce578063d936a012146101fe578063ee2815ba1461021c576100a9565b80630be15547146100ae5780633c669d55146100de578063513a9c05146100fa578063569541b91461012a578063842da36d14610148575b600080fd5b6100c860048036038101906100c3919061094d565b610238565b6040516100d59190610bce565b60405180910390f35b6100f860048036038101906100f39190610898565b61026b565b005b610114600480360381019061010f919061094d565b6103b8565b6040516101219190610bce565b60405180910390f35b6101326103eb565b60405161013f9190610bce565b60405180910390f35b610150610411565b60405161015d9190610bce565b60405180910390f35b610180600480360381019061017b9190610818565b610437565b005b61019c600480360381019061019791906109ba565b6104d4565b005b6101b860048036038101906101b39190610845565b610528565b6040516101c59190610bce565b60405180910390f35b6101e860048036038101906101e3919061094d565b61059a565b6040516101f59190610c67565b60405180910390f35b6102066105b2565b6040516102139190610bce565b60405180910390f35b6102366004803603810190610231919061097a565b6105d8565b005b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405180606001604052806040518060200160405280600081525081526020013373ffffffffffffffffffffffffffffffffffffffff1681526020014681525090508473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87866040518363ffffffff1660e01b81526004016102ea929190610be9565b602060405180830381600087803b15801561030457600080fd5b505af1158015610318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033c9190610920565b508573ffffffffffffffffffffffffffffffffffffffff1663de43156e82878787876040518663ffffffff1660e01b815260040161037e959493929190610c12565b600060405180830381600087803b15801561039857600080fd5b505af11580156103ac573d6000803e3d6000fd5b50505050505050505050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516104c99190610bce565b60405180910390a150565b80600080848152602001908152602001600020819055507f49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d828260405161051c929190610cab565b60405180910390a15050565b60008060006105378585610667565b9150915085828260405160200161054f929190610b60565b60405160208183030381529060405280519060200120604051602001610576929190610b8c565b6040516020818303038152906040528051906020012060001c925050509392505050565b60006020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b806001600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d828260405161065b929190610c82565b60405180910390a15050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156106d0576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161061070a57828461070d565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561077c576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008135905061079281610e57565b92915050565b6000815190506107a781610e6e565b92915050565b60008083601f8401126107c3576107c2610dd3565b5b8235905067ffffffffffffffff8111156107e0576107df610dce565b5b6020830191508360018202830111156107fc576107fb610dd8565b5b9250929050565b60008135905061081281610e85565b92915050565b60006020828403121561082e5761082d610de2565b5b600061083c84828501610783565b91505092915050565b60008060006060848603121561085e5761085d610de2565b5b600061086c86828701610783565b935050602061087d86828701610783565b925050604061088e86828701610783565b9150509250925092565b6000806000806000608086880312156108b4576108b3610de2565b5b60006108c288828901610783565b95505060206108d388828901610783565b94505060406108e488828901610803565b935050606086013567ffffffffffffffff81111561090557610904610ddd565b5b610911888289016107ad565b92509250509295509295909350565b60006020828403121561093657610935610de2565b5b600061094484828501610798565b91505092915050565b60006020828403121561096357610962610de2565b5b600061097184828501610803565b91505092915050565b6000806040838503121561099157610990610de2565b5b600061099f85828601610803565b92505060206109b085828601610783565b9150509250929050565b600080604083850312156109d1576109d0610de2565b5b60006109df85828601610803565b92505060206109f085828601610803565b9150509250929050565b610a0381610d0c565b82525050565b610a1281610d0c565b82525050565b610a29610a2482610d0c565b610da0565b82525050565b610a40610a3b82610d2a565b610db2565b82525050565b6000610a528385610cf0565b9350610a5f838584610d5e565b610a6883610de7565b840190509392505050565b6000610a7e82610cd4565b610a888185610cdf565b9350610a98818560208601610d6d565b610aa181610de7565b840191505092915050565b6000610ab9602083610d01565b9150610ac482610e05565b602082019050919050565b6000610adc600183610d01565b9150610ae782610e2e565b600182019050919050565b60006060830160008301518482036000860152610b0f8282610a73565b9150506020830151610b2460208601826109fa565b506040830151610b376040860182610b42565b508091505092915050565b610b4b81610d54565b82525050565b610b5a81610d54565b82525050565b6000610b6c8285610a18565b601482019150610b7c8284610a18565b6014820191508190509392505050565b6000610b9782610acf565b9150610ba38285610a18565b601482019150610bb38284610a2f565b602082019150610bc282610aac565b91508190509392505050565b6000602082019050610be36000830184610a09565b92915050565b6000604082019050610bfe6000830185610a09565b610c0b6020830184610b51565b9392505050565b60006080820190508181036000830152610c2c8188610af2565b9050610c3b6020830187610a09565b610c486040830186610b51565b8181036060830152610c5b818486610a46565b90509695505050505050565b6000602082019050610c7c6000830184610b51565b92915050565b6000604082019050610c976000830185610b51565b610ca46020830184610a09565b9392505050565b6000604082019050610cc06000830185610b51565b610ccd6020830184610b51565b9392505050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000610d1782610d34565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610d8b578082015181840152602081019050610d70565b83811115610d9a576000848401525b50505050565b6000610dab82610dbc565b9050919050565b6000819050919050565b6000610dc782610df8565b9050919050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f600082015250565b7fff00000000000000000000000000000000000000000000000000000000000000600082015250565b610e6081610d0c565b8114610e6b57600080fd5b50565b610e7781610d1e565b8114610e8257600080fd5b50565b610e8e81610d54565b8114610e9957600080fd5b5056fea26469706673582212200ba12c9e6d9b24f4467c622d42302be9e9ceb57f7588e1dd2778bc19ae263c6b64736f6c63430008070033", + Bin: "0x60806040523480156200001157600080fd5b50604051620010d7380380620010d7833981810160405281019062000037919062000146565b82600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac560405160405180910390a1505050620001f5565b6000815190506200014081620001db565b92915050565b600080600060608486031215620001625762000161620001d6565b5b600062000172868287016200012f565b935050602062000185868287016200012f565b925050604062000198868287016200012f565b9150509250925092565b6000620001af82620001b6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b620001e681620001a2565b8114620001f257600080fd5b50565b610ed280620002056000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806397770dff1161007157806397770dff14610166578063a7cb050714610182578063c63585cc1461019e578063d7fd7afb146101ce578063d936a012146101fe578063ee2815ba1461021c576100a9565b80630be15547146100ae5780633c669d55146100de578063513a9c05146100fa578063569541b91461012a578063842da36d14610148575b600080fd5b6100c860048036038101906100c3919061094d565b610238565b6040516100d59190610bce565b60405180910390f35b6100f860048036038101906100f39190610898565b61026b565b005b610114600480360381019061010f919061094d565b6103b8565b6040516101219190610bce565b60405180910390f35b6101326103eb565b60405161013f9190610bce565b60405180910390f35b610150610411565b60405161015d9190610bce565b60405180910390f35b610180600480360381019061017b9190610818565b610437565b005b61019c600480360381019061019791906109ba565b6104d4565b005b6101b860048036038101906101b39190610845565b610528565b6040516101c59190610bce565b60405180910390f35b6101e860048036038101906101e3919061094d565b61059a565b6040516101f59190610c67565b60405180910390f35b6102066105b2565b6040516102139190610bce565b60405180910390f35b6102366004803603810190610231919061097a565b6105d8565b005b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405180606001604052806040518060200160405280600081525081526020013373ffffffffffffffffffffffffffffffffffffffff1681526020014681525090508473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87866040518363ffffffff1660e01b81526004016102ea929190610be9565b602060405180830381600087803b15801561030457600080fd5b505af1158015610318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033c9190610920565b508573ffffffffffffffffffffffffffffffffffffffff1663de43156e82878787876040518663ffffffff1660e01b815260040161037e959493929190610c12565b600060405180830381600087803b15801561039857600080fd5b505af11580156103ac573d6000803e3d6000fd5b50505050505050505050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516104c99190610bce565b60405180910390a150565b80600080848152602001908152602001600020819055507f49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d828260405161051c929190610cab565b60405180910390a15050565b60008060006105378585610667565b9150915085828260405160200161054f929190610b60565b60405160208183030381529060405280519060200120604051602001610576929190610b8c565b6040516020818303038152906040528051906020012060001c925050509392505050565b60006020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b806001600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d828260405161065b929190610c82565b60405180910390a15050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156106d0576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161061070a57828461070d565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561077c576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008135905061079281610e57565b92915050565b6000815190506107a781610e6e565b92915050565b60008083601f8401126107c3576107c2610dd3565b5b8235905067ffffffffffffffff8111156107e0576107df610dce565b5b6020830191508360018202830111156107fc576107fb610dd8565b5b9250929050565b60008135905061081281610e85565b92915050565b60006020828403121561082e5761082d610de2565b5b600061083c84828501610783565b91505092915050565b60008060006060848603121561085e5761085d610de2565b5b600061086c86828701610783565b935050602061087d86828701610783565b925050604061088e86828701610783565b9150509250925092565b6000806000806000608086880312156108b4576108b3610de2565b5b60006108c288828901610783565b95505060206108d388828901610783565b94505060406108e488828901610803565b935050606086013567ffffffffffffffff81111561090557610904610ddd565b5b610911888289016107ad565b92509250509295509295909350565b60006020828403121561093657610935610de2565b5b600061094484828501610798565b91505092915050565b60006020828403121561096357610962610de2565b5b600061097184828501610803565b91505092915050565b6000806040838503121561099157610990610de2565b5b600061099f85828601610803565b92505060206109b085828601610783565b9150509250929050565b600080604083850312156109d1576109d0610de2565b5b60006109df85828601610803565b92505060206109f085828601610803565b9150509250929050565b610a0381610d0c565b82525050565b610a1281610d0c565b82525050565b610a29610a2482610d0c565b610da0565b82525050565b610a40610a3b82610d2a565b610db2565b82525050565b6000610a528385610cf0565b9350610a5f838584610d5e565b610a6883610de7565b840190509392505050565b6000610a7e82610cd4565b610a888185610cdf565b9350610a98818560208601610d6d565b610aa181610de7565b840191505092915050565b6000610ab9602083610d01565b9150610ac482610e05565b602082019050919050565b6000610adc600183610d01565b9150610ae782610e2e565b600182019050919050565b60006060830160008301518482036000860152610b0f8282610a73565b9150506020830151610b2460208601826109fa565b506040830151610b376040860182610b42565b508091505092915050565b610b4b81610d54565b82525050565b610b5a81610d54565b82525050565b6000610b6c8285610a18565b601482019150610b7c8284610a18565b6014820191508190509392505050565b6000610b9782610acf565b9150610ba38285610a18565b601482019150610bb38284610a2f565b602082019150610bc282610aac565b91508190509392505050565b6000602082019050610be36000830184610a09565b92915050565b6000604082019050610bfe6000830185610a09565b610c0b6020830184610b51565b9392505050565b60006080820190508181036000830152610c2c8188610af2565b9050610c3b6020830187610a09565b610c486040830186610b51565b8181036060830152610c5b818486610a46565b90509695505050505050565b6000602082019050610c7c6000830184610b51565b92915050565b6000604082019050610c976000830185610b51565b610ca46020830184610a09565b9392505050565b6000604082019050610cc06000830185610b51565b610ccd6020830184610b51565b9392505050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000610d1782610d34565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610d8b578082015181840152602081019050610d70565b83811115610d9a576000848401525b50505050565b6000610dab82610dbc565b9050919050565b6000819050919050565b6000610dc782610df8565b9050919050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f600082015250565b7fff00000000000000000000000000000000000000000000000000000000000000600082015250565b610e6081610d0c565b8114610e6b57600080fd5b50565b610e7781610d1e565b8114610e8257600080fd5b50565b610e8e81610d54565b8114610e9957600080fd5b5056fea26469706673582212203fa9d55135c7f24f7b5da3516688ef5fb78d92d28a850d2fe6d6fc3799422af364736f6c63430008070033", } -// MockSystemContractABI is the input ABI used to generate the binding from. -// Deprecated: Use MockSystemContractMetaData.ABI instead. -var MockSystemContractABI = MockSystemContractMetaData.ABI +// SystemContractMockABI is the input ABI used to generate the binding from. +// Deprecated: Use SystemContractMockMetaData.ABI instead. +var SystemContractMockABI = SystemContractMockMetaData.ABI -// MockSystemContractBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use MockSystemContractMetaData.Bin instead. -var MockSystemContractBin = MockSystemContractMetaData.Bin +// SystemContractMockBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use SystemContractMockMetaData.Bin instead. +var SystemContractMockBin = SystemContractMockMetaData.Bin -// DeployMockSystemContract deploys a new Ethereum contract, binding an instance of MockSystemContract to it. -func DeployMockSystemContract(auth *bind.TransactOpts, backend bind.ContractBackend, wzeta_ common.Address, uniswapv2Factory_ common.Address, uniswapv2Router02_ common.Address) (common.Address, *types.Transaction, *MockSystemContract, error) { - parsed, err := MockSystemContractMetaData.GetAbi() +// DeploySystemContractMock deploys a new Ethereum contract, binding an instance of SystemContractMock to it. +func DeploySystemContractMock(auth *bind.TransactOpts, backend bind.ContractBackend, wzeta_ common.Address, uniswapv2Factory_ common.Address, uniswapv2Router02_ common.Address) (common.Address, *types.Transaction, *SystemContractMock, error) { + parsed, err := SystemContractMockMetaData.GetAbi() if err != nil { return common.Address{}, nil, nil, err } @@ -53,111 +53,111 @@ func DeployMockSystemContract(auth *bind.TransactOpts, backend bind.ContractBack return common.Address{}, nil, nil, errors.New("GetABI returned nil") } - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(MockSystemContractBin), backend, wzeta_, uniswapv2Factory_, uniswapv2Router02_) + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SystemContractMockBin), backend, wzeta_, uniswapv2Factory_, uniswapv2Router02_) if err != nil { return common.Address{}, nil, nil, err } - return address, tx, &MockSystemContract{MockSystemContractCaller: MockSystemContractCaller{contract: contract}, MockSystemContractTransactor: MockSystemContractTransactor{contract: contract}, MockSystemContractFilterer: MockSystemContractFilterer{contract: contract}}, nil + return address, tx, &SystemContractMock{SystemContractMockCaller: SystemContractMockCaller{contract: contract}, SystemContractMockTransactor: SystemContractMockTransactor{contract: contract}, SystemContractMockFilterer: SystemContractMockFilterer{contract: contract}}, nil } -// MockSystemContract is an auto generated Go binding around an Ethereum contract. -type MockSystemContract struct { - MockSystemContractCaller // Read-only binding to the contract - MockSystemContractTransactor // Write-only binding to the contract - MockSystemContractFilterer // Log filterer for contract events +// SystemContractMock is an auto generated Go binding around an Ethereum contract. +type SystemContractMock struct { + SystemContractMockCaller // Read-only binding to the contract + SystemContractMockTransactor // Write-only binding to the contract + SystemContractMockFilterer // Log filterer for contract events } -// MockSystemContractCaller is an auto generated read-only Go binding around an Ethereum contract. -type MockSystemContractCaller struct { +// SystemContractMockCaller is an auto generated read-only Go binding around an Ethereum contract. +type SystemContractMockCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// MockSystemContractTransactor is an auto generated write-only Go binding around an Ethereum contract. -type MockSystemContractTransactor struct { +// SystemContractMockTransactor is an auto generated write-only Go binding around an Ethereum contract. +type SystemContractMockTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// MockSystemContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type MockSystemContractFilterer struct { +// SystemContractMockFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type SystemContractMockFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// MockSystemContractSession is an auto generated Go binding around an Ethereum contract, +// SystemContractMockSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. -type MockSystemContractSession struct { - Contract *MockSystemContract // Generic contract binding to set the session for +type SystemContractMockSession struct { + Contract *SystemContractMock // Generic contract binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// MockSystemContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// SystemContractMockCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. -type MockSystemContractCallerSession struct { - Contract *MockSystemContractCaller // Generic contract caller binding to set the session for +type SystemContractMockCallerSession struct { + Contract *SystemContractMockCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } -// MockSystemContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// SystemContractMockTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. -type MockSystemContractTransactorSession struct { - Contract *MockSystemContractTransactor // Generic contract transactor binding to set the session for +type SystemContractMockTransactorSession struct { + Contract *SystemContractMockTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// MockSystemContractRaw is an auto generated low-level Go binding around an Ethereum contract. -type MockSystemContractRaw struct { - Contract *MockSystemContract // Generic contract binding to access the raw methods on +// SystemContractMockRaw is an auto generated low-level Go binding around an Ethereum contract. +type SystemContractMockRaw struct { + Contract *SystemContractMock // Generic contract binding to access the raw methods on } -// MockSystemContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type MockSystemContractCallerRaw struct { - Contract *MockSystemContractCaller // Generic read-only contract binding to access the raw methods on +// SystemContractMockCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type SystemContractMockCallerRaw struct { + Contract *SystemContractMockCaller // Generic read-only contract binding to access the raw methods on } -// MockSystemContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type MockSystemContractTransactorRaw struct { - Contract *MockSystemContractTransactor // Generic write-only contract binding to access the raw methods on +// SystemContractMockTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type SystemContractMockTransactorRaw struct { + Contract *SystemContractMockTransactor // Generic write-only contract binding to access the raw methods on } -// NewMockSystemContract creates a new instance of MockSystemContract, bound to a specific deployed contract. -func NewMockSystemContract(address common.Address, backend bind.ContractBackend) (*MockSystemContract, error) { - contract, err := bindMockSystemContract(address, backend, backend, backend) +// NewSystemContractMock creates a new instance of SystemContractMock, bound to a specific deployed contract. +func NewSystemContractMock(address common.Address, backend bind.ContractBackend) (*SystemContractMock, error) { + contract, err := bindSystemContractMock(address, backend, backend, backend) if err != nil { return nil, err } - return &MockSystemContract{MockSystemContractCaller: MockSystemContractCaller{contract: contract}, MockSystemContractTransactor: MockSystemContractTransactor{contract: contract}, MockSystemContractFilterer: MockSystemContractFilterer{contract: contract}}, nil + return &SystemContractMock{SystemContractMockCaller: SystemContractMockCaller{contract: contract}, SystemContractMockTransactor: SystemContractMockTransactor{contract: contract}, SystemContractMockFilterer: SystemContractMockFilterer{contract: contract}}, nil } -// NewMockSystemContractCaller creates a new read-only instance of MockSystemContract, bound to a specific deployed contract. -func NewMockSystemContractCaller(address common.Address, caller bind.ContractCaller) (*MockSystemContractCaller, error) { - contract, err := bindMockSystemContract(address, caller, nil, nil) +// NewSystemContractMockCaller creates a new read-only instance of SystemContractMock, bound to a specific deployed contract. +func NewSystemContractMockCaller(address common.Address, caller bind.ContractCaller) (*SystemContractMockCaller, error) { + contract, err := bindSystemContractMock(address, caller, nil, nil) if err != nil { return nil, err } - return &MockSystemContractCaller{contract: contract}, nil + return &SystemContractMockCaller{contract: contract}, nil } -// NewMockSystemContractTransactor creates a new write-only instance of MockSystemContract, bound to a specific deployed contract. -func NewMockSystemContractTransactor(address common.Address, transactor bind.ContractTransactor) (*MockSystemContractTransactor, error) { - contract, err := bindMockSystemContract(address, nil, transactor, nil) +// NewSystemContractMockTransactor creates a new write-only instance of SystemContractMock, bound to a specific deployed contract. +func NewSystemContractMockTransactor(address common.Address, transactor bind.ContractTransactor) (*SystemContractMockTransactor, error) { + contract, err := bindSystemContractMock(address, nil, transactor, nil) if err != nil { return nil, err } - return &MockSystemContractTransactor{contract: contract}, nil + return &SystemContractMockTransactor{contract: contract}, nil } -// NewMockSystemContractFilterer creates a new log filterer instance of MockSystemContract, bound to a specific deployed contract. -func NewMockSystemContractFilterer(address common.Address, filterer bind.ContractFilterer) (*MockSystemContractFilterer, error) { - contract, err := bindMockSystemContract(address, nil, nil, filterer) +// NewSystemContractMockFilterer creates a new log filterer instance of SystemContractMock, bound to a specific deployed contract. +func NewSystemContractMockFilterer(address common.Address, filterer bind.ContractFilterer) (*SystemContractMockFilterer, error) { + contract, err := bindSystemContractMock(address, nil, nil, filterer) if err != nil { return nil, err } - return &MockSystemContractFilterer{contract: contract}, nil + return &SystemContractMockFilterer{contract: contract}, nil } -// bindMockSystemContract binds a generic wrapper to an already deployed contract. -func bindMockSystemContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := MockSystemContractMetaData.GetAbi() +// bindSystemContractMock binds a generic wrapper to an already deployed contract. +func bindSystemContractMock(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := SystemContractMockMetaData.GetAbi() if err != nil { return nil, err } @@ -168,46 +168,46 @@ func bindMockSystemContract(address common.Address, caller bind.ContractCaller, // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_MockSystemContract *MockSystemContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _MockSystemContract.Contract.MockSystemContractCaller.contract.Call(opts, result, method, params...) +func (_SystemContractMock *SystemContractMockRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _SystemContractMock.Contract.SystemContractMockCaller.contract.Call(opts, result, method, params...) } // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. -func (_MockSystemContract *MockSystemContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _MockSystemContract.Contract.MockSystemContractTransactor.contract.Transfer(opts) +func (_SystemContractMock *SystemContractMockRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SystemContractMock.Contract.SystemContractMockTransactor.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_MockSystemContract *MockSystemContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _MockSystemContract.Contract.MockSystemContractTransactor.contract.Transact(opts, method, params...) +func (_SystemContractMock *SystemContractMockRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SystemContractMock.Contract.SystemContractMockTransactor.contract.Transact(opts, method, params...) } // Call invokes the (constant) contract method with params as input values and // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_MockSystemContract *MockSystemContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _MockSystemContract.Contract.contract.Call(opts, result, method, params...) +func (_SystemContractMock *SystemContractMockCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _SystemContractMock.Contract.contract.Call(opts, result, method, params...) } // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. -func (_MockSystemContract *MockSystemContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _MockSystemContract.Contract.contract.Transfer(opts) +func (_SystemContractMock *SystemContractMockTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _SystemContractMock.Contract.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_MockSystemContract *MockSystemContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _MockSystemContract.Contract.contract.Transact(opts, method, params...) +func (_SystemContractMock *SystemContractMockTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _SystemContractMock.Contract.contract.Transact(opts, method, params...) } // GasCoinZRC20ByChainId is a free data retrieval call binding the contract method 0x0be15547. // // Solidity: function gasCoinZRC20ByChainId(uint256 ) view returns(address) -func (_MockSystemContract *MockSystemContractCaller) GasCoinZRC20ByChainId(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { +func (_SystemContractMock *SystemContractMockCaller) GasCoinZRC20ByChainId(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { var out []interface{} - err := _MockSystemContract.contract.Call(opts, &out, "gasCoinZRC20ByChainId", arg0) + err := _SystemContractMock.contract.Call(opts, &out, "gasCoinZRC20ByChainId", arg0) if err != nil { return *new(common.Address), err @@ -222,23 +222,23 @@ func (_MockSystemContract *MockSystemContractCaller) GasCoinZRC20ByChainId(opts // GasCoinZRC20ByChainId is a free data retrieval call binding the contract method 0x0be15547. // // Solidity: function gasCoinZRC20ByChainId(uint256 ) view returns(address) -func (_MockSystemContract *MockSystemContractSession) GasCoinZRC20ByChainId(arg0 *big.Int) (common.Address, error) { - return _MockSystemContract.Contract.GasCoinZRC20ByChainId(&_MockSystemContract.CallOpts, arg0) +func (_SystemContractMock *SystemContractMockSession) GasCoinZRC20ByChainId(arg0 *big.Int) (common.Address, error) { + return _SystemContractMock.Contract.GasCoinZRC20ByChainId(&_SystemContractMock.CallOpts, arg0) } // GasCoinZRC20ByChainId is a free data retrieval call binding the contract method 0x0be15547. // // Solidity: function gasCoinZRC20ByChainId(uint256 ) view returns(address) -func (_MockSystemContract *MockSystemContractCallerSession) GasCoinZRC20ByChainId(arg0 *big.Int) (common.Address, error) { - return _MockSystemContract.Contract.GasCoinZRC20ByChainId(&_MockSystemContract.CallOpts, arg0) +func (_SystemContractMock *SystemContractMockCallerSession) GasCoinZRC20ByChainId(arg0 *big.Int) (common.Address, error) { + return _SystemContractMock.Contract.GasCoinZRC20ByChainId(&_SystemContractMock.CallOpts, arg0) } // GasPriceByChainId is a free data retrieval call binding the contract method 0xd7fd7afb. // // Solidity: function gasPriceByChainId(uint256 ) view returns(uint256) -func (_MockSystemContract *MockSystemContractCaller) GasPriceByChainId(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error) { +func (_SystemContractMock *SystemContractMockCaller) GasPriceByChainId(opts *bind.CallOpts, arg0 *big.Int) (*big.Int, error) { var out []interface{} - err := _MockSystemContract.contract.Call(opts, &out, "gasPriceByChainId", arg0) + err := _SystemContractMock.contract.Call(opts, &out, "gasPriceByChainId", arg0) if err != nil { return *new(*big.Int), err @@ -253,23 +253,23 @@ func (_MockSystemContract *MockSystemContractCaller) GasPriceByChainId(opts *bin // GasPriceByChainId is a free data retrieval call binding the contract method 0xd7fd7afb. // // Solidity: function gasPriceByChainId(uint256 ) view returns(uint256) -func (_MockSystemContract *MockSystemContractSession) GasPriceByChainId(arg0 *big.Int) (*big.Int, error) { - return _MockSystemContract.Contract.GasPriceByChainId(&_MockSystemContract.CallOpts, arg0) +func (_SystemContractMock *SystemContractMockSession) GasPriceByChainId(arg0 *big.Int) (*big.Int, error) { + return _SystemContractMock.Contract.GasPriceByChainId(&_SystemContractMock.CallOpts, arg0) } // GasPriceByChainId is a free data retrieval call binding the contract method 0xd7fd7afb. // // Solidity: function gasPriceByChainId(uint256 ) view returns(uint256) -func (_MockSystemContract *MockSystemContractCallerSession) GasPriceByChainId(arg0 *big.Int) (*big.Int, error) { - return _MockSystemContract.Contract.GasPriceByChainId(&_MockSystemContract.CallOpts, arg0) +func (_SystemContractMock *SystemContractMockCallerSession) GasPriceByChainId(arg0 *big.Int) (*big.Int, error) { + return _SystemContractMock.Contract.GasPriceByChainId(&_SystemContractMock.CallOpts, arg0) } // GasZetaPoolByChainId is a free data retrieval call binding the contract method 0x513a9c05. // // Solidity: function gasZetaPoolByChainId(uint256 ) view returns(address) -func (_MockSystemContract *MockSystemContractCaller) GasZetaPoolByChainId(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { +func (_SystemContractMock *SystemContractMockCaller) GasZetaPoolByChainId(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) { var out []interface{} - err := _MockSystemContract.contract.Call(opts, &out, "gasZetaPoolByChainId", arg0) + err := _SystemContractMock.contract.Call(opts, &out, "gasZetaPoolByChainId", arg0) if err != nil { return *new(common.Address), err @@ -284,23 +284,23 @@ func (_MockSystemContract *MockSystemContractCaller) GasZetaPoolByChainId(opts * // GasZetaPoolByChainId is a free data retrieval call binding the contract method 0x513a9c05. // // Solidity: function gasZetaPoolByChainId(uint256 ) view returns(address) -func (_MockSystemContract *MockSystemContractSession) GasZetaPoolByChainId(arg0 *big.Int) (common.Address, error) { - return _MockSystemContract.Contract.GasZetaPoolByChainId(&_MockSystemContract.CallOpts, arg0) +func (_SystemContractMock *SystemContractMockSession) GasZetaPoolByChainId(arg0 *big.Int) (common.Address, error) { + return _SystemContractMock.Contract.GasZetaPoolByChainId(&_SystemContractMock.CallOpts, arg0) } // GasZetaPoolByChainId is a free data retrieval call binding the contract method 0x513a9c05. // // Solidity: function gasZetaPoolByChainId(uint256 ) view returns(address) -func (_MockSystemContract *MockSystemContractCallerSession) GasZetaPoolByChainId(arg0 *big.Int) (common.Address, error) { - return _MockSystemContract.Contract.GasZetaPoolByChainId(&_MockSystemContract.CallOpts, arg0) +func (_SystemContractMock *SystemContractMockCallerSession) GasZetaPoolByChainId(arg0 *big.Int) (common.Address, error) { + return _SystemContractMock.Contract.GasZetaPoolByChainId(&_SystemContractMock.CallOpts, arg0) } // Uniswapv2FactoryAddress is a free data retrieval call binding the contract method 0xd936a012. // // Solidity: function uniswapv2FactoryAddress() view returns(address) -func (_MockSystemContract *MockSystemContractCaller) Uniswapv2FactoryAddress(opts *bind.CallOpts) (common.Address, error) { +func (_SystemContractMock *SystemContractMockCaller) Uniswapv2FactoryAddress(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _MockSystemContract.contract.Call(opts, &out, "uniswapv2FactoryAddress") + err := _SystemContractMock.contract.Call(opts, &out, "uniswapv2FactoryAddress") if err != nil { return *new(common.Address), err @@ -315,23 +315,23 @@ func (_MockSystemContract *MockSystemContractCaller) Uniswapv2FactoryAddress(opt // Uniswapv2FactoryAddress is a free data retrieval call binding the contract method 0xd936a012. // // Solidity: function uniswapv2FactoryAddress() view returns(address) -func (_MockSystemContract *MockSystemContractSession) Uniswapv2FactoryAddress() (common.Address, error) { - return _MockSystemContract.Contract.Uniswapv2FactoryAddress(&_MockSystemContract.CallOpts) +func (_SystemContractMock *SystemContractMockSession) Uniswapv2FactoryAddress() (common.Address, error) { + return _SystemContractMock.Contract.Uniswapv2FactoryAddress(&_SystemContractMock.CallOpts) } // Uniswapv2FactoryAddress is a free data retrieval call binding the contract method 0xd936a012. // // Solidity: function uniswapv2FactoryAddress() view returns(address) -func (_MockSystemContract *MockSystemContractCallerSession) Uniswapv2FactoryAddress() (common.Address, error) { - return _MockSystemContract.Contract.Uniswapv2FactoryAddress(&_MockSystemContract.CallOpts) +func (_SystemContractMock *SystemContractMockCallerSession) Uniswapv2FactoryAddress() (common.Address, error) { + return _SystemContractMock.Contract.Uniswapv2FactoryAddress(&_SystemContractMock.CallOpts) } // Uniswapv2PairFor is a free data retrieval call binding the contract method 0xc63585cc. // // Solidity: function uniswapv2PairFor(address factory, address tokenA, address tokenB) pure returns(address pair) -func (_MockSystemContract *MockSystemContractCaller) Uniswapv2PairFor(opts *bind.CallOpts, factory common.Address, tokenA common.Address, tokenB common.Address) (common.Address, error) { +func (_SystemContractMock *SystemContractMockCaller) Uniswapv2PairFor(opts *bind.CallOpts, factory common.Address, tokenA common.Address, tokenB common.Address) (common.Address, error) { var out []interface{} - err := _MockSystemContract.contract.Call(opts, &out, "uniswapv2PairFor", factory, tokenA, tokenB) + err := _SystemContractMock.contract.Call(opts, &out, "uniswapv2PairFor", factory, tokenA, tokenB) if err != nil { return *new(common.Address), err @@ -346,23 +346,23 @@ func (_MockSystemContract *MockSystemContractCaller) Uniswapv2PairFor(opts *bind // Uniswapv2PairFor is a free data retrieval call binding the contract method 0xc63585cc. // // Solidity: function uniswapv2PairFor(address factory, address tokenA, address tokenB) pure returns(address pair) -func (_MockSystemContract *MockSystemContractSession) Uniswapv2PairFor(factory common.Address, tokenA common.Address, tokenB common.Address) (common.Address, error) { - return _MockSystemContract.Contract.Uniswapv2PairFor(&_MockSystemContract.CallOpts, factory, tokenA, tokenB) +func (_SystemContractMock *SystemContractMockSession) Uniswapv2PairFor(factory common.Address, tokenA common.Address, tokenB common.Address) (common.Address, error) { + return _SystemContractMock.Contract.Uniswapv2PairFor(&_SystemContractMock.CallOpts, factory, tokenA, tokenB) } // Uniswapv2PairFor is a free data retrieval call binding the contract method 0xc63585cc. // // Solidity: function uniswapv2PairFor(address factory, address tokenA, address tokenB) pure returns(address pair) -func (_MockSystemContract *MockSystemContractCallerSession) Uniswapv2PairFor(factory common.Address, tokenA common.Address, tokenB common.Address) (common.Address, error) { - return _MockSystemContract.Contract.Uniswapv2PairFor(&_MockSystemContract.CallOpts, factory, tokenA, tokenB) +func (_SystemContractMock *SystemContractMockCallerSession) Uniswapv2PairFor(factory common.Address, tokenA common.Address, tokenB common.Address) (common.Address, error) { + return _SystemContractMock.Contract.Uniswapv2PairFor(&_SystemContractMock.CallOpts, factory, tokenA, tokenB) } // Uniswapv2Router02Address is a free data retrieval call binding the contract method 0x842da36d. // // Solidity: function uniswapv2Router02Address() view returns(address) -func (_MockSystemContract *MockSystemContractCaller) Uniswapv2Router02Address(opts *bind.CallOpts) (common.Address, error) { +func (_SystemContractMock *SystemContractMockCaller) Uniswapv2Router02Address(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _MockSystemContract.contract.Call(opts, &out, "uniswapv2Router02Address") + err := _SystemContractMock.contract.Call(opts, &out, "uniswapv2Router02Address") if err != nil { return *new(common.Address), err @@ -377,23 +377,23 @@ func (_MockSystemContract *MockSystemContractCaller) Uniswapv2Router02Address(op // Uniswapv2Router02Address is a free data retrieval call binding the contract method 0x842da36d. // // Solidity: function uniswapv2Router02Address() view returns(address) -func (_MockSystemContract *MockSystemContractSession) Uniswapv2Router02Address() (common.Address, error) { - return _MockSystemContract.Contract.Uniswapv2Router02Address(&_MockSystemContract.CallOpts) +func (_SystemContractMock *SystemContractMockSession) Uniswapv2Router02Address() (common.Address, error) { + return _SystemContractMock.Contract.Uniswapv2Router02Address(&_SystemContractMock.CallOpts) } // Uniswapv2Router02Address is a free data retrieval call binding the contract method 0x842da36d. // // Solidity: function uniswapv2Router02Address() view returns(address) -func (_MockSystemContract *MockSystemContractCallerSession) Uniswapv2Router02Address() (common.Address, error) { - return _MockSystemContract.Contract.Uniswapv2Router02Address(&_MockSystemContract.CallOpts) +func (_SystemContractMock *SystemContractMockCallerSession) Uniswapv2Router02Address() (common.Address, error) { + return _SystemContractMock.Contract.Uniswapv2Router02Address(&_SystemContractMock.CallOpts) } // WZetaContractAddress is a free data retrieval call binding the contract method 0x569541b9. // // Solidity: function wZetaContractAddress() view returns(address) -func (_MockSystemContract *MockSystemContractCaller) WZetaContractAddress(opts *bind.CallOpts) (common.Address, error) { +func (_SystemContractMock *SystemContractMockCaller) WZetaContractAddress(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _MockSystemContract.contract.Call(opts, &out, "wZetaContractAddress") + err := _SystemContractMock.contract.Call(opts, &out, "wZetaContractAddress") if err != nil { return *new(common.Address), err @@ -408,104 +408,104 @@ func (_MockSystemContract *MockSystemContractCaller) WZetaContractAddress(opts * // WZetaContractAddress is a free data retrieval call binding the contract method 0x569541b9. // // Solidity: function wZetaContractAddress() view returns(address) -func (_MockSystemContract *MockSystemContractSession) WZetaContractAddress() (common.Address, error) { - return _MockSystemContract.Contract.WZetaContractAddress(&_MockSystemContract.CallOpts) +func (_SystemContractMock *SystemContractMockSession) WZetaContractAddress() (common.Address, error) { + return _SystemContractMock.Contract.WZetaContractAddress(&_SystemContractMock.CallOpts) } // WZetaContractAddress is a free data retrieval call binding the contract method 0x569541b9. // // Solidity: function wZetaContractAddress() view returns(address) -func (_MockSystemContract *MockSystemContractCallerSession) WZetaContractAddress() (common.Address, error) { - return _MockSystemContract.Contract.WZetaContractAddress(&_MockSystemContract.CallOpts) +func (_SystemContractMock *SystemContractMockCallerSession) WZetaContractAddress() (common.Address, error) { + return _SystemContractMock.Contract.WZetaContractAddress(&_SystemContractMock.CallOpts) } // OnCrossChainCall is a paid mutator transaction binding the contract method 0x3c669d55. // // Solidity: function onCrossChainCall(address target, address zrc20, uint256 amount, bytes message) returns() -func (_MockSystemContract *MockSystemContractTransactor) OnCrossChainCall(opts *bind.TransactOpts, target common.Address, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { - return _MockSystemContract.contract.Transact(opts, "onCrossChainCall", target, zrc20, amount, message) +func (_SystemContractMock *SystemContractMockTransactor) OnCrossChainCall(opts *bind.TransactOpts, target common.Address, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _SystemContractMock.contract.Transact(opts, "onCrossChainCall", target, zrc20, amount, message) } // OnCrossChainCall is a paid mutator transaction binding the contract method 0x3c669d55. // // Solidity: function onCrossChainCall(address target, address zrc20, uint256 amount, bytes message) returns() -func (_MockSystemContract *MockSystemContractSession) OnCrossChainCall(target common.Address, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { - return _MockSystemContract.Contract.OnCrossChainCall(&_MockSystemContract.TransactOpts, target, zrc20, amount, message) +func (_SystemContractMock *SystemContractMockSession) OnCrossChainCall(target common.Address, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _SystemContractMock.Contract.OnCrossChainCall(&_SystemContractMock.TransactOpts, target, zrc20, amount, message) } // OnCrossChainCall is a paid mutator transaction binding the contract method 0x3c669d55. // // Solidity: function onCrossChainCall(address target, address zrc20, uint256 amount, bytes message) returns() -func (_MockSystemContract *MockSystemContractTransactorSession) OnCrossChainCall(target common.Address, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { - return _MockSystemContract.Contract.OnCrossChainCall(&_MockSystemContract.TransactOpts, target, zrc20, amount, message) +func (_SystemContractMock *SystemContractMockTransactorSession) OnCrossChainCall(target common.Address, zrc20 common.Address, amount *big.Int, message []byte) (*types.Transaction, error) { + return _SystemContractMock.Contract.OnCrossChainCall(&_SystemContractMock.TransactOpts, target, zrc20, amount, message) } // SetGasCoinZRC20 is a paid mutator transaction binding the contract method 0xee2815ba. // // Solidity: function setGasCoinZRC20(uint256 chainID, address zrc20) returns() -func (_MockSystemContract *MockSystemContractTransactor) SetGasCoinZRC20(opts *bind.TransactOpts, chainID *big.Int, zrc20 common.Address) (*types.Transaction, error) { - return _MockSystemContract.contract.Transact(opts, "setGasCoinZRC20", chainID, zrc20) +func (_SystemContractMock *SystemContractMockTransactor) SetGasCoinZRC20(opts *bind.TransactOpts, chainID *big.Int, zrc20 common.Address) (*types.Transaction, error) { + return _SystemContractMock.contract.Transact(opts, "setGasCoinZRC20", chainID, zrc20) } // SetGasCoinZRC20 is a paid mutator transaction binding the contract method 0xee2815ba. // // Solidity: function setGasCoinZRC20(uint256 chainID, address zrc20) returns() -func (_MockSystemContract *MockSystemContractSession) SetGasCoinZRC20(chainID *big.Int, zrc20 common.Address) (*types.Transaction, error) { - return _MockSystemContract.Contract.SetGasCoinZRC20(&_MockSystemContract.TransactOpts, chainID, zrc20) +func (_SystemContractMock *SystemContractMockSession) SetGasCoinZRC20(chainID *big.Int, zrc20 common.Address) (*types.Transaction, error) { + return _SystemContractMock.Contract.SetGasCoinZRC20(&_SystemContractMock.TransactOpts, chainID, zrc20) } // SetGasCoinZRC20 is a paid mutator transaction binding the contract method 0xee2815ba. // // Solidity: function setGasCoinZRC20(uint256 chainID, address zrc20) returns() -func (_MockSystemContract *MockSystemContractTransactorSession) SetGasCoinZRC20(chainID *big.Int, zrc20 common.Address) (*types.Transaction, error) { - return _MockSystemContract.Contract.SetGasCoinZRC20(&_MockSystemContract.TransactOpts, chainID, zrc20) +func (_SystemContractMock *SystemContractMockTransactorSession) SetGasCoinZRC20(chainID *big.Int, zrc20 common.Address) (*types.Transaction, error) { + return _SystemContractMock.Contract.SetGasCoinZRC20(&_SystemContractMock.TransactOpts, chainID, zrc20) } // SetGasPrice is a paid mutator transaction binding the contract method 0xa7cb0507. // // Solidity: function setGasPrice(uint256 chainID, uint256 price) returns() -func (_MockSystemContract *MockSystemContractTransactor) SetGasPrice(opts *bind.TransactOpts, chainID *big.Int, price *big.Int) (*types.Transaction, error) { - return _MockSystemContract.contract.Transact(opts, "setGasPrice", chainID, price) +func (_SystemContractMock *SystemContractMockTransactor) SetGasPrice(opts *bind.TransactOpts, chainID *big.Int, price *big.Int) (*types.Transaction, error) { + return _SystemContractMock.contract.Transact(opts, "setGasPrice", chainID, price) } // SetGasPrice is a paid mutator transaction binding the contract method 0xa7cb0507. // // Solidity: function setGasPrice(uint256 chainID, uint256 price) returns() -func (_MockSystemContract *MockSystemContractSession) SetGasPrice(chainID *big.Int, price *big.Int) (*types.Transaction, error) { - return _MockSystemContract.Contract.SetGasPrice(&_MockSystemContract.TransactOpts, chainID, price) +func (_SystemContractMock *SystemContractMockSession) SetGasPrice(chainID *big.Int, price *big.Int) (*types.Transaction, error) { + return _SystemContractMock.Contract.SetGasPrice(&_SystemContractMock.TransactOpts, chainID, price) } // SetGasPrice is a paid mutator transaction binding the contract method 0xa7cb0507. // // Solidity: function setGasPrice(uint256 chainID, uint256 price) returns() -func (_MockSystemContract *MockSystemContractTransactorSession) SetGasPrice(chainID *big.Int, price *big.Int) (*types.Transaction, error) { - return _MockSystemContract.Contract.SetGasPrice(&_MockSystemContract.TransactOpts, chainID, price) +func (_SystemContractMock *SystemContractMockTransactorSession) SetGasPrice(chainID *big.Int, price *big.Int) (*types.Transaction, error) { + return _SystemContractMock.Contract.SetGasPrice(&_SystemContractMock.TransactOpts, chainID, price) } // SetWZETAContractAddress is a paid mutator transaction binding the contract method 0x97770dff. // // Solidity: function setWZETAContractAddress(address addr) returns() -func (_MockSystemContract *MockSystemContractTransactor) SetWZETAContractAddress(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _MockSystemContract.contract.Transact(opts, "setWZETAContractAddress", addr) +func (_SystemContractMock *SystemContractMockTransactor) SetWZETAContractAddress(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { + return _SystemContractMock.contract.Transact(opts, "setWZETAContractAddress", addr) } // SetWZETAContractAddress is a paid mutator transaction binding the contract method 0x97770dff. // // Solidity: function setWZETAContractAddress(address addr) returns() -func (_MockSystemContract *MockSystemContractSession) SetWZETAContractAddress(addr common.Address) (*types.Transaction, error) { - return _MockSystemContract.Contract.SetWZETAContractAddress(&_MockSystemContract.TransactOpts, addr) +func (_SystemContractMock *SystemContractMockSession) SetWZETAContractAddress(addr common.Address) (*types.Transaction, error) { + return _SystemContractMock.Contract.SetWZETAContractAddress(&_SystemContractMock.TransactOpts, addr) } // SetWZETAContractAddress is a paid mutator transaction binding the contract method 0x97770dff. // // Solidity: function setWZETAContractAddress(address addr) returns() -func (_MockSystemContract *MockSystemContractTransactorSession) SetWZETAContractAddress(addr common.Address) (*types.Transaction, error) { - return _MockSystemContract.Contract.SetWZETAContractAddress(&_MockSystemContract.TransactOpts, addr) +func (_SystemContractMock *SystemContractMockTransactorSession) SetWZETAContractAddress(addr common.Address) (*types.Transaction, error) { + return _SystemContractMock.Contract.SetWZETAContractAddress(&_SystemContractMock.TransactOpts, addr) } -// MockSystemContractSetGasCoinIterator is returned from FilterSetGasCoin and is used to iterate over the raw logs and unpacked data for SetGasCoin events raised by the MockSystemContract contract. -type MockSystemContractSetGasCoinIterator struct { - Event *MockSystemContractSetGasCoin // Event containing the contract specifics and raw log +// SystemContractMockSetGasCoinIterator is returned from FilterSetGasCoin and is used to iterate over the raw logs and unpacked data for SetGasCoin events raised by the SystemContractMock contract. +type SystemContractMockSetGasCoinIterator struct { + Event *SystemContractMockSetGasCoin // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -519,7 +519,7 @@ type MockSystemContractSetGasCoinIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *MockSystemContractSetGasCoinIterator) Next() bool { +func (it *SystemContractMockSetGasCoinIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -528,7 +528,7 @@ func (it *MockSystemContractSetGasCoinIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(MockSystemContractSetGasCoin) + it.Event = new(SystemContractMockSetGasCoin) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -543,7 +543,7 @@ func (it *MockSystemContractSetGasCoinIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(MockSystemContractSetGasCoin) + it.Event = new(SystemContractMockSetGasCoin) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -559,19 +559,19 @@ func (it *MockSystemContractSetGasCoinIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *MockSystemContractSetGasCoinIterator) Error() error { +func (it *SystemContractMockSetGasCoinIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *MockSystemContractSetGasCoinIterator) Close() error { +func (it *SystemContractMockSetGasCoinIterator) Close() error { it.sub.Unsubscribe() return nil } -// MockSystemContractSetGasCoin represents a SetGasCoin event raised by the MockSystemContract contract. -type MockSystemContractSetGasCoin struct { +// SystemContractMockSetGasCoin represents a SetGasCoin event raised by the SystemContractMock contract. +type SystemContractMockSetGasCoin struct { Arg0 *big.Int Arg1 common.Address Raw types.Log // Blockchain specific contextual infos @@ -580,21 +580,21 @@ type MockSystemContractSetGasCoin struct { // FilterSetGasCoin is a free log retrieval operation binding the contract event 0xd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d. // // Solidity: event SetGasCoin(uint256 arg0, address arg1) -func (_MockSystemContract *MockSystemContractFilterer) FilterSetGasCoin(opts *bind.FilterOpts) (*MockSystemContractSetGasCoinIterator, error) { +func (_SystemContractMock *SystemContractMockFilterer) FilterSetGasCoin(opts *bind.FilterOpts) (*SystemContractMockSetGasCoinIterator, error) { - logs, sub, err := _MockSystemContract.contract.FilterLogs(opts, "SetGasCoin") + logs, sub, err := _SystemContractMock.contract.FilterLogs(opts, "SetGasCoin") if err != nil { return nil, err } - return &MockSystemContractSetGasCoinIterator{contract: _MockSystemContract.contract, event: "SetGasCoin", logs: logs, sub: sub}, nil + return &SystemContractMockSetGasCoinIterator{contract: _SystemContractMock.contract, event: "SetGasCoin", logs: logs, sub: sub}, nil } // WatchSetGasCoin is a free log subscription operation binding the contract event 0xd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d. // // Solidity: event SetGasCoin(uint256 arg0, address arg1) -func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasCoin(opts *bind.WatchOpts, sink chan<- *MockSystemContractSetGasCoin) (event.Subscription, error) { +func (_SystemContractMock *SystemContractMockFilterer) WatchSetGasCoin(opts *bind.WatchOpts, sink chan<- *SystemContractMockSetGasCoin) (event.Subscription, error) { - logs, sub, err := _MockSystemContract.contract.WatchLogs(opts, "SetGasCoin") + logs, sub, err := _SystemContractMock.contract.WatchLogs(opts, "SetGasCoin") if err != nil { return nil, err } @@ -604,8 +604,8 @@ func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasCoin(opts *bin select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(MockSystemContractSetGasCoin) - if err := _MockSystemContract.contract.UnpackLog(event, "SetGasCoin", log); err != nil { + event := new(SystemContractMockSetGasCoin) + if err := _SystemContractMock.contract.UnpackLog(event, "SetGasCoin", log); err != nil { return err } event.Raw = log @@ -629,18 +629,18 @@ func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasCoin(opts *bin // ParseSetGasCoin is a log parse operation binding the contract event 0xd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d. // // Solidity: event SetGasCoin(uint256 arg0, address arg1) -func (_MockSystemContract *MockSystemContractFilterer) ParseSetGasCoin(log types.Log) (*MockSystemContractSetGasCoin, error) { - event := new(MockSystemContractSetGasCoin) - if err := _MockSystemContract.contract.UnpackLog(event, "SetGasCoin", log); err != nil { +func (_SystemContractMock *SystemContractMockFilterer) ParseSetGasCoin(log types.Log) (*SystemContractMockSetGasCoin, error) { + event := new(SystemContractMockSetGasCoin) + if err := _SystemContractMock.contract.UnpackLog(event, "SetGasCoin", log); err != nil { return nil, err } event.Raw = log return event, nil } -// MockSystemContractSetGasPriceIterator is returned from FilterSetGasPrice and is used to iterate over the raw logs and unpacked data for SetGasPrice events raised by the MockSystemContract contract. -type MockSystemContractSetGasPriceIterator struct { - Event *MockSystemContractSetGasPrice // Event containing the contract specifics and raw log +// SystemContractMockSetGasPriceIterator is returned from FilterSetGasPrice and is used to iterate over the raw logs and unpacked data for SetGasPrice events raised by the SystemContractMock contract. +type SystemContractMockSetGasPriceIterator struct { + Event *SystemContractMockSetGasPrice // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -654,7 +654,7 @@ type MockSystemContractSetGasPriceIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *MockSystemContractSetGasPriceIterator) Next() bool { +func (it *SystemContractMockSetGasPriceIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -663,7 +663,7 @@ func (it *MockSystemContractSetGasPriceIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(MockSystemContractSetGasPrice) + it.Event = new(SystemContractMockSetGasPrice) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -678,7 +678,7 @@ func (it *MockSystemContractSetGasPriceIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(MockSystemContractSetGasPrice) + it.Event = new(SystemContractMockSetGasPrice) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -694,19 +694,19 @@ func (it *MockSystemContractSetGasPriceIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *MockSystemContractSetGasPriceIterator) Error() error { +func (it *SystemContractMockSetGasPriceIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *MockSystemContractSetGasPriceIterator) Close() error { +func (it *SystemContractMockSetGasPriceIterator) Close() error { it.sub.Unsubscribe() return nil } -// MockSystemContractSetGasPrice represents a SetGasPrice event raised by the MockSystemContract contract. -type MockSystemContractSetGasPrice struct { +// SystemContractMockSetGasPrice represents a SetGasPrice event raised by the SystemContractMock contract. +type SystemContractMockSetGasPrice struct { Arg0 *big.Int Arg1 *big.Int Raw types.Log // Blockchain specific contextual infos @@ -715,21 +715,21 @@ type MockSystemContractSetGasPrice struct { // FilterSetGasPrice is a free log retrieval operation binding the contract event 0x49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d. // // Solidity: event SetGasPrice(uint256 arg0, uint256 arg1) -func (_MockSystemContract *MockSystemContractFilterer) FilterSetGasPrice(opts *bind.FilterOpts) (*MockSystemContractSetGasPriceIterator, error) { +func (_SystemContractMock *SystemContractMockFilterer) FilterSetGasPrice(opts *bind.FilterOpts) (*SystemContractMockSetGasPriceIterator, error) { - logs, sub, err := _MockSystemContract.contract.FilterLogs(opts, "SetGasPrice") + logs, sub, err := _SystemContractMock.contract.FilterLogs(opts, "SetGasPrice") if err != nil { return nil, err } - return &MockSystemContractSetGasPriceIterator{contract: _MockSystemContract.contract, event: "SetGasPrice", logs: logs, sub: sub}, nil + return &SystemContractMockSetGasPriceIterator{contract: _SystemContractMock.contract, event: "SetGasPrice", logs: logs, sub: sub}, nil } // WatchSetGasPrice is a free log subscription operation binding the contract event 0x49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d. // // Solidity: event SetGasPrice(uint256 arg0, uint256 arg1) -func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasPrice(opts *bind.WatchOpts, sink chan<- *MockSystemContractSetGasPrice) (event.Subscription, error) { +func (_SystemContractMock *SystemContractMockFilterer) WatchSetGasPrice(opts *bind.WatchOpts, sink chan<- *SystemContractMockSetGasPrice) (event.Subscription, error) { - logs, sub, err := _MockSystemContract.contract.WatchLogs(opts, "SetGasPrice") + logs, sub, err := _SystemContractMock.contract.WatchLogs(opts, "SetGasPrice") if err != nil { return nil, err } @@ -739,8 +739,8 @@ func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasPrice(opts *bi select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(MockSystemContractSetGasPrice) - if err := _MockSystemContract.contract.UnpackLog(event, "SetGasPrice", log); err != nil { + event := new(SystemContractMockSetGasPrice) + if err := _SystemContractMock.contract.UnpackLog(event, "SetGasPrice", log); err != nil { return err } event.Raw = log @@ -764,18 +764,18 @@ func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasPrice(opts *bi // ParseSetGasPrice is a log parse operation binding the contract event 0x49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d. // // Solidity: event SetGasPrice(uint256 arg0, uint256 arg1) -func (_MockSystemContract *MockSystemContractFilterer) ParseSetGasPrice(log types.Log) (*MockSystemContractSetGasPrice, error) { - event := new(MockSystemContractSetGasPrice) - if err := _MockSystemContract.contract.UnpackLog(event, "SetGasPrice", log); err != nil { +func (_SystemContractMock *SystemContractMockFilterer) ParseSetGasPrice(log types.Log) (*SystemContractMockSetGasPrice, error) { + event := new(SystemContractMockSetGasPrice) + if err := _SystemContractMock.contract.UnpackLog(event, "SetGasPrice", log); err != nil { return nil, err } event.Raw = log return event, nil } -// MockSystemContractSetGasZetaPoolIterator is returned from FilterSetGasZetaPool and is used to iterate over the raw logs and unpacked data for SetGasZetaPool events raised by the MockSystemContract contract. -type MockSystemContractSetGasZetaPoolIterator struct { - Event *MockSystemContractSetGasZetaPool // Event containing the contract specifics and raw log +// SystemContractMockSetGasZetaPoolIterator is returned from FilterSetGasZetaPool and is used to iterate over the raw logs and unpacked data for SetGasZetaPool events raised by the SystemContractMock contract. +type SystemContractMockSetGasZetaPoolIterator struct { + Event *SystemContractMockSetGasZetaPool // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -789,7 +789,7 @@ type MockSystemContractSetGasZetaPoolIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *MockSystemContractSetGasZetaPoolIterator) Next() bool { +func (it *SystemContractMockSetGasZetaPoolIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -798,7 +798,7 @@ func (it *MockSystemContractSetGasZetaPoolIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(MockSystemContractSetGasZetaPool) + it.Event = new(SystemContractMockSetGasZetaPool) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -813,7 +813,7 @@ func (it *MockSystemContractSetGasZetaPoolIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(MockSystemContractSetGasZetaPool) + it.Event = new(SystemContractMockSetGasZetaPool) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -829,19 +829,19 @@ func (it *MockSystemContractSetGasZetaPoolIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *MockSystemContractSetGasZetaPoolIterator) Error() error { +func (it *SystemContractMockSetGasZetaPoolIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *MockSystemContractSetGasZetaPoolIterator) Close() error { +func (it *SystemContractMockSetGasZetaPoolIterator) Close() error { it.sub.Unsubscribe() return nil } -// MockSystemContractSetGasZetaPool represents a SetGasZetaPool event raised by the MockSystemContract contract. -type MockSystemContractSetGasZetaPool struct { +// SystemContractMockSetGasZetaPool represents a SetGasZetaPool event raised by the SystemContractMock contract. +type SystemContractMockSetGasZetaPool struct { Arg0 *big.Int Arg1 common.Address Raw types.Log // Blockchain specific contextual infos @@ -850,21 +850,21 @@ type MockSystemContractSetGasZetaPool struct { // FilterSetGasZetaPool is a free log retrieval operation binding the contract event 0x0ecec485166da6139b13bb7e033e9446e2d35348e80ebf1180d4afe2dba1704e. // // Solidity: event SetGasZetaPool(uint256 arg0, address arg1) -func (_MockSystemContract *MockSystemContractFilterer) FilterSetGasZetaPool(opts *bind.FilterOpts) (*MockSystemContractSetGasZetaPoolIterator, error) { +func (_SystemContractMock *SystemContractMockFilterer) FilterSetGasZetaPool(opts *bind.FilterOpts) (*SystemContractMockSetGasZetaPoolIterator, error) { - logs, sub, err := _MockSystemContract.contract.FilterLogs(opts, "SetGasZetaPool") + logs, sub, err := _SystemContractMock.contract.FilterLogs(opts, "SetGasZetaPool") if err != nil { return nil, err } - return &MockSystemContractSetGasZetaPoolIterator{contract: _MockSystemContract.contract, event: "SetGasZetaPool", logs: logs, sub: sub}, nil + return &SystemContractMockSetGasZetaPoolIterator{contract: _SystemContractMock.contract, event: "SetGasZetaPool", logs: logs, sub: sub}, nil } // WatchSetGasZetaPool is a free log subscription operation binding the contract event 0x0ecec485166da6139b13bb7e033e9446e2d35348e80ebf1180d4afe2dba1704e. // // Solidity: event SetGasZetaPool(uint256 arg0, address arg1) -func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasZetaPool(opts *bind.WatchOpts, sink chan<- *MockSystemContractSetGasZetaPool) (event.Subscription, error) { +func (_SystemContractMock *SystemContractMockFilterer) WatchSetGasZetaPool(opts *bind.WatchOpts, sink chan<- *SystemContractMockSetGasZetaPool) (event.Subscription, error) { - logs, sub, err := _MockSystemContract.contract.WatchLogs(opts, "SetGasZetaPool") + logs, sub, err := _SystemContractMock.contract.WatchLogs(opts, "SetGasZetaPool") if err != nil { return nil, err } @@ -874,8 +874,8 @@ func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasZetaPool(opts select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(MockSystemContractSetGasZetaPool) - if err := _MockSystemContract.contract.UnpackLog(event, "SetGasZetaPool", log); err != nil { + event := new(SystemContractMockSetGasZetaPool) + if err := _SystemContractMock.contract.UnpackLog(event, "SetGasZetaPool", log); err != nil { return err } event.Raw = log @@ -899,18 +899,18 @@ func (_MockSystemContract *MockSystemContractFilterer) WatchSetGasZetaPool(opts // ParseSetGasZetaPool is a log parse operation binding the contract event 0x0ecec485166da6139b13bb7e033e9446e2d35348e80ebf1180d4afe2dba1704e. // // Solidity: event SetGasZetaPool(uint256 arg0, address arg1) -func (_MockSystemContract *MockSystemContractFilterer) ParseSetGasZetaPool(log types.Log) (*MockSystemContractSetGasZetaPool, error) { - event := new(MockSystemContractSetGasZetaPool) - if err := _MockSystemContract.contract.UnpackLog(event, "SetGasZetaPool", log); err != nil { +func (_SystemContractMock *SystemContractMockFilterer) ParseSetGasZetaPool(log types.Log) (*SystemContractMockSetGasZetaPool, error) { + event := new(SystemContractMockSetGasZetaPool) + if err := _SystemContractMock.contract.UnpackLog(event, "SetGasZetaPool", log); err != nil { return nil, err } event.Raw = log return event, nil } -// MockSystemContractSetWZetaIterator is returned from FilterSetWZeta and is used to iterate over the raw logs and unpacked data for SetWZeta events raised by the MockSystemContract contract. -type MockSystemContractSetWZetaIterator struct { - Event *MockSystemContractSetWZeta // Event containing the contract specifics and raw log +// SystemContractMockSetWZetaIterator is returned from FilterSetWZeta and is used to iterate over the raw logs and unpacked data for SetWZeta events raised by the SystemContractMock contract. +type SystemContractMockSetWZetaIterator struct { + Event *SystemContractMockSetWZeta // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -924,7 +924,7 @@ type MockSystemContractSetWZetaIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *MockSystemContractSetWZetaIterator) Next() bool { +func (it *SystemContractMockSetWZetaIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -933,7 +933,7 @@ func (it *MockSystemContractSetWZetaIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(MockSystemContractSetWZeta) + it.Event = new(SystemContractMockSetWZeta) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -948,7 +948,7 @@ func (it *MockSystemContractSetWZetaIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(MockSystemContractSetWZeta) + it.Event = new(SystemContractMockSetWZeta) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -964,19 +964,19 @@ func (it *MockSystemContractSetWZetaIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *MockSystemContractSetWZetaIterator) Error() error { +func (it *SystemContractMockSetWZetaIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *MockSystemContractSetWZetaIterator) Close() error { +func (it *SystemContractMockSetWZetaIterator) Close() error { it.sub.Unsubscribe() return nil } -// MockSystemContractSetWZeta represents a SetWZeta event raised by the MockSystemContract contract. -type MockSystemContractSetWZeta struct { +// SystemContractMockSetWZeta represents a SetWZeta event raised by the SystemContractMock contract. +type SystemContractMockSetWZeta struct { Arg0 common.Address Raw types.Log // Blockchain specific contextual infos } @@ -984,21 +984,21 @@ type MockSystemContractSetWZeta struct { // FilterSetWZeta is a free log retrieval operation binding the contract event 0xdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e. // // Solidity: event SetWZeta(address arg0) -func (_MockSystemContract *MockSystemContractFilterer) FilterSetWZeta(opts *bind.FilterOpts) (*MockSystemContractSetWZetaIterator, error) { +func (_SystemContractMock *SystemContractMockFilterer) FilterSetWZeta(opts *bind.FilterOpts) (*SystemContractMockSetWZetaIterator, error) { - logs, sub, err := _MockSystemContract.contract.FilterLogs(opts, "SetWZeta") + logs, sub, err := _SystemContractMock.contract.FilterLogs(opts, "SetWZeta") if err != nil { return nil, err } - return &MockSystemContractSetWZetaIterator{contract: _MockSystemContract.contract, event: "SetWZeta", logs: logs, sub: sub}, nil + return &SystemContractMockSetWZetaIterator{contract: _SystemContractMock.contract, event: "SetWZeta", logs: logs, sub: sub}, nil } // WatchSetWZeta is a free log subscription operation binding the contract event 0xdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e. // // Solidity: event SetWZeta(address arg0) -func (_MockSystemContract *MockSystemContractFilterer) WatchSetWZeta(opts *bind.WatchOpts, sink chan<- *MockSystemContractSetWZeta) (event.Subscription, error) { +func (_SystemContractMock *SystemContractMockFilterer) WatchSetWZeta(opts *bind.WatchOpts, sink chan<- *SystemContractMockSetWZeta) (event.Subscription, error) { - logs, sub, err := _MockSystemContract.contract.WatchLogs(opts, "SetWZeta") + logs, sub, err := _SystemContractMock.contract.WatchLogs(opts, "SetWZeta") if err != nil { return nil, err } @@ -1008,8 +1008,8 @@ func (_MockSystemContract *MockSystemContractFilterer) WatchSetWZeta(opts *bind. select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(MockSystemContractSetWZeta) - if err := _MockSystemContract.contract.UnpackLog(event, "SetWZeta", log); err != nil { + event := new(SystemContractMockSetWZeta) + if err := _SystemContractMock.contract.UnpackLog(event, "SetWZeta", log); err != nil { return err } event.Raw = log @@ -1033,18 +1033,18 @@ func (_MockSystemContract *MockSystemContractFilterer) WatchSetWZeta(opts *bind. // ParseSetWZeta is a log parse operation binding the contract event 0xdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e. // // Solidity: event SetWZeta(address arg0) -func (_MockSystemContract *MockSystemContractFilterer) ParseSetWZeta(log types.Log) (*MockSystemContractSetWZeta, error) { - event := new(MockSystemContractSetWZeta) - if err := _MockSystemContract.contract.UnpackLog(event, "SetWZeta", log); err != nil { +func (_SystemContractMock *SystemContractMockFilterer) ParseSetWZeta(log types.Log) (*SystemContractMockSetWZeta, error) { + event := new(SystemContractMockSetWZeta) + if err := _SystemContractMock.contract.UnpackLog(event, "SetWZeta", log); err != nil { return nil, err } event.Raw = log return event, nil } -// MockSystemContractSystemContractDeployedIterator is returned from FilterSystemContractDeployed and is used to iterate over the raw logs and unpacked data for SystemContractDeployed events raised by the MockSystemContract contract. -type MockSystemContractSystemContractDeployedIterator struct { - Event *MockSystemContractSystemContractDeployed // Event containing the contract specifics and raw log +// SystemContractMockSystemContractDeployedIterator is returned from FilterSystemContractDeployed and is used to iterate over the raw logs and unpacked data for SystemContractDeployed events raised by the SystemContractMock contract. +type SystemContractMockSystemContractDeployedIterator struct { + Event *SystemContractMockSystemContractDeployed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1058,7 +1058,7 @@ type MockSystemContractSystemContractDeployedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *MockSystemContractSystemContractDeployedIterator) Next() bool { +func (it *SystemContractMockSystemContractDeployedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1067,7 +1067,7 @@ func (it *MockSystemContractSystemContractDeployedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(MockSystemContractSystemContractDeployed) + it.Event = new(SystemContractMockSystemContractDeployed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1082,7 +1082,7 @@ func (it *MockSystemContractSystemContractDeployedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(MockSystemContractSystemContractDeployed) + it.Event = new(SystemContractMockSystemContractDeployed) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1098,40 +1098,40 @@ func (it *MockSystemContractSystemContractDeployedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *MockSystemContractSystemContractDeployedIterator) Error() error { +func (it *SystemContractMockSystemContractDeployedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *MockSystemContractSystemContractDeployedIterator) Close() error { +func (it *SystemContractMockSystemContractDeployedIterator) Close() error { it.sub.Unsubscribe() return nil } -// MockSystemContractSystemContractDeployed represents a SystemContractDeployed event raised by the MockSystemContract contract. -type MockSystemContractSystemContractDeployed struct { +// SystemContractMockSystemContractDeployed represents a SystemContractDeployed event raised by the SystemContractMock contract. +type SystemContractMockSystemContractDeployed struct { Raw types.Log // Blockchain specific contextual infos } // FilterSystemContractDeployed is a free log retrieval operation binding the contract event 0x80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac5. // // Solidity: event SystemContractDeployed() -func (_MockSystemContract *MockSystemContractFilterer) FilterSystemContractDeployed(opts *bind.FilterOpts) (*MockSystemContractSystemContractDeployedIterator, error) { +func (_SystemContractMock *SystemContractMockFilterer) FilterSystemContractDeployed(opts *bind.FilterOpts) (*SystemContractMockSystemContractDeployedIterator, error) { - logs, sub, err := _MockSystemContract.contract.FilterLogs(opts, "SystemContractDeployed") + logs, sub, err := _SystemContractMock.contract.FilterLogs(opts, "SystemContractDeployed") if err != nil { return nil, err } - return &MockSystemContractSystemContractDeployedIterator{contract: _MockSystemContract.contract, event: "SystemContractDeployed", logs: logs, sub: sub}, nil + return &SystemContractMockSystemContractDeployedIterator{contract: _SystemContractMock.contract, event: "SystemContractDeployed", logs: logs, sub: sub}, nil } // WatchSystemContractDeployed is a free log subscription operation binding the contract event 0x80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac5. // // Solidity: event SystemContractDeployed() -func (_MockSystemContract *MockSystemContractFilterer) WatchSystemContractDeployed(opts *bind.WatchOpts, sink chan<- *MockSystemContractSystemContractDeployed) (event.Subscription, error) { +func (_SystemContractMock *SystemContractMockFilterer) WatchSystemContractDeployed(opts *bind.WatchOpts, sink chan<- *SystemContractMockSystemContractDeployed) (event.Subscription, error) { - logs, sub, err := _MockSystemContract.contract.WatchLogs(opts, "SystemContractDeployed") + logs, sub, err := _SystemContractMock.contract.WatchLogs(opts, "SystemContractDeployed") if err != nil { return nil, err } @@ -1141,8 +1141,8 @@ func (_MockSystemContract *MockSystemContractFilterer) WatchSystemContractDeploy select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(MockSystemContractSystemContractDeployed) - if err := _MockSystemContract.contract.UnpackLog(event, "SystemContractDeployed", log); err != nil { + event := new(SystemContractMockSystemContractDeployed) + if err := _SystemContractMock.contract.UnpackLog(event, "SystemContractDeployed", log); err != nil { return err } event.Raw = log @@ -1166,9 +1166,9 @@ func (_MockSystemContract *MockSystemContractFilterer) WatchSystemContractDeploy // ParseSystemContractDeployed is a log parse operation binding the contract event 0x80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac5. // // Solidity: event SystemContractDeployed() -func (_MockSystemContract *MockSystemContractFilterer) ParseSystemContractDeployed(log types.Log) (*MockSystemContractSystemContractDeployed, error) { - event := new(MockSystemContractSystemContractDeployed) - if err := _MockSystemContract.contract.UnpackLog(event, "SystemContractDeployed", log); err != nil { +func (_SystemContractMock *SystemContractMockFilterer) ParseSystemContractDeployed(log types.Log) (*SystemContractMockSystemContractDeployed, error) { + event := new(SystemContractMockSystemContractDeployed) + if err := _SystemContractMock.contract.UnpackLog(event, "SystemContractDeployed", log); err != nil { return nil, err } event.Raw = log diff --git a/pkg/contracts/zevm/connectorzevm.sol/wzeta.go b/pkg/contracts/zevm/zetaconnectorzevm.sol/wzeta.go similarity index 99% rename from pkg/contracts/zevm/connectorzevm.sol/wzeta.go rename to pkg/contracts/zevm/zetaconnectorzevm.sol/wzeta.go index 0dcbf7a1..49ae1bad 100644 --- a/pkg/contracts/zevm/connectorzevm.sol/wzeta.go +++ b/pkg/contracts/zevm/zetaconnectorzevm.sol/wzeta.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package connectorzevm +package zetaconnectorzevm import ( "errors" diff --git a/pkg/contracts/zevm/connectorzevm.sol/zetaconnectorzevm.go b/pkg/contracts/zevm/zetaconnectorzevm.sol/zetaconnectorzevm.go similarity index 98% rename from pkg/contracts/zevm/connectorzevm.sol/zetaconnectorzevm.go rename to pkg/contracts/zevm/zetaconnectorzevm.sol/zetaconnectorzevm.go index 46589211..7eda84c1 100644 --- a/pkg/contracts/zevm/connectorzevm.sol/zetaconnectorzevm.go +++ b/pkg/contracts/zevm/zetaconnectorzevm.sol/zetaconnectorzevm.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package connectorzevm +package zetaconnectorzevm import ( "errors" @@ -41,8 +41,8 @@ type ZetaInterfacesSendInput struct { // ZetaConnectorZEVMMetaData contains all meta data concerning the ZetaConnectorZEVM contract. var ZetaConnectorZEVMMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_wzeta\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"FailedZetaSent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyFungibleModule\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyWZETA\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"WZETATransferFailed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"wzeta_\",\"type\":\"address\"}],\"name\":\"SetWZETA\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sourceTxOriginAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"zetaTxSenderAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"destinationAddress\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"zetaValueAndGas\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationGasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zetaParams\",\"type\":\"bytes\"}],\"name\":\"ZetaSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"FUNGIBLE_MODULE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"destinationAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"destinationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"zetaValueAndGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"zetaParams\",\"type\":\"bytes\"}],\"internalType\":\"structZetaInterfaces.SendInput\",\"name\":\"input\",\"type\":\"tuple\"}],\"name\":\"send\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wzeta_\",\"type\":\"address\"}],\"name\":\"setWzetaAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wzeta\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561001057600080fd5b50604051610a51380380610a518339818101604052810190610032919061008d565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600081519050610087816100f1565b92915050565b6000602082840312156100a3576100a26100ec565b5b60006100b184828501610078565b91505092915050565b60006100c5826100cc565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6100fa816100ba565b811461010557600080fd5b50565b61093a806101176000396000f3fe6080604052600436106100425760003560e01c8062173d46146100d35780633ce4a5bc146100fe578063eb3bacbd14610129578063ec02690114610152576100ce565b366100ce5760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146100cc576040517f6e6b6de700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b600080fd5b3480156100df57600080fd5b506100e861017b565b6040516100f591906106e5565b60405180910390f35b34801561010a57600080fd5b5061011361019f565b60405161012091906106e5565b60405180910390f35b34801561013557600080fd5b50610150600480360381019061014b91906105bf565b6101b7565b005b34801561015e57600080fd5b5061017960048036038101906101749190610619565b6102aa565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b73735b14bb79463307aacbed86daf3322b1e6226ab81565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610230576040517fea02b3f300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f7325870b05f8f3412c318a35fc6a74feca51ea15811ec7a257676ca4db9d41768160405161029f91906106e5565b60405180910390a150565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd333084608001356040518463ffffffff1660e01b815260040161030b93929190610700565b602060405180830381600087803b15801561032557600080fd5b505af1158015610339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035d91906105ec565b610393576040517fa8c6fd4a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d82608001356040518263ffffffff1660e01b81526004016103f091906107b3565b600060405180830381600087803b15801561040a57600080fd5b505af115801561041e573d6000803e3d6000fd5b50505050600073735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff168260800135604051610460906106d0565b60006040518083038185875af1925050503d806000811461049d576040519150601f19603f3d011682016040523d82523d6000602084013e6104a2565b606091505b50509050806104dd576040517fc7ffc47b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600001353373ffffffffffffffffffffffffffffffffffffffff167f7ec1c94701e09b1652f3e1d307e60c4b9ebf99aff8c2079fd1d8c585e031c4e43285806020019061052b91906107ce565b8760800135886040013589806060019061054591906107ce565b8b8060a0019061055591906107ce565b60405161056a99989796959493929190610737565b60405180910390a35050565b600081359050610585816108d6565b92915050565b60008151905061059a816108ed565b92915050565b600060c082840312156105b6576105b56108a9565b5b81905092915050565b6000602082840312156105d5576105d46108bd565b5b60006105e384828501610576565b91505092915050565b600060208284031215610602576106016108bd565b5b60006106108482850161058b565b91505092915050565b60006020828403121561062f5761062e6108bd565b5b600082013567ffffffffffffffff81111561064d5761064c6108b8565b5b610659848285016105a0565b91505092915050565b61066b8161084d565b82525050565b600061067d8385610831565b935061068a838584610895565b610693836108c2565b840190509392505050565b60006106ab600083610842565b91506106b6826108d3565b600082019050919050565b6106ca8161088b565b82525050565b60006106db8261069e565b9150819050919050565b60006020820190506106fa6000830184610662565b92915050565b60006060820190506107156000830186610662565b6107226020830185610662565b61072f60408301846106c1565b949350505050565b600060c08201905061074c600083018c610662565b818103602083015261075f818a8c610671565b905061076e60408301896106c1565b61077b60608301886106c1565b818103608083015261078e818688610671565b905081810360a08301526107a3818486610671565b90509a9950505050505050505050565b60006020820190506107c860008301846106c1565b92915050565b600080833560016020038436030381126107eb576107ea6108ae565b5b80840192508235915067ffffffffffffffff82111561080d5761080c6108a4565b5b602083019250600182023603831315610829576108286108b3565b5b509250929050565b600082825260208201905092915050565b600081905092915050565b60006108588261086b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b50565b6108df8161084d565b81146108ea57600080fd5b50565b6108f68161085f565b811461090157600080fd5b5056fea2646970667358221220de77795070b6e9d863f949e5ff84ae67c6e2c498e6ffb04996698d04fcebe44864736f6c63430008070033", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wzeta_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"FailedZetaSent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyFungibleModule\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyWZETA\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"WZETATransferFailed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"wzeta_\",\"type\":\"address\"}],\"name\":\"SetWZETA\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sourceTxOriginAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"zetaTxSenderAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"destinationAddress\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"zetaValueAndGas\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destinationGasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zetaParams\",\"type\":\"bytes\"}],\"name\":\"ZetaSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"FUNGIBLE_MODULE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"destinationChainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"destinationAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"destinationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"zetaValueAndGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"zetaParams\",\"type\":\"bytes\"}],\"internalType\":\"structZetaInterfaces.SendInput\",\"name\":\"input\",\"type\":\"tuple\"}],\"name\":\"send\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wzeta_\",\"type\":\"address\"}],\"name\":\"setWzetaAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wzeta\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", + Bin: "0x608060405234801561001057600080fd5b50604051610a51380380610a518339818101604052810190610032919061008d565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600081519050610087816100f1565b92915050565b6000602082840312156100a3576100a26100ec565b5b60006100b184828501610078565b91505092915050565b60006100c5826100cc565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6100fa816100ba565b811461010557600080fd5b50565b61093a806101176000396000f3fe6080604052600436106100425760003560e01c8062173d46146100d35780633ce4a5bc146100fe578063eb3bacbd14610129578063ec02690114610152576100ce565b366100ce5760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146100cc576040517f6e6b6de700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b600080fd5b3480156100df57600080fd5b506100e861017b565b6040516100f591906106e5565b60405180910390f35b34801561010a57600080fd5b5061011361019f565b60405161012091906106e5565b60405180910390f35b34801561013557600080fd5b50610150600480360381019061014b91906105bf565b6101b7565b005b34801561015e57600080fd5b5061017960048036038101906101749190610619565b6102aa565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b73735b14bb79463307aacbed86daf3322b1e6226ab81565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610230576040517fea02b3f300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f7325870b05f8f3412c318a35fc6a74feca51ea15811ec7a257676ca4db9d41768160405161029f91906106e5565b60405180910390a150565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd333084608001356040518463ffffffff1660e01b815260040161030b93929190610700565b602060405180830381600087803b15801561032557600080fd5b505af1158015610339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035d91906105ec565b610393576040517fa8c6fd4a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d82608001356040518263ffffffff1660e01b81526004016103f091906107b3565b600060405180830381600087803b15801561040a57600080fd5b505af115801561041e573d6000803e3d6000fd5b50505050600073735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff168260800135604051610460906106d0565b60006040518083038185875af1925050503d806000811461049d576040519150601f19603f3d011682016040523d82523d6000602084013e6104a2565b606091505b50509050806104dd576040517fc7ffc47b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600001353373ffffffffffffffffffffffffffffffffffffffff167f7ec1c94701e09b1652f3e1d307e60c4b9ebf99aff8c2079fd1d8c585e031c4e43285806020019061052b91906107ce565b8760800135886040013589806060019061054591906107ce565b8b8060a0019061055591906107ce565b60405161056a99989796959493929190610737565b60405180910390a35050565b600081359050610585816108d6565b92915050565b60008151905061059a816108ed565b92915050565b600060c082840312156105b6576105b56108a9565b5b81905092915050565b6000602082840312156105d5576105d46108bd565b5b60006105e384828501610576565b91505092915050565b600060208284031215610602576106016108bd565b5b60006106108482850161058b565b91505092915050565b60006020828403121561062f5761062e6108bd565b5b600082013567ffffffffffffffff81111561064d5761064c6108b8565b5b610659848285016105a0565b91505092915050565b61066b8161084d565b82525050565b600061067d8385610831565b935061068a838584610895565b610693836108c2565b840190509392505050565b60006106ab600083610842565b91506106b6826108d3565b600082019050919050565b6106ca8161088b565b82525050565b60006106db8261069e565b9150819050919050565b60006020820190506106fa6000830184610662565b92915050565b60006060820190506107156000830186610662565b6107226020830185610662565b61072f60408301846106c1565b949350505050565b600060c08201905061074c600083018c610662565b818103602083015261075f818a8c610671565b905061076e60408301896106c1565b61077b60608301886106c1565b818103608083015261078e818688610671565b905081810360a08301526107a3818486610671565b90509a9950505050505050505050565b60006020820190506107c860008301846106c1565b92915050565b600080833560016020038436030381126107eb576107ea6108ae565b5b80840192508235915067ffffffffffffffff82111561080d5761080c6108a4565b5b602083019250600182023603831315610829576108286108b3565b5b509250929050565b600082825260208201905092915050565b600081905092915050565b60006108588261086b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b50565b6108df8161084d565b81146108ea57600080fd5b50565b6108f68161085f565b811461090157600080fd5b5056fea26469706673582212209cb0a71343946ce3fb0c8378bb2c769fc506ceab04e93e858de3b8c13a0e1deb64736f6c63430008070033", } // ZetaConnectorZEVMABI is the input ABI used to generate the binding from. @@ -54,7 +54,7 @@ var ZetaConnectorZEVMABI = ZetaConnectorZEVMMetaData.ABI var ZetaConnectorZEVMBin = ZetaConnectorZEVMMetaData.Bin // DeployZetaConnectorZEVM deploys a new Ethereum contract, binding an instance of ZetaConnectorZEVM to it. -func DeployZetaConnectorZEVM(auth *bind.TransactOpts, backend bind.ContractBackend, _wzeta common.Address) (common.Address, *types.Transaction, *ZetaConnectorZEVM, error) { +func DeployZetaConnectorZEVM(auth *bind.TransactOpts, backend bind.ContractBackend, wzeta_ common.Address) (common.Address, *types.Transaction, *ZetaConnectorZEVM, error) { parsed, err := ZetaConnectorZEVMMetaData.GetAbi() if err != nil { return common.Address{}, nil, nil, err @@ -63,7 +63,7 @@ func DeployZetaConnectorZEVM(auth *bind.TransactOpts, backend bind.ContractBacke return common.Address{}, nil, nil, errors.New("GetABI returned nil") } - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(ZetaConnectorZEVMBin), backend, _wzeta) + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(ZetaConnectorZEVMBin), backend, wzeta_) if err != nil { return common.Address{}, nil, nil, err } diff --git a/pkg/contracts/zevm/connectorzevm.sol/zetainterfaces.go b/pkg/contracts/zevm/zetaconnectorzevm.sol/zetainterfaces.go similarity index 99% rename from pkg/contracts/zevm/connectorzevm.sol/zetainterfaces.go rename to pkg/contracts/zevm/zetaconnectorzevm.sol/zetainterfaces.go index 445277e8..8497e3ea 100644 --- a/pkg/contracts/zevm/connectorzevm.sol/zetainterfaces.go +++ b/pkg/contracts/zevm/zetaconnectorzevm.sol/zetainterfaces.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package connectorzevm +package zetaconnectorzevm import ( "errors" diff --git a/test/ConnectorZEVM.spec.ts b/test/ConnectorZEVM.spec.ts new file mode 100644 index 00000000..11380043 --- /dev/null +++ b/test/ConnectorZEVM.spec.ts @@ -0,0 +1,135 @@ +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { WETH9, ZetaConnectorZEVM } from "@typechain-types"; +import { expect } from "chai"; +import exp from "constants"; +import { parseEther } from "ethers/lib/utils"; +import { ethers } from "hardhat"; + +import { FUNGIBLE_MODULE_ADDRESS } from "./test.helpers"; + +const hre = require("hardhat"); + +describe("ConnectorZEVM tests", () => { + let zetaTokenContract: WETH9; + let zetaConnectorZEVM: ZetaConnectorZEVM; + + let owner: SignerWithAddress; + let fungibleModuleSigner: SignerWithAddress; + let addrs: SignerWithAddress[]; + let randomSigner: SignerWithAddress; + + beforeEach(async () => { + [owner, randomSigner, ...addrs] = await ethers.getSigners(); + + // Impersonate the fungible module account + await hre.network.provider.request({ + method: "hardhat_impersonateAccount", + params: [FUNGIBLE_MODULE_ADDRESS], + }); + + // Get a signer for the fungible module account + fungibleModuleSigner = await ethers.getSigner(FUNGIBLE_MODULE_ADDRESS); + hre.network.provider.send("hardhat_setBalance", [FUNGIBLE_MODULE_ADDRESS, parseEther("1000000").toHexString()]); + + const WZETAFactory = await ethers.getContractFactory("contracts/zevm/WZETA.sol:WETH9"); + zetaTokenContract = (await WZETAFactory.deploy()) as WETH9; + + const ZetaConnectorZEVMFactory = await ethers.getContractFactory("ZetaConnectorZEVM"); + zetaConnectorZEVM = (await ZetaConnectorZEVMFactory.connect(owner).deploy( + zetaTokenContract.address + )) as ZetaConnectorZEVM; + }); + + describe("ZetaConnectorZEVM", () => { + it("Should revert if the zetaTxSender has no enough zeta", async () => { + await zetaTokenContract.connect(randomSigner).approve(zetaConnectorZEVM.address, 100_000); + + const tx = zetaConnectorZEVM.connect(randomSigner).send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 1000, + }); + + // @dev: As we use the standard WETH contract, there's no error message for not enough balance + await expect(tx).to.be.reverted; + }); + + it("Should revert if the zetaTxSender didn't allow ZetaConnector to spend Zeta token", async () => { + await zetaTokenContract.deposit({ value: 100_000 }); + await zetaTokenContract.transfer(randomSigner.address, 100_000); + + const balance = await zetaTokenContract.balanceOf(randomSigner.address); + expect(balance.toString()).to.equal("100000"); + + const tx = zetaConnectorZEVM.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 1000, + }); + + // @dev: As we use the standard WETH contract, there's no error message for not enough balance + await expect(tx).to.be.reverted; + + await zetaTokenContract.connect(randomSigner).transfer(owner.address, balance); + }); + + it("Should emit `ZetaSent` on success", async () => { + const tx = await zetaConnectorZEVM.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas: 0, + }); + + expect(tx) + .to.emit(zetaConnectorZEVM, "ZetaSent") + .withArgs(owner.address, owner.address, 1, randomSigner.address, 0, 2500000, "hello", "hello"); + }); + + it("Should transfer value and gas to fungible address", async () => { + const zetaValueAndGas = 1000; + await zetaTokenContract.approve(zetaConnectorZEVM.address, zetaValueAndGas); + await zetaTokenContract.deposit({ value: zetaValueAndGas }); + + const balanceBefore = await ethers.provider.getBalance(fungibleModuleSigner.address); + + await zetaConnectorZEVM.send({ + destinationAddress: randomSigner.address, + destinationChainId: 1, + destinationGasLimit: 2500000, + message: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaParams: new ethers.utils.AbiCoder().encode(["string"], ["hello"]), + zetaValueAndGas, + }); + + const balanceAfter = await ethers.provider.getBalance(fungibleModuleSigner.address); + expect(balanceAfter.sub(balanceBefore)).to.equal(zetaValueAndGas); + }); + + it("Should update wzeta address if is call from fungible address", async () => { + const WZETAFactory = await ethers.getContractFactory("contracts/zevm/WZETA.sol:WETH9"); + const newZetaTokenContract = (await WZETAFactory.deploy()) as WETH9; + + const tx = zetaConnectorZEVM.connect(fungibleModuleSigner).setWzetaAddress(newZetaTokenContract.address); + await expect(tx).to.emit(zetaConnectorZEVM, "SetWZETA").withArgs(newZetaTokenContract.address); + + expect(await zetaConnectorZEVM.wzeta()).to.equal(newZetaTokenContract.address); + }); + + it("Should revert if try to update wzeta address from other address", async () => { + const WZETAFactory = await ethers.getContractFactory("contracts/zevm/WZETA.sol:WETH9"); + const newZetaTokenContract = (await WZETAFactory.deploy()) as WETH9; + + const tx = zetaConnectorZEVM.setWzetaAddress(newZetaTokenContract.address); + await expect(tx).to.be.revertedWith("OnlyFungibleModule"); + }); + }); +}); diff --git a/test/ZRC20.spec.ts b/test/ZRC20.spec.ts index 299440d5..28d443e4 100644 --- a/test/ZRC20.spec.ts +++ b/test/ZRC20.spec.ts @@ -4,6 +4,8 @@ import { SystemContract, ZRC20 } from "@typechain-types"; import { expect } from "chai"; import { parseEther } from "ethers/lib/utils"; import { ethers } from "hardhat"; + +import { FUNGIBLE_MODULE_ADDRESS } from "./test.helpers"; const hre = require("hardhat"); describe("ZRC20 tests", () => { @@ -15,8 +17,6 @@ describe("ZRC20 tests", () => { beforeEach(async () => { [owner, ...addrs] = await ethers.getSigners(); - const FUNGIBLE_MODULE_ADDRESS = "0x735b14BB79463307AAcBED86DAf3322B1e6226aB"; - // Impersonate the fungible module account await hre.network.provider.request({ method: "hardhat_impersonateAccount", @@ -27,7 +27,7 @@ describe("ZRC20 tests", () => { fungibleModuleSigner = await ethers.getSigner(FUNGIBLE_MODULE_ADDRESS); hre.network.provider.send("hardhat_setBalance", [FUNGIBLE_MODULE_ADDRESS, parseEther("1000000").toHexString()]); - const SystemContractFactory = await ethers.getContractFactory("MockSystemContract"); + const SystemContractFactory = await ethers.getContractFactory("SystemContractMock"); systemContract = (await SystemContractFactory.deploy(AddressZero, AddressZero, AddressZero)) as SystemContract; const ZRC20Factory = await ethers.getContractFactory("ZRC20"); diff --git a/test/test.helpers.ts b/test/test.helpers.ts index 006c5dc0..3ff6cea9 100644 --- a/test/test.helpers.ts +++ b/test/test.helpers.ts @@ -1,6 +1,8 @@ import { ZetaTokenConsumer__factory } from "@typechain-types"; import { BigNumber, ContractReceipt } from "ethers"; +export const FUNGIBLE_MODULE_ADDRESS = "0x735b14BB79463307AAcBED86DAf3322B1e6226aB"; + export const parseZetaConsumerLog = (logs: ContractReceipt["logs"]) => { const iface = ZetaTokenConsumer__factory.createInterface(); diff --git a/typechain-types/contracts/zevm/ConnectorZEVM.sol/WZETA.ts b/typechain-types/contracts/zevm/ZetaConnectorZEVM.sol/WZETA.ts similarity index 100% rename from typechain-types/contracts/zevm/ConnectorZEVM.sol/WZETA.ts rename to typechain-types/contracts/zevm/ZetaConnectorZEVM.sol/WZETA.ts diff --git a/typechain-types/contracts/zevm/ConnectorZEVM.sol/ZetaConnectorZEVM.ts b/typechain-types/contracts/zevm/ZetaConnectorZEVM.sol/ZetaConnectorZEVM.ts similarity index 100% rename from typechain-types/contracts/zevm/ConnectorZEVM.sol/ZetaConnectorZEVM.ts rename to typechain-types/contracts/zevm/ZetaConnectorZEVM.sol/ZetaConnectorZEVM.ts diff --git a/typechain-types/contracts/zevm/ConnectorZEVM.sol/index.ts b/typechain-types/contracts/zevm/ZetaConnectorZEVM.sol/index.ts similarity index 100% rename from typechain-types/contracts/zevm/ConnectorZEVM.sol/index.ts rename to typechain-types/contracts/zevm/ZetaConnectorZEVM.sol/index.ts diff --git a/typechain-types/contracts/zevm/index.ts b/typechain-types/contracts/zevm/index.ts index 8962bad7..c1e5459a 100644 --- a/typechain-types/contracts/zevm/index.ts +++ b/typechain-types/contracts/zevm/index.ts @@ -1,8 +1,6 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -import type * as connectorZevmSol from "./ConnectorZEVM.sol"; -export type { connectorZevmSol }; import type * as interfacesSol from "./Interfaces.sol"; export type { interfacesSol }; import type * as systemContractSol from "./SystemContract.sol"; @@ -11,6 +9,8 @@ import type * as wzetaSol from "./WZETA.sol"; export type { wzetaSol }; import type * as zrc20Sol from "./ZRC20.sol"; export type { zrc20Sol }; +import type * as zetaConnectorZevmSol from "./ZetaConnectorZEVM.sol"; +export type { zetaConnectorZevmSol }; import type * as interfaces from "./interfaces"; export type { interfaces }; import type * as testing from "./testing"; diff --git a/typechain-types/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors.ts b/typechain-types/contracts/zevm/testing/SystemContractMock.sol/SystemContractErrors.ts similarity index 100% rename from typechain-types/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors.ts rename to typechain-types/contracts/zevm/testing/SystemContractMock.sol/SystemContractErrors.ts diff --git a/typechain-types/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract.ts b/typechain-types/contracts/zevm/testing/SystemContractMock.sol/SystemContractMock.ts similarity index 98% rename from typechain-types/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract.ts rename to typechain-types/contracts/zevm/testing/SystemContractMock.sol/SystemContractMock.ts index 351c8e37..3e74ebc7 100644 --- a/typechain-types/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract.ts +++ b/typechain-types/contracts/zevm/testing/SystemContractMock.sol/SystemContractMock.ts @@ -27,7 +27,7 @@ import type { PromiseOrValue, } from "../../../../common"; -export interface MockSystemContractInterface extends utils.Interface { +export interface SystemContractMockInterface extends utils.Interface { functions: { "gasCoinZRC20ByChainId(uint256)": FunctionFragment; "gasPriceByChainId(uint256)": FunctionFragment; @@ -220,12 +220,12 @@ export type SystemContractDeployedEvent = TypedEvent< export type SystemContractDeployedEventFilter = TypedEventFilter; -export interface MockSystemContract extends BaseContract { +export interface SystemContractMock extends BaseContract { connect(signerOrProvider: Signer | Provider | string): this; attach(addressOrName: string): this; deployed(): Promise; - interface: MockSystemContractInterface; + interface: SystemContractMockInterface; queryFilter( event: TypedEventFilter, diff --git a/typechain-types/contracts/zevm/testing/MockSystemContract.sol/index.ts b/typechain-types/contracts/zevm/testing/SystemContractMock.sol/index.ts similarity index 71% rename from typechain-types/contracts/zevm/testing/MockSystemContract.sol/index.ts rename to typechain-types/contracts/zevm/testing/SystemContractMock.sol/index.ts index da3a6f9a..122c1994 100644 --- a/typechain-types/contracts/zevm/testing/MockSystemContract.sol/index.ts +++ b/typechain-types/contracts/zevm/testing/SystemContractMock.sol/index.ts @@ -1,5 +1,5 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export type { MockSystemContract } from "./MockSystemContract"; export type { SystemContractErrors } from "./SystemContractErrors"; +export type { SystemContractMock } from "./SystemContractMock"; diff --git a/typechain-types/contracts/zevm/testing/index.ts b/typechain-types/contracts/zevm/testing/index.ts index aeb46272..2da3428d 100644 --- a/typechain-types/contracts/zevm/testing/index.ts +++ b/typechain-types/contracts/zevm/testing/index.ts @@ -1,5 +1,5 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -import type * as mockSystemContractSol from "./MockSystemContract.sol"; -export type { mockSystemContractSol }; +import type * as systemContractMockSol from "./SystemContractMock.sol"; +export type { systemContractMockSol }; diff --git a/typechain-types/factories/contracts/zevm/ConnectorZEVM.sol/WZETA__factory.ts b/typechain-types/factories/contracts/zevm/ZetaConnectorZEVM.sol/WZETA__factory.ts similarity index 95% rename from typechain-types/factories/contracts/zevm/ConnectorZEVM.sol/WZETA__factory.ts rename to typechain-types/factories/contracts/zevm/ZetaConnectorZEVM.sol/WZETA__factory.ts index 83fd3571..e4a3c435 100644 --- a/typechain-types/factories/contracts/zevm/ConnectorZEVM.sol/WZETA__factory.ts +++ b/typechain-types/factories/contracts/zevm/ZetaConnectorZEVM.sol/WZETA__factory.ts @@ -7,7 +7,7 @@ import type { Provider } from "@ethersproject/providers"; import type { WZETA, WZETAInterface, -} from "../../../../contracts/zevm/ConnectorZEVM.sol/WZETA"; +} from "../../../../contracts/zevm/ZetaConnectorZEVM.sol/WZETA"; const _abi = [ { diff --git a/typechain-types/factories/contracts/zevm/ConnectorZEVM.sol/ZetaConnectorZEVM__factory.ts b/typechain-types/factories/contracts/zevm/ZetaConnectorZEVM.sol/ZetaConnectorZEVM__factory.ts similarity index 96% rename from typechain-types/factories/contracts/zevm/ConnectorZEVM.sol/ZetaConnectorZEVM__factory.ts rename to typechain-types/factories/contracts/zevm/ZetaConnectorZEVM.sol/ZetaConnectorZEVM__factory.ts index e4d04ec8..12df41bf 100644 --- a/typechain-types/factories/contracts/zevm/ConnectorZEVM.sol/ZetaConnectorZEVM__factory.ts +++ b/typechain-types/factories/contracts/zevm/ZetaConnectorZEVM.sol/ZetaConnectorZEVM__factory.ts @@ -7,14 +7,14 @@ import type { PromiseOrValue } from "../../../../common"; import type { ZetaConnectorZEVM, ZetaConnectorZEVMInterface, -} from "../../../../contracts/zevm/ConnectorZEVM.sol/ZetaConnectorZEVM"; +} from "../../../../contracts/zevm/ZetaConnectorZEVM.sol/ZetaConnectorZEVM"; const _abi = [ { inputs: [ { internalType: "address", - name: "_wzeta", + name: "wzeta_", type: "address", }, ], @@ -200,7 +200,7 @@ const _abi = [ ] as const; const _bytecode = - "0x608060405234801561001057600080fd5b50604051610a51380380610a518339818101604052810190610032919061008d565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600081519050610087816100f1565b92915050565b6000602082840312156100a3576100a26100ec565b5b60006100b184828501610078565b91505092915050565b60006100c5826100cc565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6100fa816100ba565b811461010557600080fd5b50565b61093a806101176000396000f3fe6080604052600436106100425760003560e01c8062173d46146100d35780633ce4a5bc146100fe578063eb3bacbd14610129578063ec02690114610152576100ce565b366100ce5760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146100cc576040517f6e6b6de700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b600080fd5b3480156100df57600080fd5b506100e861017b565b6040516100f591906106e5565b60405180910390f35b34801561010a57600080fd5b5061011361019f565b60405161012091906106e5565b60405180910390f35b34801561013557600080fd5b50610150600480360381019061014b91906105bf565b6101b7565b005b34801561015e57600080fd5b5061017960048036038101906101749190610619565b6102aa565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b73735b14bb79463307aacbed86daf3322b1e6226ab81565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610230576040517fea02b3f300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f7325870b05f8f3412c318a35fc6a74feca51ea15811ec7a257676ca4db9d41768160405161029f91906106e5565b60405180910390a150565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd333084608001356040518463ffffffff1660e01b815260040161030b93929190610700565b602060405180830381600087803b15801561032557600080fd5b505af1158015610339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035d91906105ec565b610393576040517fa8c6fd4a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d82608001356040518263ffffffff1660e01b81526004016103f091906107b3565b600060405180830381600087803b15801561040a57600080fd5b505af115801561041e573d6000803e3d6000fd5b50505050600073735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff168260800135604051610460906106d0565b60006040518083038185875af1925050503d806000811461049d576040519150601f19603f3d011682016040523d82523d6000602084013e6104a2565b606091505b50509050806104dd576040517fc7ffc47b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600001353373ffffffffffffffffffffffffffffffffffffffff167f7ec1c94701e09b1652f3e1d307e60c4b9ebf99aff8c2079fd1d8c585e031c4e43285806020019061052b91906107ce565b8760800135886040013589806060019061054591906107ce565b8b8060a0019061055591906107ce565b60405161056a99989796959493929190610737565b60405180910390a35050565b600081359050610585816108d6565b92915050565b60008151905061059a816108ed565b92915050565b600060c082840312156105b6576105b56108a9565b5b81905092915050565b6000602082840312156105d5576105d46108bd565b5b60006105e384828501610576565b91505092915050565b600060208284031215610602576106016108bd565b5b60006106108482850161058b565b91505092915050565b60006020828403121561062f5761062e6108bd565b5b600082013567ffffffffffffffff81111561064d5761064c6108b8565b5b610659848285016105a0565b91505092915050565b61066b8161084d565b82525050565b600061067d8385610831565b935061068a838584610895565b610693836108c2565b840190509392505050565b60006106ab600083610842565b91506106b6826108d3565b600082019050919050565b6106ca8161088b565b82525050565b60006106db8261069e565b9150819050919050565b60006020820190506106fa6000830184610662565b92915050565b60006060820190506107156000830186610662565b6107226020830185610662565b61072f60408301846106c1565b949350505050565b600060c08201905061074c600083018c610662565b818103602083015261075f818a8c610671565b905061076e60408301896106c1565b61077b60608301886106c1565b818103608083015261078e818688610671565b905081810360a08301526107a3818486610671565b90509a9950505050505050505050565b60006020820190506107c860008301846106c1565b92915050565b600080833560016020038436030381126107eb576107ea6108ae565b5b80840192508235915067ffffffffffffffff82111561080d5761080c6108a4565b5b602083019250600182023603831315610829576108286108b3565b5b509250929050565b600082825260208201905092915050565b600081905092915050565b60006108588261086b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b50565b6108df8161084d565b81146108ea57600080fd5b50565b6108f68161085f565b811461090157600080fd5b5056fea2646970667358221220de77795070b6e9d863f949e5ff84ae67c6e2c498e6ffb04996698d04fcebe44864736f6c63430008070033"; + "0x608060405234801561001057600080fd5b50604051610a51380380610a518339818101604052810190610032919061008d565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610108565b600081519050610087816100f1565b92915050565b6000602082840312156100a3576100a26100ec565b5b60006100b184828501610078565b91505092915050565b60006100c5826100cc565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6100fa816100ba565b811461010557600080fd5b50565b61093a806101176000396000f3fe6080604052600436106100425760003560e01c8062173d46146100d35780633ce4a5bc146100fe578063eb3bacbd14610129578063ec02690114610152576100ce565b366100ce5760008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146100cc576040517f6e6b6de700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b600080fd5b3480156100df57600080fd5b506100e861017b565b6040516100f591906106e5565b60405180910390f35b34801561010a57600080fd5b5061011361019f565b60405161012091906106e5565b60405180910390f35b34801561013557600080fd5b50610150600480360381019061014b91906105bf565b6101b7565b005b34801561015e57600080fd5b5061017960048036038101906101749190610619565b6102aa565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b73735b14bb79463307aacbed86daf3322b1e6226ab81565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610230576040517fea02b3f300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f7325870b05f8f3412c318a35fc6a74feca51ea15811ec7a257676ca4db9d41768160405161029f91906106e5565b60405180910390a150565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd333084608001356040518463ffffffff1660e01b815260040161030b93929190610700565b602060405180830381600087803b15801561032557600080fd5b505af1158015610339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061035d91906105ec565b610393576040517fa8c6fd4a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d82608001356040518263ffffffff1660e01b81526004016103f091906107b3565b600060405180830381600087803b15801561040a57600080fd5b505af115801561041e573d6000803e3d6000fd5b50505050600073735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff168260800135604051610460906106d0565b60006040518083038185875af1925050503d806000811461049d576040519150601f19603f3d011682016040523d82523d6000602084013e6104a2565b606091505b50509050806104dd576040517fc7ffc47b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600001353373ffffffffffffffffffffffffffffffffffffffff167f7ec1c94701e09b1652f3e1d307e60c4b9ebf99aff8c2079fd1d8c585e031c4e43285806020019061052b91906107ce565b8760800135886040013589806060019061054591906107ce565b8b8060a0019061055591906107ce565b60405161056a99989796959493929190610737565b60405180910390a35050565b600081359050610585816108d6565b92915050565b60008151905061059a816108ed565b92915050565b600060c082840312156105b6576105b56108a9565b5b81905092915050565b6000602082840312156105d5576105d46108bd565b5b60006105e384828501610576565b91505092915050565b600060208284031215610602576106016108bd565b5b60006106108482850161058b565b91505092915050565b60006020828403121561062f5761062e6108bd565b5b600082013567ffffffffffffffff81111561064d5761064c6108b8565b5b610659848285016105a0565b91505092915050565b61066b8161084d565b82525050565b600061067d8385610831565b935061068a838584610895565b610693836108c2565b840190509392505050565b60006106ab600083610842565b91506106b6826108d3565b600082019050919050565b6106ca8161088b565b82525050565b60006106db8261069e565b9150819050919050565b60006020820190506106fa6000830184610662565b92915050565b60006060820190506107156000830186610662565b6107226020830185610662565b61072f60408301846106c1565b949350505050565b600060c08201905061074c600083018c610662565b818103602083015261075f818a8c610671565b905061076e60408301896106c1565b61077b60608301886106c1565b818103608083015261078e818688610671565b905081810360a08301526107a3818486610671565b90509a9950505050505050505050565b60006020820190506107c860008301846106c1565b92915050565b600080833560016020038436030381126107eb576107ea6108ae565b5b80840192508235915067ffffffffffffffff82111561080d5761080c6108a4565b5b602083019250600182023603831315610829576108286108b3565b5b509250929050565b600082825260208201905092915050565b600081905092915050565b60006108588261086b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b50565b6108df8161084d565b81146108ea57600080fd5b50565b6108f68161085f565b811461090157600080fd5b5056fea26469706673582212209cb0a71343946ce3fb0c8378bb2c769fc506ceab04e93e858de3b8c13a0e1deb64736f6c63430008070033"; type ZetaConnectorZEVMConstructorParams = | [signer?: Signer] @@ -220,16 +220,16 @@ export class ZetaConnectorZEVM__factory extends ContractFactory { } override deploy( - _wzeta: PromiseOrValue, + wzeta_: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise { - return super.deploy(_wzeta, overrides || {}) as Promise; + return super.deploy(wzeta_, overrides || {}) as Promise; } override getDeployTransaction( - _wzeta: PromiseOrValue, + wzeta_: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): TransactionRequest { - return super.getDeployTransaction(_wzeta, overrides || {}); + return super.getDeployTransaction(wzeta_, overrides || {}); } override attach(address: string): ZetaConnectorZEVM { return super.attach(address) as ZetaConnectorZEVM; diff --git a/typechain-types/factories/contracts/zevm/ConnectorZEVM.sol/index.ts b/typechain-types/factories/contracts/zevm/ZetaConnectorZEVM.sol/index.ts similarity index 100% rename from typechain-types/factories/contracts/zevm/ConnectorZEVM.sol/index.ts rename to typechain-types/factories/contracts/zevm/ZetaConnectorZEVM.sol/index.ts diff --git a/typechain-types/factories/contracts/zevm/index.ts b/typechain-types/factories/contracts/zevm/index.ts index 4ce66036..1d36cb0b 100644 --- a/typechain-types/factories/contracts/zevm/index.ts +++ b/typechain-types/factories/contracts/zevm/index.ts @@ -1,10 +1,10 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export * as connectorZevmSol from "./ConnectorZEVM.sol"; export * as interfacesSol from "./Interfaces.sol"; export * as systemContractSol from "./SystemContract.sol"; export * as wzetaSol from "./WZETA.sol"; export * as zrc20Sol from "./ZRC20.sol"; +export * as zetaConnectorZevmSol from "./ZetaConnectorZEVM.sol"; export * as interfaces from "./interfaces"; export * as testing from "./testing"; diff --git a/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors__factory.ts b/typechain-types/factories/contracts/zevm/testing/SystemContractMock.sol/SystemContractErrors__factory.ts similarity index 94% rename from typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors__factory.ts rename to typechain-types/factories/contracts/zevm/testing/SystemContractMock.sol/SystemContractErrors__factory.ts index a5e39efb..2b4a91bf 100644 --- a/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors__factory.ts +++ b/typechain-types/factories/contracts/zevm/testing/SystemContractMock.sol/SystemContractErrors__factory.ts @@ -7,7 +7,7 @@ import type { Provider } from "@ethersproject/providers"; import type { SystemContractErrors, SystemContractErrorsInterface, -} from "../../../../../contracts/zevm/testing/MockSystemContract.sol/SystemContractErrors"; +} from "../../../../../contracts/zevm/testing/SystemContractMock.sol/SystemContractErrors"; const _abi = [ { diff --git a/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract__factory.ts b/typechain-types/factories/contracts/zevm/testing/SystemContractMock.sol/SystemContractMock__factory.ts similarity index 93% rename from typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract__factory.ts rename to typechain-types/factories/contracts/zevm/testing/SystemContractMock.sol/SystemContractMock__factory.ts index fc7bd1a8..f4f16134 100644 --- a/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract__factory.ts +++ b/typechain-types/factories/contracts/zevm/testing/SystemContractMock.sol/SystemContractMock__factory.ts @@ -5,9 +5,9 @@ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; import type { PromiseOrValue } from "../../../../../common"; import type { - MockSystemContract, - MockSystemContractInterface, -} from "../../../../../contracts/zevm/testing/MockSystemContract.sol/MockSystemContract"; + SystemContractMock, + SystemContractMockInterface, +} from "../../../../../contracts/zevm/testing/SystemContractMock.sol/SystemContractMock"; const _abi = [ { @@ -332,18 +332,18 @@ const _abi = [ ] as const; const _bytecode = - "0x60806040523480156200001157600080fd5b50604051620010d7380380620010d7833981810160405281019062000037919062000146565b82600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac560405160405180910390a1505050620001f5565b6000815190506200014081620001db565b92915050565b600080600060608486031215620001625762000161620001d6565b5b600062000172868287016200012f565b935050602062000185868287016200012f565b925050604062000198868287016200012f565b9150509250925092565b6000620001af82620001b6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b620001e681620001a2565b8114620001f257600080fd5b50565b610ed280620002056000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806397770dff1161007157806397770dff14610166578063a7cb050714610182578063c63585cc1461019e578063d7fd7afb146101ce578063d936a012146101fe578063ee2815ba1461021c576100a9565b80630be15547146100ae5780633c669d55146100de578063513a9c05146100fa578063569541b91461012a578063842da36d14610148575b600080fd5b6100c860048036038101906100c3919061094d565b610238565b6040516100d59190610bce565b60405180910390f35b6100f860048036038101906100f39190610898565b61026b565b005b610114600480360381019061010f919061094d565b6103b8565b6040516101219190610bce565b60405180910390f35b6101326103eb565b60405161013f9190610bce565b60405180910390f35b610150610411565b60405161015d9190610bce565b60405180910390f35b610180600480360381019061017b9190610818565b610437565b005b61019c600480360381019061019791906109ba565b6104d4565b005b6101b860048036038101906101b39190610845565b610528565b6040516101c59190610bce565b60405180910390f35b6101e860048036038101906101e3919061094d565b61059a565b6040516101f59190610c67565b60405180910390f35b6102066105b2565b6040516102139190610bce565b60405180910390f35b6102366004803603810190610231919061097a565b6105d8565b005b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405180606001604052806040518060200160405280600081525081526020013373ffffffffffffffffffffffffffffffffffffffff1681526020014681525090508473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87866040518363ffffffff1660e01b81526004016102ea929190610be9565b602060405180830381600087803b15801561030457600080fd5b505af1158015610318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033c9190610920565b508573ffffffffffffffffffffffffffffffffffffffff1663de43156e82878787876040518663ffffffff1660e01b815260040161037e959493929190610c12565b600060405180830381600087803b15801561039857600080fd5b505af11580156103ac573d6000803e3d6000fd5b50505050505050505050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516104c99190610bce565b60405180910390a150565b80600080848152602001908152602001600020819055507f49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d828260405161051c929190610cab565b60405180910390a15050565b60008060006105378585610667565b9150915085828260405160200161054f929190610b60565b60405160208183030381529060405280519060200120604051602001610576929190610b8c565b6040516020818303038152906040528051906020012060001c925050509392505050565b60006020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b806001600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d828260405161065b929190610c82565b60405180910390a15050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156106d0576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161061070a57828461070d565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561077c576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008135905061079281610e57565b92915050565b6000815190506107a781610e6e565b92915050565b60008083601f8401126107c3576107c2610dd3565b5b8235905067ffffffffffffffff8111156107e0576107df610dce565b5b6020830191508360018202830111156107fc576107fb610dd8565b5b9250929050565b60008135905061081281610e85565b92915050565b60006020828403121561082e5761082d610de2565b5b600061083c84828501610783565b91505092915050565b60008060006060848603121561085e5761085d610de2565b5b600061086c86828701610783565b935050602061087d86828701610783565b925050604061088e86828701610783565b9150509250925092565b6000806000806000608086880312156108b4576108b3610de2565b5b60006108c288828901610783565b95505060206108d388828901610783565b94505060406108e488828901610803565b935050606086013567ffffffffffffffff81111561090557610904610ddd565b5b610911888289016107ad565b92509250509295509295909350565b60006020828403121561093657610935610de2565b5b600061094484828501610798565b91505092915050565b60006020828403121561096357610962610de2565b5b600061097184828501610803565b91505092915050565b6000806040838503121561099157610990610de2565b5b600061099f85828601610803565b92505060206109b085828601610783565b9150509250929050565b600080604083850312156109d1576109d0610de2565b5b60006109df85828601610803565b92505060206109f085828601610803565b9150509250929050565b610a0381610d0c565b82525050565b610a1281610d0c565b82525050565b610a29610a2482610d0c565b610da0565b82525050565b610a40610a3b82610d2a565b610db2565b82525050565b6000610a528385610cf0565b9350610a5f838584610d5e565b610a6883610de7565b840190509392505050565b6000610a7e82610cd4565b610a888185610cdf565b9350610a98818560208601610d6d565b610aa181610de7565b840191505092915050565b6000610ab9602083610d01565b9150610ac482610e05565b602082019050919050565b6000610adc600183610d01565b9150610ae782610e2e565b600182019050919050565b60006060830160008301518482036000860152610b0f8282610a73565b9150506020830151610b2460208601826109fa565b506040830151610b376040860182610b42565b508091505092915050565b610b4b81610d54565b82525050565b610b5a81610d54565b82525050565b6000610b6c8285610a18565b601482019150610b7c8284610a18565b6014820191508190509392505050565b6000610b9782610acf565b9150610ba38285610a18565b601482019150610bb38284610a2f565b602082019150610bc282610aac565b91508190509392505050565b6000602082019050610be36000830184610a09565b92915050565b6000604082019050610bfe6000830185610a09565b610c0b6020830184610b51565b9392505050565b60006080820190508181036000830152610c2c8188610af2565b9050610c3b6020830187610a09565b610c486040830186610b51565b8181036060830152610c5b818486610a46565b90509695505050505050565b6000602082019050610c7c6000830184610b51565b92915050565b6000604082019050610c976000830185610b51565b610ca46020830184610a09565b9392505050565b6000604082019050610cc06000830185610b51565b610ccd6020830184610b51565b9392505050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000610d1782610d34565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610d8b578082015181840152602081019050610d70565b83811115610d9a576000848401525b50505050565b6000610dab82610dbc565b9050919050565b6000819050919050565b6000610dc782610df8565b9050919050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f600082015250565b7fff00000000000000000000000000000000000000000000000000000000000000600082015250565b610e6081610d0c565b8114610e6b57600080fd5b50565b610e7781610d1e565b8114610e8257600080fd5b50565b610e8e81610d54565b8114610e9957600080fd5b5056fea26469706673582212200ba12c9e6d9b24f4467c622d42302be9e9ceb57f7588e1dd2778bc19ae263c6b64736f6c63430008070033"; + "0x60806040523480156200001157600080fd5b50604051620010d7380380620010d7833981810160405281019062000037919062000146565b82600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac560405160405180910390a1505050620001f5565b6000815190506200014081620001db565b92915050565b600080600060608486031215620001625762000161620001d6565b5b600062000172868287016200012f565b935050602062000185868287016200012f565b925050604062000198868287016200012f565b9150509250925092565b6000620001af82620001b6565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b620001e681620001a2565b8114620001f257600080fd5b50565b610ed280620002056000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806397770dff1161007157806397770dff14610166578063a7cb050714610182578063c63585cc1461019e578063d7fd7afb146101ce578063d936a012146101fe578063ee2815ba1461021c576100a9565b80630be15547146100ae5780633c669d55146100de578063513a9c05146100fa578063569541b91461012a578063842da36d14610148575b600080fd5b6100c860048036038101906100c3919061094d565b610238565b6040516100d59190610bce565b60405180910390f35b6100f860048036038101906100f39190610898565b61026b565b005b610114600480360381019061010f919061094d565b6103b8565b6040516101219190610bce565b60405180910390f35b6101326103eb565b60405161013f9190610bce565b60405180910390f35b610150610411565b60405161015d9190610bce565b60405180910390f35b610180600480360381019061017b9190610818565b610437565b005b61019c600480360381019061019791906109ba565b6104d4565b005b6101b860048036038101906101b39190610845565b610528565b6040516101c59190610bce565b60405180910390f35b6101e860048036038101906101e3919061094d565b61059a565b6040516101f59190610c67565b60405180910390f35b6102066105b2565b6040516102139190610bce565b60405180910390f35b6102366004803603810190610231919061097a565b6105d8565b005b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060405180606001604052806040518060200160405280600081525081526020013373ffffffffffffffffffffffffffffffffffffffff1681526020014681525090508473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87866040518363ffffffff1660e01b81526004016102ea929190610be9565b602060405180830381600087803b15801561030457600080fd5b505af1158015610318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033c9190610920565b508573ffffffffffffffffffffffffffffffffffffffff1663de43156e82878787876040518663ffffffff1660e01b815260040161037e959493929190610c12565b600060405180830381600087803b15801561039857600080fd5b505af11580156103ac573d6000803e3d6000fd5b50505050505050505050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516104c99190610bce565b60405180910390a150565b80600080848152602001908152602001600020819055507f49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d828260405161051c929190610cab565b60405180910390a15050565b60008060006105378585610667565b9150915085828260405160200161054f929190610b60565b60405160208183030381529060405280519060200120604051602001610576929190610b8c565b6040516020818303038152906040528051906020012060001c925050509392505050565b60006020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b806001600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d828260405161065b929190610c82565b60405180910390a15050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156106d0576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161061070a57828461070d565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561077c576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008135905061079281610e57565b92915050565b6000815190506107a781610e6e565b92915050565b60008083601f8401126107c3576107c2610dd3565b5b8235905067ffffffffffffffff8111156107e0576107df610dce565b5b6020830191508360018202830111156107fc576107fb610dd8565b5b9250929050565b60008135905061081281610e85565b92915050565b60006020828403121561082e5761082d610de2565b5b600061083c84828501610783565b91505092915050565b60008060006060848603121561085e5761085d610de2565b5b600061086c86828701610783565b935050602061087d86828701610783565b925050604061088e86828701610783565b9150509250925092565b6000806000806000608086880312156108b4576108b3610de2565b5b60006108c288828901610783565b95505060206108d388828901610783565b94505060406108e488828901610803565b935050606086013567ffffffffffffffff81111561090557610904610ddd565b5b610911888289016107ad565b92509250509295509295909350565b60006020828403121561093657610935610de2565b5b600061094484828501610798565b91505092915050565b60006020828403121561096357610962610de2565b5b600061097184828501610803565b91505092915050565b6000806040838503121561099157610990610de2565b5b600061099f85828601610803565b92505060206109b085828601610783565b9150509250929050565b600080604083850312156109d1576109d0610de2565b5b60006109df85828601610803565b92505060206109f085828601610803565b9150509250929050565b610a0381610d0c565b82525050565b610a1281610d0c565b82525050565b610a29610a2482610d0c565b610da0565b82525050565b610a40610a3b82610d2a565b610db2565b82525050565b6000610a528385610cf0565b9350610a5f838584610d5e565b610a6883610de7565b840190509392505050565b6000610a7e82610cd4565b610a888185610cdf565b9350610a98818560208601610d6d565b610aa181610de7565b840191505092915050565b6000610ab9602083610d01565b9150610ac482610e05565b602082019050919050565b6000610adc600183610d01565b9150610ae782610e2e565b600182019050919050565b60006060830160008301518482036000860152610b0f8282610a73565b9150506020830151610b2460208601826109fa565b506040830151610b376040860182610b42565b508091505092915050565b610b4b81610d54565b82525050565b610b5a81610d54565b82525050565b6000610b6c8285610a18565b601482019150610b7c8284610a18565b6014820191508190509392505050565b6000610b9782610acf565b9150610ba38285610a18565b601482019150610bb38284610a2f565b602082019150610bc282610aac565b91508190509392505050565b6000602082019050610be36000830184610a09565b92915050565b6000604082019050610bfe6000830185610a09565b610c0b6020830184610b51565b9392505050565b60006080820190508181036000830152610c2c8188610af2565b9050610c3b6020830187610a09565b610c486040830186610b51565b8181036060830152610c5b818486610a46565b90509695505050505050565b6000602082019050610c7c6000830184610b51565b92915050565b6000604082019050610c976000830185610b51565b610ca46020830184610a09565b9392505050565b6000604082019050610cc06000830185610b51565b610ccd6020830184610b51565b9392505050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000610d1782610d34565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610d8b578082015181840152602081019050610d70565b83811115610d9a576000848401525b50505050565b6000610dab82610dbc565b9050919050565b6000819050919050565b6000610dc782610df8565b9050919050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f600082015250565b7fff00000000000000000000000000000000000000000000000000000000000000600082015250565b610e6081610d0c565b8114610e6b57600080fd5b50565b610e7781610d1e565b8114610e8257600080fd5b50565b610e8e81610d54565b8114610e9957600080fd5b5056fea26469706673582212203fa9d55135c7f24f7b5da3516688ef5fb78d92d28a850d2fe6d6fc3799422af364736f6c63430008070033"; -type MockSystemContractConstructorParams = +type SystemContractMockConstructorParams = | [signer?: Signer] | ConstructorParameters; const isSuperArgs = ( - xs: MockSystemContractConstructorParams + xs: SystemContractMockConstructorParams ): xs is ConstructorParameters => xs.length > 1; -export class MockSystemContract__factory extends ContractFactory { - constructor(...args: MockSystemContractConstructorParams) { +export class SystemContractMock__factory extends ContractFactory { + constructor(...args: SystemContractMockConstructorParams) { if (isSuperArgs(args)) { super(...args); } else { @@ -356,13 +356,13 @@ export class MockSystemContract__factory extends ContractFactory { uniswapv2Factory_: PromiseOrValue, uniswapv2Router02_: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } - ): Promise { + ): Promise { return super.deploy( wzeta_, uniswapv2Factory_, uniswapv2Router02_, overrides || {} - ) as Promise; + ) as Promise; } override getDeployTransaction( wzeta_: PromiseOrValue, @@ -377,22 +377,22 @@ export class MockSystemContract__factory extends ContractFactory { overrides || {} ); } - override attach(address: string): MockSystemContract { - return super.attach(address) as MockSystemContract; + override attach(address: string): SystemContractMock { + return super.attach(address) as SystemContractMock; } - override connect(signer: Signer): MockSystemContract__factory { - return super.connect(signer) as MockSystemContract__factory; + override connect(signer: Signer): SystemContractMock__factory { + return super.connect(signer) as SystemContractMock__factory; } static readonly bytecode = _bytecode; static readonly abi = _abi; - static createInterface(): MockSystemContractInterface { - return new utils.Interface(_abi) as MockSystemContractInterface; + static createInterface(): SystemContractMockInterface { + return new utils.Interface(_abi) as SystemContractMockInterface; } static connect( address: string, signerOrProvider: Signer | Provider - ): MockSystemContract { - return new Contract(address, _abi, signerOrProvider) as MockSystemContract; + ): SystemContractMock { + return new Contract(address, _abi, signerOrProvider) as SystemContractMock; } } diff --git a/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/index.ts b/typechain-types/factories/contracts/zevm/testing/SystemContractMock.sol/index.ts similarity index 68% rename from typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/index.ts rename to typechain-types/factories/contracts/zevm/testing/SystemContractMock.sol/index.ts index 705440b4..006bdc5d 100644 --- a/typechain-types/factories/contracts/zevm/testing/MockSystemContract.sol/index.ts +++ b/typechain-types/factories/contracts/zevm/testing/SystemContractMock.sol/index.ts @@ -1,5 +1,5 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export { MockSystemContract__factory } from "./MockSystemContract__factory"; export { SystemContractErrors__factory } from "./SystemContractErrors__factory"; +export { SystemContractMock__factory } from "./SystemContractMock__factory"; diff --git a/typechain-types/factories/contracts/zevm/testing/index.ts b/typechain-types/factories/contracts/zevm/testing/index.ts index 18b0d117..ffbe5a26 100644 --- a/typechain-types/factories/contracts/zevm/testing/index.ts +++ b/typechain-types/factories/contracts/zevm/testing/index.ts @@ -1,4 +1,4 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ -export * as mockSystemContractSol from "./MockSystemContract.sol"; +export * as systemContractMockSol from "./SystemContractMock.sol"; diff --git a/typechain-types/hardhat.d.ts b/typechain-types/hardhat.d.ts index c9aca675..d0d85364 100644 --- a/typechain-types/hardhat.d.ts +++ b/typechain-types/hardhat.d.ts @@ -292,14 +292,6 @@ declare module "hardhat/types/runtime" { name: "ZetaConnectorNonEth", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; - getContractFactory( - name: "WZETA", - signerOrOptions?: ethers.Signer | FactoryOptions - ): Promise; - getContractFactory( - name: "ZetaConnectorZEVM", - signerOrOptions?: ethers.Signer | FactoryOptions - ): Promise; getContractFactory( name: "ISystem", signerOrOptions?: ethers.Signer | FactoryOptions @@ -340,18 +332,26 @@ declare module "hardhat/types/runtime" { name: "SystemContractErrors", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; - getContractFactory( - name: "MockSystemContract", - signerOrOptions?: ethers.Signer | FactoryOptions - ): Promise; getContractFactory( name: "SystemContractErrors", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; + getContractFactory( + name: "SystemContractMock", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; getContractFactory( name: "WETH9", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; + getContractFactory( + name: "WZETA", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "ZetaConnectorZEVM", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; getContractFactory( name: "ZRC20", signerOrOptions?: ethers.Signer | FactoryOptions @@ -711,16 +711,6 @@ declare module "hardhat/types/runtime" { address: string, signer?: ethers.Signer ): Promise; - getContractAt( - name: "WZETA", - address: string, - signer?: ethers.Signer - ): Promise; - getContractAt( - name: "ZetaConnectorZEVM", - address: string, - signer?: ethers.Signer - ): Promise; getContractAt( name: "ISystem", address: string, @@ -772,20 +762,30 @@ declare module "hardhat/types/runtime" { signer?: ethers.Signer ): Promise; getContractAt( - name: "MockSystemContract", + name: "SystemContractErrors", address: string, signer?: ethers.Signer - ): Promise; + ): Promise; getContractAt( - name: "SystemContractErrors", + name: "SystemContractMock", address: string, signer?: ethers.Signer - ): Promise; + ): Promise; getContractAt( name: "WETH9", address: string, signer?: ethers.Signer ): Promise; + getContractAt( + name: "WZETA", + address: string, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "ZetaConnectorZEVM", + address: string, + signer?: ethers.Signer + ): Promise; getContractAt( name: "ZRC20", address: string, diff --git a/typechain-types/index.ts b/typechain-types/index.ts index fcfd7da3..688a7938 100644 --- a/typechain-types/index.ts +++ b/typechain-types/index.ts @@ -136,10 +136,6 @@ export type { ZetaConnectorEth } from "./contracts/evm/ZetaConnector.eth.sol/Zet export { ZetaConnectorEth__factory } from "./factories/contracts/evm/ZetaConnector.eth.sol/ZetaConnectorEth__factory"; export type { ZetaConnectorNonEth } from "./contracts/evm/ZetaConnector.non-eth.sol/ZetaConnectorNonEth"; export { ZetaConnectorNonEth__factory } from "./factories/contracts/evm/ZetaConnector.non-eth.sol/ZetaConnectorNonEth__factory"; -export type { WZETA } from "./contracts/zevm/ConnectorZEVM.sol/WZETA"; -export { WZETA__factory } from "./factories/contracts/zevm/ConnectorZEVM.sol/WZETA__factory"; -export type { ZetaConnectorZEVM } from "./contracts/zevm/ConnectorZEVM.sol/ZetaConnectorZEVM"; -export { ZetaConnectorZEVM__factory } from "./factories/contracts/zevm/ConnectorZEVM.sol/ZetaConnectorZEVM__factory"; export type { ISystem } from "./contracts/zevm/Interfaces.sol/ISystem"; export { ISystem__factory } from "./factories/contracts/zevm/Interfaces.sol/ISystem__factory"; export type { IZRC20 } from "./contracts/zevm/Interfaces.sol/IZRC20"; @@ -154,8 +150,12 @@ export type { SystemContract } from "./contracts/zevm/SystemContract.sol/SystemC export { SystemContract__factory } from "./factories/contracts/zevm/SystemContract.sol/SystemContract__factory"; export type { SystemContractErrors } from "./contracts/zevm/SystemContract.sol/SystemContractErrors"; export { SystemContractErrors__factory } from "./factories/contracts/zevm/SystemContract.sol/SystemContractErrors__factory"; -export type { MockSystemContract } from "./contracts/zevm/testing/MockSystemContract.sol/MockSystemContract"; -export { MockSystemContract__factory } from "./factories/contracts/zevm/testing/MockSystemContract.sol/MockSystemContract__factory"; +export type { SystemContractMock } from "./contracts/zevm/testing/SystemContractMock.sol/SystemContractMock"; +export { SystemContractMock__factory } from "./factories/contracts/zevm/testing/SystemContractMock.sol/SystemContractMock__factory"; +export type { WZETA } from "./contracts/zevm/ZetaConnectorZEVM.sol/WZETA"; +export { WZETA__factory } from "./factories/contracts/zevm/ZetaConnectorZEVM.sol/WZETA__factory"; +export type { ZetaConnectorZEVM } from "./contracts/zevm/ZetaConnectorZEVM.sol/ZetaConnectorZEVM"; +export { ZetaConnectorZEVM__factory } from "./factories/contracts/zevm/ZetaConnectorZEVM.sol/ZetaConnectorZEVM__factory"; export type { ZRC20 } from "./contracts/zevm/ZRC20.sol/ZRC20"; export { ZRC20__factory } from "./factories/contracts/zevm/ZRC20.sol/ZRC20__factory"; export type { ZRC20Errors } from "./contracts/zevm/ZRC20.sol/ZRC20Errors";