UNPKG

ethers-opt

Version:

Collection of heavily optimized functions for ethers.js V6

1 lines 72.6 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ethers"),require("crypto")):"function"==typeof define&&define.amd?define(["exports","ethers","crypto"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ethersOpt={},e.ethers)}(this,function(e,t){"use strict";const n={},a={1:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",11155111:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",8453:"0xB94704422c2a1E396835A571837Aa5AE53285a95",84532:"0x1493b2567056c2181630115660963E13A8E32735"},r={1:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",11155111:"0xce01f8eee7E479C928F8919abD53E553a36CeF67"},i={...r,8453:"0xC6d566A56A1aFf6508b41f6c90ff131615583BCD",84532:"0x6533C94869D28fAA8dF77cc63f9e2b2D6Cf77eBA"},s={8453:".80002105.reverse",84532:".80002105.reverse"},o=new Set(["0xce01f8eee7E479C928F8919abD53E553a36CeF67","0xC6d566A56A1aFf6508b41f6c90ff131615583BCD","0x6533C94869D28fAA8dF77cc63f9e2b2D6Cf77eBA"]);class p extends t.EnsResolver{async supportsWildcard(){return!!o.has(this.address)||super.supportsWildcard()}static async getEnsAddress(e){const t=await e.getNetwork(),n=Number(t.chainId),r=t.getPlugin("org.ethers.plugins.network.Ens"),i=a[n]||r?.address;if(!i)throw new Error(`Network ${n} doesn't have ENS registry address specified`);return i}static async#e(e,n,a){const r=Number((await e.getNetwork()).chainId);if(i[r])return i[r];const s=await p.getEnsAddress(e);try{const r=new t.Contract(s,["function resolver(bytes32) view returns (address)"],e),i=await r.resolver(a||t.namehash(n||""),{enableCcipRead:!0});return i===t.ZeroAddress?null:i}catch(e){throw e}}static async fromName(e,t){let n=t;for(;;){if(""===n||"."===n)return null;if("eth"!==t&&"eth"===n)return null;const a=await p.#e(e,n);if(null!=a){const r=new p(e,a,t);return n===t||await r.supportsWildcard()?r:null}n=n.split(".").slice(1).join(".")}}static async lookupAddress(e,n,a=!0){try{n=t.getAddress(n);const i=Number((await e.getNetwork()).chainId),o=n.substring(2).toLowerCase()+(s[i]||".addr.reverse"),u=t.namehash(o),y=await p.#e(e,"",u);if(null==y||y===t.ZeroAddress)return null;const l=new t.Contract(y,["function reverse(bytes) view returns (string memory, address, address, address)","function name(bytes32) view returns (string)"],e);if(r[i]){const e=t.dnsEncode(o),[a,r]=await l.reverse(e);return a&&r===n?a:null}const c=await l.name(u);if(!c)return null;if(a){if(await e.resolveName(c)!==n)return null}return c}catch(e){if(t.isError(e,"BAD_DATA")&&"0x"===e.value)return null;if(t.isError(e,"CALL_EXCEPTION"))return null;throw e}}async getAddress(e){try{return await super.getAddress(e)}catch(e){if(t.isError(e,"BAD_DATA")&&"0x"===e.value)return null;throw e}}async getText(e){try{return await super.getText(e)}catch(e){if(t.isError(e,"BAD_DATA")&&"0x"===e.value)return null;throw e}}async getContentHash(){try{return await super.getContentHash()}catch(e){if(t.isError(e,"BAD_DATA")&&"0x"===e.value)return null;throw e}}async getAvatar(){try{return await super.getAvatar()}catch(e){if(t.isError(e,"BAD_DATA")&&"0x"===e.value)return null;throw e}}}const u=[{inputs:[{internalType:"address",name:"emitter",type:"address"}],name:"FailedContractCreation",type:"error"},{inputs:[{internalType:"address",name:"emitter",type:"address"},{internalType:"bytes",name:"revertData",type:"bytes"}],name:"FailedContractInitialisation",type:"error"},{inputs:[{internalType:"address",name:"emitter",type:"address"},{internalType:"bytes",name:"revertData",type:"bytes"}],name:"FailedEtherTransfer",type:"error"},{inputs:[{internalType:"address",name:"emitter",type:"address"}],name:"InvalidNonceValue",type:"error"},{inputs:[{internalType:"address",name:"emitter",type:"address"}],name:"InvalidSalt",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newContract",type:"address"},{indexed:!0,internalType:"bytes32",name:"salt",type:"bytes32"}],name:"ContractCreation",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newContract",type:"address"}],name:"ContractCreation",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newContract",type:"address"},{indexed:!0,internalType:"bytes32",name:"salt",type:"bytes32"}],name:"Create3ProxyContractCreation",type:"event"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"bytes32",name:"initCodeHash",type:"bytes32"}],name:"computeCreate2Address",outputs:[{internalType:"address",name:"computedAddress",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"bytes32",name:"initCodeHash",type:"bytes32"},{internalType:"address",name:"deployer",type:"address"}],name:"computeCreate2Address",outputs:[{internalType:"address",name:"computedAddress",type:"address"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"address",name:"deployer",type:"address"}],name:"computeCreate3Address",outputs:[{internalType:"address",name:"computedAddress",type:"address"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"}],name:"computeCreate3Address",outputs:[{internalType:"address",name:"computedAddress",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"nonce",type:"uint256"}],name:"computeCreateAddress",outputs:[{internalType:"address",name:"computedAddress",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"deployer",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"}],name:"computeCreateAddress",outputs:[{internalType:"address",name:"computedAddress",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"}],name:"deployCreate",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"bytes",name:"initCode",type:"bytes"}],name:"deployCreate2",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"}],name:"deployCreate2",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"},{components:[{internalType:"uint256",name:"constructorAmount",type:"uint256"},{internalType:"uint256",name:"initCallAmount",type:"uint256"}],internalType:"struct CreateX.Values",name:"values",type:"tuple"},{internalType:"address",name:"refundAddress",type:"address"}],name:"deployCreate2AndInit",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"},{components:[{internalType:"uint256",name:"constructorAmount",type:"uint256"},{internalType:"uint256",name:"initCallAmount",type:"uint256"}],internalType:"struct CreateX.Values",name:"values",type:"tuple"}],name:"deployCreate2AndInit",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"},{components:[{internalType:"uint256",name:"constructorAmount",type:"uint256"},{internalType:"uint256",name:"initCallAmount",type:"uint256"}],internalType:"struct CreateX.Values",name:"values",type:"tuple"},{internalType:"address",name:"refundAddress",type:"address"}],name:"deployCreate2AndInit",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"},{components:[{internalType:"uint256",name:"constructorAmount",type:"uint256"},{internalType:"uint256",name:"initCallAmount",type:"uint256"}],internalType:"struct CreateX.Values",name:"values",type:"tuple"}],name:"deployCreate2AndInit",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"address",name:"implementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"deployCreate2Clone",outputs:[{internalType:"address",name:"proxy",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"implementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"deployCreate2Clone",outputs:[{internalType:"address",name:"proxy",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"}],name:"deployCreate3",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"bytes",name:"initCode",type:"bytes"}],name:"deployCreate3",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"},{components:[{internalType:"uint256",name:"constructorAmount",type:"uint256"},{internalType:"uint256",name:"initCallAmount",type:"uint256"}],internalType:"struct CreateX.Values",name:"values",type:"tuple"}],name:"deployCreate3AndInit",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"},{components:[{internalType:"uint256",name:"constructorAmount",type:"uint256"},{internalType:"uint256",name:"initCallAmount",type:"uint256"}],internalType:"struct CreateX.Values",name:"values",type:"tuple"}],name:"deployCreate3AndInit",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"},{components:[{internalType:"uint256",name:"constructorAmount",type:"uint256"},{internalType:"uint256",name:"initCallAmount",type:"uint256"}],internalType:"struct CreateX.Values",name:"values",type:"tuple"},{internalType:"address",name:"refundAddress",type:"address"}],name:"deployCreate3AndInit",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"},{components:[{internalType:"uint256",name:"constructorAmount",type:"uint256"},{internalType:"uint256",name:"initCallAmount",type:"uint256"}],internalType:"struct CreateX.Values",name:"values",type:"tuple"},{internalType:"address",name:"refundAddress",type:"address"}],name:"deployCreate3AndInit",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"},{components:[{internalType:"uint256",name:"constructorAmount",type:"uint256"},{internalType:"uint256",name:"initCallAmount",type:"uint256"}],internalType:"struct CreateX.Values",name:"values",type:"tuple"}],name:"deployCreateAndInit",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"},{components:[{internalType:"uint256",name:"constructorAmount",type:"uint256"},{internalType:"uint256",name:"initCallAmount",type:"uint256"}],internalType:"struct CreateX.Values",name:"values",type:"tuple"},{internalType:"address",name:"refundAddress",type:"address"}],name:"deployCreateAndInit",outputs:[{internalType:"address",name:"newContract",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"implementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"deployCreateClone",outputs:[{internalType:"address",name:"proxy",type:"address"}],stateMutability:"payable",type:"function"}];class y{static abi=u;static createInterface(){return new t.Interface(u)}static connect(e,n){return new t.Contract(e,u,n)}}const l=[{inputs:[],name:"aggregator",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"description",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint80",name:"_roundId",type:"uint80"}],name:"getRoundData",outputs:[{internalType:"uint80",name:"roundId",type:"uint80"},{internalType:"int256",name:"answer",type:"int256"},{internalType:"uint256",name:"startedAt",type:"uint256"},{internalType:"uint256",name:"updatedAt",type:"uint256"},{internalType:"uint80",name:"answeredInRound",type:"uint80"}],stateMutability:"view",type:"function"},{inputs:[],name:"latestRoundData",outputs:[{internalType:"uint80",name:"roundId",type:"uint80"},{internalType:"int256",name:"answer",type:"int256"},{internalType:"uint256",name:"startedAt",type:"uint256"},{internalType:"uint256",name:"updatedAt",type:"uint256"},{internalType:"uint80",name:"answeredInRound",type:"uint80"}],stateMutability:"view",type:"function"},{inputs:[],name:"latestAnswer",outputs:[{internalType:"int256",name:"",type:"int256"}],stateMutability:"view",type:"function"},{inputs:[],name:"latestRound",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}];class c{static abi=l;static createInterface(){return new t.Interface(l)}static connect(e,n){return new t.Contract(e,l,n)}}const d=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",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:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],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:"value",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:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];class m{static abi=d;static createInterface(){return new t.Interface(d)}static connect(e,n){return new t.Contract(e,d,n)}}const T=[{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"aggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes[]",name:"returnData",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"allowFailure",type:"bool"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call3[]",name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"allowFailure",type:"bool"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call3Value[]",name:"calls",type:"tuple[]"}],name:"aggregate3Value",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"blockAndAggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes32",name:"blockHash",type:"bytes32"},{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[],name:"getBasefee",outputs:[{internalType:"uint256",name:"basefee",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"}],name:"getBlockHash",outputs:[{internalType:"bytes32",name:"blockHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getBlockNumber",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getChainId",outputs:[{internalType:"uint256",name:"chainid",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockCoinbase",outputs:[{internalType:"address",name:"coinbase",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockDifficulty",outputs:[{internalType:"uint256",name:"difficulty",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockGasLimit",outputs:[{internalType:"uint256",name:"gaslimit",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"getEthBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastBlockHash",outputs:[{internalType:"bytes32",name:"blockHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"requireSuccess",type:"bool"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"tryAggregate",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bool",name:"requireSuccess",type:"bool"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall3.Call[]",name:"calls",type:"tuple[]"}],name:"tryBlockAndAggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes32",name:"blockHash",type:"bytes32"},{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall3.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"}];class b{static abi=T;static createInterface(){return new t.Interface(T)}static connect(e,n){return new t.Contract(e,T,n)}}const h=[{inputs:[{internalType:"contract MultiWrapper",name:"_multiWrapper",type:"address"},{internalType:"contract IOracle[]",name:"existingOracles",type:"address[]"},{internalType:"enum OffchainOracle.OracleType[]",name:"oracleTypes",type:"uint8[]"},{internalType:"contract IERC20[]",name:"existingConnectors",type:"address[]"},{internalType:"contract IERC20",name:"wBase",type:"address"},{internalType:"address",name:"owner_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"ArraysLengthMismatch",type:"error"},{inputs:[],name:"ConnectorAlreadyAdded",type:"error"},{inputs:[],name:"InvalidOracleTokenKind",type:"error"},{inputs:[],name:"MathOverflowedMulDiv",type:"error"},{inputs:[],name:"OracleAlreadyAdded",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"SameTokens",type:"error"},{inputs:[],name:"TooBigThreshold",type:"error"},{inputs:[],name:"UnknownConnector",type:"error"},{inputs:[],name:"UnknownOracle",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IERC20",name:"connector",type:"address"}],name:"ConnectorAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IERC20",name:"connector",type:"address"}],name:"ConnectorRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract MultiWrapper",name:"multiWrapper",type:"address"}],name:"MultiWrapperUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IOracle",name:"oracle",type:"address"},{indexed:!1,internalType:"enum OffchainOracle.OracleType",name:"oracleType",type:"uint8"}],name:"OracleAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"contract IOracle",name:"oracle",type:"address"},{indexed:!1,internalType:"enum OffchainOracle.OracleType",name:"oracleType",type:"uint8"}],name:"OracleRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[{internalType:"contract IERC20",name:"connector",type:"address"}],name:"addConnector",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IOracle",name:"oracle",type:"address"},{internalType:"enum OffchainOracle.OracleType",name:"oracleKind",type:"uint8"}],name:"addOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"connectors",outputs:[{internalType:"contract IERC20[]",name:"allConnectors",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"contract IERC20",name:"dstToken",type:"address"},{internalType:"bool",name:"useWrappers",type:"bool"}],name:"getRate",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"}],name:"getRateToEth",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"},{internalType:"contract IERC20[]",name:"customConnectors",type:"address[]"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateToEthWithCustomConnectors",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateToEthWithThreshold",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"contract IERC20",name:"dstToken",type:"address"},{internalType:"bool",name:"useWrappers",type:"bool"},{internalType:"contract IERC20[]",name:"customConnectors",type:"address[]"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateWithCustomConnectors",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"contract IERC20",name:"dstToken",type:"address"},{internalType:"bool",name:"useWrappers",type:"bool"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRateWithThreshold",outputs:[{internalType:"uint256",name:"weightedRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"bool",name:"useSrcWrappers",type:"bool"},{internalType:"contract IERC20[]",name:"customConnectors",type:"address[]"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRatesAndWeightsToEthWithCustomConnectors",outputs:[{internalType:"uint256",name:"wrappedPrice",type:"uint256"},{components:[{internalType:"uint256",name:"maxOracleWeight",type:"uint256"},{internalType:"uint256",name:"size",type:"uint256"},{components:[{internalType:"uint256",name:"rate",type:"uint256"},{internalType:"uint256",name:"weight",type:"uint256"}],internalType:"struct OraclePrices.OraclePrice[]",name:"oraclePrices",type:"tuple[]"}],internalType:"struct OraclePrices.Data",name:"ratesAndWeights",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"srcToken",type:"address"},{internalType:"contract IERC20",name:"dstToken",type:"address"},{internalType:"bool",name:"useWrappers",type:"bool"},{internalType:"contract IERC20[]",name:"customConnectors",type:"address[]"},{internalType:"uint256",name:"thresholdFilter",type:"uint256"}],name:"getRatesAndWeightsWithCustomConnectors",outputs:[{internalType:"uint256",name:"wrappedPrice",type:"uint256"},{components:[{internalType:"uint256",name:"maxOracleWeight",type:"uint256"},{internalType:"uint256",name:"size",type:"uint256"},{components:[{internalType:"uint256",name:"rate",type:"uint256"},{internalType:"uint256",name:"weight",type:"uint256"}],internalType:"struct OraclePrices.OraclePrice[]",name:"oraclePrices",type:"tuple[]"}],internalType:"struct OraclePrices.Data",name:"ratesAndWeights",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"multiWrapper",outputs:[{internalType:"contract MultiWrapper",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"oracles",outputs:[{internalType:"contract IOracle[]",name:"allOracles",type:"address[]"},{internalType:"enum OffchainOracle.OracleType[]",name:"oracleTypes",type:"uint8[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"connector",type:"address"}],name:"removeConnector",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IOracle",name:"oracle",type:"address"},{internalType:"enum OffchainOracle.OracleType",name:"oracleKind",type:"uint8"}],name:"removeOracle",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract MultiWrapper",name:"_multiWrapper",type:"address"}],name:"setMultiWrapper",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];class f{static abi=h;static createInterface(){return new t.Interface(h)}static connect(e,n){return new t.Contract(e,h,n)}}const g=[{inputs:[],name:"DECIMALS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseFeeScalar",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"blobBaseFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"blobBaseFeeScalar",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[],name:"gasPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1Fee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_unsignedTxSize",type:"uint256"}],name:"getL1FeeUpperBound",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1GasUsed",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"isEcotone",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"isFjord",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"l1BaseFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"overhead",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"scalar",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"setEcotone",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"setFjord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];class w{static abi=g;static createInterface(){return new t.Interface(g)}static connect(e,n){return new t.Contract(e,g,n)}}const v=[{inputs:[{internalType:"uint256",name:"deadline",type:"uint256"}],name:"AllowanceExpired",type:"error"},{inputs:[],name:"ExcessiveInvalidation",type:"error"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"InsufficientAllowance",type:"error"},{inputs:[{internalType:"uint256",name:"maxAmount",type:"uint256"}],name:"InvalidAmount",type:"error"},{inputs:[],name:"InvalidContractSignature",type:"error"},{inputs:[],name:"InvalidNonce",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"InvalidSignatureLength",type:"error"},{inputs:[],name:"InvalidSigner",type:"error"},{inputs:[],name:"LengthMismatch",type:"error"},{inputs:[{internalType:"uint256",name:"signatureDeadline",type:"uint256"}],name:"SignatureExpired",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint160",name:"amount",type:"uint160"},{indexed:!1,internalType:"uint48",name:"expiration",type:"uint48"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"address",name:"spender",type:"address"}],name:"Lockdown",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint48",name:"newNonce",type:"uint48"},{indexed:!1,internalType:"uint48",name:"oldNonce",type:"uint48"}],name:"NonceInvalidation",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint160",name:"amount",type:"uint160"},{indexed:!1,internalType:"uint48",name:"expiration",type:"uint48"},{indexed:!1,internalType:"uint48",name:"nonce",type:"uint48"}],name:"Permit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"uint256",name:"word",type:"uint256"},{indexed:!1,internalType:"uint256",name:"mask",type:"uint256"}],name:"UnorderedNonceInvalidation",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"allowance",outputs:[{internalType:"uint160",name:"amount",type:"uint160"},{internalType:"uint48",name:"expiration",type:"uint48"},{internalType:"uint48",name:"nonce",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint160",name:"amount",type:"uint160"},{internalType:"uint48",name:"expiration",type:"uint48"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint48",name:"newNonce",type:"uint48"}],name:"invalidateNonces",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"wordPos",type:"uint256"},{internalType:"uint256",name:"mask",type:"uint256"}],name:"invalidateUnorderedNonces",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"spender",type:"address"}],internalType:"struct IAllowanceTransfer.TokenSpenderPair[]",name:"approvals",type:"tuple[]"}],name:"lockdown",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"nonceBitmap",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{components:[{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint160",name:"amount",type:"uint160"},{internalType:"uint48",name:"expiration",type:"uint48"},{internalType:"uint48",name:"nonce",type:"uint48"}],internalType:"struct IAllowanceTransfer.PermitDetails[]",name:"details",type:"tuple[]"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"sigDeadline",type:"uint256"}],internalType:"struct IAllowanceTransfer.PermitBatch",name:"permitBatch",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{components:[{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint160",name:"amount",type:"uint160"},{internalType:"uint48",name:"expiration",type:"uint48"},{internalType:"uint48",name:"nonce",type:"uint48"}],internalType:"struct IAllowanceTransfer.PermitDetails",name:"details",type:"tuple"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"sigDeadline",type:"uint256"}],internalType:"struct IAllowanceTransfer.PermitSingle",name:"permitSingle",type:"tuple"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ISignatureTransfer.TokenPermissions",name:"permitted",type:"tuple"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct ISignatureTransfer.PermitTransferFrom",name:"permit",type:"tuple"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"requestedAmount",type:"uint256"}],internalType:"struct ISignatureTransfer.SignatureTransferDetails",name:"transferDetails",type:"tuple"},{internalType:"address",name:"owner",type:"address"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"permitTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ISignatureTransfer.TokenPermissions[]",name:"permitted",type:"tuple[]"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct ISignatureTransfer.PermitBatchTransferFrom",name:"permit",type:"tuple"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"requestedAmount",type:"uint256"}],internalType:"struct ISignatureTransfer.SignatureTransferDetails[]",name:"transferDetails",type:"tuple[]"},{internalType:"address",name:"owner",type:"address"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"permitTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ISignatureTransfer.TokenPermissions",name:"permitted",type:"tuple"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct ISignatureTransfer.PermitTransferFrom",name:"permit",type:"tuple"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"requestedAmount",type:"uint256"}],internalType:"struct ISignatureTransfer.SignatureTransferDetails",name:"transferDetails",type:"tuple"},{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32",name:"witness",type:"bytes32"},{internalType:"string",name:"witnessTypeString",type:"string"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"permitWitnessTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],internalType:"struct ISignatureTransfer.TokenPermissions[]",name:"permitted",type:"tuple[]"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct ISignatureTransfer.PermitBatchTransferFrom",name:"permit",type:"tuple"},{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"requestedAmount",type:"uint256"}],internalType:"struct ISignatureTransfer.SignatureTransferDetails[]",name:"transferDetails",type:"tuple[]"},{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32",name:"witness",type:"bytes32"},{internalType:"string",name:"witnessTypeString",type:"string"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"permitWitnessTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint160",name:"amount",type:"uint160"},{internalType:"address",name:"token",type:"address"}],internalType:"struct IAllowanceTransfer.AllowanceTransferDetails[]",name:"transferDetails",type:"tuple[]"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint160",name:"amount",type:"uint160"},{internalType:"address",name:"token",type:"address"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}];class C{static abi=v;static createInterface(){return new t.Interface(v)}static connect(e,n){return new t.Contract(e,v,n)}}const A=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"guy",type:"address"},{name:"wad",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"src",type:"address"},{name:"dst",type:"address"},{name:"wad",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"wad",type:"uint256"}],name:"withdraw",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"dst",type:"address"},{name:"wad",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[],name:"deposit",outputs:[],payable:!0,stateMutability:"payable",type:"function"},{constant:!0,inputs:[{name:"",type:"address"},{name:"",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"src",type:"address"},{indexed:!0,name:"guy",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"src",type:"address"},{indexed:!0,name:"dst",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"dst",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"src",type:"address"},{indexed:!1,name:"wad",type:"uint256"}],name:"Withdrawal",type:"event"}];class P{static abi=A;static createInterface(){return new t.Interface(A)}static connect(e,n){return new t.Contract(e,A,n)}}var x=Object.freeze({__proto__:null,CreateX__factory:y,DataFeed__factory:c,ERC20__factory:m,Multicall__factory:b,OffchainOracle__factory:f,OpGasPriceOracle__factory:w,Permit2__factory:C,WETH__factory:P});BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});function M(e,t=5,n=1e3){if(e<1)throw new Error("ratePerSecond must be >= 1");if(t<1)throw new Error("maxBatch must be >= 1");const a=e*((n>1e3?n:1e3)/1e3),r=Math.min(t,Math.floor(a)),i=Math.max(r,1);return{concurrency:Math.max(1,Math.floor(a/i)),batchSize:i,delays:n}}function I(e,t,n=1e3,a=!1){const r=[];if(t-e>n)for(let a=e;a<t+1;a+=n){const e=a+n-1>t?t:a+n-1;r.push({fromBlock:a,toBlock:e})}else{if(!(t-e>=0))throw new Error(`Invalid block range ${e}~${t}`);r.push({fromBlock:e,toBlock:t})}return a&&r.reverse(),r}function k(e,t,n=1){return Array(Math.ceil((t-e)/n)+1).fill(e).map((e,t)=>e+t*n)}function S(e,t){return[...Array(Math.ceil(e.length/t))].map((n,a)=>e.slice(t*a,t+t*a))}function B(e){return new Promise(t=>setTimeout(t,e))}const F=globalThis.crypto;async function E(e,t="SHA-256"){return new Uint8Array(await F.subtle.digest(t,e))}function R(e){let t="bigint"==typeof e?e.toString(16):e;return t.startsWith("0x")&&(t=t.slice(2)),t.length%2!=0&&(t="0"+t),Uint8Array.from(t.match(/.{1,2}/g).map(e=>parseInt(e,16)))}function D(e){return"0x"+Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")}function N(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function _(e){return btoa(e.reduce((e,t)=>e+String.fromCharCode(t),""))}function O(e){return e&&"object"==typeof e&&"getTopicFilter"in e&&"function"==typeof e.getTopicFilter&&e.fragment}async function G(e,n){let a,r=null;if(Array.isArray(n)){const r=function(n){if(t.isHexString(n,32))return n;const a=e.getEvent(n);return t.assertArgument(a,"unknown fragment","name",n),a.topicHash};a=n.map(e=>null==e?null:Array.isArray(e)?e.map(r):r(e))}else"*"===n?a=[null]:"string"==typeof n?t.isHexString(n,32)?a=[n]:(r=e.getEvent(n),t.assertArgument(r,"unknown fragment","event",n),a=[r.topicHash]):O(n)?a=await n.getTopicFilter():"fragment"in n?(r=n.fragment,a=[r.topicHash]):t.assertArgument(!1,"unknown event name","event",n);a=a.map(e=>{if(null==e)return null;if(Array.isArray(e)){const t=Array.from(new Set(e.map(e=>e.toLowerCase())).values());return 1===t.length?t[0]:(t.sort(),t)}return e.toLowerCase()});return{fragment:r,tag:a.map(e=>null==e?"null":Array.isArray(e)?e.join("|"):e).join("&"),topics:a}}async function L({address:e,provider:n,contract:a,event:r,fromBlock:i,toBlock:s}){!e&&a?e=a.target:"*"===e&&(e=void 0),!n&&a&&(n=a.runner?.provider||a.runner),r||(r="*"),i||0===i||(i=0),s||0===s||(s="latest");let o=null,p=[null];a&&({fragment:o,topics:p}=await G(a.interface,r));const u={address:e,topics:p,fromBlock:i,toBlock:s};return t.assert(n,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await n.getLogs(u)).map(e=>{let r=o;if(null==r&&a)try{r=a.interface.getEvent(e.topics[0])}catch{}if(r&&a)try{return new t.EventLog(e,a.interface,r)}catch(n){return new t.UndecodedEventLog(e,n)}return new t.Log(e,n)})}async function H(e,t,n){const a=e,r=n||await e.getNetwork(),i=t?a._getBlockTag(t):"latest",s=await a.send("eth_getBlockReceipts",[i]);if(!s)throw new Error(`No block receipts for ${t}`);return s.map(e=>a._wrapTransactionReceipt(e,r))}function W(e,n,a){return{from:e.from?t.getAddress(e.from):"",gas:Number(e.gas||0),gasUsed:Number(e.gasUsed||0),to:e.to?t.getAddress(e.to):"",input:e.input,output:e.output,calls:e.calls,value:BigInt(e.value||0),type:e.type,blockNumber:a.number,blockHash:a.hash||void 0,txHash:n}}async function U(e,t,n=!1){const a=t?e._getBlockTag(t):"latest",r=66===a.length?"debug_traceBlockByHash":"debug_traceBlockByNumber",[i,s]=await Promise.all(["number"==typeof t?{number:t,hash:void 0}:e.getBlock(a),e.send(r,[a,{tracer:"callTracer",traceConfig:{onlyTopCall:n}}])]);if(!i)throw new Error(`Invalid block for ${t}`);if(!s)throw new Error(`No trace results for block ${t}`);return s.map(({txHash:e,result:t})=>W(t,e,i))}async function q(e,t,n=!1,a){const[r,i]=await Promise.all([a||e.getTransaction(t),e.send("debug_traceTransaction",[t,{tracer:"callTracer",traceConfig:{onlyTopCall:n}}])]);if(!r)throw new Error(`Invalid tx for ${r}`);if(!i)throw new Error(`No trace results for tx ${t}`