diff --git a/helpers/evm.ts b/helpers/evm.ts index 4bf5e11b..b40102d7 100644 --- a/helpers/evm.ts +++ b/helpers/evm.ts @@ -1,6 +1,7 @@ import { MaxUint256 } from "@ethersproject/constants"; import { parseUnits } from "@ethersproject/units"; import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { ethers } from "ethers"; import { TestSystemContract, @@ -10,8 +11,6 @@ import { UniswapV2Router02__factory, } from "../typechain-types"; -declare const hre: any; - const addZetaEthLiquidity = async ( signer: SignerWithAddress, token: TestZRC20, @@ -100,10 +99,10 @@ export const prepareData = (contract: string, types: string[], args: any[]) => { }; export const prepareParams = (types: string[], args: any[]) => { - const abiCoder = hre.ethers.utils.defaultAbiCoder; + const abiCoder = ethers.utils.defaultAbiCoder; for (let i = 0; i < args.length; i++) { if (types[i] === "bytes32") { - args[i] = hre.ethers.utils.hexlify(hre.ethers.utils.zeroPad(args[i], 32)); + args[i] = ethers.utils.hexlify(ethers.utils.zeroPad(args[i], 32)); } } return abiCoder.encode(types, args); diff --git a/package.json b/package.json index e6d4cfbf..1da1b53d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "exports": { "./tasks": "./dist/tasks/index.js", "./helpers": "./dist/helpers/index.js", - "./helpers/fees": "./dist/helpers/fees.js" + "./helpers/fees": "./dist/helpers/fees.js", + "./helpers/evm": "./dist/helpers/evm.js" }, "scripts": { "prebuild": "rimraf dist", diff --git a/typechain-types/contracts/TestSystemContract.ts b/typechain-types/contracts/TestSystemContract.ts new file mode 100644 index 00000000..c0761aa5 --- /dev/null +++ b/typechain-types/contracts/TestSystemContract.ts @@ -0,0 +1,449 @@ +/* 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 TestSystemContractInterface extends utils.Interface { + functions: { + "gasCoinZRC20ByChainId(uint256)": FunctionFragment; + "gasPriceByChainId(uint256)": FunctionFragment; + "gasZetaPoolByChainId(uint256)": FunctionFragment; + "setGasCoinZRC20(uint256,address)": FunctionFragment; + "setGasPrice(uint256,uint256)": FunctionFragment; + "setWZETAContractAddress(address)": FunctionFragment; + "uniswapv2FactoryAddress()": FunctionFragment; + "uniswapv2Router02Address()": FunctionFragment; + "wZetaContractAddress()": FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | "gasCoinZRC20ByChainId" + | "gasPriceByChainId" + | "gasZetaPoolByChainId" + | "setGasCoinZRC20" + | "setGasPrice" + | "setWZETAContractAddress" + | "uniswapv2FactoryAddress" + | "uniswapv2Router02Address" + | "wZetaContractAddress" + ): FunctionFragment; + + encodeFunctionData( + functionFragment: "gasCoinZRC20ByChainId", + values: [PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "gasPriceByChainId", + values: [PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "gasZetaPoolByChainId", + values: [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: "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: "setGasCoinZRC20", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setGasPrice", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setWZETAContractAddress", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "uniswapv2FactoryAddress", + 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 TestSystemContract extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: TestSystemContractInterface; + + 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]>; + + 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]>; + + 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; + + 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; + + 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; + + 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; + + 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; + + 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; + + 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; + + 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; + + uniswapv2Router02Address( + overrides?: CallOverrides + ): Promise; + + wZetaContractAddress( + overrides?: CallOverrides + ): Promise; + }; +} diff --git a/typechain-types/contracts/index.ts b/typechain-types/contracts/index.ts index 55a71ca0..54779ebf 100644 --- a/typechain-types/contracts/index.ts +++ b/typechain-types/contracts/index.ts @@ -3,9 +3,8 @@ /* eslint-disable */ import type * as ethZetaMockSol from "./EthZetaMock.sol"; export type { ethZetaMockSol }; -import type * as testSystemContractSol from "./TestSystemContract.sol"; -export type { testSystemContractSol }; import type * as zetaConnectorMockSol from "./ZetaConnectorMock.sol"; export type { zetaConnectorMockSol }; export type { SwapHelperLib } from "./SwapHelperLib"; +export type { TestSystemContract } from "./TestSystemContract"; export type { TestZRC20 } from "./TestZRC20"; diff --git a/typechain-types/factories/contracts/TestSystemContract__factory.ts b/typechain-types/factories/contracts/TestSystemContract__factory.ts new file mode 100644 index 00000000..79207565 --- /dev/null +++ b/typechain-types/factories/contracts/TestSystemContract__factory.ts @@ -0,0 +1,341 @@ +/* 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 { + TestSystemContract, + TestSystemContractInterface, +} from "../../contracts/TestSystemContract"; + +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: "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: [], + 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 = + "0x608060405234801561001057600080fd5b506040516108833803806108838339818101604052810190610032919061013e565b82600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac560405160405180910390a15050506101df565b600081519050610138816101c8565b92915050565b600080600060608486031215610157576101566101c3565b5b600061016586828701610129565b935050602061017686828701610129565b925050604061018786828701610129565b9150509250925092565b600061019c826101a3565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6101d181610191565b81146101dc57600080fd5b50565b610695806101ee6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c806397770dff1161006657806397770dff14610134578063a7cb050714610150578063d7fd7afb1461016c578063d936a0121461019c578063ee2815ba146101ba57610093565b80630be1554714610098578063513a9c05146100c8578063569541b9146100f8578063842da36d14610116575b600080fd5b6100b260048036038101906100ad919061049d565b6101d6565b6040516100bf9190610568565b60405180910390f35b6100e260048036038101906100dd919061049d565b610209565b6040516100ef9190610568565b60405180910390f35b61010061023c565b60405161010d9190610568565b60405180910390f35b61011e610262565b60405161012b9190610568565b60405180910390f35b61014e60048036038101906101499190610470565b610288565b005b61016a6004803603810190610165919061050a565b610325565b005b6101866004803603810190610181919061049d565b610379565b6040516101939190610583565b60405180910390f35b6101a4610391565b6040516101b19190610568565b60405180910390f35b6101d460048036038101906101cf91906104ca565b6103b7565b005b60016020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405161031a9190610568565b60405180910390a150565b80600080848152602001908152602001600020819055507f49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d828260405161036d9291906105c7565b60405180910390a15050565b60006020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b806001600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d828260405161043a92919061059e565b60405180910390a15050565b60008135905061045581610631565b92915050565b60008135905061046a81610648565b92915050565b6000602082840312156104865761048561062c565b5b600061049484828501610446565b91505092915050565b6000602082840312156104b3576104b261062c565b5b60006104c18482850161045b565b91505092915050565b600080604083850312156104e1576104e061062c565b5b60006104ef8582860161045b565b925050602061050085828601610446565b9150509250929050565b600080604083850312156105215761052061062c565b5b600061052f8582860161045b565b92505060206105408582860161045b565b9150509250929050565b610553816105f0565b82525050565b61056281610622565b82525050565b600060208201905061057d600083018461054a565b92915050565b60006020820190506105986000830184610559565b92915050565b60006040820190506105b36000830185610559565b6105c0602083018461054a565b9392505050565b60006040820190506105dc6000830185610559565b6105e96020830184610559565b9392505050565b60006105fb82610602565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600080fd5b61063a816105f0565b811461064557600080fd5b50565b61065181610622565b811461065c57600080fd5b5056fea26469706673582212204385eb79cbfd3f4c16625b097917df623038e4a25f38987349e8b8396577151064736f6c63430008070033"; + +type TestSystemContractConstructorParams = + | [signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: TestSystemContractConstructorParams +): xs is ConstructorParameters => xs.length > 1; + +export class TestSystemContract__factory extends ContractFactory { + constructor(...args: TestSystemContractConstructorParams) { + 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): TestSystemContract { + return super.attach(address) as TestSystemContract; + } + override connect(signer: Signer): TestSystemContract__factory { + return super.connect(signer) as TestSystemContract__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): TestSystemContractInterface { + return new utils.Interface(_abi) as TestSystemContractInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): TestSystemContract { + return new Contract(address, _abi, signerOrProvider) as TestSystemContract; + } +} diff --git a/typechain-types/factories/contracts/index.ts b/typechain-types/factories/contracts/index.ts index fa70578f..6480c14e 100644 --- a/typechain-types/factories/contracts/index.ts +++ b/typechain-types/factories/contracts/index.ts @@ -2,7 +2,7 @@ /* tslint:disable */ /* eslint-disable */ export * as ethZetaMockSol from "./EthZetaMock.sol"; -export * as testSystemContractSol from "./TestSystemContract.sol"; export * as zetaConnectorMockSol from "./ZetaConnectorMock.sol"; export { SwapHelperLib__factory } from "./SwapHelperLib__factory"; +export { TestSystemContract__factory } from "./TestSystemContract__factory"; export { TestZRC20__factory } from "./TestZRC20__factory"; diff --git a/typechain-types/hardhat.d.ts b/typechain-types/hardhat.d.ts index a25b3118..af6107fc 100644 --- a/typechain-types/hardhat.d.ts +++ b/typechain-types/hardhat.d.ts @@ -92,10 +92,6 @@ declare module "hardhat/types/runtime" { name: "SwapHelperLib", signerOrOptions?: ethers.Signer | FactoryOptions ): Promise; - getContractFactory( - name: "SystemContractErrors", - signerOrOptions?: ethers.Signer | FactoryOptions - ): Promise; getContractFactory( name: "TestSystemContract", signerOrOptions?: ethers.Signer | FactoryOptions @@ -209,11 +205,6 @@ declare module "hardhat/types/runtime" { address: string, signer?: ethers.Signer ): Promise; - getContractAt( - name: "SystemContractErrors", - address: string, - signer?: ethers.Signer - ): Promise; getContractAt( name: "TestSystemContract", address: string, diff --git a/typechain-types/index.ts b/typechain-types/index.ts index 9ca133ab..d8fdf55a 100644 --- a/typechain-types/index.ts +++ b/typechain-types/index.ts @@ -48,8 +48,8 @@ export type { ZetaEthMock } from "./contracts/EthZetaMock.sol/ZetaEthMock"; export { ZetaEthMock__factory } from "./factories/contracts/EthZetaMock.sol/ZetaEthMock__factory"; export type { SwapHelperLib } from "./contracts/SwapHelperLib"; export { SwapHelperLib__factory } from "./factories/contracts/SwapHelperLib__factory"; -export type { TestSystemContract } from "./contracts/TestSystemContract.sol/TestSystemContract"; -export { TestSystemContract__factory } from "./factories/contracts/TestSystemContract.sol/TestSystemContract__factory"; +export type { TestSystemContract } from "./contracts/TestSystemContract"; +export { TestSystemContract__factory } from "./factories/contracts/TestSystemContract__factory"; export type { TestZRC20 } from "./contracts/TestZRC20"; export { TestZRC20__factory } from "./factories/contracts/TestZRC20__factory"; export type { ZetaConnectorMockValue } from "./contracts/ZetaConnectorMock.sol/ZetaConnectorMockValue";