@wardenswap/bestrate-sdk-beta 2.7.0 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +39 -24
- package/dist/index.es.d.ts +39 -24
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{ethers as e,utils as t,Contract as a}from"ethers";var n;!function(e){e[e.DEBUG=8]="DEBUG",e[e.LOG=4]="LOG",e[e.WARN=2]="WARN",e[e.ERROR=1]="ERROR",e[e.SILENT=0]="SILENT"}(n||(n={}));class s{constructor(e){this.level=e}static overrideLogger(e){i=e}log(e,...t){if(this.level>=n.LOG){let a=e;e instanceof Function&&(a=e()),console.log((new Date).toISOString(),"INFO",a,...t)}}error(e,...t){if(this.level>=n.ERROR){let a=e;e instanceof Function&&(a=e()),console.error((new Date).toISOString(),"ERROR",a,...t)}}warn(e,...t){if(this.level>=n.WARN){let a=e;e instanceof Function&&(a=e()),console.warn((new Date).toISOString(),"WARN",a,...t)}}debug(e,...t){if(this.level>=n.DEBUG){let a=e;e instanceof Function&&(a=e()),console.debug((new Date).toISOString(),"DEBUG",a,...t)}}table(e,t){if(this.level>=n.DEBUG){let a=e;e instanceof Function&&(a=e()),void 0===t?console.table(a):console.table(a,t)}}}let i=new s(n.SILENT);const d={bsc:92360n,polygon:80662n,arbitrum:414810n,ethereum:94906n,avalanche:102011n,optimism:109683n},c={bsc:95785n,polygon:100000n,arbitrum:341712n,ethereum:97983n,avalanche:107322n,optimism:106373n},r={bsc:76191n,polygon:55000n,arbitrum:294000n,ethereum:67200n,avalanche:83930n,optimism:64000n},o={bsc:93650n,polygon:66000n,arbitrum:281000n,ethereum:65000n,avalanche:80450n,optimism:51000n},f={bsc:{constant:0n,multiplier:4700n},polygon:{constant:0n,multiplier:4700n},arbitrum:{constant:0n,multiplier:3000n},ethereum:{constant:0n,multiplier:2000n},avalanche:{constant:0n,multiplier:5000n},optimism:{constant:0n,multiplier:3000n}},l={bsc:{constant:0n,multiplier:4700n},polygon:{constant:0n,multiplier:4700n},arbitrum:{constant:0n,multiplier:3700n},ethereum:{constant:0n,multiplier:3700n},avalanche:{constant:0n,multiplier:4700n},optimism:{constant:0n,multiplier:3700n}},b={bsc:20000n,polygon:20000n,arbitrum:25000n,ethereum:15000n,avalanche:15000n,optimism:25000n},h={optimism:{perRoute:48n,perPath:0n,initialSingle:5278n,initialSplit:5278n,ethWeth:1000n,wethEth:3500n},arbitrum:{perRoute:108n,perPath:60n,initialSingle:2788n,initialSplit:2884n,ethWeth:1964n,wethEth:2188n}};var u;function p(e){return e===u.arbitrum||e===u.optimism}!function(e){e.bsc="bsc",e.arbitrum="arbitrum",e.polygon="polygon",e.ethereum="ethereum",e.avalanche="avalanche",e.optimism="optimism"}(u||(u={}));const x={bsc:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",arbitrum:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",polygon:"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",ethereum:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",avalanche:"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",optimism:"0x4200000000000000000000000000000000000006"},g={bsc:"0x9cbd1322c3d029d32357808665dcae5c286c7081",polygon:"0x2a1beadcebbb72ed3f1c6eda4a86c7f3fd963b1c",arbitrum:"0xd02e02821ed3a648a028918840fed818933610f7",ethereum:"0x6b7ac96a0698bbcd80dbb7b17130d0a94284bd4d",avalanche:"0x5781d7645ad1c0e3d19365324f0b910e8a977974",optimism:"0xe2f50042766bdea8bcbfa0ff6a94bab65f897826"},m={bsc:"0x451ef8d6b645a60115eb8b8bea76b39c0c761004",polygon:"0x030b8b7bf245e762736e65c0903295447b898c30",arbitrum:"0x79a556ef2c5b613db3dfa8797e6772c5aaf86834",ethereum:"0x39f97198c5dbc193eb962c4b3b7e447091a18eab",avalanche:"0x5ef960eb78b8cfc11e654d03beeb313badf5c7c0",optimism:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},C={arbitrum:"0x0000000000000000000000000000000000000066",optimism:"0x71762f1fdc36afc769a25dcd73226c6edca6832a",bsc:"0x0000000000000000000000000000000000000000",polygon:"0x0000000000000000000000000000000000000000",ethereum:"0x0000000000000000000000000000000000000000",avalanche:"0x0000000000000000000000000000000000000000"},I={bsc:"0xca11bde05977b3631167028862be2a173976ca11",arbitrum:"0xca11bde05977b3631167028862be2a173976ca11",polygon:"0xca11bde05977b3631167028862be2a173976ca11",ethereum:"0xca11bde05977b3631167028862be2a173976ca11",avalanche:"0xca11bde05977b3631167028862be2a173976ca11",optimism:"0xca11bde05977b3631167028862be2a173976ca11"},T={bsc:{address:"0xe9e7cea3dedca5984780bafc599bd69add087d56",decimals:18},arbitrum:{address:"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",decimals:6},polygon:{address:"0x2791bca1f2de4661ed88a30c99a7a9449aa84174",decimals:6},ethereum:{address:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",decimals:6},avalanche:{address:"0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664",decimals:6},optimism:{address:"0x7f5c764cbc14f9669b88837ca1490cca17c31607",decimals:6}},y={bsc:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18},arbitrum:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18},polygon:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18},ethereum:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18},avalanche:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18},optimism:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18}},A={bsc:{address:x.bsc,decimals:18},arbitrum:{address:x.arbitrum,decimals:18},polygon:{address:x.polygon,decimals:18},ethereum:{address:x.ethereum,decimals:18},avalanche:{address:x.avalanche,decimals:18},optimism:{address:x.optimism,decimals:18}},k={bsc:25,arbitrum:25,polygon:25,ethereum:25,avalanche:25,optimism:10},E=18;function N(e,t,a){return t>a?e/10n**BigInt(t-a):t<a?e*10n**BigInt(a-t):e}function O(e,t,a){return N(e*t,E,a)}function P(e,t,a){const n={l1:{dest:e.l1[t],usd:e.l1[a].fee}};return void 0!==e.l2&&(n.l2={dest:e.l2[t],usd:e.l2[a].fee}),n}function S(e,t,a){const n=O(e,t.dest.fee,t.dest.decimals),s=O(e,t.usd,E);return void 0===a?{dest:n,unit:e,usd:s}:{dest:a.dest+n,unit:a.unit+e,usd:a.usd+s}}function D(){return{execution:{initial:0n,variable:{constant:0n,multiplier:0n},pathVariable:0n},price:{l1:{dest:{decimals:0,fee:0n},usd:0n}}}}function w(t){const{dest:a,unit:n,usd:s}=t;return{dest:a.toString(),unit:n.toString(),usd:e.utils.formatUnits(s,E)}}function _(e,t,a=!0){a&&i.log("[Best Rate Single]","Finding best rate");let n=e.map((()=>({dest:0n,unit:0n,usd:0n})));const s=void 0!==t.gas.price.l2?t.gas.price.l2:t.gas.price.l1,d=t.gas.execution;if(n=n.map((e=>S(d.initial,s,e))),n=n.map(((t,a)=>S(e[a].gas,s,t))),n=n.map(((t,a)=>S(d.variable.constant+d.variable.multiplier*BigInt(e[a].routeIndexes.length),s,t))),void 0!==t.gas.price.l2){const a=t.gas.l2Calldata,s=t.gas.price.l1;n=n.map(((t,n)=>(t=S(a.initialSingle,s,t),S(a.perRoute*BigInt(e[n].routeIndexes.length),s,t))))}a&&(i.debug("[Best Rate Single]","=== Gas Fees ==="),i.table((()=>n.map((e=>w(e))))));const c=e.map((({amountOut:e,gas:t,...a},s)=>({amountOut:e-n[s].dest,gasFee:n[s],...a})));let r=c.reduce(((e,t)=>{return a=e,(n=t).amountOut>a.amountOut?n:a;var a,n}),c.length>0?c[0]:{amountOut:0n,tokens:[],gasFee:{dest:0n,unit:0n,usd:0n},routeIndexes:[]});return a&&(i.debug("[Best Rate Single]","All possible results (gas deducted):"),i.table((()=>c.map((e=>{const{gasFee:t,...a}=v(e);return{...a,gasFee:t.dest}}))))),r.amountOut=r.amountOut+r.gasFee.dest,r}function v(e,t){const{amountOut:a,tokens:n,routeIndexes:s,gasFee:i}=e;let d=s;return void 0!==t&&(d=s.map((e=>t.getRouteInfo(e).name))),{amountOut:a.toString(),routes:d,tokens:n,gasFee:w(i)}}class R{constructor(e,t){this.itemWV=e,this.maxWeight=t;for(let e=0,t=this.itemWV.length;e<t;++e)this.itemWV[e].push([0,0n])}compute(){if(0===this.itemWV.length)return[];this.previousMaxValueMem=Array.from({length:this.maxWeight+1},(()=>-1n)),this.previousItemSelection=Array.from({length:this.maxWeight+1},(()=>[]));for(let e=0,t=this.itemWV[0].length;e<t;++e)for(let t=this.itemWV[0][e][0],a=this.maxWeight;t<=a;++t){const a=this.itemWV[0][e][1];this.previousMaxValueMem[t]<a&&(this.previousMaxValueMem[t]=a,this.previousItemSelection[t]=[[0,e]])}for(let e=1,t=this.itemWV.length;e<t;++e){this.currentMaxValueMem=Array.from({length:this.maxWeight+1},(()=>-1n)),this.currentItemSelection=Array.from({length:this.maxWeight+1},(()=>[]));for(let t=0,a=this.itemWV[e].length;t<a;++t){for(let a=this.itemWV[e][t][0],n=this.maxWeight;a<=n;++a){const n=a-this.itemWV[e][t][0],s=this.itemWV[e][t][1];this.previousMaxValueMem[n]>=0&&this.currentMaxValueMem[a]<s+this.previousMaxValueMem[n]&&(this.currentMaxValueMem[a]=s+this.previousMaxValueMem[n],this.currentItemSelection[a]=this.previousItemSelection[n].map((e=>[...e])),this.currentItemSelection[a].push([e,t]))}}let t=this.previousMaxValueMem;this.previousMaxValueMem=this.currentMaxValueMem,this.currentMaxValueMem=t;let a=this.previousItemSelection;this.previousItemSelection=this.currentItemSelection,this.currentItemSelection=a}return this.previousItemSelection[this.maxWeight].filter((e=>e[1]<this.itemWV[e[0]].length-1))}}const B=Array.from({length:100},((e,t)=>t+1));function M(e,t){return{paths:e.paths.map((e=>{let a="src -",n=e.routeIndexes;return void 0!==t&&(n=e.routeIndexes.map((e=>t.getRouteInfo(e).name))),e.tokens.forEach(((e,t)=>{a+=`${n[t]}-> ${e} -`})),a+=`${n[n.length-1]}-> dest`,a})),volumes:e.volumns,amount:e.amountOut.toString(),gasFee:{usd:e.gasFee.usd.toString(),dest:e.gasFee.dest.toString(),unit:e.gasFee.unit.toString()}}}const F=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",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:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],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:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",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:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",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:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}];class U{static createInterface(){return new t.Interface(F)}static connect(e,t){return new a(e,F,t)}}U.abi=F;const L=[{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall2.Call[]",name:"calls",type:"tuple[]"}],name:"aggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes[]",name:"returnData",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall2.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 Multicall2.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"nonpayable",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:"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 Multicall2.Call[]",name:"calls",type:"tuple[]"}],name:"tryAggregate",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall2.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bool",name:"requireSuccess",type:"bool"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall2.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 Multicall2.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"nonpayable",type:"function"}];class V{static createInterface(){return new t.Interface(L)}static connect(e,t){return new a(e,L,t)}}V.abi=L;const W=[{inputs:[{internalType:"contract IWardenPreTrade2",name:"_preTrade",type:"address"},{internalType:"contract IWETH",name:"_weth",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"partnerId",type:"uint256"},{indexed:!0,internalType:"contract IERC20",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"PartnerFee",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract IERC20",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ProtocolFee",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"srcAsset",type:"address"},{indexed:!1,internalType:"uint256",name:"srcAmount",type:"uint256"},{indexed:!0,internalType:"address",name:"destAsset",type:"address"},{indexed:!1,internalType:"uint256",name:"destAmount",type:"uint256"},{indexed:!0,internalType:"address",name:"trader",type:"address"},{indexed:!1,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"bool",name:"hasSplitted",type:"bool"}],name:"Trade",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract IWardenPreTrade2",name:"preTrade",type:"address"}],name:"UpdatedWardenPreTrade",type:"event"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"collectRemainingEther",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"_token",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"collectRemainingToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"preTrade",outputs:[{internalType:"contract IWardenPreTrade2",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IWardenSwap2",name:"_swap",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"address",name:"_deposits",type:"address"},{internalType:"contract IERC20",name:"_src",type:"address"},{internalType:"uint256",name:"_srcAmount",type:"uint256"},{internalType:"contract IERC20",name:"_dest",type:"address"},{internalType:"uint256",name:"_minDestAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"},{internalType:"uint256",name:"_partnerId",type:"uint256"},{internalType:"uint256",name:"_metaData",type:"uint256"}],name:"swap",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract IWardenSwap2",name:"_swap",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"address[]",name:"_deposits",type:"address[]"},{internalType:"uint256[]",name:"_volumes",type:"uint256[]"},{internalType:"contract IERC20",name:"_src",type:"address"},{internalType:"uint256",name:"_totalSrcAmount",type:"uint256"},{internalType:"contract IERC20",name:"_dest",type:"address"},{internalType:"uint256",name:"_minDestAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"},{internalType:"uint256",name:"_partnerId",type:"uint256"},{internalType:"uint256",name:"_metaData",type:"uint256"}],name:"swapSplit",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_receiver",type:"address"}],name:"tradeEthToWeth",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"_srcAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"}],name:"tradeWethToEth",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IWardenPreTrade2",name:"_preTrade",type:"address"}],name:"updateWardenPreTrade",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"weth",outputs:[{internalType:"contract IWETH",name:"",type:"address"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}];class q{static createInterface(){return new t.Interface(W)}static connect(e,t){return new a(e,W,t)}}q.abi=W;const X=[{inputs:[{internalType:"contract IWardenPreTrade2",name:"_preTrade",type:"address"},{internalType:"contract IWETH",name:"_weth",type:"address"},{internalType:"contract IArbAddressTable",name:"_addressTable",type:"address"},{internalType:"bool",name:"_autoRegisterAddressMapping",type:"bool"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"partnerId",type:"uint256"},{indexed:!0,internalType:"contract IERC20",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"PartnerFee",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract IERC20",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ProtocolFee",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"_enable",type:"bool"}],name:"SetAutoRegisterAddressMapping",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"srcAsset",type:"address"},{indexed:!1,internalType:"uint256",name:"srcAmount",type:"uint256"},{indexed:!0,internalType:"address",name:"destAsset",type:"address"},{indexed:!1,internalType:"uint256",name:"destAmount",type:"uint256"},{indexed:!0,internalType:"address",name:"trader",type:"address"},{indexed:!1,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"bool",name:"hasSplitted",type:"bool"}],name:"Trade",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract IWardenPreTrade2",name:"preTrade",type:"address"}],name:"UpdatedWardenPreTrade",type:"event"},{inputs:[],name:"addressTable",outputs:[{internalType:"contract IArbAddressTable",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"autoRegisterAddressMapping",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"collectRemainingEther",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"_token",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"collectRemainingToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"uint256",name:"_cursor",type:"uint256"}],name:"decodeSwapData",outputs:[{components:[{internalType:"address",name:"swap",type:"address"},{internalType:"address",name:"src",type:"address"},{internalType:"address",name:"dest",type:"address"},{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"srcAmount",type:"uint256"},{internalType:"uint256",name:"minDestAmount",type:"uint256"},{internalType:"uint256",name:"partnerId",type:"uint256"},{internalType:"uint256",name:"metaData",type:"uint256"}],internalType:"struct WardenDataDeserialize2.SwapData",name:"_swapData",type:"tuple"},{internalType:"uint256",name:"_newCursor",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"preTrade",outputs:[{internalType:"contract IWardenPreTrade2",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bool",name:"_enable",type:"bool"}],name:"setAutoRegisterAddressMapping",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IWardenSwap2",name:"_swap",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"address",name:"_deposits",type:"address"},{internalType:"contract IERC20",name:"_src",type:"address"},{internalType:"uint256",name:"_srcAmount",type:"uint256"},{internalType:"contract IERC20",name:"_dest",type:"address"},{internalType:"uint256",name:"_minDestAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"},{internalType:"uint256",name:"_partnerId",type:"uint256"},{internalType:"uint256",name:"_metaData",type:"uint256"}],name:"swap",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"swapCompressed",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract IWardenSwap2",name:"_swap",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"address[]",name:"_deposits",type:"address[]"},{internalType:"uint256[]",name:"_volumes",type:"uint256[]"},{internalType:"contract IERC20",name:"_src",type:"address"},{internalType:"uint256",name:"_totalSrcAmount",type:"uint256"},{internalType:"contract IERC20",name:"_dest",type:"address"},{internalType:"uint256",name:"_minDestAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"},{internalType:"uint256",name:"_partnerId",type:"uint256"},{internalType:"uint256",name:"_metaData",type:"uint256"}],name:"swapSplit",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"swapSplitCompressed",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_receiver",type:"address"}],name:"tradeEthToWeth",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"_srcAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"}],name:"tradeWethToEth",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IWardenPreTrade2",name:"_preTrade",type:"address"}],name:"updateWardenPreTrade",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"weth",outputs:[{internalType:"contract IWETH",name:"",type:"address"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}];class H{static createInterface(){return new t.Interface(X)}static connect(e,t){return new a(e,X,t)}}function G(e){return x[e]}H.abi=X;const K="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";var z;function Q(e,t){return e.toLocaleLowerCase()===K&&(e=G(t)),e}!function(e){e[e.ETH2WETH=0]="ETH2WETH",e[e.WETH2ETH=1]="WETH2ETH",e[e.BESTRATE=2]="BESTRATE"}(z||(z={}));const Y=10n**BigInt(E),Z=100n*10n**BigInt(E);function $(e,t,a){return void 0!==a?a/e:e*t}function j(e,t,a,n,s,d){const c={};a=N(a,n,E);const r=$(e[s.address],a),o=Object.keys(e);for(let n=0,i=o.length;n<i;++n)if(o[n]===s.address)c[s.address]={fee:a,decimals:s.decimals};else{const s=t[o[n]];c[o[n]]={fee:$(e[o[n]],a,r),decimals:s}}const f={[d.address]:{fee:r/Y,decimals:d.decimals},...c};return i.log("[Gas Estimation]","Gas Price Unit",a.toString()),i.log("[Gas Estimation]","Gas price:",{usd:f[d.address].fee.toString()}),f}function J(e,t,a,n,s,d,c){const r=e.getTokenPriceRoutes(d.address,d.decimals,[s.address,n.address]),o={[s.address]:s.decimals,[n.address]:n.decimals,...e.corrTokenDecimals},f=function(e,t){const a=Object.keys(e),n={},s={};for(let d=0,c=a.length;d<c;++d){const c=_(e[a[d]],{gas:{execution:{initial:0n,variable:{constant:0n,multiplier:0n},pathVariable:0n},price:{l1:{dest:{decimals:0,fee:0n},usd:0n}}}},!1);i.debug(`Token price for ${a[d]}: ${c.amountOut}`),n[a[d]]=c,s[a[d]]=Z*Y/N(c.amountOut,t[a[d]],E)}return s}(r,o);i.debug((()=>f)),i.debug((()=>o));const l={l1:j(f,o,t,a,n,d)};return void 0!==c&&(l.l2=j(f,o,c,a,n,d)),l}var ee;!function(e){e[e.UniswapV2=0]="UniswapV2",e[e.UniswapV3=1]="UniswapV3",e[e.PancakeV3=2]="PancakeV3",e[e.VelodromeSS=3]="VelodromeSS",e[e.DMM=4]="DMM",e[e.CurvePlain=5]="CurvePlain",e[e.CurveMeta=6]="CurveMeta",e[e.CurvePlainSol=7]="CurvePlainSol",e[e.Iron=8]="Iron",e[e.Synapse=9]="Synapse",e[e.CurveMetaSol=10]="CurveMetaSol",e[e.CurveCrypto=11]="CurveCrypto",e[e.CurveTriCryptoNG=12]="CurveTriCryptoNG",e[e.CurveLendingA=13]="CurveLendingA",e[e.CurveLendingCryptoZap=14]="CurveLendingCryptoZap",e[e.CurveLendingCryptoTwoZap=15]="CurveLendingCryptoTwoZap",e[e.PolyDex=16]="PolyDex",e[e.FireBirdWeighted=17]="FireBirdWeighted",e[e.BalancerWeighted=18]="BalancerWeighted",e[e.BalancerStable=19]="BalancerStable",e[e.BalancerMetaStable=20]="BalancerMetaStable",e[e.BalancerBoostedStable=21]="BalancerBoostedStable",e[e.BalancerLinear=22]="BalancerLinear",e[e.BalancerLiquidityBootstrapping=23]="BalancerLiquidityBootstrapping",e[e.Biswap=24]="Biswap",e[e.DodoV1=25]="DodoV1",e[e.DodoV2=26]="DodoV2",e[e.Mdex=27]="Mdex",e[e.Mars=28]="Mars",e[e.Smoothy=29]="Smoothy",e[e.Shibaswap=30]="Shibaswap",e[e.GmxDex=31]="GmxDex",e[e.Solidly=32]="Solidly",e[e.VelodromeV2=33]="VelodromeV2",e[e.Synthetix=34]="Synthetix",e[e.Unknown=35]="Unknown"}(ee||(ee={}));const te=I.arbitrum,ae=[{id:"66d95ca4-28ff-45ab-b82a-15d54ed4197a",address:"0xdcc3a56e97a7448c64341e38867241f65168817d",name:"SUSHI",gas:80933n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xc35dadb65012ec5796536bd9864ed8773abc74c4",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"},{id:"35ae2524-0570-452c-ad57-8e0e627a9886",address:"0x493f1b81b05e29e86d9a4762944ed8b5fd2924a5",name:"UNI:V3F500",gas:111091n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:500n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:20,tickQuerier:"0x3ffecb3df6c24b3676cafd408b561065337326c9"},{id:"8db6276e-5297-49aa-a005-2182ba762857",address:"0x02800d3d33e7e9d32c586fcaaea0412e5a57792d",name:"UNI:V3F3000",gas:121189n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:3000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:20,tickQuerier:"0x3ffecb3df6c24b3676cafd408b561065337326c9"},{id:"3bb43bcb-170f-4b9a-97ac-95050f157714",address:"0x2c49bdff3acb931491d1c0231952d9718c516539",name:"UNI:V3F10000",gas:96497n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:10000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:20,tickQuerier:"0x3ffecb3df6c24b3676cafd408b561065337326c9"},{id:"2cb63ea5-b2d9-4edc-afdd-5f4028216a7b",address:"0x166612320d53575c91c8988ba73ca8b34297fcd5",name:"BALANCER:WETHWBTCUSDC",gas:125837n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x64541216bafffeec8ea535bb71fbc927831d0595000100000000000000000002",scalingFactors:[10000000000n,1n,1000000000000n],tokens:["0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f","0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[333333333333333333n,333333333333333334n,333333333333333333n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"a3bd5712-7180-4181-8ed9-fce7f095acfa",address:"0x2208705b6f232ef498d46514b5130192789e9dc8",name:"BALANCER:DAIUSDTUSDC",gas:161222n,model:ee.BalancerStable,isTradingAllowed:!0,aPrecision:1000n,scalingFactors:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0xda10009cbd5d07dd0cecc66161fc93d7c9000da1","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9","0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",poolId:"0x1533a3278f3f9141d5f820a184ea4b017fce2382000000000000000000000016",depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"aae33579-5d27-4c8e-acd7-cc3c00402552",address:"0x815f667a542653d89d44ff9d09b11dd7d4d78004",name:"BALANCER:BALWETH",gas:119645n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xcc65a812ce382ab909a11e434dbf75b34f1cc59d000200000000000000000001",scalingFactors:[1n,1n],tokens:["0x040d1edc9569d4bab2d15287dc5a4f10f56a56b8","0x82af49447d8a07e3bd95bd0d56f35241523fbab1"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[600000000000000000n,400000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"a29709c4-157d-462b-a2e5-7e0c7b364f9e",address:"0x81d10cbea2b7e2ce9589cfe48442a83f013885ab",name:"BALANCER:LINKWETH",gas:119150n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x651e00ffd5ecfa7f3d4f33d62ede0a97cf62ede2000200000000000000000006",scalingFactors:[1n,1n],tokens:["0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0xf97f4df75117a78c1a5a0dbb814af92458539fb4"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[200000000000000000n,800000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"3d8e0b66-8831-43bc-b2d6-361c43c4d419",address:"0xe2f50042766bdea8bcbfa0ff6a94bab65f897826",name:"BALANCER:STGUSDC",gas:116392n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x3a4c6d2404b5eb14915041e01f63200a82f4a343000200000000000000000065",scalingFactors:[1n,1000000000000n],tokens:["0x6694340fc020c5e6b96567843da2df01b2ce1eb6","0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"fa7866bc-f73c-4fba-8094-a4afc356385e",address:"0xafeb1dc3f5a10577ba84bc9df63cb74930b86bf0",name:"BALANCER:WETHVSTA",gas:109084n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xc61ff48f94d801c1ceface0289085197b5ec44f000020000000000000000004d",scalingFactors:[1n,1n],tokens:["0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0xa684cd057951541187f288294a1e1c2646aa2d24"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"71937b88-7990-4882-8d42-a4938505ef01",address:"0x24928cfc2688407061615ad76d9d396ded9b2f2b",name:"BALANCER:COMPWETH",gas:119161n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xa6625f741400f90d31e39a17b0d429a92e347a6000020000000000000000000e",scalingFactors:[1n,1n],tokens:["0x354a6da3fcde098f8389cad84b0182725c6c91de","0x82af49447d8a07e3bd95bd0d56f35241523fbab1"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[800000000000000000n,200000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"8e5c3a47-103e-4bb6-a753-d477db1a4f18",address:"0x7d125de51f4bbaabb1ba40791f88ffebe44d26d1",name:"BALANCER:GNOWETH",gas:119150n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x4a3a22a3e7fee0ffbb66f1c28bfac50f75546fc7000200000000000000000008",scalingFactors:[1n,1n],tokens:["0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0xa0b862f60edef4452f25b4160f177db44deb6cf1"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[200000000000000000n,800000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"7796b71c-fbd8-4344-9c92-4c738757eb37",address:"0xc9784ea2327b530fd57ee62abc8e8f0352943fd1",name:"BALANCER:MAIUSDTUSDC",gas:164646n,model:ee.BalancerStable,isTradingAllowed:!0,aPrecision:1000n,scalingFactors:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x3f56e0c36d275367b8c502090edf38289b3dea0d","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9","0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",poolId:"0x0510ccf9eb3ab03c1508d3b9769e8ee2cfd6fdcf00000000000000000000005d",depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"a8576203-25fb-4957-8b61-b07a01f1ca3b",address:"0xdc9c24fe7f44d9787fd381a65079b2a6fad4a557",name:"BALANCER:MCBWETH",gas:116190n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xb5b77f1ad2b520df01612399258e7787af63025d000200000000000000000010",scalingFactors:[1n,1n],tokens:["0x4e352cf164e64adcbad318c3a1e222e9eba4ce42","0x82af49447d8a07e3bd95bd0d56f35241523fbab1"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[600000000000000000n,400000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"7a6871f9-aee1-49ae-bd27-674641a0333b",address:"0x49ab6b33c750a6ffee148ad581aa34311b3898dd",name:"DODO:V1USDC",gas:255326n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0xbcc3401e16c25eaf4d3fed632ce3288503883b1f",pools:{"0x82af49447d8a07e3bd95bd0d56f35241523fbab1":{"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8":"0xfe176a2b1e1f67250d2903b8d25f56c0dabcd6b2"},"0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9":{"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8":"0xe4b2dfc82977dd2dce7e8d37895a6a8f50cbb4fb"},"0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f":{"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8":"0xb42a054d950dafd872808b3c839fbb7afb86e14c"}}},{id:"65bdfea2-439a-4217-a5ba-1a11b575068b",address:"0x521902ac8079bad162abc6636c8bd0b3e2de0f5e",name:"DODO:V2DVMUSDC",gas:141696n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xda4c4411c55b0785e501332354a036c04833b72b",pools:{"0x69eb4fa4a2fbd498c257c57ea8b7655a2559a581":{"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8":"0x6a58c68ff5c4e4d90eb6561449cc74a64f818da5"}}},{id:"00679168-e748-466e-9899-a00f2e26d7de",address:"0x719239a2521f5ad2451a5a6988a12454786b8575",name:"CURVE:TRICRYPTO",gas:363199n,model:ee.CurveCrypto,isTradingAllowed:!0,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0x8e0b8c8bb9db49a46697f3a5bb8a308e744821d2",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0x960ea3e3c7fb317332d990873d354e18d7645590",precision:1000000000000000000n,precisions:[1000000000000n,10000000000n,1n],tokens:["0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9","0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f","0x82af49447d8a07e3bd95bd0d56f35241523fbab1"]},{id:"f456db5b-5dd5-44d8-8288-03139af11572",address:"0x767e3e758ecf1bb294c7d948ab7333f02cca1d6e",name:"CURVE:2POOL",gas:138176n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x7f90122bf0700f9e7e1f688fe926940e8839f353",poolContract:"0x7f90122bf0700f9e7e1f688fe926940e8839f353",precision:1000000000000000000n,precisionMul:[1000000000000n,1000000000000n],aPrecision:100n,rates:[1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0xff970a61a04b1ca14834a43f5de4533ebddb5cc8","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"]},{id:"9625dc8d-5021-4682-a622-43638f5e9019",address:"0x294921d3d09dfa64f3b4f4e2e6025c49fb291718",name:"CURVE:REN",gas:132496n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x3e01dd8a5e1fb3481f0f589056b428fc308af0fb",poolContract:"0x3e01dd8a5e1fb3481f0f589056b428fc308af0fb",precision:1000000000000000000n,precisionMul:[10000000000n,10000000000n],aPrecision:100n,rates:[10000000000000000000000000000n,10000000000000000000000000000n],tokens:["0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f","0xdbf31df14b66535af65aac99c32e9ea844e14501"]},{id:"0edb879b-f7d0-4a38-8385-b80ff81aff7f",address:"0xda930db9e0636d3e21c5ec1641a1360ecd576a2d",name:"CURVE:MIM",model:ee.CurveMeta,isTradingAllowed:!0,gas:231322n,baseCacheExpires:0n,basePoolRouteId:"f456db5b-5dd5-44d8-8288-03139af11572",feeDenominator:10000000000n,aPrecision:100n,isCacheExists:!1,lpToken:"0x30df229cefa463e991e29d42db0bae2e122b2ac7",multicall:te,poolContract:"0x30df229cefa463e991e29d42db0bae2e122b2ac7",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a","0x7f90122bf0700f9e7e1f688fe926940e8839f353"]},{id:"33225472-5542-4d12-b4b8-4ffa7818928f",address:"0x8a632a907cd186c046a388cbf40abcd69f9f6144",name:"CURVE:FRAX+2CRV",model:ee.CurveMeta,isTradingAllowed:!0,gas:231322n,baseCacheExpires:0n,basePoolRouteId:"f456db5b-5dd5-44d8-8288-03139af11572",feeDenominator:10000000000n,aPrecision:100n,isCacheExists:!1,lpToken:"0xf07d553b195080f84f582e88ecdd54baa122b279",multicall:te,poolContract:"0xf07d553b195080f84f582e88ecdd54baa122b279",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x17fc002b466eec40dae837fc4be5c67993ddbd6f","0x7f90122bf0700f9e7e1f688fe926940e8839f353"]},{id:"b4aa5d7d-d596-41b9-bb78-0646f1bfd67c",address:"0x8b4102ce74e7615a1327e4307d3f584eb8ff07c5",name:"GMX",model:ee.GmxDex,isTradingAllowed:!0,gas:309213n,vaultContract:"0x489ee077994b6658eafa855c308275ead8097c4a",pricePrecision:1000000000000000000000000000000n,debtTokenContract:"0x45096e7aa921f27590f8f19e457794eb09678141"}],ne=[{id:"0",address:"0x0dea19cab88f45301a83c6b5eaa18e8387546afe",name:"WARDEN",gas:65916n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x3657952d7ba5a0a4799809b5b6fdff9ec5b46293",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xfbbcb3ce9944dd53a7ef447076d0e4e4811911365339bab292e4733d5b37a120"},{id:"1",address:"0xdb36b4bf9167ead6822db522d9b667fbb6e75c5d",name:"PANCAKEV2",gas:75294n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xca143ce32fe78f1f7019d7d551a6402fc5350c73",fee:9975n,feePrecision:10000n,pairBytecodeHash:"0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5"},{id:"2",address:"0x120b8d7102bd8abb7adfac5a93516db5229497d0",name:"PANCAKE",gas:66364n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xbcfccbde45ce874adcb698cc183debcf17952812",fee:998n,feePrecision:1000n,pairBytecodeHash:"0xd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66"},{id:"3",address:"0xd4f319ea1ee46595e1f48443bcadff0bfeee7f10",name:"DEFINIX",gas:72540n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x43ebb0cb9bd53a3ed928dd662095ace1cef92d19",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x898b8e59fbd4e8d6538b7d59d469440d56e24a77616ec248916ca9b36712dfe2"},{id:"4",address:"0xf632b0ad2e44cf40e3fb2369a11998a8de56dc4b",name:"APE",gas:66368n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x0841bd0b734e4f5853f0dd8d7ea041c241fb0da6",fee:998n,feePrecision:1000n,pairBytecodeHash:"0xf4ccce374816856d11f00e4069e7cada164065686fbef53c6167a63ec2fd8c5b"},{id:"5",address:"0x677ee749ba8ae558795f659440f7fbe78176321e",name:"TWIN",gas:63162n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x4e66fda7820c53c1a2f601f84918c375205eac3e",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x652b5a4fa6b1efd55c9821e56279c871f9999588a5472d22ab78b8ec61e2521e"},{id:"6",address:"0x6b75377a56f27d6eeabea6589547e2a863d4cf95",name:"WAULT",gas:75294n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xb42e3fe71b7e0673335b3331b3e1053bd9822570",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x9599db1eaa37ab366bf260f51beefce9296eb6197de387c533d905e9b82debe9"},{id:"7",address:"0x63d7897cef3a91167da5ca0f1c1e48714cad32ab",name:"PANTHER",gas:66364n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x670f55c6284c629c23bae99f585e3f17e8b9fc31",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x867d1354ae93986b4c49f35d8d7884f174264895ad8501d50d2cd365933d4aa5"},{id:"8",address:"0x6c216de4acc409777cc022b0cc255d5a958ffc62",name:"FAT",gas:63162n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xaba5ca9729294c2a49cb6e741f2b97b988e80407",fee:9975n,feePrecision:10000n,pairBytecodeHash:"0x2cfacfa13b2d16c4bb67512dc8c809e331070f22dd2bd6a1052984f835eb0121"},{id:"9",address:"0xe22231cc0e4c7ffbef23504ca072b15616c4500e",name:"BAKERY",gas:66483n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x01bf7c66c6bd861915cdaae475042d3c4bae16a7",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe2e87433120e32c4738a7d8f3271f3d872cbe16241d67537139158d90bac61d3"},{id:"10",address:"0x3b242e8b3b2ebb09cbb80ee8b73051a798e64f36",name:"JUL",gas:66345n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x553990f2cba90272390f62c5bdb1681ffc899675",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xb1e98e21a5335633815a8cfb3b580071c2e4561c50afd57a8746def9ed890b18"},{id:"11",address:"0x01e25c2bb785791ca48978b14a62a9b904346aed",name:"MDEX",gas:79901n,model:ee.Mdex,isTradingAllowed:!0,factory:"0x3cd1c46068daea5ebb0d3f55f6915b10648062b8",fee:0n,feePrecision:10000n,pairBytecodeHash:"0x0d994d996174b05cfc7bed897dc1b20b4c458fc8d64fe98bc78b3c64a6b4d093"},{id:"12",address:"0xb53f17b7bd19bee6153579ea8ca95ebe00e1eae2",name:"ELLIPSIS",gas:167762n,model:ee.CurvePlain,isTradingAllowed:!0,aPrecision:1n,feeDenominator:10000000000n,isUnderlying:!0,lendingPrecision:1000000000000000000n,lpToken:"0xaf4de8e872131ae328ce21d909c74705d3aaf452",poolContract:"0x160caed03795365f3a589f10c379ffa7d75d4e76",precision:1000000000000000000n,precisionMul:[1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0xe9e7cea3dedca5984780bafc599bd69add087d56","0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d","0x55d398326f99059ff775485246999027b3197955"]},{id:"13",address:"0x0cd12512ac262fff5441d34b72f4e9e921a39d92",name:"ACRYPTOS:ACS4",gas:159324n,model:ee.CurvePlain,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x83d69ef5c9837e21e2389d47d791714f5771f29b",poolContract:"0xb3f0c9ea1f05e312093fdb031e789a756659b0ac",precision:1000000000000000000n,precisionMul:[1n,1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955","0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3","0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d"]},{id:"14",address:"0x0e826d7f0fcda8fb22b4e5ddc1b13df2294f053f",name:"ACRYPTOS:VAI",gas:292815n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:600n,feeDenominator:10000000000n,lpToken:"0xeb7dc7b3bff60a450eff31edf1330355361ea5ad",multicall:I.bsc,poolContract:"0x191409d5a4effe25b0f4240557ba2192d18a191e",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x4bd17003473389a42daf6a0a729f6fdb328bbbd7","0x83d69ef5c9837e21e2389d47d791714f5771f29b"],basePoolRouteId:"13",isCacheExists:!0},{id:"15",address:"0x8314bc047114a9cb253787303dca9a54992488f7",name:"ACRYPTOS:UST",gas:292815n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:600n,feeDenominator:10000000000n,lpToken:"0xd3debe4a971e4492d0d61ab145468a5b2c23301b",multicall:I.bsc,poolContract:"0x99c92765efc472a9709ced86310d64c4573c4b77",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x23396cf899ca06c4472205fc903bdb4de249d6fc","0x83d69ef5c9837e21e2389d47d791714f5771f29b"],basePoolRouteId:"13",isCacheExists:!0},{id:"16",address:"0x32e33d9d8717bf0059b25d7f606114a9b35049f0",name:"ACRYPTOS:QUSD",gas:292815n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:600n,feeDenominator:10000000000n,lpToken:"0x49440376254290b3264183807a16450457f02b28",multicall:I.bsc,poolContract:"0x3919874c7bc0699cf59c981c5eb668823fa4f958",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xb8c540d00dd0bf76ea12e4b4b95efc90804f924e","0x83d69ef5c9837e21e2389d47d791714f5771f29b"],basePoolRouteId:"13",isCacheExists:!0},{id:"17",address:"0xe2582b433059463e83c5e8dddd015b3b9830f946",name:"NERVE",gas:207104n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0xf2511b5e4fb0e5e2d123004b672ba14850478c14",poolContract:"0x1b3771a66ee31180906972580ade9b81afc5fcdc",precision:1000000000000000000n,precisionMul:[1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955","0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d"]},{id:"18",address:"0xac8339448234237ce6311eb661cfa4578c9957e4",name:"DOP:4P",gas:212741n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x9116f04092828390799514bac9986529d70c3791",poolContract:"0x5162f992edf7101637446ecccd5943a9dcc63a8a",precision:1000000000000000000n,precisionMul:[1n,1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3","0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955","0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d"]},{id:"19",address:"0x0e7dbd5e56ffdb53cd098732598c4082eb8fe872",name:"DOP:UST",gas:207884n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x7edcdc8cd062948ce9a9bc38c477e6aa244dd545",poolContract:"0x830e287ac5947b1c0da865dfb3afd7cdf7900464",precision:1000000000000000000n,precisionMul:[1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0x23396cf899ca06c4472205fc903bdb4de249d6fc","0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955"]},{id:"20",address:"0x5f30620586c6c635c38535f9811e8ce29ef57a27",name:"DOP:2P",gas:197708n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x124166103814e5a033869c88e0f40c61700fca17",poolContract:"0x449256e20ac3ed7f9ae81c2583068f7508d15c02",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955"]},{id:"21",address:"0x02c66a602ab5b9866d58839ec14cb9ed157b88a4",name:"DOP:DOLLY",gas:205200n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0xaa5509ce0ecea324bff504a46fc61eb75cb68b0c",poolContract:"0x61f864a7dfe66cc818a4fd0baabe845323d70454",precision:1000000000000000000n,precisionMul:[1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955","0xff54da7caf3bc3d34664891fc8f3c9b6dea6c7a5"]},{id:"22",address:"0x174db639683104e39bb5537d759963fb646c26a1",name:"DODO:V2DPPBUSD",gas:89223n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xafe0a75dffb395eaabd0a7e1bbbd0b11f8609eef",pools:{"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x0fe261aee0d1c4dfddee4102e82dd425999065f4"},"0x2170ed0880ac9a755fd29b2688956bd959f933f8":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x9ba8966b706c905e594acbb946ad5e29509f45eb"},"0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0xe3c58d202d4047ba227e437b79871d51982deeb7"},"0x4691937a7508860f876c9c0a2a617e7d9e945d4b":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x88cbf433471a0cd8240d2a12354362988b4593e5"}}},{id:"23",address:"0x1a48f4827d96bfd03e1d5a4b3c34f6d2313cba08",name:"BISWAP",gas:69620n,model:ee.Biswap,isTradingAllowed:!0,factory:"0x858e3312ed3a876947ea49d572a7c42de08af7ee",fee:0n,feePrecision:1000n,pairBytecodeHash:"0xfea293c909d87cd4153593f077b76bb7e94340200f4ee84211ae8e4f9bd7ffdf"},{id:"24",address:"0x384041cd83125b669f9e692b03ae536a00acc5b1",name:"JETSWAP",gas:76212n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x0eb58e5c8aa63314ff5547289185cc4583dfcbd5",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x3125d0a15fa7af49ce234ba1cf5f931bad0504242e0e1ee9fcd7d1d7aa88c651"},{id:"25",address:"0x5ad333eaf52e48ab19095805f552a0734bb57252",name:"SMOOTHY",gas:141572n,model:ee.Smoothy,isTradingAllowed:!0,poolContract:"0xe5859f4efc09027a9b718781dcb2c6910cac6e91",expectedImplAddress:"0x965cc658158a7689fbb6c4df735aa435c500c29b",expectedTokens:{"0xe9e7cea3dedca5984780bafc599bd69add087d56":0,"0x55d398326f99059ff775485246999027b3197955":1,"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d":2,"0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3":3,"0xb7f8cd00c5a06c0537e2abff0b58033d02e5e094":4,"0x23396cf899ca06c4472205fc903bdb4de249d6fc":5}},{id:"29",address:"0xd4c354e0ec0a0866b418cf9007a9f6dba7e9721f",name:"LATTE",gas:67220n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x4dce5bdb81b8d5edb66ca1b8b2616a8e0dd5f807",fee:9975n,feePrecision:10000n,pairBytecodeHash:"0xd186cd0235b0839707c25b5e4a518a7e67159a1c74f36680d920c0d82097db36"},{id:"30",address:"0xa3bad596dfbaac51e28f1015b7bc3f0644073ce8",name:"BABY",gas:66407n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x86407bea2078ea5f5eb5a52b2caa963bc1f889da",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x48c8bec5512d397a5d512fbb7d83d515e7b6d91e9838730bd1aa1b16575da7f5"},{id:"31",address:"0x96c7427837db437875c6f5ae439417571db4bec5",name:"DSG",gas:63483n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x73d9f93d53505cb8c4c7f952ae42450d9e859d10",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x772d76e02b5a3aeeef00b07a18a744c893227f52ecb6e3d431da85a229ed6a1d"},{id:"32",address:"0x579543fa36cef7d00111e0ec9d8991cde71a57de",name:"SUSHI",gas:66302n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xc35dadb65012ec5796536bd9864ed8773abc74c4",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"},{id:"33",address:"0xf049f5a5917c6f036756b4abc7e1c0bfb4cd824e",name:"DODO:V1BUSD",gas:246497n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0xca459456a45e300aa7ef447dbb60f87cccb42828",pools:{"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x6064dbd0ff10bfed5a797807042e9f63f18cfe10"}}},{id:"34",address:"0x6be09f2b3c69476f7a3942f6cb0f5717656a9ee0",name:"DODO:V1USDT",gas:239380n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0xca459456a45e300aa7ef447dbb60f87cccb42828",pools:{"0xe9e7cea3dedca5984780bafc599bd69add087d56":{"0x55d398326f99059ff775485246999027b3197955":"0xbe60d4c4250438344bec816ec2dec99925deb4c7"}}},{id:"35",address:"0xe0eb29dd528ab01ab2ca93d47c283ab97ef726e2",name:"DODO:V2DPPBUSD2",gas:102565n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xafe0a75dffb395eaabd0a7e1bbbd0b11f8609eef",pools:{"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x9a24b2051bf094219ab7b435671b77cba06415f6"}}},{id:"36",address:"0xe66ed920794f1f7d29062f20bf40df0802352d37",name:"AUTOSHARK",gas:78722n,model:ee.Biswap,isTradingAllowed:!0,factory:"0xe759dd4b9f99392be64f1050a6a8018f73b53a13",fee:0n,feePrecision:10000n,pairBytecodeHash:"0x024c8482358faf5eeea4ff7f0a18734bc482bf2e61ec04711fcee726756287ee"},{id:"37",address:"0x58a3a7d39dfa18fdba2bb4321857dc2852c8a88b",name:"MARS",gas:90714n,model:ee.Mars,isTradingAllowed:!0,factory:"0x6f12482d9869303b998c54d91bcd8bccba81f3be",fee:0n,feePrecision:1000n,pairBytecodeHash:"0x1bebc382ef02a42adebba8056f178019d890f3b232007a868603393bddd2f1ab"},{id:"38",address:"0xa6b93c5e9c1646513fda96583624d7219311596d",name:"KYBER",gas:112657n,model:ee.DMM,isTradingAllowed:!0,pools:{"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":{"0xfe56d5892bdffc7bf58f2e84be1b2c32d21c308b":"0x6170b6d96167346896169b35e1e9585feab873bb","0xd6cce248263ea1e2b8cb765178c944fc16ed0727":"0x97dbaf4ad688aed04817121301a005b710e6067a"},"0x55d398326f99059ff775485246999027b3197955":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0xc3dac2049616326e7d596ce52062789d96373b55","0x633237c6fa30fae46cc5bb22014da30e50a718cc":"0xf81e106c5b44ba9a993fc1f456a4c8e54c47cf34","0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":"0xec303ce1edbebf7e71fc7b350341bb6a6a7a6381"},"0x3944ac66b9b9b40a6474022d6962b6caa001b5e3":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0xf8e61e301a44df4e2dbaba570d2cb09039289b31"},"0xd07e82440a395f3f3551b42da9210cd1ef4f8b24":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x3e95e07550e9798272130ab65b58f2f17b3f7c57"},"0xe83ce6bfb580583bd6a62b4be7b34fc25f02910d":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x3a853210ef83a75ef4a7c406f22b9f861cdf3c94"}}},{id:"39",address:"0x59254c308831f6ed3a88cc61c81e1e33d8957ed3",name:"SYNAPSE:STABLESWAP",gas:198274n,model:ee.Synapse,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0xa4b7bc06ec817785170c2dbc1dd3ff86cdcdcc4c",poolContract:"0x28ec0b36f0819ecb5005cab836f4ed5a2eca4d13",precision:1000000000000000000n,precisionMul:[1n,1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0x23b891e5c62e0955ae2bd185990103928ab817b3","0xe9e7cea3dedca5984780bafc599bd69add087d56","0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d","0x55d398326f99059ff775485246999027b3197955"]},{id:"40",name:"DODO:V2DPPUSDT",address:"0xebcb90d057cc5363787f5918ad5cbb71a3d18853",gas:101414n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xafe0a75dffb395eaabd0a7e1bbbd0b11f8609eef",pools:{"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":{"0x55d398326f99059ff775485246999027b3197955":"0x6098a5638d8d7e9ed2f952d35b2b67c34ec6b476"},"0x59802ac95f2399c929a096171c1bee93c27dae90":{"0x55d398326f99059ff775485246999027b3197955":"0x9dd96e239cf22806af02671518fada1c9f614339"}}},{id:"41",name:"DODO:V2DVMWBNB",address:"0xd3c1e9276f5ea8ec2e503d8106378f81f188ee1f",gas:108925n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x790b4a80fb1094589a3c0efc8740aa9b0c1733fb",pools:{"0x67ee3cb086f8a16f34bee3ca72fad36f7db929e2":{"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":"0xd534fae679f7f02364d177e9d44f1d15963c0dd7"}}},{id:"42",name:"DODO:V2DVMBUSD",address:"0xf35d96492d59b7f279c1d1a50a653c8fd53cdb79",gas:127590n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x790b4a80fb1094589a3c0efc8740aa9b0c1733fb",pools:{"0xca1acab14e85f30996ac83c64ff93ded7586977c":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0xdd2ec03c97381f0cb591bc62a26d0508a0388a32"}}},{id:"935b41a7-d9ed-4218-aed6-005449ae441d",name:"ELK",address:"0x02800d3d33e7e9d32c586fcaaea0412e5a57792d",gas:81064n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x31affd875e9f68cd6cd12cee8943566c9a4bba13",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x84845e7ccb283dec564acfcd3d9287a491dec6d675705545a2ab8be22ad78f31"},{id:"09b62e64-0e42-49dd-abba-3b450337c174",name:"UNI:V3F100",address:"0x0261fe3d25e470c387f456cd68b69eaf20b21063",gas:100559n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,factory:"0xdb1d10011ad0ff90774d0c6bb92e5c5c8b4461f7",fee:100n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",depositAddress:"0x9db45b627ee95ac86b059171cb17dc266be857fb",maxInitializedTicks:15,tickQuerier:"0xb964976c3c4f60278fc755ffc5a65008a147b014"},{id:"6b17220c-7dd8-4418-8900-e235218055c3",name:"UNI:V3F500",address:"0x2eca6cfc9f78c9dd10e03520613a647ac8b5fdcf",gas:94279n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,factory:"0xdb1d10011ad0ff90774d0c6bb92e5c5c8b4461f7",fee:500n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",depositAddress:"0x9db45b627ee95ac86b059171cb17dc266be857fb",maxInitializedTicks:15,tickQuerier:"0xb964976c3c4f60278fc755ffc5a65008a147b014"},{id:"31fe588e-0ed9-47cf-985a-32b9dab462f1",name:"UNI:V3F3000",address:"0x156928f341f8618ec88820f85b4ea52468d088e3",gas:121189n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,factory:"0xdb1d10011ad0ff90774d0c6bb92e5c5c8b4461f7",fee:3000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",depositAddress:"0x9db45b627ee95ac86b059171cb17dc266be857fb",maxInitializedTicks:15,tickQuerier:"0xb964976c3c4f60278fc755ffc5a65008a147b014"},{id:"a5cf8539-b979-415b-94d1-323bf5675c6c",name:"UNI:V3F10000",address:"0xa2b12a2816d2cbe083b45367e97824ec2bb2d97a",gas:93957n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,factory:"0xdb1d10011ad0ff90774d0c6bb92e5c5c8b4461f7",fee:10000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",depositAddress:"0x9db45b627ee95ac86b059171cb17dc266be857fb",maxInitializedTicks:15,tickQuerier:"0xb964976c3c4f60278fc755ffc5a65008a147b014"},{id:"24e64ee3-d46d-4767-b5f0-545fe7ef21bb",name:"PNCK:V3F100",address:"0xb048ed7234277fe37db6fa00ed4d3d54296c275b",gas:126259n,gasPerInitializedTick:30363n,gasPerTick:4171n,model:ee.PancakeV3,isTradingAllowed:!0,poolDeployer:"0x41ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9",fee:100n,pairBytecodeHash:"0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2",depositAddress:"0x5781d7645ad1c0e3d19365324f0b910e8a977974",maxInitializedTicks:15,tickQuerier:"0xc05d55315c78d8884d31656d56b20c14f89ef68e"},{id:"623fc76e-7140-4aa0-b191-7b8c45e51490",name:"PNCK:V3F500",address:"0x5ef960eb78b8cfc11e654d03beeb313badf5c7c0",gas:119984n,gasPerInitializedTick:30363n,gasPerTick:4171n,model:ee.PancakeV3,isTradingAllowed:!0,poolDeployer:"0x41ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9",fee:500n,pairBytecodeHash:"0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2",depositAddress:"0x5781d7645ad1c0e3d19365324f0b910e8a977974",maxInitializedTicks:15,tickQuerier:"0xc05d55315c78d8884d31656d56b20c14f89ef68e"},{id:"e413625b-abdb-479b-b2e7-aaabefc295af",name:"PNCK:V3F2500",address:"0x2e92474af285b41b39a0701109ebc22195f3583f",gas:146894n,gasPerInitializedTick:30363n,gasPerTick:4171n,model:ee.PancakeV3,isTradingAllowed:!0,poolDeployer:"0x41ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9",fee:2500n,pairBytecodeHash:"0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2",depositAddress:"0x5781d7645ad1c0e3d19365324f0b910e8a977974",maxInitializedTicks:15,tickQuerier:"0xc05d55315c78d8884d31656d56b20c14f89ef68e"},{id:"46296528-4057-448c-a1cc-5e06dc93463d",name:"PNCK:V3F10000",address:"0xac35f8f91ddc8eb19acb3c5374f1191a748353c6",gas:119662n,gasPerInitializedTick:30363n,gasPerTick:4171n,model:ee.PancakeV3,isTradingAllowed:!0,poolDeployer:"0x41ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9",fee:10000n,pairBytecodeHash:"0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2",depositAddress:"0x5781d7645ad1c0e3d19365324f0b910e8a977974",maxInitializedTicks:15,tickQuerier:"0xc05d55315c78d8884d31656d56b20c14f89ef68e"}],se=I.ethereum,ie=[{id:"e8297329-0ece-4e9c-bf6b-781042b78c83",address:"0x7968edaef6e70a406bcbc799682e05e512a42b68",name:"UNI:V2",gas:75475n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f"},{id:"17e4b849-5bdf-40c2-b130-a801dc63d1f3",address:"0x3a24e3d0c1cac841478ff6d7de5d7cefd7350724",name:"SUSHI",gas:76113n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xc0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"},{id:"272c8b87-e3c5-4f11-8dc4-7df2d87c9fe7",address:"0xe9f10830f90bac287e16dc70875786e9a6d97eb4",name:"SHIBA",gas:84935n,model:ee.Shibaswap,isTradingAllowed:!0,factory:"0x115934131916c8b277dd010ee02de363c09d037c",fee:0n,feePrecision:1000n,pairBytecodeHash:"0x65d1a3b1e46c6e4f1be1ad5f99ef14dc488ae0549dc97db9b30afe2241ce1c7a"},{id:"422c9fbd-66df-4a5f-8134-541a20cd3174",address:"0x30e679d1743e866842026f81fc2c91fcbff19857",name:"UNI:V3F100",gas:99193n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,depositAddress:"0xeb1f1b38cbc17b4eb123d560b463eff774bdae02",isTradingAllowed:!0,factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:100n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:15,tickQuerier:"0x8b4102ce74e7615a1327e4307d3f584eb8ff07c5"},{id:"6705b39c-e1e8-4293-9f3a-a9b4f34e9cf7",address:"0x679ee78d6c5829eb5d9f82390f78c5fd893ba51e",name:"UNI:V3F500",gas:111091n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0xeb1f1b38cbc17b4eb123d560b463eff774bdae02",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:500n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:15,tickQuerier:"0x8b4102ce74e7615a1327e4307d3f584eb8ff07c5"},{id:"23450784-75d9-408d-b310-6efea9533fff",address:"0x4f065eefac4be3b4a6ed77770acb54fa1b9ab36e",name:"UNI:V3F3000",gas:121189n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0xeb1f1b38cbc17b4eb123d560b463eff774bdae02",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:3000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:15,tickQuerier:"0x8b4102ce74e7615a1327e4307d3f584eb8ff07c5"},{id:"1ca886d6-09e2-48f1-a197-f350b4c71da5",address:"0xdf4abddf946bd2741b37bc8c96b8dc0094eb0b6d",name:"UNI:V3F10000",gas:96497n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0xeb1f1b38cbc17b4eb123d560b463eff774bdae02",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:10000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:15,tickQuerier:"0x8b4102ce74e7615a1327e4307d3f584eb8ff07c5"},{id:"43bfe1d7-999d-42c3-a644-981bc0e2b207",address:"0xa4a9f50628716091425d861179a6cd8395665931",name:"CURVE:3POOL",gas:190858n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!0,lendingPrecision:1000000000000000000n,lpToken:"0x6c3f90f043a72fa612cbac8115ee7e52bde6e490",poolContract:"0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x6b175474e89094c44da98b954eedeac495271d0f","0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","0xdac17f958d2ee523a2206206994597c13d831ec7"]},{id:"6c6c80c3-1bc6-4974-9bbf-2d8cf7ca192e",address:"0x31568cbfe0722e9d25fb7805d515f4974aa18bef",name:"CURVE:TRICRYPTO2",gas:392159n,model:ee.CurveCrypto,isTradingAllowed:!0,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0xc4ad29ba4b3c580e6d59105fff484999997675ff",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0xd51a44d3fae010294c616388b506acda1bfaae46",precision:1000000000000000000n,precisions:[1000000000000n,10000000000n,1n],tokens:["0xdac17f958d2ee523a2206206994597c13d831ec7","0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"]},{id:"57296e7b-3033-44f2-8790-49fc98fa9ac9",address:"0x35ff8cfd744f3289200b59cfe392f13b8e03d40f",name:"CURVE:MIM",gas:317380n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:0n,basePoolRouteId:"43bfe1d7-999d-42c3-a644-981bc0e2b207",feeDenominator:10000000000n,isCacheExists:!1,lpToken:"0x5a6a4d54456819380173272a5e8e9b9904bdf41b",multicall:se,poolContract:"0x5a6a4d54456819380173272a5e8e9b9904bdf41b",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3","0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"]},{id:"c78a0ce9-8048-4c3c-9ca8-2964fa5af914",address:"0xf3fd9b964dbb6f4071c41af2202aa34670ca244a",name:"CURVE:MIMUST",gas:139443n,model:ee.CurvePlain,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x55a8a39bc9694714e2874c1ce77aa1e599461e18",poolContract:"0x55a8a39bc9694714e2874c1ce77aa1e599461e18",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3","0xa47c8bf37f92abed4a126bda807a7b7498661acd"]},{id:"13053082-9871-4681-9b0c-0365bae2de08",address:"0xd28136e0566ebfaa826bca532673f41f3415c351",name:"CURVE:UST",gas:313462n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:600n,basePoolRouteId:"43bfe1d7-999d-42c3-a644-981bc0e2b207",feeDenominator:10000000000n,isCacheExists:!0,lpToken:"0x94e131324b6054c0d789b190b2dac504e4361b53",multicall:se,poolContract:"0x890f4e345b1daed0367a877a1612f86a1f86985f",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xa47c8bf37f92abed4a126bda807a7b7498661acd","0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"]},{id:"114dd100-de92-4f35-b159-3a76feaddb28",address:"0x773cfb4b1028400cf92d6177ceb95b223a4e2eb3",name:"CURVE:CVXETH",gas:366025n,model:ee.CurveCrypto,isTradingAllowed:!0,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0x3a283d9c08e8b55966afb64c515f5143cf907611",maxA:4000000000n,minA:4000n,maxGamma:20000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0xb576491f1e6e5e62f1d8f26062ee822b40b0e0d4",precision:1000000000000000000n,precisions:[1n,1n],tokens:["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b"]},{id:"0ff7b35f-948c-4b68-b46f-7526eb58e373",address:"0xddd82e011c1ae7c035085e714d4fa8b916b3bd42",name:"CURVE:FRAX",gas:349642n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:0n,basePoolRouteId:"43bfe1d7-999d-42c3-a644-981bc0e2b207",feeDenominator:10000000000n,isCacheExists:!1,lpToken:"0xd632f22692fac7611d2aa1c0d552930d43caed3b",multicall:se,poolContract:"0xd632f22692fac7611d2aa1c0d552930d43caed3b",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x853d955acef822db058eb8505911ed77f175b99e","0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"]},{id:"89b6f314-eaa8-4bdb-b300-a9bca162e16a",address:"0xbda10b763bfc6faf7e2733fb00efb610e859fb8e",name:"CURVE:REN",gas:173168n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!0,lendingPrecision:1000000000000000000n,lpToken:"0x49849c98ae39fff122806c06791fa73784fb3675",poolContract:"0x93054188d876f558f4a66b2ef1d97d16edf0895b",precision:1000000000000000000n,precisionMul:[10000000000n,10000000000n],rates:[10000000000000000000000000000n,10000000000000000000000000000n],tokens:["0xeb4c2781e4eba804ce9a9803c67d0893436bb27d","0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"],balancesArgs:"int128"},{id:"8ee937cc-24a5-41d4-ab22-8b076163bd0a",address:"0x402b6aaf6eae5b5d71608726dac9ec644273d7ed",name:"CURVE:STETH",gas:206038n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x06325440d014e39736583c165c2963ba99faf14e",poolContract:"0xdc24316b9ae028f1497c275eb9192a3ea0f67022",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0xae7ab96520de3a18e5e111b5eaab095312d7fe84"],aPrecision:100n},{id:"68b1ec16-4de5-4e06-969e-93127ae1c119",address:"0x09664deaf1ad177a17a7d82942bedca87eac6574",name:"CURVE:CRVETH",gas:259851n,model:ee.CurveCrypto,isTradingAllowed:!0,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0xed4064f376cb8d68f770fb1ff088a3d0f3ff5c4d",maxA:4000000000n,minA:4000n,maxGamma:20000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0x8301ae4fc9c624d1d396cbdaa1ed877821d7c511",precision:1000000000000000000n,precisions:[1n,1n],tokens:["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0xd533a949740bb3306d119cc777fa900ba034cd52"]},{id:"8be72d56-5eda-4f7b-a37c-e7a08252a4a8",address:"0x3a194cde5026d745a0fd6e83d26b083592ecc6a0",name:"CURVE:LUSD",gas:347516n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:0n,basePoolRouteId:"43bfe1d7-999d-42c3-a644-981bc0e2b207",feeDenominator:10000000000n,isCacheExists:!1,lpToken:"0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca",multicall:se,poolContract:"0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x5f98805a4e8be255a32880fdec7f6728c6568ba0","0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"]},{id:"b2c2e45c-4cc2-4bd3-8eed-4f6f8c4948e7",address:"0xc1d0e72135d38c9b84ade2689e992f656dd31cd4",name:"CURVE:GUSD",gas:361077n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:600n,basePoolRouteId:"43bfe1d7-999d-42c3-a644-981bc0e2b207",feeDenominator:10000000000n,isCacheExists:!0,lpToken:"0xd2967f45c4f384deea880f807be904762a3dea07",multicall:se,poolContract:"0x4f062658eaaf2c1ccf8c8e36d6824cdf41167956",precision:1000000000000000000n,precisionMul:[10000000000000000n,1n],rates:[10000000000000000000000000000000000n,1000000000000000000n],tokens:["0x056fd409e1d7a124bd7017459dfea2f387b6d5cd","0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"]},{id:"56cf1fc3-79a8-460e-b9d7-4d8254639c2c",address:"0xdbf093f64a60b7abcc9721f52903537ab5f74699",name:"DODO:V1USDC",gas:225458n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0x3a97247df274a17c59a3bd12735ea3fcdfb49950",pools:{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0x75c23271661d9d143dcb617222bc4bec783eff34"},"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0x2109f78b46a789125598f5ad2b7f243751c2934d"},"0xdac17f958d2ee523a2206206994597c13d831ec7":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0xc9f93163c99695c6526b799ebca2207fdf7d61ad"}}},{id:"bd8299ed-2dbc-4b30-aa0b-c9ec5975a4bc",address:"0xd5c8c2cfed4237dfb50234500829c2d92170a840",name:"DODO:V1USDT",gas:198904n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0x3a97247df274a17c59a3bd12735ea3fcdfb49950",pools:{"0x43dfc4159d86f3a37a5a4b3d4580b888ad7d4ddd":{"0xdac17f958d2ee523a2206206994597c13d831ec7":"0x8876819535b48b551c9e97ebc07332c7482b4b2d"}}},{id:"a32c5f86-6752-45fd-9451-c4d13027c03d",address:"0xcde8b956ffd7b7f719347cd1ace76f5272f2d575",name:"DODO:V2DVMUSDC",gas:198150n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x72d220ce168c4f361dd4dee5d826a01ad8598f6c",pools:{"0xd502f487e1841fdc805130e13eae80c61186bc98":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0x22591994bc89174a5bdcec57c82c881b65f9b121"}}},{id:"dea21c2d-ed5e-41af-98ca-8777c8499ba1",address:"0x2b50b463b20183b350d3d2bf5df4da6e2918a360",name:"DODO:V2DSPUSDT",gas:114344n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x6fddb76c93299d985f4d3fc7ac468f9a168577a4",pools:{"0x6b175474e89094c44da98b954eedeac495271d0f":{"0xdac17f958d2ee523a2206206994597c13d831ec7":"0x3058ef90929cb8180174d74c507176cca6835d73"}}},{id:"99a252b5-67fa-4c50-9107-5fdacf5922df",address:"0xcde8b956ffd7b7f719347cd1ace76f5272f2d575",name:"DODO:V2DSPUSDC",gas:148288n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x6fddb76c93299d985f4d3fc7ac468f9a168577a4",pools:{"0xca37530e7c5968627be470081d1c993eb1deaf90":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0xaa89cab926dcd65b3779aa98d9342fd9a21e5d1c"}}},{id:"9a998ecc-efde-4a2c-9b02-421519667be0",address:"0x436d12651df7ac472c12b52d103d5487cc24cddc",name:"DODO:V2DVMNEAR",gas:120083n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x72d220ce168c4f361dd4dee5d826a01ad8598f6c",pools:{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":{"0x85f17cf997934a597031b2e18a9ab6ebd4b9f6a4":"0x983dfba1c0724786598af0e63a9a6f94aabd24a1"}}},{id:"419c7577-4d18-4694-be70-897a8db765d4",address:"0x30d2a6159438cc53026dfe8b518e839646498f5f",name:"DODO:V2DVMWETH",gas:118808n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x72d220ce168c4f361dd4dee5d826a01ad8598f6c",pools:{"0x03e173ad8d1581a4802d3b532ace27a62c5b81dc":{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":"0x031816fd297228e4fd537c1789d51509247d0b43"}}},{id:"2a5decdc-da75-4442-a5ad-7bc58d1640b",address:"0xc954074bef805afa738eb8015ad91f2c6ae91b55",name:"SYNAPSE:STABLESWAP",gas:197928n,model:ee.Synapse,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x1b84765de8b7566e4ceaf4d0fd3c5af52d3dde4f",poolContract:"0x1116898dda4015ed8ddefb84b6e8bc24528af2d8",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x6b175474e89094c44da98b954eedeac495271d0f","0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","0xdac17f958d2ee523a2206206994597c13d831ec7"]},{id:"d3129387-f6ea-46b1-9c3c-12d11b7cb736",address:"0x5369806f04c3079035d296681614d1d12a479467",name:"SMOOTHY",gas:215284n,model:ee.Smoothy,isTradingAllowed:!0,expectedImplAddress:"0x965cc658158a7689fbb6c4df735aa435c500c29b",expectedTokens:{"0xdac17f958d2ee523a2206206994597c13d831ec7":0,"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":1,"0x6b175474e89094c44da98b954eedeac495271d0f":2,"0x0000000000085d4780b73119b644ae5ecd22b376":3,"0x57ab1ec28d129707052df4df418d58a2d46d5f51":4,"0x4fabb145d64652a948d72533023f6e7a623c7c53":5,"0x8e870d67f660d95d5be530380d0ec0bd388289e1":6,"0x056fd409e1d7a124bd7017459dfea2f387b6d5cd":7},poolContract:"0xe5859f4efc09027a9b718781dcb2c6910cac6e91"},{id:"5ae0403e-fadc-4251-b845-a1334b3519ec",address:"0x29790cfc03790dfdbf28b745cf8bf9c15ca1085e",name:"KYBER",gas:102847n,model:ee.DMM,isTradingAllowed:!0,pools:{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":{"0xdac17f958d2ee523a2206206994597c13d831ec7":"0x306121f1344ac5f84760998484c0176d7bfb7134"},"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":{"0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202":"0x61639d6ec06c13a96b5eb9560b359d7c648c7759","0xdac17f958d2ee523a2206206994597c13d831ec7":"0xce9874c42dce7fffbe5e48b026ff1182733266cb","0xd7dcd9b99787c619b4d57979521258d1a7267ad7":"0xe69ba3f5ffe577bba3a2bf8ce949f7875d4c67db"},"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599":{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":"0x1cf68bbc2b6d3c6cfe1bd3590cf0e10b06a05f17","0xdac17f958d2ee523a2206206994597c13d831ec7":"0xd343d5dba2fba55eef58189619c05e33cab95ca1"},"0x9f52c8ecbee10e00d9faaac5ee9ba0ff6550f511":{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":"0x9a56f30ff04884cb06da80cb3aef09c6132f5e77"},"0x0c0f2b41f758d66bb8e694693b0f9e6fae726499":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0xe0ca51b6cfac04b215c3b6e473e3ec1412c93fc7"},"0x8f8221afbb33998d8584a2b05749ba73c37a938a":{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":"0xa97642500517c728ce1339a466de0f10c19034cd"},"0x3845badade8e6dff049820680d1f14bd3903a5d0":{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":"0x5ba740fcc020d5b9e39760cbd2fe236586b9dc0a"},"0x196f4727526ea7fb1e17b2071b3d8eaa38486988":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0xa07c19d92985f6b0de939678b32cf23b305d8ca9"},"0xd7dcd9b99787c619b4d57979521258d1a7267ad7":{"0xdac17f958d2ee523a2206206994597c13d831ec7":"0xdeb01e683ff0d2e3adb852a03df28e1ba7c99774"},"0x656c00e1bcd96f256f224ad9112ff426ef053733":{"0xdac17f958d2ee523a2206206994597c13d831ec7":"0x898e2fef4cef5592485251fab6da7c819a2df291"}}},{id:"8bef5a14-69ec-4d4d-b84f-3ee0118ede0e",address:"0xf374c9ef1fbd5c431417e6d07abadc0a7963a52d",name:"BALANCER:BTCWETH",gas:139901n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xa6f548df93de924d73be7d25dc02554c6bd66db500020000000000000000000e",scalingFactors:[10000000000n,1n],tokens:["0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"11d99fc2-f942-43fa-97f0-231f6e28dfed",address:"0x7421a865675c1c084d5ba55456c226f683b1768f",name:"BALANCER:LIDOETH",gas:218502n,model:ee.BalancerMetaStable,isTradingAllowed:!0,aPrecision:1000n,tokens:["0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],poolId:"0x32296969ef14eb0c6d29669c550d4a0449130230000200000000000000000080",scalingFactors:[1000000000000000000n,1000000000000000000n],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",multicall:se,rateProviders:["0x72d07d7dca67b8a406ad1ec34ce969c90bfee768",""],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"96c17720-7963-41e7-a9a3-bab09f4fd1c5",address:"0x82694a1aa56b32f99c8c14d9f5194d0c4f95d2fe",name:"BALANCER:3USD",gas:162412n,model:ee.BalancerStable,isTradingAllowed:!0,aPrecision:1000n,scalingFactors:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x6b175474e89094c44da98b954eedeac495271d0f","0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","0xdac17f958d2ee523a2206206994597c13d831ec7"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",poolId:"0x06df3b2bbb68adc8b0e302443692037ed9f91b42000000000000000000000063",depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"05e24f50-9715-448a-b968-04f0a2934947",address:"0xa2484cdf796d806b67ffcfead8b2cfd946938956",name:"BALANCER:BALWETH",gas:145877n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x5c6ee304399dbdb9c8ef030ab642b10820db8f56000200000000000000000014",scalingFactors:[1n,1n],tokens:["0xba100000625a3754423978a60c9317c58a424e3d","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[800000000000000000n,200000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"9ff164b5-1a93-45d1-843b-b58562768358",address:"0x78d1ab83bc2624f4df6f651c3db0502482087ad7",name:"BALANCER:DAIWETH",gas:120337n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x0b09dea16768f0799065c475be02919503cb2a3500020000000000000000001a",scalingFactors:[1n,1n],tokens:["0x6b175474e89094c44da98b954eedeac495271d0f","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[400000000000000000n,600000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"d51cd9a7-257b-4a9b-b804-ee134bfa3098",address:"0x1d13a3e25e0a2ff1bd55847c498571707b4bf4da",name:"BALANCER:EGLWETH",gas:130122n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xb0401ab1108bd26c85a07243dfdf09f4821d76a200020000000000000000007f",scalingFactors:[1n,1n],tokens:["0x1e83916ea2ef2d7a6064775662e163b2d4c330a7","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"06050b9f-0713-46f1-8ee2-6e46cd56efb7",address:"0x62e58e7640e4bc480f705cb9a70f5cf75b70412a",name:"BALANCER:GNOWETH",gas:136594n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xf4c0dd9b82da36c07605df83c8a416f11724d88b000200000000000000000026",scalingFactors:[1n,1n],tokens:["0x6810e776880c02933d47db1b9fc05908e5386b96","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[800000000000000000n,200000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"86d078d8-4dd0-420e-ae70-29241a81c2a2",address:"0x58d05b6724aaab423489620a5ed09500ef1aa7f4",name:"BALANCER:MKRWETH",gas:139610n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xaac98ee71d4f8a156b6abaa6844cdb7789d086ce00020000000000000000001b",scalingFactors:[1n,1n],tokens:["0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[600000000000000000n,400000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"3fb31f34-95ef-4f18-8179-997487f80dde",address:"0x097fd5ec9974ad81647dac7357b5cd224c39f81a",name:"BALANCER:LINKWETH",gas:137413n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xe99481dc77691d8e2456e5f3f61c1810adfc1503000200000000000000000018",scalingFactors:[1n,1n],tokens:["0x514910771af9ca656af840dff83e8264ecf986ca","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"b84b0d1e-e3bc-462d-8ec0-c937f2578f1f",address:"0x96276f37c91b0c1d0ac819b38cc22af7fb7543a2",name:"BALANCER:USDCWETH",gas:151951n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x96646936b91d6b9d7d0c47c496afbf3d6ec7b6f8000200000000000000000019",scalingFactors:[1000000000000n,1n],tokens:["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"9c606808-b23f-4b0a-af9c-444247586d6a",address:"0xb3699f2caea2f8e974fece2bab5455ae0c6a4933",name:"BALANCER:SNXWETH",gas:194764n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x072f14b85add63488ddad88f855fda4a99d6ac9b000200000000000000000027",scalingFactors:[1n,1n],tokens:["0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"f2d268f4-5056-4bd6-b2a1-5da7cbde2d52",address:"0x77156558864426a16c740dc552043cdcd407a004",name:"BALANCER:BTCSTABLE",gas:193784n,model:ee.BalancerStable,isTradingAllowed:!0,scalingFactors:[10000000000000000000000000000n,10000000000000000000000000000n,1000000000000000000n],tokens:["0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","0xeb4c2781e4eba804ce9a9803c67d0893436bb27d","0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6"],aPrecision:1000n,poolId:"0xfeadd389a5c427952d8fdb8057d6c8ba1156cc56000000000000000000000066",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"cd6e7fa3-6a67-4cf5-95e3-d8b86f847b02",address:"0x642a715580a2856c9c881ef0454f1a52ae00c090",name:"BALANCER:FEIWETH",gas:145313n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1n,1n],tokens:["0x956f47f50a910163d8bf957cf5846d573e7f87ca","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],weights:[300000000000000000n,700000000000000000n],poolId:"0x90291319f1d4ea3ad4db0dd8fe9e12baf749e84500020000000000000000013c",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"479e5b0a-187d-44f3-9755-7276ed7da403",address:"0x5600247239afd0ada239119fe68e33b78937a456",name:"BALANCER:SRMWETH",gas:140273n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x231e687c9961d3a27e6e266ac5c433ce4f8253e4000200000000000000000023",scalingFactors:[1n,1n],tokens:["0x476c5e26a75bd202a9683ffd34359c0cc15be0ff","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"4b057398-e168-4b06-8159-bc492fff66f6",address:"0x25c74baefd70e06f9dabfa149f59189f45d7c0e7",name:"BALANCER:AKITAWETH",gas:131202n,model:ee.BalancerLiquidityBootstrapping,isTradingAllowed:!0,poolId:"0xc065798f227b49c150bcdc6cdc43149a12c4d75700020000000000000000010b",scalingFactors:[1n,1n],tokens:["0x3301ee63fb29f863f2333bd4466acb46cd8323e6","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[0n,0n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"}],de=[{id:"0",address:"0xaffadeecff79052817701ea2196d96b3be0418dd",name:"QUICK",gas:65220n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x5757371414417b8c6caad45baef941abc7d3ab32",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f"},{id:"1",address:"0xd0d4d6434a80d19b023cf44a67ecab1ee8a62dec",name:"SUSHI",gas:62341n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xc35dadb65012ec5796536bd9864ed8773abc74c4",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"},{id:"2-1",address:"0x6ea2d9125d3bfe30b1f2cd6262d9d9eb88919434",name:"CURVE:AAVE",gas:712619n,model:ee.CurveLendingA,isTradingAllowed:!0,poolContract:"0x445fe580ef8d70ff569ab36e80c647af338db351",lpToken:"0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171",aPrecision:100n,feeDenominator:10000000000n,precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],tokens:["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"]},{id:"2-2",address:"0x19f5fa8937fd18dd2f8c00768fe5d7bf48a69cfd",name:"CURVE:ATRICRYPTO",gas:0n,model:ee.CurveCrypto,isTradingAllowed:!1,lpToken:"0x8096ac61db23291252574d49f036f0f9ed8ab390",aMultiplier:100n,feeDenominator:10000000000n,noiseFee:100000n,minA:2700n,maxA:27000000n,isAPrecise:!0,minGamma:10000000000n,maxGamma:10000000000000000n,poolContract:"0x751b1e21756bdbc307cbcc5085c042a0e9aaef36",precision:1000000000000000000n,precisions:[1n,10000000000n,1n],tokens:["0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171","0x5c2ed810328349100a66b82b78a1791b101c9d61","0x28424507fefb6f7f8e9d3860f56504e4e5f5f390"]},{id:"2",address:"0x19f5fa8937fd18dd2f8c00768fe5d7bf48a69cfd",name:"CURVE:ATRICRYPTOZAP",gas:1199223n,model:ee.CurveLendingCryptoZap,isTradingAllowed:!0,basePoolId:"2-1",poolId:"2-2",poolContract:"0x3fcd5de6a9fc8a99995c406c77dda3ed7e406f81",nStablecoins:3,tokens:["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"]},{id:"3",address:"0x9686824e88fe37987e8c6f17e1c699bfa9de7652",name:"WAULT",gas:64333n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xa98ea6356a316b44bf710d5f9b6b4ea0081409ef",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x1cdc2246d318ab84d8bc7ae2a3d81c235f3db4e113f4c6fdc1e2211a9291be47"},{id:"4",address:"0x06331385f30d0ac565cc5a2e5742efa69470a4a1",name:"DFYN",gas:62341n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xe7fb3e833efe5f9c441105eb65ef8b261266423b",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xf187ed688403aa4f7acfada758d8d53698753b998a3071b06f1b777f4330eaf3"},{id:"5",address:"0x0a5aef7dad9c0e1d9f5ac06796a623f0cff18237",name:"APE",gas:61955n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xcf083be4164828f00cae704ec15a36d711491284",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x511f0f358fe530cda0859ec20becf391718fdf5a329be02f4c95361f3d6a42d8"},{id:"6",address:"0xbc924a6716226ae350f1241e6e44dcfd22fe4c65",name:"KYBER",gas:95221n,model:ee.DMM,isTradingAllowed:!0,pools:{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"0x3904ac366d348636694cb6720aa1540e76441b1b","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063":"0x7018c0bd73255c8966d0b26634e0bc0c7595d255","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619":"0x95d708e9ee04b0136b98579141624d19c89b9d68","0x4e3decbb3645551b8a19f0ea1678079fcb33fb4c":"0xa1219dbe76eecbf7571fed6b020dd9154396b70e","0x767058f11800fba6a682e73a6e79ec5eb74fac8c":"0xbb2d00675b775e0f8acd590e08da081b2a36d3a6","0xbd1463f02f61676d53fd183c2b19282bff93d099":"0x439e6a13a5ce7fdca2cc03bf31fb631b3f5ef157","0x6fb2415463e949af08ce50f83e94b7e008babf07":"0xa623aacf9eb4fc0a29515f08bdabb0d8ce385cf7","0xfade2934b8e7685070149034384fb7863860d86e":"0xa0fb4487c0935f01cbf9f0274fe3cdb21a965340","0x3a3e7650f8b9f667da98f236010fbf44ee4b2975":"0x2616f7285bdcb9c3d0422745b1c8a5751e0ea204"},"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270":{"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063":"0x45963db838a070cf7be8e7046fd63e23d376c665","0x1c954e8fe737f99f68fa1ccda3e51ebdb291948c":"0x37e6449b0e99befd2a708ea048d970f4ff4dc65d"},"0x1c954e8fe737f99f68fa1ccda3e51ebdb291948c":{"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619":"0xd8b9e9444fcbf26bea4badd6142dd6a962bca86a"},"0xc1c93d475dc82fe72dbc7074d55f5a734f8ceeae":{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"0x3f1f398887525d2d9acd154ec5e4a3979adffae6"}}},{id:"7",address:"0x0a175cdfae27b92609f8cae4a860673ca62a3c6d",name:"BALANCER:P1",gas:110586n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1n,1000000000000n,1n,1n],tokens:["0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3"],weights:[250000000000000000n,250000000000000000n,250000000000000000n,250000000000000000n],poolId:"0x0297e37f1873d2dab4487aa67cd56b58e2f27875000100000000000000000002",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x0a175cdfae27b92609f8cae4a860673ca62a3c6d"},{id:"8",address:"0x62ae64f166d35dd97daab85ce55ef440baeec3b9",name:"BALANCER:P2",gas:117068n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1000000000000n,1n,1n,1n,1n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3","0xd6df932a45c0f255f85145f286ea0b292b21c90b"],weights:[200000000000000000n,200000000000000000n,200000000000000000n,200000000000000000n,200000000000000000n],poolId:"0x36128d5436d2d70cab39c9af9cce146c38554ff0000100000000000000000008",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x62ae64f166d35dd97daab85ce55ef440baeec3b9"},{id:"9",address:"0xfefbaba274204bfc9af7da6c932fb80b47218f7f",name:"BALANCER:P3",gas:112183n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[10000000000n,1000000000000n,1n],tokens:["0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"],weights:[333333333333333333n,333333333333333333n,333333333333333334n],poolId:"0x03cd191f589d12b0582a99808cf19851e468e6b500010000000000000000000a",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0xfefbaba274204bfc9af7da6c932fb80b47218f7f"},{id:"10",address:"0x2246f96a0f1ff0bb9006a7cddd3d521dc78f23db",name:"BALANCER:P4",gas:114192n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1n,1n,1n,1n],tokens:["0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3","0xd6df932a45c0f255f85145f286ea0b292b21c90b"],weights:[250000000000000000n,250000000000000000n,250000000000000000n,250000000000000000n],poolId:"0xce66904b68f1f070332cbc631de7ee98b650b499000100000000000000000009",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x2246f96a0f1ff0bb9006a7cddd3d521dc78f23db"},{id:"11",address:"0x026b25ffad87be1dce9d8fc675b9f27b2dc7e94a",name:"BALANCER:P5",gas:116983n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1n,1000000000000n,1n,1n,1n],tokens:["0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x580a84c73811e1839f75d86d75d88cca0c241ff4","0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3","0xa3fa99a148fa48d14ed51d610c367c61876997f1"],weights:[200000000000000000n,200000000000000000n,200000000000000000n,200000000000000000n,200000000000000000n],poolId:"0xf461f2240b66d55dcf9059e26c022160c06863bf000100000000000000000006",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x026b25ffad87be1dce9d8fc675b9f27b2dc7e94a"},{id:"12",address:"0x88447266354c276d9cf46c875d1d1c518baf8f5c",name:"BALANCER:P6",gas:111005n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1n,1n,1000000000000n,1n,1n,1n,1n,1n],tokens:["0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a","0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x580a84c73811e1839f75d86d75d88cca0c241ff4","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x831753dd7087cac61ab5644b308642cc1c33dc13","0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3","0xc3fdbadc7c795ef1d6ba111e06ff8f16a20ea539"],weights:[125000000000000000n,125000000000000000n,125000000000000000n,125000000000000000n,125000000000000000n,125000000000000000n,125000000000000000n,125000000000000000n],poolId:"0x32fc95287b14eaef3afa92cccc48c285ee3a280a000100000000000000000005",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x88447266354c276d9cf46c875d1d1c518baf8f5c"},{id:"13",address:"0x1af67ed784fd304005ebdbcdf5f0cfa6807d50a1",name:"BALANCER:P7",gas:113861n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1000000000000n,1n,1n,1n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x50b728d8d964fd00c2d0aad81718b71311fef68a","0x5fe2b58c013d7601147dcdd68c143a77499f5531","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"],weights:[250000000000000000n,250000000000000000n,250000000000000000n,250000000000000000n],poolId:"0x4e7f40cd37cee710f5e87ad72959d30ef8a01a5d00010000000000000000000b",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x1af67ed784fd304005ebdbcdf5f0cfa6807d50a1"},{id:"14",address:"0x2751f56399ae84650f385d7d6d014d5310371ee1",name:"BALANCER:P8",gas:109224n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[10000000000n,1n,1n],tokens:["0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x85955046df4668e1dd369d2de9f3aeb98dd2a369"],weights:[333333333333000000n,333333333334000000n,333333333333000000n],poolId:"0x991aeafbe1b1c7ac8348dc623ae350768d0c65b3000100000000000000000007",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x2751f56399ae84650f385d7d6d014d5310371ee1"},{id:"16",address:"0x279b280bc5ad9115214dff935ee588aafe582caa",name:"JETSWAP",gas:60000n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x668ad0ed2622c62e24f0d5ab6b6ac1b9d2cd4ac7",fee:999n,feePrecision:1000n,pairBytecodeHash:"0x505c843b83f01afef714149e8b174427d552e1aca4834b4f9b4b525f426ff3c6"},{id:"17",address:"0x46d33aba505136d81a26a3329ec2be264e144c47",name:"POLYDEX",gas:300000n,model:ee.PolyDex,isTradingAllowed:!0,factory:"0xeaa98f7b5f7bfbcd1af14d0efaa9d9e68d82f640",fee:10n,feePrecision:10000n,pairBytecodeHash:"0xf60eec85709051eb86026776e0ece6269f1ab16f3af55442e19958beb5239ae2",weight:50},{id:"18",address:"0x315dc0e454f4904df58f2da90decf6167059ce8a",name:"IRON:IS3USD",gas:180728n,model:ee.Iron,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0xb4d09ff3da7f9e9a2ba029cb0a81a989fd7b8f17",poolContract:"0x837503e8a8753ae17fb8c8151b8e6f586defcb57",precision:1000000000000000000n,precisionMul:[1000000000000n,1000000000000n,1n],rates:[1000000000000000000000000000000n,1000000000000000000000000000000n,1000000000000000000n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063"]},{id:"19",address:"0xbb47628fa97409b85eb317e5a45a810b0bfddf69",name:"FIREBIRD:W50",gas:133478n,model:ee.FireBirdWeighted,isTradingAllowed:!0,factory:"0x5de74546d3b86c8df7feec30253865e1149818c8",fee:20n,feePrecision:10000n,pairBytecodeHash:"0x585665f39ba6ff2e62371f7788ded6b903667db133ab8153a17136b5033ab330",weight:50},{id:"20",address:"0x5d39269949945618239c1e9142f0b3d72acf305b",name:"FIREBIRD:3FBIRD",gas:193614n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x4a592de6899ff00fbc2c99d7af260b5e7f88d1b4",poolContract:"0x01c9475dbd36e46d1961572c8de24b74616bae9e",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"]},{id:"21",address:"0x1e2e128eec94a5a33f962c2375495e91fd2aae85",name:"BALANCER:P9",gas:156629n,model:ee.BalancerStable,isTradingAllowed:!0,scalingFactors:[1000000000000000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000000000000000n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x2e1ad108ff1d8c782fcbbb89aad783ac49586756","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"],aPrecision:1000n,poolId:"0x0d34e5dd4d8f043557145598e4e2dc286b35fd4f000000000000000000000068",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x1e2e128eec94a5a33f962c2375495e91fd2aae85"},{id:"22",address:"0x7fce0fa189c47714bd0f1d7ee49c1c7aec6ad93f",name:"BALANCER:P10",gas:155206n,model:ee.BalancerStable,isTradingAllowed:!0,tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0xa3fa99a148fa48d14ed51d610c367c61876997f1","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"],aPrecision:1000n,poolId:"0x06df3b2bbb68adc8b0e302443692037ed9f91b42000000000000000000000012",scalingFactors:[1000000000000000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000000000000000n],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x7fce0fa189c47714bd0f1d7ee49c1c7aec6ad93f"},{id:"23",address:"0x4cbfba4a1b4e7c3de12541dd27fccd04029ddd2c",name:"BALANCER:P11",gas:103806n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xcf354603a9aebd2ff9f33e1b04246d8ea204ae9500020000000000000000005a",scalingFactors:[10000000000n,1n],tokens:["0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0x4cbfba4a1b4e7c3de12541dd27fccd04029ddd2c"},{id:"24",address:"0xab78027f63bc71db1ce49a879d36c8c0b9acc531",name:"BALANCER:P12",gas:131590n,model:ee.BalancerStable,isTradingAllowed:!0,aPrecision:1000n,poolId:"0xfeadd389a5c427952d8fdb8057d6c8ba1156cc5600020000000000000000001e",scalingFactors:[10000000000000000000000000000n,10000000000000000000000000000n],tokens:["0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0xdbf31df14b66535af65aac99c32e9ea844e14501"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0xab78027f63bc71db1ce49a879d36c8c0b9acc531"},{id:"25",address:"0x51fce76156230322bc7ef329466de03a17cac55a",name:"BALANCER:P13",gas:108223n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x10f21c9bd8128a29aa785ab2de0d044dcdd79436000200000000000000000059",scalingFactors:[1000000000000n,1n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0x51fce76156230322bc7ef329466de03a17cac55a"},{id:"26",address:"0x26ca72487e89131ef99bb7ea7d01e370bffd9266",name:"BALANCER:P14",gas:108101n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xb2634e2bfab9664f603626afc3d270be63c09ade000200000000000000000021",scalingFactors:[10000000000n,1n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xe2aa7db6da1dae97c5f5c6914d285fbfcc32a128"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0x26ca72487e89131ef99bb7ea7d01e370bffd9266"},{id:"27",address:"0xd947938e917c3395074a0d5cc9b9490521bfbfb2",name:"BALANCER:P15",gas:114430n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x7c9cf12d783821d5c63d8e9427af5c44bad92445000100000000000000000051",scalingFactors:[1n,1n,1n],tokens:["0x2c89bbc92bd86f8075d1decc58c7f4e0107f286b","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x7dff46370e9ea5f0bad3c4e29711ad50062ea7a4"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[333333333333333333n,333333333333333333n,333333333333333334n],depositAddress:"0xd947938e917c3395074a0d5cc9b9490521bfbfb2"},{id:"28",address:"0xaa20d3409991b61adc8213b103798863c8fbdfc5",name:"BALANCER:P16",gas:107109n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x614b5038611729ed49e0ded154d8a5d3af9d1d9e00010000000000000000001d",scalingFactors:[1n,1n,1n],tokens:["0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0xf501dd45a1198c2e1b5aef5314a68b9006d842e0"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[400000000000000000n,200000000000000000n,400000000000000000n],depositAddress:"0xaa20d3409991b61adc8213b103798863c8fbdfc5"},{id:"29-1",address:"0x458a2a773a4be86cd3197aaaff8b23b122b8637f",name:"CURVE:ATRICRYPTO3",gas:0n,model:ee.CurveCrypto,isTradingAllowed:!1,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0xdad97f7713ae9437fa9249920ec8507e5fbb23d3",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0x92215849c439e1f8612b6646060b4e3e5ef822cc",precision:1000000000000000000n,precisions:[1n,10000000000n,1n],tokens:["0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171","0x5c2ed810328349100a66b82b78a1791b101c9d61","0x28424507fefb6f7f8e9d3860f56504e4e5f5f390"]},{id:"29",address:"0x458a2a773a4be86cd3197aaaff8b23b122b8637f",name:"CURVE:ATRICRYPTO3ZAP",gas:1348065n,model:ee.CurveLendingCryptoZap,isTradingAllowed:!0,basePoolId:"2-1",poolId:"29-1",nStablecoins:3,poolContract:"0x1d8b86e3d88cdb2d34688e87e72f388cb541b7c8",tokens:["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"]},{id:"30-1",address:"0xd89cdbd3c1299ed978248cc59091c9ac40ae44c4",name:"CURVE:EURTUSD",gas:0n,model:ee.CurveCrypto,isTradingAllowed:!1,poolContract:"0xb446bf7b8d6d4276d0c75ec0e3ee8dd7fe15783a",aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0x600743b1d8a96438bd46836fd34977a00293f6aa",maxA:4000000000n,minA:4000n,maxGamma:20000000000000000n,minGamma:10000000000n,noiseFee:100000n,precision:1000000000000000000n,precisions:[1000000000000n,1n],tokens:["0x7bdf330f423ea880ff95fc41a280fd5ecfd3d09f","0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171"]},{id:"30",address:"0xd89cdbd3c1299ed978248cc59091c9ac40ae44c4",name:"CURVE:EURTUSDZAP",gas:976835n,model:ee.CurveLendingCryptoTwoZap,isTradingAllowed:!0,basePoolId:"2-1",nCoins:2,nStablecoins:3,poolContract:"0x225fb4176f0e20cdb66b4a3df70ca3063281e855",poolId:"30-1",tokens:["0x7bdf330f423ea880ff95fc41a280fd5ecfd3d09f","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"]},{id:"31",address:"0x374fd28edf5e7191f804d622c6bc821d11a89975",name:"CURVE:FRAX3CRV",gas:1152286n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:0n,basePoolRouteId:"2-1",feeDenominator:10000000000n,isCacheExists:!1,lpToken:"0x5e5a23b52cb48f5e70271be83079ca5bc9c9e9ac",multicall:I.polygon,poolContract:"0x5e5a23b52cb48f5e70271be83079ca5bc9c9e9ac",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x45c32fa6df82ead1e2ef74d17b76547eddfaff89","0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171"]},{id:"32",address:"0xd7acd8e1f8aeb18722ce69a46acc776271ebf839",name:"CURVE:REN",gas:470804n,model:ee.CurveLendingA,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,lpToken:"0xf8a57c1d3b9629b77b6726a042ca48990a84fb49",poolContract:"0xc2d95eef97ec6c17551d45e77b590dc1f9117c67",precision:1000000000000000000n,precisionMul:[10000000000n,10000000000n],tokens:["0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0xdbf31df14b66535af65aac99c32e9ea844e14501"]},{id:"33",address:"0x1f9c96e6e7679671e9ae14e70b23bef7d8537621",name:"CURVE:2JPY",gas:131951n,model:ee.CurvePlain,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,lpToken:"0xe8dcea7fb2baf7a9f4d9af608f06d78a687f8d9a",poolContract:"0xe8dcea7fb2baf7a9f4d9af608f06d78a687f8d9a",precision:1000000000000000000n,precisionMul:[1n,1n],tokens:["0x8343091f2499fd4b6174a46d067a920a3b851ff9","0x6ae7dfc73e0dde2aa99ac063dcf7e8a63265108c"],isUnderlying:!1,lendingPrecision:1000000000000000000n,rates:[1000000000000000000n,1000000000000000000n]},{id:"34",address:"0x3b0425caff209ff2f5a942c9a7529a8ecdc61c3d",name:"CURVE:4EUR",gas:155296n,model:ee.CurvePlain,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0xad326c253a84e9805559b73a08724e11e49ca651",poolContract:"0xad326c253a84e9805559b73a08724e11e49ca651",precision:1000000000000000000n,precisionMul:[1n,1n,10000000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000n,10000000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x4e3decbb3645551b8a19f0ea1678079fcb33fb4c","0xe2aa7db6da1dae97c5f5c6914d285fbfcc32a128","0xe111178a87a3bff0c8d18decba5798827539ae99","0x7bdf330f423ea880ff95fc41a280fd5ecfd3d09f"]},{id:"35",address:"0x35d0697dda64e1a95c107e539c772c8dc6944117",name:"DODO:V1USDT",gas:219602n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0x357c5e9cfa8b834edcef7c7aabd8f9db09119d11",pools:{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"0x813fddeccd0401c4fa73b092b074802440544e52"}}},{id:"36",address:"0x1cbff260f27085cb1ef0af9874a75216e9ad8a2f",name:"DODO:V2DVMUSDT",gas:114801n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x79887f65f83bdf15bcc8736b5e5bcdb48fb8fe13",pools:{"0xe4bf2864ebec7b7fdf6eeca9bacae7cdfdaffe78":{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"0x581c7db44f2616781c86c331d31c1f09db87a746"}}},{id:"37",address:"0x95053b0cc0828437d0de875743cb052d560daf02",name:"DODO:V2DPPUSDC",gas:78608n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xd24153244066f0afa9415563bfc7ba248bfb7a51",pools:{"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619":{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"0x5333eb1e32522f1893b7c9fea3c263807a02d561"},"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270":{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"0x10dd6d8a29d489bede472cc1b22dc695c144c5c7"},"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"0xa0020444b98f67b77a3d6de6e66af11c87da086e"},"0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6":{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"0xe020008465cd72301a18b97d33d73bf44858a4b7"}}},{id:"38",address:"0x5444b8415293c350ed8bdabfc3f419f8be075f97",name:"SYNAPSE:STABLESWAP",gas:197636n,model:ee.Synapse,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x7479e1bc2f2473f9e78c89b4210eb6d55d33b645",poolContract:"0x85fcd7dd0a1e1a9fcd5fd886ed522de8221c3ee5",precision:1000000000000000000n,precisionMul:[1n,1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0xb6c473756050de474286bed418b77aeac39b02af","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"]},{id:"39",address:"0xb262f442b264d499041bb034588fc80f816a2705",name:"DODO:V2DPPUSDC2",gas:98449n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xd24153244066f0afa9415563bfc7ba248bfb7a51",pools:{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"0x38c56f05a7b4e4dc79eac6c264829c7b21fbf7a8"}}},{id:"40",address:"0xcf42c6d7d5ca8f7d4a472cc94f48f82b99444e3e",name:"DODO:V2DPPUSDT",gas:102671n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xd24153244066f0afa9415563bfc7ba248bfb7a51",pools:{"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270":{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"0x2144ee9e47998e0d7ea990252d6fe63107a31018"}}},{id:"41",address:"0xc6c24c98ad811338a1785cff80ba20465d82f5c3",name:"DODO:V2DPPDAI",gas:106532n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xd24153244066f0afa9415563bfc7ba248bfb7a51",pools:{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":{"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063":"0xaae10fa31e73287687ce56ec90f81a800361b898"},"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":{"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063":"0xda43a4aab20d313ab3aa07d8e09f3521f32a3d83"}}}],ce=I.avalanche,re=[{id:"55f72e4f-4737-4a9a-93db-05aff805eaa4",name:"SUSHI",address:"0x537b067958afbc9327958fb7441f086b71888a4b",gas:72958n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xc35dadb65012ec5796536bd9864ed8773abc74c4",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"},{id:"66ed9e07-610a-484b-a984-86f8e91326bf",name:"PANGOLIN",address:"0x493f1b81b05e29e86d9a4762944ed8b5fd2924a5",gas:69022n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xefa94de7a4656d787667c749f7e1223d71e9fd88",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x40231f6b438bce0797c9ada29b718a87ea0a5cea3fe9a771abdd76bd41a3e545"},{id:"190cecab-a63f-4f08-ac7e-8af670ad9247",name:"OLIVECASH",address:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",gas:68434n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x4fe4d8b01a56706bc6cad26e8c59d0c7169976b3",fee:998n,feePrecision:1000n,pairBytecodeHash:"0xb7145948956af92afd2ae97eff039ada60998237282c1687ca23ce1ad5e1d282"},{id:"6dd410ef-7fb5-44c1-8600-152441f72a77",name:"BAGUETTE",address:"0x2c7a8122a1b512adc848024ce72e837001ecb586",gas:69791n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x3587b8c0136c2c3605a9e5b03ab54da3e4044b50",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x81dbf51ab39dc634785936a3b34def28bf8007e6dfa30d4284c4b8547cb47a51"},{id:"a078434d-f618-4e01-b98a-569903721272",name:"CANARY",address:"0x71762f1fdc36afc769a25dcd73226c6edca6832a",gas:69781n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xcfba329d49c24b70f3a8b9cc0853493d4645436b",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x60df5edf580dff3274fff5a3d83ad2b6ef6e296f71c3bc28c939e641888bd5b0"},{id:"a30073d1-29b6-4df0-9ed5-28c3960b0c39",name:"ELK",address:"0x8860dc637a513027e4883a77a5567cfeaa718ae2",gas:88320n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x091d35d7f63487909c863001ddca481c6de47091",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x33c4831a098654d3d20a78641a198ee6ffc1ceed49f2196b75bb244891c260e3"},{id:"cfe5944f-c6bf-47fe-9128-d4c4e317d70c",name:"HAKU",address:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696",gas:74029n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x2db46feb38c57a6621bca4d97820e1fc1de40f41",fee:998n,feePrecision:1000n,pairBytecodeHash:"0xf0a389c88c385a3fa20755278000aabbe86028f1b77659475569f3575b2aebe3"},{id:"6dd92be7-2330-4215-a152-20322b7ebedf",name:"LYDIA",address:"0xdcc3a56e97a7448c64341e38867241f65168817d",gas:67409n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xe0c1bb6df4851feeedc3e14bd509feaf428f7655",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x47cc4f3a5e7a237c464e09c6758ac645084f198b8f64eedc923317ac4481a10c"},{id:"f36b19a0-6a5c-48b9-a7f4-e12d03894869",name:"THORUS",address:"0x02800d3d33e7e9d32c586fcaaea0412e5a57792d",gas:69421n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xa98ea6356a316b44bf710d5f9b6b4ea0081409ef",fee:999n,feePrecision:1000n,pairBytecodeHash:"0xc6b4cc64699496d0514c783d6aca5142c3b61e327524db01cabfa4248e430e49"},{id:"c2d346e3-8d17-4dee-9d31-f3e2755f6cb2",name:"TRADERJOE",address:"0x2c49bdff3acb931491d1c0231952d9718c516539",gas:67340n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x9ad6c38be94206ca50bb0d90783181662f0cfa10",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x0bbca9af0511ad1a1da383135cf3a8d2ac620e549ef9f6ae3a4c33c2fed0af91"},{id:"776400cb-8bf7-4960-9c24-e1b5b1c84909",name:"YETI",address:"0x2208705b6f232ef498d46514b5130192789e9dc8",gas:69349n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x58c8cd291fa36130119e6deb9e520fbb6aca1c3a",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xcc133f6dd9577d2022e9f47ec90dd24049584e73131095c170715fa7c950a64a"},{id:"c504617b-5fb4-43a2-939d-c6f1fbf19383",name:"KYBER",address:"0x81d10cbea2b7e2ce9589cfe48442a83f013885ab",gas:90276n,model:ee.DMM,isTradingAllowed:!0,pools:{"0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664":{"0xc7198437980c041c805a1edcba50c1ce5db95118":"0x108695e4e46e8232efebe63c421cc302cc780d45","0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e":"0xd87cd5aa7efdc4de73ef8c7166d4d1daa37e2330","0xe19a1684873fab5fb694cfd06607100a632ff21c":"0xd03367dd753dbf46f6e2bb7253b2f17ef947aeb8","0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7":"0x475d13a015d478aa8271655584348f3268007cbd"},"0x39fc9e94caeacb435842fadedecb783589f50f5f":{"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7":"0x4797d61a80fbb90aa060c6d8fe9991c41c4868bf"},"0x130966628846bfd36ff31a822705796e8cb8c18d":{"0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664":"0xc6710e83abbbbaa6d1576dd30df3baf6147823d8"},"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7":{"0xd1c3f94de7e5b45fa4edbba472491a9f4b166fc4":"0xb34068e28a7853123afafc936c972123eb9895a2"},"0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7":{"0xc7198437980c041c805a1edcba50c1ce5db95118":"0x88d23fc2df1e5d07e58105301a560cf92a4e6ecb"},"0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab":{"0x50b7545627a5162f82a992c33b87adc75187b218":"0x3e2673e7dcad191470d489959aba0e6e7ed2d5a3","0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7":"0x0f0fc5a5029e3d155708356b422d22cc29f8b3d4"}}},{id:"4c9c984f-d409-4049-804f-ff133bd50dcf",address:"0x815f667a542653d89d44ff9d09b11dd7d4d78004",name:"CURVE:ATRICRYPTO",model:ee.CurveCrypto,isTradingAllowed:!1,gas:0n,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0x1dab6560494b04473a0be3e7d83cf3fdf3a51828",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0xb755b949c126c04e0348dd881a5cf55d424742b2",precision:1000000000000000000n,precisions:[1n,10000000000n,1n],tokens:["0x1337bedc9d22ecbe766df105c9623922a27963ec","0x686bef2417b6dc32c50a3cbfbcc3bb60e1e9a15d","0x53f7c5869a859f0aec3d334ee8b4cf01e3492f21"]},{id:"b0f9d06f-de5a-42dc-8c47-3b6a73132a4e",address:"0xb1fae488e9cc7eb03a2b8ed5ef2f5475f4aaf1e9",name:"CURVE:AAVE",model:ee.CurveLendingA,isTradingAllowed:!0,gas:688788n,aPrecision:100n,feeDenominator:10n**10n,lpToken:"0x1337bedc9d22ecbe766df105c9623922a27963ec",poolContract:"0x7f90122bf0700f9e7e1f688fe926940e8839f353",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],tokens:["0xd586e7f844cea2f87f50152665bcbc2c279d8d70","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664","0xc7198437980c041c805a1edcba50c1ce5db95118"]},{id:"6928b0db-5314-4682-b63c-ea556e4d4d60",address:"0x815f667a542653d89d44ff9d09b11dd7d4d78004",name:"CURVE:ATRICRYPTOZAP",model:ee.CurveLendingCryptoZap,isTradingAllowed:!0,gas:1162362n,basePoolId:"b0f9d06f-de5a-42dc-8c47-3b6a73132a4e",nStablecoins:3,poolContract:"0x58e57cA18B7A47112b877E31929798Cd3D703b0f",poolId:"4c9c984f-d409-4049-804f-ff133bd50dcf",tokens:["0xd586e7f844cea2f87f50152665bcbc2c279d8d70","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664","0xc7198437980c041c805a1edcba50c1ce5db95118","0x50b7545627a5162f82a992c33b87adc75187b218","0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab"]},{id:"2ea7dd4a-39cf-4a90-8b5b-dbb2c87bc677",address:"0x3ffecb3df6c24b3676cafd408b561065337326c9",name:"CURVE:3POOLV2",model:ee.CurvePlain,isTradingAllowed:!0,gas:146636n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0xaea2e71b631fa93683bcf256a8689dfa0e094fcd",poolContract:"0xaea2e71b631fa93683bcf256a8689dfa0e094fcd",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x130966628846bfd36ff31a822705796e8cb8c18d","0xc7198437980c041c805a1edcba50c1ce5db95118","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664"]},{id:"89d9ffc2-8a1e-4517-8124-8292d56c29c5",address:"0xa3a8412c853043d4390d715b133d6c60214585de",name:"CURVE:USDC",model:ee.CurvePlain,isTradingAllowed:!0,gas:161812n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0x3a43a5851a3e3e0e25a3c1089670269786be1577",poolContract:"0x3a43a5851a3e3e0e25a3c1089670269786be1577",precision:1000000000000000000n,precisionMul:[1000000000000n,1000000000000n],rates:[1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664","0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e"]},{id:"1a3858a7-a4cc-4e0c-9166-d20d830d1bd5",address:"0x58ace9e109d9e34bb12b0afb3d09e9d94b849544",name:"CURVE:REN",model:ee.CurveLendingA,isTradingAllowed:!0,gas:469877n,aPrecision:100n,feeDenominator:10000000000n,lpToken:"0xc2b1df84112619d190193e48148000e3990bf627",poolContract:"0x16a7da911a4dd1d83f3ff066fe28f3c792c50d90",precision:1000000000000000000n,precisionMul:[10000000000n,10000000000n],tokens:["0x50b7545627a5162F82A992c33b87aDc75187B218","0xDBf31dF14B66535aF65AaC99C32e9eA844e14501"]},{id:"42be668f-c0bb-4255-a5e3-bc7745c88c41",address:"0x9db45b627ee95ac86b059171cb17dc266be857fb",name:"CURVE:MIM",model:ee.CurveMeta,isTradingAllowed:!0,gas:1144681n,baseCacheExpires:0n,basePoolRouteId:"b0f9d06f-de5a-42dc-8c47-3b6a73132a4e",feeDenominator:10000000000n,aPrecision:100n,isCacheExists:!1,lpToken:"0x30df229cefa463e991e29d42db0bae2e122b2ac7",multicall:ce,poolContract:"0x30df229cefa463e991e29d42db0bae2e122b2ac7",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x130966628846bfd36ff31a822705796e8cb8c18d","0x1337bedc9d22ecbe766df105c9623922a27963ec"]},{id:"215bc9e9-1fc5-4b98-8585-9d137d5b7e58",address:"0x672c44cba94c08b9a7d079d79a25107da5d4f585",name:"CURVE:FRAX",model:ee.CurveMeta,isTradingAllowed:!0,gas:1151134n,baseCacheExpires:0n,basePoolRouteId:"b0f9d06f-de5a-42dc-8c47-3b6a73132a4e",feeDenominator:10000000000n,isCacheExists:!1,aPrecision:100n,lpToken:"0xe013593cea239e445d2271106836b00c9e7356ae",multicall:ce,poolContract:"0xe013593cea239e445d2271106836b00c9e7356ae",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64","0x1337bedc9d22ecbe766df105c9623922a27963ec"]},{id:"5c59b646-7647-4d75-8ce9-eb70136cdd0b",address:"0x2eca6cfc9f78c9dd10e03520613a647ac8b5fdcf",name:"AXIAL:AS4D",model:ee.Synapse,isTradingAllowed:!0,gas:202535n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0x3a7387f8ba3ebffa4a0eccb1733e940ce2275d3f",poolContract:"0x2a716c4933a20cd8b9f9d9c39ae7196a85c24228",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000n,1000000000000000000000000000000n],tokens:["0x1c20e891bab6b1727d14da358fae2984ed9b59eb","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664","0xd586e7f844cea2f87f50152665bcbc2c279d8d70","0xc7198437980c041c805a1edcba50c1ce5db95118"]},{id:"0af16355-4a47-424b-99b6-9b7064f49fa4",address:"0x0261fe3d25e470c387f456cd68b69eaf20b21063",name:"AXIAL:AC4D",model:ee.Synapse,isTradingAllowed:!0,gas:201543n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0x4da067e13974a4d32d342d86fbbbe4fb0f95f382",poolContract:"0x8c3c1c6f971c01481150ca7942bd2bbb9bc27bc7",precision:1000000000000000000n,precisionMul:[1n,1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0x4fbf0429599460d327bd5f55625e30e4fc066095","0x130966628846bfd36ff31a822705796e8cb8c18d","0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64","0xd586e7f844cea2f87f50152665bcbc2c279d8d70"]},{id:"bbb66c85-4039-406b-abba-f85275a20b50",address:"0x156928f341f8618ec88820f85b4ea52468d088e3",name:"AXIAL:AM3D",model:ee.Synapse,isTradingAllowed:!0,gas:189820n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0xc161e4b11faf62584efcd2100ccb461a2dde64d1",poolContract:"0x90c7b96ad2142166d001b27b5fbc128494cdfbc8",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000n],tokens:["0x130966628846bfd36ff31a822705796e8cb8c18d","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664","0xd586e7f844cea2f87f50152665bcbc2c279d8d70"]},{id:"acef3dc9-6b67-42d8-8bd4-0b621485a4be",address:"0xa2b12a2816d2cbe083b45367e97824ec2bb2d97a",name:"AXIAL:AA3D",model:ee.Synapse,isTradingAllowed:!0,gas:209560n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0xad556e7dc377d9089c6564f9e8d275f5ee4da22d",poolContract:"0x6efbc734d91b229be29137cf9fe531c1d3bf4da6",precision:1000000000000000000n,precisionMul:[1n,1n,1000000000000n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000000000000000n],tokens:["0x346a59146b9b4a77100d369a3d18e8007a9f46a6","0x130966628846bfd36ff31a822705796e8cb8c18d","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664"]},{id:"d937f8aa-fd88-4ee0-905a-b18b98992052",address:"0x5731a6b2c7e485a954f2545850a3849e4154d7a8",name:"GMX",model:ee.GmxDex,isTradingAllowed:!0,gas:291899n,vaultContract:"0x9ab2de34a33fb459b538c43f251eb825645e8595",pricePrecision:1000000000000000000000000000000n,debtTokenContract:"0xc0253c3cc6aa5ab407b5795a04c28fb063273894"}],oe=I.optimism,fe={arbitrum:ae,polygon:de,bsc:ne,ethereum:ie,avalanche:re,optimism:[{id:"29631de7-9ff1-43c4-aa38-eece4fc168df",address:"0x815f667a542653d89d44ff9d09b11dd7d4d78004",name:"CURVE:3POOL",gas:148774n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x1337bedc9d22ecbe766df105c9623922a27963ec",poolContract:"0x1337bedc9d22ecbe766df105c9623922a27963ec",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0xda10009cbd5d07dd0cecc66161fc93d7c9000da1","0x7f5c764cbc14f9669b88837ca1490cca17c31607","0x94b008aa00579c1307b0ef2c499ad98a8ce58e58"]},{id:"c88be045-15ec-4bdb-9e05-e547343448f1",address:"0xffbd0e92861b9cb4b7ae17361786868e6f2f9324",name:"CURVE:4POOL",gas:137463n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x3da3153e26a230d918bb9f9428a8d60349b73379",poolContract:"0x3da3153e26a230d918bb9f9428a8d60349b73379",precision:1000000000000000000n,precisionMul:[1000000000000n,1n,1000000000000n,1000000000000n],rates:[1000000000000000000000000000000n,1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0xfb21b70922b9f6e3c6274bcd6cb1aa8a0fe20b80","0x2e3d870790dc77a83dd1d18184acc7439a53f475","0x7f5c764cbc14f9669b88837ca1490cca17c31607","0x94b008aa00579c1307b0ef2c499ad98a8ce58e58"]},{id:"6189ad21-d0a4-4a34-95c2-6fc8e67f9c66",address:"0x978e214ce2e34d14cf80ee6c0951909cab18abb8",name:"CURVE:MAI",model:ee.CurveMeta,isTradingAllowed:!0,gas:248263n,baseCacheExpires:0n,basePoolRouteId:"29631de7-9ff1-43c4-aa38-eece4fc168df",feeDenominator:10000000000n,aPrecision:100n,isCacheExists:!1,lpToken:"0x6645237fb81fe7227aa2fa2a244d23a5ac0da1cd",multicall:oe,poolContract:"0x6645237fb81fe7227aa2fa2a244d23a5ac0da1cd",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xdfa46478f9e5ea86d57387849598dbfb2e964b02","0x1337bedc9d22ecbe766df105c9623922a27963ec"]},{id:"afd121db-1f0c-47ac-8633-9e71673df159",address:"0x81d10cbea2b7e2ce9589cfe48442a83f013885ab",name:"CURVE:SYNTHETIX",gas:338475n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:0n,basePoolRouteId:"29631de7-9ff1-43c4-aa38-eece4fc168df",feeDenominator:10000000000n,isCacheExists:!1,lpToken:"0x061b87122ed14b9526a813209c8a59a633257bab",multicall:oe,poolContract:"0x061b87122ed14b9526a813209c8a59a633257bab",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9","0x1337bedc9d22ecbe766df105c9623922a27963ec"]},{id:"21dd33fd-a10a-4e84-8343-0c06048d4b42",address:"0x02800d3d33e7e9d32c586fcaaea0412e5a57792d",name:"UNI:V3F500",gas:148155n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:500n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:30,tickQuerier:"0x2c7a8122a1b512adc848024ce72e837001ecb586"},{id:"a1ed973b-f136-496b-944a-5dde3cb73962",address:"0x2c49bdff3acb931491d1c0231952d9718c516539",name:"UNI:V3F3000",gas:92387n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:3000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:30,tickQuerier:"0x2c7a8122a1b512adc848024ce72e837001ecb586"},{id:"6605bbed-0e36-46f9-80c7-aebf66e3e2cc",address:"0x2208705b6f232ef498d46514b5130192789e9dc8",name:"UNI:V3F10000",gas:98398n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:10000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:30,tickQuerier:"0x2c7a8122a1b512adc848024ce72e837001ecb586"},{id:"20054883-b7d7-4068-869b-898279bc9b62",address:"0x156928f341f8618ec88820f85b4ea52468d088e3",name:"VELODROME:STABLE",gas:238696n,model:ee.Solidly,isTradingAllowed:!0,factoryContract:"0x25cbddb98b35ab1ff77413456b31ec81a6b6b746",isStable:!0,pairBytecodeHash:"0xc1ac28b1c4ebe53c0cff67bab5878c4eb68759bb1e9f73977cd266b247d149f0"},{id:"09c33f3b-9aec-4c02-b455-6af01efce4c1",address:"0x2eca6cfc9f78c9dd10e03520613a647ac8b5fdcf",name:"VELODROME:VOLATILE",gas:126168n,model:ee.Solidly,isTradingAllowed:!0,factoryContract:"0x25cbddb98b35ab1ff77413456b31ec81a6b6b746",isStable:!1,pairBytecodeHash:"0xc1ac28b1c4ebe53c0cff67bab5878c4eb68759bb1e9f73977cd266b247d149f0"},{id:"f56c67ba-84f7-446a-8591-ad9156041f4d",address:"0xb964976c3c4f60278fc755ffc5a65008a147b014",name:"SYNTHETIX",gas:327223n,model:ee.Synthetix,isTradingAllowed:!0,sUsdContract:"0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9",exchangeRatesContract:"0x22602469d704bffb0936c7a7cfcd18f7aa269375",exchangerContract:"0xcc02f000b0aa8a0efc2b55c9cf2305fb3531cca1",synthetixContract:"0x8700daec35af8ff88c16bdf0418774cb3d7599b4",flexibleStorageContract:"0x47649022380d182da8010ae5d257fea4227b21ff",tokens:{"0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9":"sUSD","0x00b8d5a5e1ac97cb4341c4bc4367443c8776e8d9":"sAAVE","0xb2b42b231c68cbb0b4bf2ffebf57782fd97d3da4":"sAVAX","0x298b9b95708152ff6968aafd889c6586e9169f1d":"sBTC","0xe405de8f52ba7559f9df3c368500b6e6ae6cee49":"sETH","0xfbc4198702e81ae77c06d58f81b629bdf36f0a71":"sEUR","0xa3a538ea5d5838dc32dde15946ccd74bdd5652ff":"sINR","0xc5db22719a06418028a40a9b5e9a7c02959d0d08":"sLINK","0x81ddfac111913d3d5218dea999216323b7cd6356":"sMATIC","0x8b2f7ae8ca8ee8428b6d76de88326bb413db2766":"sSOL","0xf5a6115aa582fd1beea22bc93b7dc7a785f60d03":"sUNI"},PRECISION_UNIT:1000000000000000000n},{id:"10e4169c-3485-449f-8da1-cb3271746aec",address:"0x357c495fede59bc878d79bb50f1ab407ac18d359",name:"VELO:CL1",gas:134971n,gasPerInitializedTick:50513n,gasPerTick:10060n,model:ee.VelodromeSS,isTradingAllowed:!0,depositAddress:"0xcdd097847f685031fd3f43d2f4be90dfa27aaa56",factory:"0x548118c7e0b865c2cfa94d15ec86b666468ac758",tickSpacing:1n,pairBytecodeHash:"0x3e17c3f6d9f39d14b65192404b8d70a2f921655d3f7f5e7481ab3fcf0756e8ea",maxInitializedTicks:30,tickQuerier:"0xc08d052983c1c72fa3f80d65f4aca61caacb4305"},{id:"75fa546a-eaec-449a-ab28-535f786b2de2",address:"0x44fa71edcf6b490a5037e44ca1941e530487e59a",name:"VELO:CL50",gas:141276n,gasPerInitializedTick:50513n,gasPerTick:10060n,model:ee.VelodromeSS,isTradingAllowed:!0,depositAddress:"0xcdd097847f685031fd3f43d2f4be90dfa27aaa56",factory:"0x548118c7e0b865c2cfa94d15ec86b666468ac758",tickSpacing:50n,pairBytecodeHash:"0x3e17c3f6d9f39d14b65192404b8d70a2f921655d3f7f5e7481ab3fcf0756e8ea",maxInitializedTicks:30,tickQuerier:"0xc08d052983c1c72fa3f80d65f4aca61caacb4305"},{id:"e49e5196-a257-48ff-86df-162cf6e3de1c",address:"0xdebe380b9450dc33886f25662426d000b4f5e2e9",name:"VELO:CL100",gas:149438n,gasPerInitializedTick:50513n,gasPerTick:10060n,model:ee.VelodromeSS,isTradingAllowed:!0,depositAddress:"0xcdd097847f685031fd3f43d2f4be90dfa27aaa56",factory:"0x548118c7e0b865c2cfa94d15ec86b666468ac758",tickSpacing:100n,pairBytecodeHash:"0x3e17c3f6d9f39d14b65192404b8d70a2f921655d3f7f5e7481ab3fcf0756e8ea",maxInitializedTicks:30,tickQuerier:"0xc08d052983c1c72fa3f80d65f4aca61caacb4305"},{id:"4aab6422-95da-4594-9144-aae093841016",address:"0xe591203b0322b9774f5ddd5973dd6e062c27fbae",name:"VELO:CL200",gas:144128n,gasPerInitializedTick:50513n,gasPerTick:10060n,model:ee.VelodromeSS,isTradingAllowed:!0,depositAddress:"0xcdd097847f685031fd3f43d2f4be90dfa27aaa56",factory:"0x548118c7e0b865c2cfa94d15ec86b666468ac758",tickSpacing:200n,pairBytecodeHash:"0x3e17c3f6d9f39d14b65192404b8d70a2f921655d3f7f5e7481ab3fcf0756e8ea",maxInitializedTicks:30,tickQuerier:"0xc08d052983c1c72fa3f80d65f4aca61caacb4305"},{id:"b7b62aba-c38c-4f4e-bf57-3327e6aa4a1b",address:"0x86112f7888d068f5e805b12a1503dd23d2a62e86",name:"VELO:CL2000",gas:136567n,gasPerInitializedTick:50513n,gasPerTick:10060n,model:ee.VelodromeSS,isTradingAllowed:!0,depositAddress:"0xcdd097847f685031fd3f43d2f4be90dfa27aaa56",factory:"0x548118c7e0b865c2cfa94d15ec86b666468ac758",tickSpacing:2000n,pairBytecodeHash:"0x3e17c3f6d9f39d14b65192404b8d70a2f921655d3f7f5e7481ab3fcf0756e8ea",maxInitializedTicks:30,tickQuerier:"0xc08d052983c1c72fa3f80d65f4aca61caacb4305"},{id:"a5d339ba-9014-4522-8666-02bcf44f3a43",address:"0xb33d7906e308037a53a54502159a88dfdbd4ab9a",name:"VELODROME:V2STABLE",gas:228946n,model:ee.VelodromeV2,isTradingAllowed:!0,factoryContract:"0xf1046053aa5682b4f9a81b5481394da16be5ff5a",isStable:!0,pairBytecodeHash:"0xc0629f1c7daa09624e54d4f711ba99922a844907cce02997176399e4cc7e8fcf"},{id:"a73d3d9f-4b42-41d5-8df3-545b296e6762",address:"0x3e0bb9c5695ebbe20bc3cbf29dcf21422310dcce",name:"VELODROME:V2VOLATILE",gas:208223n,model:ee.VelodromeV2,isTradingAllowed:!0,factoryContract:"0xf1046053aa5682b4f9a81b5481394da16be5ff5a",isStable:!1,pairBytecodeHash:"0xc0629f1c7daa09624e54d4f711ba99922a844907cce02997176399e4cc7e8fcf"},{id:"f50ca1c0-f842-4872-9fe8-de95a3015081",address:"0xec7f1a405b2e516740cc5e4f9e017bdff4aeb945",name:"CURVE:TRICRYPTONG:CRVUSD",gas:183867n,model:ee.CurveTriCryptoNG,isTradingAllowed:!0,aMultiplier:10000n,multicallContract:"0xca11bde05977b3631167028862be2a173976ca11",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0x4456d13fc6736e8e8330394c0c622103e06ea419",precisions:[1n,10000000000n,1n],precision:1000000000000000000n,tokens:["0xc52d7f23a2e460248db6ee192cb23dd12bddcbf6","0x68f180fcce6836688e9084f035309e29bf0a2095","0x4200000000000000000000000000000000000006"]},{id:"73076b5c-56f4-498e-b3a6-5e945baf9967",address:"0x961ae74511a8ecb6e88badbd0285e1838ac47e27",name:"CURVE:TRICRYPTONG:OP",gas:192412n,model:ee.CurveTriCryptoNG,isTradingAllowed:!0,aMultiplier:10000n,multicallContract:"0xca11bde05977b3631167028862be2a173976ca11",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0xd8dd9a8b2aca88e68c46af9008259d0ec04b7751",precisions:[1n,1n,1n],precision:1000000000000000000n,tokens:["0xc52d7f23a2e460248db6ee192cb23dd12bddcbf6","0x4200000000000000000000000000000000000042","0x0994206dfe8de6ec6920ff4d779b0d950605fb53"]}]},le={bsc:[{address:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",decimals:18},{address:"0xe9e7cea3dedca5984780bafc599bd69add087d56",decimals:18},{address:"0x55d398326f99059ff775485246999027b3197955",decimals:18},{address:"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",decimals:18},{address:"0x23396cf899ca06c4472205fc903bdb4de249d6fc",decimals:18},{address:"0x2170ed0880ac9a755fd29b2688956bd959f933f8",decimals:18},{address:"0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",decimals:18},{address:"0x9c65ab58d8d978db963e63f2bfb7121627e3a739",decimals:18},{address:"0x844fa82f1e54824655470970f7004dd90546bb28",decimals:18},{address:"0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95",decimals:18}],polygon:[{address:"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",decimals:18},{address:"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",decimals:18},{address:"0x831753dd7087cac61ab5644b308642cc1c33dc13",decimals:18},{address:"0x2791bca1f2de4661ed88a30c99a7a9449aa84174",decimals:6},{address:"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",decimals:18},{address:"0xc2132d05d31c914a87c6611c10748aeb04b58e8f",decimals:6},{address:"0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6",decimals:8},{address:"0x4c4bf319237d98a30a929a96112effa8da3510eb",decimals:18},{address:"0x9719d867a500ef117cc201206b8ab51e794d3f82",decimals:18}],arbitrum:[{address:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",decimals:18},{address:"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",decimals:6},{address:"0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",decimals:6},{address:"0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",decimals:18},{address:"0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",decimals:8},{address:"0x3f56e0c36d275367b8c502090edf38289b3dea0d",decimals:18}],ethereum:[{address:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",decimals:18},{address:"0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",decimals:18},{address:"0xdac17f958d2ee523a2206206994597c13d831ec7",decimals:6},{address:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",decimals:6},{address:"0x6b175474e89094c44da98b954eedeac495271d0f",decimals:18},{address:"0x4fabb145d64652a948d72533023f6e7a623c7c53",decimals:18},{address:"0xa47c8bf37f92abed4a126bda807a7b7498661acd",decimals:18},{address:"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",decimals:8},{address:"0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0",decimals:18}],avalanche:[{address:"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",decimals:18},{address:"0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664",decimals:6},{address:"0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",decimals:6},{address:"0xc7198437980c041c805a1edcba50c1ce5db95118",decimals:6},{address:"0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",decimals:6},{address:"0x19860ccb0a68fd4213ab9d8266f7bbf05a8dde98",decimals:18},{address:"0x50b7545627a5162f82a992c33b87adc75187b218",decimals:8},{address:"0xd586e7f844cea2f87f50152665bcbc2c279d8d70",decimals:18},{address:"0x5947bb275c521040051d82396192181b413227a3",decimals:18},{address:"0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab",decimals:18}],optimism:[{address:"0x4200000000000000000000000000000000000006",decimals:18},{address:"0x7f5c764cbc14f9669b88837ca1490cca17c31607",decimals:6},{address:"0x94b008aa00579c1307b0ef2c499ad98a8ce58e58",decimals:6},{address:"0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",decimals:18},{address:"0x68f180fcce6836688e9084f035309e29bf0a2095",decimals:8},{address:"0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9",decimals:18},{address:"0xe405de8f52ba7559f9df3c368500b6e6ae6cee49",decimals:18}]};async function be(e,t,a){const{maxCallsPerBatch:n}=t,s=[];for(let t=0,i=e.length;t<i;t+=n){const d=e.slice(t,Math.min(t+n,i));s.push(a.callStatic.tryAggregate(!1,d))}i.log("[Multicall]","Perform Multicall; Total:",e.length,"Calls:",s.length);return(await Promise.all(s)).flatMap((e=>e))}V.createInterface(),U.createInterface();const he=e.utils.defaultAbiCoder;class ue{constructor(e,t,a,n,s,i,d,c){this.PAIR_BYTECODE_HASH=e,this.factory=t,this.fee=a,this.feePrecision=n,this.token0=s,this.token1=i,this.tradingRouteIndex=d,this.gasConstant=c,this.abiCoder=he,this.reserve0=0n,this.reserve1=0n;const r=this.getSortedPair(this.token0,this.token1);this.token0=r[0],this.token1=r[1],this.pairContract=this.generatePairAddress(this.factory,this.token0,this.token1)}static create(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,gas:c}=e;return new ue(d,n,s,i,t[0],t[1],a,c)}getTradablePairs(){return[[this.token0,this.token1],[this.token1,this.token0]]}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.pairContract}getDepositAddress(){return this.pairContract}getSortedPair(e,t){return e.localeCompare(t,"en",{sensitivity:"base"})<=0?[e,t]:[t,e]}getReserveInOut(e,t,a){return e===this.token0?{reserveIn:t,reserveOut:a}:{reserveIn:a,reserveOut:t}}generatePairAddress(t,a,n){return e.utils.hexDataSlice(e.utils.keccak256(e.utils.concat(["0xff",t,e.utils.solidityKeccak256(["address","address"],[a,n]),this.PAIR_BYTECODE_HASH])),12)}getfetchingCurrentStateCalls(){return[{callData:"0x0902f1ac",target:this.pairContract}]}applyCurrentStateFromCalls(e){if(0===e.length||!1===e[0].success||"0x"===e[0].returnData)return this.reserve0=0n,void(this.reserve1=0n);const[t,a]=this.abiCoder.decode(["uint112","uint112","uint32"],e[0].returnData);this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt()}getAmountOut(e,t,a){if(a<=0n||this.reserve0<=0n||this.reserve1<=0n)return{amount:0n,gas:0n};const{reserveIn:n,reserveOut:s}=this.getReserveInOut(e,this.reserve0,this.reserve1),i=a*this.fee,d=i*s,c=n*this.feePrecision+i;return 0n===c?{amount:0n,gas:0n}:{amount:d/c,gas:this.gasConstant}}}class pe extends ue{static create(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,gas:c}=e;return new pe(d,n,s,i,t[0],t[1],a,c)}getfetchingCurrentStateCalls(){return[{callData:"0x0902f1ac",target:this.pairContract},{callData:"0x54cf2aeb",target:this.pairContract}]}applyCurrentStateFromCalls(e){if(0===e.length||!e[0].success||"0x"===e[0].returnData)return this.reserve0=0n,this.reserve1=0n,void(this.fee=0n);const[t,a]=this.abiCoder.decode(["uint112","uint112","uint32"],e[0].returnData);if(this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt(),e[1].success){const[t]=this.abiCoder.decode(["uint32"],e[1].returnData);this.fee=this.feePrecision-BigInt(t)}else this.fee=this.feePrecision}}class xe extends Error{}class ge{constructor(e){this.contractName=e}createRequireViolated(e){return new xe(`[${this.contractName}]: ${e}`)}require(e,t){if(!e)throw this.createRequireViolated(t)}}class me{constructor(e,t,a,n,s,i,d,c,r,o,f,l,b=1n,h="uint256"){this.poolContract=e,this.lpToken=t,this.TOKENS=a,this.RATES=n,this.LENDING_PRECISION=s,this.PRECISION=i,this.PRECISION_MUL=d,this.FEE_DENOMINATOR=c,this.isUnderlying=r,this.routeIndex=o,this.depositAddress=f,this.gasConstant=l,this.A_PRECISION=b,this.balancesArgs=h,this.errorFactory=new ge(me.name),this.abiCoder=he,this.tokenIndex={},this.balances=[],this.A=0n,this.lpTokenTotalSupply=0n,this.tokenIndex=a.reduce(((e,t,a)=>(e[t]=a,e)),{})}static create(e,t){return new me(e.poolContract,e.lpToken,e.tokens,e.rates,e.lendingPrecision,e.precision,e.precisionMul,e.feeDenominator,e.isUnderlying,t,e.address,e.gas,e.aPrecision,e.balancesArgs)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.TOKENS.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.TOKENS[t],this.TOKENS[n]]),e.push([this.TOKENS[n],this.TOKENS[t]]);return e}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}calculateTokenAmount(e,t){const a=this.TOKENS.length,n=this.A,s=[...this.balances],i=this.getDMem(s,n);for(let n=0;n<a;n++)t?s[n]+=e[n]:s[n]-=e[n];const d=this.getDMem(s,n);let c=0n;return c=t?d-i:i-d,c*this.lpTokenTotalSupply/i}getDy(e,t,a){return this.getDyOrUnderlying(e,t,a,!1)}calculateWithdrawOneCoin(e,t){const a=this.TOKENS.length,n=this.A,s=this.xp(),i=this.getD(s,n),d=this.lpTokenTotalSupply,c=i-e*i/d,r=this.getYD(n,t,s,c);let o=s;const f=this.fee*BigInt(a)/(4n*(BigInt(a)-1n));for(let e=0;e<a;++e){let a=0n;a=e===t?s[e]*c/i-r:s[e]-s[e]*c/i,o[e]-=f*a/this.FEE_DENOMINATOR}let l=o[t]-this.getYD(n,t,o,c);const b=this.PRECISION_MUL;l=(l-1n)/b[t];return{dy:l,dyDiff:(s[t]-r)/b[t]-l,totalSupply:d}}getLPMintAmount(e){const t=this.TOKENS.length;let a=Array.from({length:t},(()=>0n)),n=this.fee*BigInt(t)/(4n*(BigInt(t)-1n)),s=this.A,i=this.lpTokenTotalSupply,d=0n,c=[...this.balances];i>0n&&(d=this.getDMem(c,s));let r=[...c];for(let a=0;a<t;a++){let t=e[a];if(0n===i&&t<=0n)throw this.errorFactory.createRequireViolated("initial deposit requires all coins");t>0n&&(r[a]=c[a]+t)}let o=this.getDMem(r,s);if(o<=d)throw this.errorFactory.createRequireViolated("D1 must more than D0");let f=o;if(i>0n){for(let e=0;e<t;e++){let t=o*c[e]/d,s=0n;s=t>r[e]?t-r[e]:r[e]-t,a[e]=n*s/this.FEE_DENOMINATOR,r[e]-=a[e]}f=this.getDMem(r,s)}let l=0n;return l=0n===i?o:i*(f-d)/d,l}getVirtualPrice(){const e=this.getD(this.xp(),this.A),t=this.lpTokenTotalSupply;return e*this.PRECISION/t}getfetchingCurrentStateCalls(){return[{callData:1n===this.A_PRECISION?"0xf446c1d0":"0x76a2f0f0",target:this.poolContract},{callData:"0xddca3f43",target:this.poolContract},{callData:"0x18160ddd",target:this.lpToken},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode([this.balancesArgs],[a]);let s="0x4903b0d1";return"int128"===this.balancesArgs&&(s="0x065a80d8"),{callData:e.utils.hexConcat([s,n]),target:this.poolContract}}))]}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=(this.A_PRECISION,this.abiCoder.decode(["uint256"],e[0].returnData));this.A=t.toBigInt()}else i.warn("unable to find A for Curve pool",this.poolContract),this.A=0n;if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.fee=t.toBigInt()}else i.warn("unable to find fee for Curve pool",this.poolContract),this.fee=0n;if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.lpTokenTotalSupply=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve pool",this.poolContract),this.lpTokenTotalSupply=0n;for(let t=3,a=this.TOKENS.length;t<3+a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances.push(a.toBigInt())}else i.warn("unable to find balance at index",t-3,"for Curve pool",this.poolContract),this.balances.push(0n)}}xp(){return this.RATES.map(((e,t)=>e*this.balances[t]/this.LENDING_PRECISION))}xpMem(e){return this.RATES.map(((t,a)=>t*e[a]/this.LENDING_PRECISION))}getYD(e,t,a,n){const s=this.TOKENS.length;if(t<0||t>=s)throw this.errorFactory.createRequireViolated(`invalid index; i=${t}`);const i=e*BigInt(s);let d=n,c=0n,r=0n,o=0n;for(let e=0;e<s;++e)e!=t&&(r=a[e],c+=r,d=d*n/(r*BigInt(s)));d=d*n*this.A_PRECISION/(i*BigInt(s));const f=c+n*this.A_PRECISION/i;let l=n;for(let e=0;e<255;++e)if(o=l,l=(l*l+d)/(2n*l+f-n),l>o){if(l-o<=1n)break}else if(o-l<=1n)break;return l}getDMem(e,t){return this.getD(this.xpMem(e),t)}getD(e,t){const a=BigInt(this.TOKENS.length);let n=0n;for(let t=0,a=e.length;t<a;++t)n+=e[t];if(0n===n)return 0n;let s=0n,i=n;const d=t*a;for(let t=0;t<255;++t){let t=i;for(let n=0,s=e.length;n<s;++n)t=t*i/(e[n]*a);if(s=i,i=(d*n/this.A_PRECISION+t*a)*i/((d-this.A_PRECISION)*i/this.A_PRECISION+(a+1n)*t),i>s){if(i-s<=1n)return i}else if(s-i<=1n)return i}throw this.errorFactory.createRequireViolated("getD does not converge")}getY(e,t,a,n){const s=this.TOKENS.length;if(e===t||t<0||t>=s||e<0||e>=s)throw this.errorFactory.createRequireViolated(`invalid given token index; i=${e},j=${t}`);const i=this.A,d=this.getD(n,i);let c=d,r=0n;const o=i*BigInt(s);let f=0n;for(let i=0;i<s;++i){if(i===e)f=a;else{if(i===t)continue;f=n[i]}r+=f,c=c*d/(f*BigInt(s))}c=c*d*this.A_PRECISION/(o*BigInt(s));const l=r+d*this.A_PRECISION/o;let b=0n,h=d;for(let e=0;e<255;++e)if(b=h,h=(h*h+c)/(2n*h+l-d),h>b){if(h-b<=1n)return h}else if(b-h<=1n)return h;throw this.errorFactory.createRequireViolated("getY does not converge")}getDyOrUnderlying(e,t,a,n){const s=this.xp();if(n){const n=this.PRECISION_MUL,i=s[e]+a*n[e],d=this.getY(e,t,i,s),c=(s[t]-d-1n)/n[t];return c-this.fee*c/this.FEE_DENOMINATOR}{const n=s[e]+a*this.RATES[e]/this.PRECISION,i=this.getY(e,t,n,s),d=s[t]-i-1n;return(d-this.fee*d/this.FEE_DENOMINATOR)*this.PRECISION/this.RATES[t]}}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];return{amount:this.getDyOrUnderlying(n,s,a,this.isUnderlying),gas:this.gasConstant}}}var Ce,Ie;!function(e){e[e.PLAIN=0]="PLAIN",e[e.META=1]="META",e[e.LENDING=2]="LENDING"}(Ce||(Ce={}));class Te extends me{constructor(e,t,a,n,s,i,d,c,r,o,f,l,b,h,u=1n){super(i,s,d,c,0n,r,o,f,!0,l,b,h,u),this.basePool=e,this.multicall=t,this.BASE_CACHE_EXPIRES=a,this.isCacheExist=n,this.errorFactory=new ge(Te.name);let p=0;this.tokenIndex=d.concat(e.TOKENS).reduce(((t,a)=>(a===e.lpToken||(t[a]=p,++p),t)),{})}static createMeta(e,t,a){return new Te(a,e.multicall,e.baseCacheExpires,e.isCacheExists,e.lpToken,e.poolContract,e.tokens,e.rates,e.precision,e.precisionMul,e.feeDenominator,t,e.address,e.gas,e.aPrecision)}static isPairSupportedMeta(e,t,a,n){const s=t.filter((e=>e!==n));return s.includes(e[0])&&a.includes(e[1])||s.includes(e[1])&&a.includes(e[0])}getTradablePairs(){const e=[],t=this.TOKENS,a=this.basePool;for(let n=0,s=t.length;n<s;++n)if(t[n]!==a.lpToken)for(let s=0,i=a.TOKENS.length;s<i;++s)e.push([t[n],a.TOKENS[s]]),e.push([a.TOKENS[s],t[n]]);return e}getfetchingCurrentStateCalls(){const e=super.getfetchingCurrentStateCalls();return this.isCacheExist&&e.push({callData:"0x0f28c97d",target:this.multicall},{callData:"0x8296f84f",target:this.poolContract},{callData:"0x95ccc02f",target:this.poolContract}),e}applyCurrentStateFromCalls(e){if(0!==e.length&&(super.applyCurrentStateFromCalls(e),this.isCacheExist)){if(e[e.length-1].success){const[t]=this.abiCoder.decode(["uint256"],e[e.length-1].returnData);this.baseVirtualPrice=t.toBigInt()}else this.baseVirtualPrice=0n;if(e[e.length-2].success){const[t]=this.abiCoder.decode(["uint256"],e[e.length-2].returnData);this.baseCacheUpdated=t.toBigInt()}else this.baseCacheUpdated=0n;if(e[e.length-3].success){const[t]=this.abiCoder.decode(["uint256"],e[e.length-3].returnData);this.blockTimestamp=t.toBigInt()}else this.blockTimestamp=0n}}getRateWithVpRate(e){const t=[...this.RATES];return t[this.TOKENS.length-1]=e,t}xpWithCustomRates(e){return e.map(((e,t)=>e*this.balances[t]/this.PRECISION))}vpRateReadOnly(){return!this.isCacheExist||this.blockTimestamp>this.baseCacheUpdated+this.BASE_CACHE_EXPIRES?this.basePool.getVirtualPrice():this.baseVirtualPrice}xpVpRate(e){const t=this.TOKENS.length,a=t-1,n=[...this.RATES];n[a]=e;for(let e=0;e<t;++e)n[e]=n[e]*this.balances[e]/this.PRECISION;return n}getDyOrUnderlying(e,t,a,n){const s=this.TOKENS.length-1;if(n)return this.simulateExchangeUnderlying(e,t,a);{const n=[...this.RATES];n[s]=this.vpRateReadOnly();const i=this.xpVpRate(n[s]),d=i[e]+a*n[e]/this.PRECISION,c=this.getY(e,t,d,i),r=i[t]-c-1n;return(r-this.fee*r/this.FEE_DENOMINATOR)*this.PRECISION/n[t]}}simulateExchangeUnderlying(e,t,a){let n,s,i,d=0,c=0,r=0,o=0,f=this.vpRateReadOnly(),l=this.getRateWithVpRate(f),b=this.xpWithCustomRates(l);const h=this.TOKENS.length-1;if(0!==e&&(d=e-h,r=1),0!==t&&(c=t-h,o=1),n=a,0===e||0===t){if(0===e)s=b[e]+n*l[e]/this.PRECISION;else{let e=Array.from({length:this.basePool.TOKENS.length},(()=>0n));e[d]=n,n=this.basePool.getLPMintAmount(e),s=n*l[h]/this.PRECISION,s+=b[h]}let a=this.getY(r,o,s,b);i=b[o]-a-1n,i=(i-i*this.fee/this.FEE_DENOMINATOR)*this.PRECISION/l[o],t>0&&(i=this.basePool.calculateWithdrawOneCoin(i,c).dy)}else i=this.basePool.getDy(d,c,n);return i}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];return this.errorFactory.require(void 0!==n&&void 0!==s,"Unknown token"),{amount:this.getDyOrUnderlying(n,s,a,this.isUnderlying),gas:this.gasConstant}}}class ye extends me{static create(e,t){return new ye(e.poolContract,e.lpToken,e.tokens,e.rates,e.lendingPrecision,e.precision,e.precisionMul,e.feeDenominator,e.isUnderlying,t,e.address,e.gas,e.aPrecision)}getfetchingCurrentStateCalls(){return[{callData:"0x0ba81959",target:this.poolContract},{callData:"0x5fd65f0f",target:this.poolContract},{callData:"0x18160ddd",target:this.lpToken},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode(["uint8"],[a]);return{callData:e.utils.hexConcat(["0x91ceb3eb",n]),target:this.poolContract}}))]}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}else i.warn("unable to find A for Curve pool",this.poolContract),this.A=0n;if(e[1].success){const[,,,,t]=this.abiCoder.decode(["uint256","uint256","uint256","uint256","uint256","uint256","uint256","address"],e[1].returnData);this.fee=t.toBigInt()}else i.warn("unable to find fee for Curve pool",this.poolContract),this.fee=0n;if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.lpTokenTotalSupply=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve pool",this.poolContract),this.lpTokenTotalSupply=0n;for(let t=3,a=this.TOKENS.length;t<3+a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances.push(a.toBigInt())}else i.warn("unable to find balance at index",t-3,"for Curve pool",this.poolContract),this.balances.push(0n)}}xp(){return this.PRECISION_MUL.map(((e,t)=>e*this.balances[t]))}xpMem(e){return this.PRECISION_MUL.map(((t,a)=>t*e[a]))}getDyOrUnderlying(e,t,a,n){const s=this.xp(),i=s[e]+a*this.PRECISION_MUL[e],d=this.getY(e,t,i,s),c=s[t]-d-1n;return(c-this.fee*c/this.FEE_DENOMINATOR)/this.PRECISION_MUL[t]}}!function(e){e[e.ONE=0]="ONE",e[e.ABOVE_ONE=1]="ABOVE_ONE",e[e.BELOW_ONE=2]="BELOW_ONE"}(Ie||(Ie={}));class Ae{constructor(e,t,a,n,s,i,d){this.factoryContract=e,this.traderAddress=t,this.baseToken=a,this.quoteToken=n,this.poolContract=s,this.routeIndex=i,this.gasConstant=d,this.abiCoder=he,this.errorFactory=new ge(Ae.name),this.W_ONE=1000000000000000000n,this.pmmState={B:0n,B0:0n,K:0n,Q:0n,Q0:0n,R:0,i:0n},this.lpFeeRate=0n,this.mtFeeRate=0n}static getBaseQuoteTokens(e,t){const{pools:a}=e,n=void 0!==a[t[0]]&&void 0!==a[t[0]][t[1]],s=void 0!==a[t[1]]&&void 0!==a[t[1]][t[0]];let i="",d="";if(n?(d=t[0],i=t[1]):s&&(d=t[1],i=t[0]),""===i||""===d)throw new Error("expected DODOv2 to successfully identify base/quote tokens, but got empty string");return{btkn:d,qtkn:i}}static create(e,t,a){const{btkn:n,qtkn:s}=Ae.getBaseQuoteTokens(e,t);return new Ae(e.factoryContract,e.address,n,s,e.pools[n][s],a,e.gas)}static isPairSupported(e,t){const a=void 0!==t[e[0]]&&void 0!==t[e[0]][e[1]],n=void 0!==t[e[1]]&&void 0!==t[e[1]][e[0]];return a||n}getTradablePairs(){return[[this.baseToken,this.quoteToken],[this.quoteToken,this.baseToken]]}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.poolContract}getfetchingCurrentStateCalls(){const t=this.abiCoder.encode(["address"],[this.traderAddress]);return[{callData:"0xa382d1b9",target:this.poolContract},{callData:e.utils.hexConcat(["0x44096609",t]),target:this.poolContract}]}applyCurrentStateFromCalls(e){if(0===e.length)return;const[t]=this.abiCoder.decode(["tuple(uint256,uint256,uint256,uint256,uint256,uint256,uint8)"],e[0].returnData),[a,n]=this.abiCoder.decode(["uint256","uint256"],e[1].returnData);this.pmmState={i:t[0].toBigInt(),K:t[1].toBigInt(),B:t[2].toBigInt(),Q:t[3].toBigInt(),B0:t[4].toBigInt(),Q0:t[5].toBigInt(),R:t[6]},this.mtFeeRate=n.toBigInt(),this.lpFeeRate=a.toBigInt()}mulFloor(e,t){return e*t/this.W_ONE}divFloor(e,t){return e*this.W_ONE/t}divCeil(e,t){const a=e*this.W_ONE,n=a/t;return a-n*t>0?n+1n:n}reciprocalFloor(e){return this.W_ONE*this.W_ONE/e}sqrt(e){let t=e/2n+1n,a=e;for(;t<a;)a=t,t=(e/t+t)/2n;return a}solveQuadraticFunctionForTrade(e,t,a,n,s){if(e<=0n)throw this.errorFactory.createRequireViolated("TARGET_IS_ZERO");if(0n===a)return 0n;if(0n===s)return this.mulFloor(n,a)>t?t:this.mulFloor(n,a);if(s==this.W_ONE){let s;const i=n*a;return s=0n===i?0n:i*t/i===t?i*t/(e*e):a*t/e*n/e,t*s/(s+this.W_ONE)}const i=s*e/t*e+n*a;let d,c=(this.W_ONE-s)*t;c>=i?(c-=i,d=!1):(c=i-c,d=!0),c/=this.W_ONE;let r=this.mulFloor(4n*(this.W_ONE-s),this.mulFloor(s,e)*e);r=this.sqrt(c*c+r);let o,f=2n*(this.W_ONE-s);o=d?r-c:c+r;const l=this.divCeil(o,f);return l>t?0n:t-l}generalIntegrate(e,t,a,n,s){if(e<=0n)throw this.errorFactory.createRequireViolated("TARGET_IS_ZERO");const i=n*(t-a);if(0n===s)return i/this.W_ONE;const d=this.divFloor(e*e/t,a),c=this.mulFloor(s,d);return(this.W_ONE-s+c)*i/(this.W_ONE*this.W_ONE)}ROneSellBaseToken(e,t){return this.solveQuadraticFunctionForTrade(e.Q0,e.Q0,t,e.i,e.K)}RAboveSellBaseToken(e,t){return this.generalIntegrate(e.B0,e.B+t,e.B,e.i,e.K)}RBelowSellBaseToken(e,t){return this.solveQuadraticFunctionForTrade(e.Q0,e.Q,t,e.i,e.K)}ROneSellQuoteToken(e,t){return this.solveQuadraticFunctionForTrade(e.B0,e.B0,t,this.reciprocalFloor(e.i),e.K)}RAboveSellQuoteToken(e,t){return this.solveQuadraticFunctionForTrade(e.B0,e.B,t,this.reciprocalFloor(e.i),e.K)}RBelowSellQuoteToken(e,t){return this.generalIntegrate(e.Q0,e.Q+t,e.Q,this.reciprocalFloor(e.i),e.K)}sellBaseToken(e,t){let a=0n,n=Ie.BELOW_ONE;if(e.R===Ie.ONE)a=this.ROneSellBaseToken(e,t),n=Ie.BELOW_ONE;else if(e.R===Ie.ABOVE_ONE){const s=e.B0-e.B,i=e.Q-e.Q0;t<s?(a=this.RAboveSellBaseToken(e,t),n=Ie.ABOVE_ONE,a>i&&(a=i)):t==s?(a=i,n=Ie.ONE):(a=i+this.ROneSellBaseToken(e,t-s),n=Ie.BELOW_ONE)}else a=this.RBelowSellBaseToken(e,t),n=Ie.BELOW_ONE;return{receiveQuoteAmount:a,newR:n}}sellQuoteToken(e,t){let a=0n,n=Ie.BELOW_ONE;if(e.R===Ie.ONE)a=this.ROneSellQuoteToken(e,t),n=Ie.ABOVE_ONE;else if(e.R===Ie.ABOVE_ONE)a=this.RAboveSellQuoteToken(e,t),n=Ie.ABOVE_ONE;else{const s=e.Q0-e.Q,i=e.B-e.B0;t<s?(a=this.RBelowSellQuoteToken(e,t),n=Ie.BELOW_ONE,a>i&&(a=i)):t===s?(a=i,n=Ie.ONE):(a=i+this.ROneSellQuoteToken(e,t-s),n=Ie.ABOVE_ONE)}return{receiveBaseAmount:a,newR:n}}querySellBase(e){let{receiveQuoteAmount:t,newR:a}=this.sellBaseToken(this.pmmState,e);const n=this.lpFeeRate,s=this.mtFeeRate,i=this.mulFloor(t,s);t=t-this.mulFloor(t,n)-i;return{mtFee:i,newTarget:this.pmmState.B0,newRState:a,receiveAmount:t}}querySellQuote(e){let{receiveBaseAmount:t,newR:a}=this.sellQuoteToken(this.pmmState,e);const n=this.lpFeeRate,s=this.mtFeeRate,i=this.mulFloor(t,s);t=t-this.mulFloor(t,n)-i;return{mtFee:i,newTarget:this.pmmState.Q0,newRState:a,receiveAmount:t}}getAmountOut(e,t,a){return""===this.poolContract?{amount:0n,gas:0n}:e===this.quoteToken?{amount:this.querySellQuote(a).receiveAmount,gas:this.gasConstant}:{amount:this.querySellBase(a).receiveAmount,gas:this.gasConstant}}}class ke extends ue{static create(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,gas:c}=e;return new ke(d,n,s,i,t[0],t[1],a,c)}getfetchingCurrentStateCalls(){const t=this.abiCoder.encode(["address"],[this.pairContract]);return[{callData:"0x0902f1ac",target:this.pairContract},{callData:e.utils.hexConcat(["0x4c2fc06f",t]),target:this.factory}]}applyCurrentStateFromCalls(e){if(0===e.length||!e[0].success||"0x"===e[0].returnData)return this.reserve0=0n,this.reserve1=0n,void(this.fee=0n);const[t,a]=this.abiCoder.decode(["uint112","uint112","uint32"],e[0].returnData);if(this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt(),e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.fee=this.feePrecision-t.toBigInt()}else this.fee=this.feePrecision}}class Ee{constructor(e,t,a,n,s,i,d){this.poolContract=e,this.expectedImplementation=t,this.expectedTokens=a,this.expectedTokenIdx=n,this.depositAddress=s,this.routeIndex=i,this.gasConstant=d,this.errorFactory=new ge(Ee.name),this.abiCoder=he,this.W_ONE=1000000000000000000n,this.MASK_128=340282366920938463463374607431768211455n,this.DECM_OFF=41n,this.YENABLE_OFF=40n,this.implementation="",this.tokens=[],this.tokenIndex={},this.tokenInfos=[],this.balances=[],this.softWeights=[],this.hardWeights=[],this.decimalMultipliers=[],this.normalizedDecimals=[],this.swapFee=0n,this.totalBalance=0n}static create(e,t){const a=Object.keys(e.expectedTokens);return new Ee(e.poolContract,e.expectedImplAddress,a,a.map((t=>e.expectedTokens[t])),e.address,t,e.gas)}static isPairSupported(e,t){return void 0!==t[e[0]]&&void 0!==t[e[1]]}getTradablePairs(){const e=[];for(let t=0,a=this.expectedTokens.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.expectedTokens[t],this.expectedTokens[n]]),e.push([this.expectedTokens[n],this.expectedTokens[t]]);return e}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){const t=[{callData:"0x252f7b49",target:this.poolContract},{callData:"0x83278155",target:this.poolContract},{callData:"0x5c60da1b",target:this.poolContract}];for(let a=0,n=this.expectedTokenIdx.length;a<n;++a){const n=this.abiCoder.encode(["uint256"],[this.expectedTokenIdx[a]]);t.push({callData:e.utils.hexConcat(["0x1e010439",n]),target:this.poolContract}),t.push({callData:e.utils.hexConcat(["0x8676192b",n]),target:this.poolContract})}return t}applyCurrentStateFromCalls(e){if(0===e.length)return;const[t]=this.abiCoder.decode(["uint256"],e[0].returnData),[a]=this.abiCoder.decode(["uint256"],e[1].returnData),[n]=this.abiCoder.decode(["address"],e[2].returnData);if(this.implementation=n.toLowerCase(),this.implementation!==this.expectedImplementation)return;this.totalBalance=t.toBigInt(),this.swapFee=a.toBigInt();const s=[],i=[];for(let t=3,a=2,n=t+a*this.expectedTokenIdx.length;t<n;t+=a){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData),[n]=this.abiCoder.decode(["uint256"],e[t+1].returnData);s.push(a.toBigInt()),i.push(n.toBigInt())}this.balances=s,this.tokenInfos=i,this.softWeights=this.tokenInfos.map((e=>this.getSoftWeight(e))),this.hardWeights=this.tokenInfos.map((e=>this.getHardWeight(e))),this.decimalMultipliers=this.tokenInfos.map((e=>this.getDecimalMultiplier(e))),this.normalizedDecimals=this.tokenInfos.map((e=>this.normalizeBalance(e))),this.tokens=this.tokenInfos.map((e=>this.getAddress(e))),this.tokenIndex=this.tokens.reduce(((e,t,a)=>(e[t]=a,e)),{})}getAddress(t){const a=t&(1n<<160n)-1n;return e.utils.hexZeroPad("0x"+a.toString(16),20)}getSoftWeight(e){return 1000000000000n*(e>>160n&1048575n)}getHardWeight(e){return 1000000000000n*(e>>180n&1048575n)}getDecimalMultiplier(e){return e>>160n+this.DECM_OFF&31n}isYEnabled(e){return 1n===(e>>160n+this.YENABLE_OFF&1n)}normalizeBalance(e){return 10n**this.getDecimalMultiplier(e)}lg2(e){let t=0n,a=e;a>=18446744073709551616n&&(a>>=64n,t+=64n),a>=4294967296n&&(a>>=32n,t+=32n),a>=65536n&&(a>>=16n,t+=16n),a>=256n&&(a>>=8n,t+=8n),a>=16n&&(a>>=4n,t+=4n),a>=4n&&(a>>=2n,t+=2n),a>=2n&&(t+=1n);let n=t-64n<<64n,s=e<<127n-t;for(let e=9223372036854775808n;e>8796093022208n;e>>=1n){s*=s;const t=s>>255n;s>>=127n+t,n+=e*t}return n}logApprox(e){const t=this.W_ONE;if(e<t)throw this.errorFactory.createRequireViolated("logApprox: x must >= 1");const a=e-t,n=a*a/t,s=n*a/t,i=s*a/t;return a-n/2n+s/3n-i/4n+i*a/t/5n}log(e){if(e<this.W_ONE)throw this.errorFactory.createRequireViolated("log(x): x must be greater than 1");if(e>this.W_ONE<<63n)throw this.errorFactory.createRequireViolated("log(x): x is too large");if(e<=this.W_ONE+this.W_ONE/10n)return this.logApprox(e);const t=(e<<64n)/this.W_ONE&this.MASK_128;return 693147180559945344n*this.lg2(t)>>64n}min(e,t){return e<=t?e:t}getMintAmount(e,t,a,n,s){const i=t+e,d=a+e;if(d*this.W_ONE<=n*i)return e;if(d*this.W_ONE>s*i)throw this.errorFactory.createRequireViolated("mint: new percentage exceeds hard weight");let c=0n;a*this.W_ONE<=n*t&&(c=(t*n-a*this.W_ONE)/(this.W_ONE-n));let r=(t-a)*this.log(i*this.W_ONE/(t+c));if(r-=(e-c)*(this.W_ONE-s),r/=s-n,c+=r,c>e)throw this.errorFactory.createRequireViolated("penalty should be positive");return c}redeemPenaltyFor(e,t,a,n,s){const i=e-a;if(t*this.W_ONE<=i*n)return 0n;if(t*this.W_ONE>i*s)throw this.errorFactory.createRequireViolated("redeem: hard-limit weight is broken");let d=0n;t*this.W_ONE<e*n&&(d=e-t*this.W_ONE/n);return t*this.log(this.W_ONE+(a-d)*s/(s*i/this.W_ONE-t))*(s-n)/s/s-(a-d)*n/s}redeemPenaltyDerivativeForOne(e,t,a,n,s){const i=this.W_ONE,d=e-a;if(t*this.W_ONE<=d*n)return i;const c=s*d/this.W_ONE-t;return i+(t*this.W_ONE-d*n)/c}redeemFindOne(e,t,a,n,s,i){let d=this.min(n,999n*e/1000n);for(let c=0;c<256;c++){const c=d+this.redeemPenaltyFor(t,a,d,s,i);let r=0n;if(r=c>n?c-n:n-c,r<d/100000n){if(d>n)throw this.errorFactory.createRequireViolated("Redeem error: out amount > lp amount");if(d>e)throw this.errorFactory.createRequireViolated("Redeem error: insufficient balance");return d}const o=this.redeemPenaltyDerivativeForOne(t,a,d,s,i);c>n?d-=r*this.W_ONE/o:d+=r*this.W_ONE/o}throw this.errorFactory.createRequireViolated("cannot find proper resolution of fx")}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];if(void 0===n||void 0===s||a<=0n)return{amount:0n,gas:0n};let i=this.totalBalance,d=this.balances[n],c=0n;const r=this.softWeights[n],o=this.hardWeights[n],f=a*this.normalizedDecimals[n];c=this.getMintAmount(f,i,d,r,o),i+=f,d+=f;const l=this.balances[s],b=this.redeemFindOne(l,i,d,c,r,o)/this.normalizedDecimals[s];return{amount:b-b*this.swapFee/this.W_ONE,gas:this.gasConstant}}}class Ne extends Ae{constructor(e,t,a,n,s,i,d,c){super(e,t,a,n,s,i,d),this.depositAddress=c}static create(e,t,a){const{btkn:n,qtkn:s}=Ae.getBaseQuoteTokens(e,t);return new Ne(e.factoryContract,e.address,n,s,e.pools[n][s],a,e.gas,e.address)}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[{callData:"0xffa64225",target:this.poolContract},{callData:"0x17be952e",target:this.poolContract},{callData:"0x796da7af",target:this.poolContract},{callData:"0x7c9b8e89",target:this.poolContract},{callData:"0xeab5d20e",target:this.poolContract},{callData:"0xec2fd46d",target:this.poolContract},{callData:"0xc0ffa178",target:this.poolContract},{callData:"0xab44a7a3",target:this.poolContract}]}applyCurrentStateFromCalls(e){if(0===e.length)return;const[t,a]=this.abiCoder.decode(["uint256","uint256"],e[0].returnData),[n]=this.abiCoder.decode(["uint8"],e[1].returnData),[s]=this.abiCoder.decode(["uint256"],e[2].returnData),[i]=this.abiCoder.decode(["uint256"],e[3].returnData),[d]=this.abiCoder.decode(["uint256"],e[4].returnData),[c]=this.abiCoder.decode(["uint256"],e[5].returnData),[r]=this.abiCoder.decode(["uint256"],e[6].returnData),[o]=this.abiCoder.decode(["uint256"],e[7].returnData);this.pmmState={B:d.toBigInt(),B0:t.toBigInt(),K:c.toBigInt(),Q:i.toBigInt(),Q0:a.toBigInt(),i:s.toBigInt(),R:n},this.mtFeeRate=r.toBigInt(),this.lpFeeRate=o.toBigInt()}generalIntegrate(e,t,a,n,s){const i=this.mulFloor(n,t-a),d=this.divCeil(e*e/t,a),c=this.mulFloor(s,d);return this.mulFloor(i,this.W_ONE-s+c)}solveQuadraticFunctionForTradeV1(e,t,a,n,s){this.errorFactory.require(t>0n,"TARGET_IS_ZERO");let i=this.mulFloor(s,e)*e/t,d=this.mulFloor(this.W_ONE-s,t),c=!0;n?d+=a:i+=a,d>=i?(d-=i,c=!0):(d=i-d,c=!1);let r=this.mulFloor(4n*(this.W_ONE-s),this.mulFloor(s,e)*e);r=this.sqrt(d*d+r);const o=2n*(this.W_ONE-s);let f;return f=c?d+r:r-d,n?this.divFloor(f,o):this.divCeil(f,o)}ROneSellBaseToken(e,t){const a=this.solveQuadraticFunctionForTradeV1(e.Q0,e.Q0,this.mulFloor(e.i,t),!1,e.K);return e.Q0-a}RBelowSellBaseToken(e,t){const a=this.solveQuadraticFunctionForTradeV1(e.Q0,e.Q,this.mulFloor(e.i,t),!1,e.K);return e.Q-a}ROneSellQuoteToken(e,t){const a=this.divFloor(this.W_ONE,e.i),n=this.solveQuadraticFunctionForTradeV1(e.B0,e.B0,this.mulFloor(a,t),!1,e.K);return e.B0-n}RAboveSellQuoteToken(e,t){const a=this.divFloor(this.W_ONE,e.i),n=this.solveQuadraticFunctionForTradeV1(e.B0,e.B,this.mulFloor(a,t),!1,e.K);return e.B-n}sellQuoteToken(e,t){let a=0n;if(e.R===Ie.ONE)a=this.ROneSellQuoteToken(e,t);else if(e.R===Ie.ABOVE_ONE)a=this.RAboveSellQuoteToken(e,t);else{const n=e.B-e.B0,s=e.Q0-e.Q;a=t<=s?this.RBelowSellQuoteToken(e,t):n+this.ROneSellQuoteToken(e,t-s)}return{receiveBaseAmount:a,newR:Ie.ONE}}querySellQuote(e){let{receiveBaseAmount:t,newR:a}=this.sellQuoteToken(this.pmmState,e);const n=this.mulFloor(t,this.mtFeeRate);t=this.divFloor(t,this.W_ONE+this.mtFeeRate+this.lpFeeRate);return{mtFee:n,newTarget:this.pmmState.Q0,newRState:a,receiveAmount:t}}}class Oe{constructor(t,a,n,s,i,d,c,r){this.tradingRouteIndex=t,this.tokens=a,this.scalingFactors=n,this.normalizedWeights=s,this.poolId=i,this.vaultContract=d,this.depositAddress=c,this.gasConstant=r,this.abiCoder=he,this.err=new ge(Oe.name),this.ONE=1000000000000000000n,this.ONE_36=1000000000000000000000000000000000000n,this.MAX_POW_RELATIVE_ERROR=10000n,this.ONE_20=100000000000000000000n,this.MILD_EXPONENT_BOUND=289480223093290488558927462521719769633174961664101410098n,this.X_BOUND=57896044618658097711785492504343953926634992332820282019728792003956564819968n,this.LN_36_LOWER_BOUND=900000000000000000n,this.LN_36_UPPER_BOUND=1100000000000000000n,this.MIN_NATURAL_EXPONENT=-41000000000000000000n,this.MAX_NATURAL_EXPONENT=130000000000000000000n,this.MAX_IN_RATIO=300000000000000000n,this.x0=128000000000000000000n,this.a0=38877084059945950922200000000000000000000000000000000000n,this.x1=64000000000000000000n,this.a1=6235149080811616882910000000n,this.x2=3200000000000000000000n,this.a2=7896296018268069516100000000000000n,this.x3=1600000000000000000000n,this.a3=888611052050787263676000000n,this.x4=800000000000000000000n,this.a4=298095798704172827474000n,this.x5=400000000000000000000n,this.a5=5459815003314423907810n,this.x6=200000000000000000000n,this.a6=738905609893065022723n,this.x7=100000000000000000000n,this.a7=271828182845904523536n,this.x8=50000000000000000000n,this.a8=164872127070012814685n,this.x9=25000000000000000000n,this.a9=128402541668774148407n,this.x10=12500000000000000000n,this.a10=113314845306682631683n,this.x11=6250000000000000000n,this.a11=106449445891785942956n,this.swapFee=0n,this.tokenIndexes=this.tokens.reduce(((e,t,a)=>(e[t]=a,e)),{}),this.balances=Array.from({length:a.length},(()=>0n)),this.balancesUpScaled=Array.from({length:a.length},(()=>0n)),this.poolIdParam=this.abiCoder.encode(["bytes32"],[this.poolId]),this.poolContract=e.utils.hexZeroPad("0x"+(BigInt(this.poolId)>>96n).toString(16),20)}static create(e,t){return new Oe(t,e.tokens,e.scalingFactors,e.weights,e.poolId,e.vaultContract,e.depositAddress,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.tokens.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.tokens[t],this.tokens[n]]),e.push([this.tokens[n],this.tokens[t]]);return e}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[{callData:"0x55c67628",target:this.poolContract},{callData:e.utils.hexConcat(["0xf94d4668",this.poolIdParam]),target:this.vaultContract}]}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.swapFee=t.toBigInt()}if(e[1].success){const[,t]=this.abiCoder.decode(["address[]","uint256[]","uint256"],e[1].returnData);this.balances=t.map((e=>e.toBigInt())),this.balancesUpScaled=this.balances.map(((e,t)=>e*this.scalingFactors[t]))}}}mulDown(e,t){const a=e*t;return this.err.require(0n===e||a/e===t,"MUL_OVERFLOW"),a/this.ONE}mulUp(e,t){const a=e*t;return this.err.require(0n===e||a/e===t,"MUL_OVERFLOW"),0n===a?0n:(a-1n)/this.ONE+1n}divUp(e,t){if(this.err.require(0n!==t,"ZERO_DIVISION"),0n===e)return 0n;{const a=e*this.ONE;return this.err.require(a/e===this.ONE,"DIV_INTERNAL"),(a-1n)/t+1n}}ln_36(e){const t=((e*=this.ONE)-this.ONE_36)*this.ONE_36/(e+this.ONE_36),a=t*t/this.ONE_36;let n=t,s=n;return n=n*a/this.ONE_36,s+=n/3n,n=n*a/this.ONE_36,s+=n/5n,n=n*a/this.ONE_36,s+=n/7n,n=n*a/this.ONE_36,s+=n/9n,n=n*a/this.ONE_36,s+=n/11n,n=n*a/this.ONE_36,s+=n/13n,n=n*a/this.ONE_36,s+=n/15n,2n*s}ln(e){if(this.err.require(e>0n,"OUT_OF_BOUNDS"),e<this.ONE)return-this.ln(this.ONE*this.ONE/e);let t=0n;e>=this.a0*this.ONE&&(e/=this.a0,t+=this.x0),e>=this.a1*this.ONE&&(e/=this.a1,t+=this.x1),t*=100n,(e*=100n)>=this.a2&&(e=e*this.ONE_20/this.a2,t+=this.x2),e>=this.a3&&(e=e*this.ONE_20/this.a3,t+=this.x3),e>=this.a4&&(e=e*this.ONE_20/this.a4,t+=this.x4),e>=this.a5&&(e=e*this.ONE_20/this.a5,t+=this.x5),e>=this.a6&&(e=e*this.ONE_20/this.a6,t+=this.x6),e>=this.a7&&(e=e*this.ONE_20/this.a7,t+=this.x7),e>=this.a8&&(e=e*this.ONE_20/this.a8,t+=this.x8),e>=this.a9&&(e=e*this.ONE_20/this.a9,t+=this.x9),e>=this.a10&&(e=e*this.ONE_20/this.a10,t+=this.x10),e>=this.a11&&(e=e*this.ONE_20/this.a11,t+=this.x11);const a=(e-this.ONE_20)*this.ONE_20/(e+this.ONE_20),n=a*a/this.ONE_20;let s=a,i=s;return s=s*n/this.ONE_20,i+=s/3n,s=s*n/this.ONE_20,i+=s/5n,s=s*n/this.ONE_20,i+=s/7n,s=s*n/this.ONE_20,i+=s/9n,s=s*n/this.ONE_20,i+=s/11n,i*=2n,(t+i)/100n}exp(e){if(this.err.require(e>=this.MIN_NATURAL_EXPONENT&&e<=this.MAX_NATURAL_EXPONENT,"INVALID_EXPONENT"),e<0n)return this.ONE*this.ONE/this.exp(-e);let t=0n;e>=this.x0?(e-=this.x0,t=this.a0):e>=this.x1?(e-=this.x1,t=this.a1):t=1n,e*=100n;let a=this.ONE_20;e>=this.x2&&(e-=this.x2,a=a*this.a2/this.ONE_20),e>=this.x3&&(e-=this.x3,a=a*this.a3/this.ONE_20),e>=this.x4&&(e-=this.x4,a=a*this.a4/this.ONE_20),e>=this.x5&&(e-=this.x5,a=a*this.a5/this.ONE_20),e>=this.x6&&(e-=this.x6,a=a*this.a6/this.ONE_20),e>=this.x7&&(e-=this.x7,a=a*this.a7/this.ONE_20),e>=this.x8&&(e-=this.x8,a=a*this.a8/this.ONE_20),e>=this.x9&&(e-=this.x9,a=a*this.a9/this.ONE_20);let n=this.ONE_20,s=e;return n+=s,s=s*e/this.ONE_20/2n,n+=s,s=s*e/this.ONE_20/3n,n+=s,s=s*e/this.ONE_20/4n,n+=s,s=s*e/this.ONE_20/5n,n+=s,s=s*e/this.ONE_20/6n,n+=s,s=s*e/this.ONE_20/7n,n+=s,s=s*e/this.ONE_20/8n,n+=s,s=s*e/this.ONE_20/9n,n+=s,s=s*e/this.ONE_20/10n,n+=s,s=s*e/this.ONE_20/11n,n+=s,s=s*e/this.ONE_20/12n,n+=s,a*n/this.ONE_20*t/100n}powExp(e,t){if(0n===t)return this.ONE;if(0n===e)return 0n;this.err.require(e<this.X_BOUND,"X_OUT_OF_BOUNDS");const a=e;this.err.require(t<this.MILD_EXPONENT_BOUND,"Y_OUT_OF_BOUNDS");const n=t;let s=0n;if(this.LN_36_LOWER_BOUND<a&&a<this.LN_36_UPPER_BOUND){const e=this.ln_36(a);s=e/this.ONE*n+e%this.ONE*n/this.ONE}else s=this.ln(a)*n;return s/=this.ONE,this.err.require(this.MIN_NATURAL_EXPONENT<=s&&s<=this.MAX_NATURAL_EXPONENT,"PRODUCT_OUT_OF_BOUNDS"),this.exp(s)}powUp(e,t){const a=this.powExp(e,t);return a+(this.mulUp(a,this.MAX_POW_RELATIVE_ERROR)+1n)}complement(e){return e<this.ONE?this.ONE-e:0n}calcOutGivenIn(e,t,a,n,s){this.err.require(s<=this.mulDown(e,this.MAX_IN_RATIO),"MAX_IN_RATIO");const i=e+s,d=this.divUp(e,i),c=this.divDown(t,n),r=this.powUp(d,c);return this.mulDown(a,this.complement(r))}divDown(e,t){if(this.err.require(0n!==t,"ZERO_DIVISION"),0n===e)return 0n;{const a=e*this.ONE;return this.err.require(a/e===this.ONE,"DIV_INTERNAL"),a/t}}getAmountOut(e,t,a){const n=this.tokenIndexes[e],s=this.tokenIndexes[t];let i=a-this.mulUp(a,this.swapFee);i*=this.scalingFactors[n];return{amount:this.calcOutGivenIn(this.balancesUpScaled[n],this.normalizedWeights[n],this.balancesUpScaled[s],this.normalizedWeights[s],i)/this.scalingFactors[s],gas:this.gasConstant}}}class Pe{constructor(e,t,a,n,s,i,d,c,r,o,f,l,b,h,u,p){this.poolContract=e,this.lpToken=t,this.TOKENS=a,this.PRECISION=n,this.PRECISIONS=s,this.FEE_DENOMINATOR=i,this.NOISE_FEE=d,this.MIN_A=c,this.MAX_A=r,this.MIN_GAMMA=o,this.MAX_GAMMA=f,this.A_MULTIPLIER=l,this.isAPrecise=b,this.routeIndex=h,this.depositAddress=u,this.gasConstant=p,this.err=new ge(Pe.name),this.abiCoder=he,this.tokenIndex={},this.W_ONE=10n**18n,this.TENe9=10n**9n,this.TENe11=10n**11n,this.TENe14=10n**14n,this.TENe15=10n**15n,this.TENe16=10n**16n,this.TENe17=10n**17n,this.TENe20=10n**20n,this.A=0n,this.gamma=0n,this.D=0n,this.feeGamma=0n,this.midFee=0n,this.outFee=0n,this.lpTokenTotalSupply=0n,this.tokenIndex=a.reduce(((e,t,a)=>(e[t]=a,e)),{}),this.balances=Array.from({length:this.TOKENS.length},(()=>0n)),this.priceScales=Array.from({length:this.TOKENS.length-1},(()=>0n))}getLPMintAmount(e){throw new Error("TODO: Method not implemented.")}static create(e,t){return new Pe(e.poolContract,e.lpToken,e.tokens,e.precision,e.precisions,e.feeDenominator,e.noiseFee,e.minA,e.maxA,e.minGamma,e.maxGamma,e.aMultiplier,e.isAPrecise,t,e.address,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}get fee(){return this.feeCalc(this.xp())}getTradablePairs(){const e=[];for(let t=0,a=this.TOKENS.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.TOKENS[t],this.TOKENS[n]]),e.push([this.TOKENS[n],this.TOKENS[t]]);return e}xp(){const e=this.TOKENS.length,t=[...this.balances],a=this.PRECISIONS;t[0]*=this.PRECISIONS[0];for(let n=1;n<e;++n){const e=this.priceScales[n-1]*a[n];t[n]=t[n]*e/this.PRECISION}return t}getDy(e,t,a){const n=this.TOKENS.length;if(e===t||e>=n||t>=n)throw this.err.createRequireViolated("coin index out of range");if(a<=0n)throw this.err.createRequireViolated("do not exchange 0 coins");const s=this.PRECISIONS,i=[...this.balances];i[e]+=a,i[0]*=s[0];for(let e=0,t=n-1;e<t;++e)i[e+1]=i[e+1]*this.priceScales[e]*s[e+1]/this.PRECISION;const d=this.newtonY(this.A,this.gamma,i,this.D,t);let c=i[t]-d-1n;return i[t]=d,t>0&&(c=c*this.PRECISION/this.priceScales[t-1]),c/=s[t],c-=this.feeCalc(i)*c/this.FEE_DENOMINATOR,c}calculateWithdrawOneCoin(e,t){throw new Error("Method not implemented.")}getVirtualPrice(){throw new Error("Method not implemented.")}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){const t=[{callData:this.isAPrecise?"0x76a2f0f0":"0xf446c1d0",target:this.poolContract},{callData:"0x0f529ba2",target:this.poolContract},{callData:"0xb1373929",target:this.poolContract},{callData:"0x72d4f0e2",target:this.poolContract},{callData:"0x92526c0c",target:this.poolContract},{callData:"0xee8de675",target:this.poolContract},{callData:"0x18160ddd",target:this.lpToken},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode(["uint256"],[a]);return{callData:e.utils.hexConcat(["0x4903b0d1",n]),target:this.poolContract}}))];return 2===this.TOKENS.length?t.push({callData:"0xb9e8c9fd",target:this.poolContract}):t.push(...this.TOKENS.slice(0,this.TOKENS.length-1).map(((t,a)=>{const n=this.abiCoder.encode(["uint256"],[a]);return{callData:e.utils.hexConcat(["0xa3f7cdd5",n]),target:this.poolContract}}))),t}applyCurrentStateFromCalls(e){if(0===e.length)return;if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.D=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.gamma=t.toBigInt()}if(e[3].success){const[t]=this.abiCoder.decode(["uint256"],e[3].returnData);this.feeGamma=t.toBigInt()}if(e[4].success){const[t]=this.abiCoder.decode(["uint256"],e[4].returnData);this.midFee=t.toBigInt()}if(e[5].success){const[t]=this.abiCoder.decode(["uint256"],e[5].returnData);this.outFee=t.toBigInt()}if(e[6].success){const[t]=this.abiCoder.decode(["uint256"],e[6].returnData);this.lpTokenTotalSupply=t.toBigInt()}let t=0;for(let a=7,n=a+this.TOKENS.length;a<n;++a)if(e[a].success){const[n]=this.abiCoder.decode(["uint256"],e[a].returnData);this.balances[t]=n.toBigInt(),t+=1}t=0;for(let a=this.TOKENS.length+7,n=a+this.TOKENS.length-1;a<n;++a)if(e[a].success){const[n]=this.abiCoder.decode(["uint256"],e[a].returnData);this.priceScales[t]=n.toBigInt(),t+=1}}max(e,t){return e>t?e:t}reductionCoefficient(e,t){const a=this.TOKENS.length;let n=this.W_ONE,s=0n;return e.forEach((e=>{s+=e})),e.forEach((e=>{n=n*BigInt(a)*e/s})),t>0&&(n=t*this.W_ONE/(t+this.W_ONE-n)),n}newtonY(e,t,a,n,s){const i=this.TOKENS.length;this.err.require(e>this.MIN_A-1n&&e<this.MAX_A+1n,"unsafe values A"),this.err.require(t>this.MIN_GAMMA-1n&&t<this.MAX_GAMMA+1n,"unsafe values gamma"),this.err.require(n>this.TENe17-1n&&n<this.TENe15*this.W_ONE+1n,"unsafe values D");for(let e=0;e<i;++e)if(e!==s){const t=a[e]*this.W_ONE/n;this.err.require(t>this.TENe16-1n&&t<this.TENe20+1n,"unsafe values x[i]")}let d=n;i>2&&(d/=BigInt(i));let c=this.W_ONE,r=0n,o=[...a];o[s]=0n,o.sort(((e,t)=>e<t?1:t<e?-1:0));const f=this.max(this.max(o[0]/this.TENe14,n/this.TENe14),100n);for(let e=2,t=i+1;e<t;++e){const t=o[i-e];d=2===e&&2===i?d*n/(t*BigInt(i)*BigInt(i)):d*n/(t*BigInt(i)),r+=t}for(let e=0,t=i-1;e<t;++e)c=c*o[e]*BigInt(i)/n;for(let a=0;a<255;++a){const a=d,s=c*d*BigInt(i)/n,o=r+d;let l=t+this.W_ONE;l=l>s?l-s+1n:s-l+1n;const b=this.W_ONE*n/t*l/t*l*this.A_MULTIPLIER/e,h=this.W_ONE+2n*this.W_ONE*s/l;let u=this.W_ONE*d+o*h+b;const p=n*h;if(u<p){d=a/2n;continue}u-=p;const x=u/d;let g=b/x;const m=(u+this.W_ONE*n)/x+g*this.W_ONE/s;g+=this.W_ONE*o/x,d=m<g?a/2n:m-g;let C=0n;if(C=d>a?d-a:a-d,C<this.max(f,d/this.TENe14)){const e=d*this.W_ONE/n;return this.err.require(e>this.TENe16-1n&&e<this.TENe20+1n,"unsafe value for y"),d}}throw this.err.createRequireViolated("Did not converge")}geometricMean(e,t=!0){const a=this.TOKENS.length;let n=[...e];t&&(n=n.sort(((e,t)=>e>t?-1:e<t?1:0)));let s=n[0],i=0n;for(let e=0;e<255;++e){let e=s,t=this.W_ONE;for(let e=0,a=n.length;e<a;++e)t=t*n[e]/s;if(s=s*(BigInt(a-1)*this.W_ONE+t)/(BigInt(a)*this.W_ONE),i=s>e?s-e:e-s,i<=1n||i*this.W_ONE<s)return s}throw this.err.createRequireViolated("Did not converge")}newtonD(e,t,a){const n=this.TOKENS.length;this.err.require(e>this.MIN_A-1n&&e<this.MAX_A+1n,"unsafe values A"),this.err.require(t>this.MIN_GAMMA-1n&&t<this.MAX_GAMMA+1n,"unsafe values gamma");const s=[...a].sort(((e,t)=>e>t?-1:e<t?1:0));this.err.require(s[0]>this.TENe9-1n&&s[0]<this.TENe15*this.W_ONE+1n,"unsafe values x[0]");for(let e=1;e<n;++e){const t=s[e]*this.W_ONE/s[0];this.err.require(t>this.TENe11-1n,"unsafe values x[i]")}let i=BigInt(n)*this.geometricMean(s,!1),d=s.reduce(((e,t)=>t+e),0n);for(let a=0;a<255;++a){let a=i,c=this.W_ONE;c=s.reduce(((e,t)=>e*t*BigInt(n)/i),c);let r=t+this.W_ONE;r=r>c?r-c+1n:c-r+1n;const o=this.W_ONE*i/t*r/t*r*this.A_MULTIPLIER/e,f=2n*this.W_ONE*BigInt(n)*c/r,l=d+d*f/this.W_ONE+o*BigInt(n)/c-f*i/this.W_ONE,b=i*(l+d)/l;let h=i*i/l;this.W_ONE>c?h+=i*(o/l)/this.W_ONE*(this.W_ONE-c)/c:h-=i*(o/l)/this.W_ONE*(c-this.W_ONE)/c,i=b>h?b-h:(h-b)/2n;let u=0n;if(u=i>a?i-a:a-i,u*this.TENe14<this.max(this.TENe16,i)){for(let e=0,t=s.length;e<t;++e){const t=s[e]*this.W_ONE/i;this.err.require(t>this.TENe16-1n&&t<this.TENe20+1n,"unsafe values x[i]")}return i}}throw this.err.createRequireViolated("Did not converge")}feeCalc(e){const t=this.reductionCoefficient(e,this.feeGamma);return(this.midFee*t+this.outFee*(this.W_ONE-t))/this.W_ONE}calculateTokenFee(e,t){const a=this.TOKENS.length,n=this.feeCalc(t)*BigInt(a)/BigInt(4*(a-1));let s=0n;for(let t=0,a=e.length;t<a;++t)s+=e[t];const i=s/BigInt(a);let d=0n;for(let t=0,a=e.length;t<a;++t){const a=e[t];d+=a>i?a-i:i-a}return n*d/s+this.NOISE_FEE}calculateTokenAmount(e,t){const a=this.TOKENS.length,n=this.PRECISIONS;let s=[...this.balances],i=[...e];if(t)for(let t=0;t<a;++t)s[t]+=e[t];else for(let t=0;t<a;++t)s[t]-=e[t];s[0]*=n[0],i[0]*=n[0];for(let e=0;e<a-1;++e){const t=this.priceScales[e]*n[e+1];s[e+1]=s[e+1]*t/this.PRECISION,i[e+1]=i[e+1]*t/this.PRECISION}const d=this.newtonD(this.A,this.gamma,s);let c=this.lpTokenTotalSupply*d/this.D;return t?c-=this.lpTokenTotalSupply:c=this.lpTokenTotalSupply-c,c-=this.calculateTokenFee(i,s)*c/this.FEE_DENOMINATOR+1n,c}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];return{amount:this.getDy(n,s,a),gas:this.gasConstant}}}class Se extends me{constructor(e,t,a,n,s,i,d,c,r,o=1n){super(e,t,a,s.map((e=>e*n)),n,n,s,i,!1,d,c,r,o),this.offpegFeeMultiplier=0n}static createLendingA(e,t){return new Se(e.poolContract,e.lpToken,e.tokens,e.precision,e.precisionMul,e.feeDenominator,t,e.address,e.gas,e.aPrecision)}dynamicFee(e,t,a,n){if(n<=this.FEE_DENOMINATOR)return a;{let s=e+t;return s*=s,n*a/(4n*(n-this.FEE_DENOMINATOR)*e*t/s+this.FEE_DENOMINATOR)}}getfetchingCurrentStateCalls(){const e=super.getfetchingCurrentStateCalls();return e.push({callData:"0x8edfdd5f",target:this.poolContract}),e}applyCurrentStateFromCalls(e){super.applyCurrentStateFromCalls(e);const t=e.length;if(e[t-1].success){const[a]=this.abiCoder.decode(["uint256"],e[t-1].returnData);this.offpegFeeMultiplier=a.toBigInt()}}getD(e,t){const a=BigInt(this.TOKENS.length);let n=0n;for(let t=0,a=e.length;t<a;++t)n+=e[t];if(0n===n)return 0n;let s=0n,i=n;const d=t*a;for(let t=0;t<255;++t){let t=i;for(let n=0,s=e.length;n<s;++n)t=t*i/(e[n]*a+1n);if(s=i,i=(d*n/this.A_PRECISION+t*a)*i/((d-this.A_PRECISION)*i/this.A_PRECISION+(a+1n)*t),i>s){if(i-s<=1n)return i}else if(s-i<=1n)return i}throw this.errorFactory.createRequireViolated("getD does not converge")}getDPrecision(e,t){const a=[...this.PRECISION_MUL].map(((t,a)=>t*e[a]));return this.getD(a,t)}getVirtualPrice(){const e=this.getDPrecision(this.balances,this.A),t=this.lpTokenTotalSupply;return e*this.PRECISION/t}getLPMintAmount(e){const t=this.A,a=[...this.balances];let n=0n;0n!==this.lpTokenTotalSupply&&(n=this.getDPrecision(a,t));const s=[...a],i=this.TOKENS.length;for(let t=0;t<i;++t)0n===this.lpTokenTotalSupply&&this.errorFactory.require(0n!==e[t],"initial deposit requires all coins"),s[t]+=e[t];const d=this.getDPrecision(s,t);this.errorFactory.require(d>n,"D1 > D0");const c=Array.from({length:i},(()=>0n));let r=0n;if(0n!==this.lpTokenTotalSupply){const e=(n+d)/BigInt(i),o=this.fee*BigInt(i)/(4n*(BigInt(i)-1n)),f=this.offpegFeeMultiplier;let l=0n;for(let t=0;t<i;++t){const i=d*a[t]/n,r=s[t];l=i>r?i-r:r-i;const b=a[t]+r;c[t]=this.dynamicFee(b,e,o,f)*l/this.FEE_DENOMINATOR,s[t]=r-c[t]}const b=this.getDPrecision(s,t);r=this.lpTokenTotalSupply*(b-n)/n}else r=d;return r}calculateWithdrawOneCoin(e,t){const a=this.TOKENS.length,n=this.A,s=[...this.balances],i=this.PRECISION_MUL;for(let e=0;e<a;++e)s[e]*=i[e];const d=this.getD(s,n),c=d-e*d/this.lpTokenTotalSupply,r=this.getYD(n,t,s,c),o=[...s],f=(d+c)/(2n*BigInt(a)),l=this.fee*BigInt(a)/(4n*(BigInt(a)-1n)),b=this.offpegFeeMultiplier;for(let e=0;e<a;++e){let a=0n,n=0n;e===t?(a=s[e]*c/d-r,n=(s[e]+r)/2n):(a=s[e]-s[e]*c/d,n=s[e]),o[e]-=this.dynamicFee(n,f,l,b)*a/this.FEE_DENOMINATOR}const h=o[t]-this.getYD(n,t,o,c),u=(s[t]-r)/i[t];return{dy:(h-1n)/i[t],dyDiff:u-h,totalSupply:this.lpTokenTotalSupply}}getDyOrUnderlying(e,t,a,n){const s=this.TOKENS.length,i=[...this.balances],d=this.PRECISION_MUL;for(let e=0;e<s;++e)i[e]*=d[e];const c=i[e]+a*d[e],r=this.getY(e,t,c,i),o=i[t]-r;return(o-this.dynamicFee((i[e]+c)/2n,(i[t]+r)/2n,this.fee,this.offpegFeeMultiplier)*o/this.FEE_DENOMINATOR)/d[t]}}class De{constructor(e,t,a,n,s,i,d,c){this.stablePool=e,this.cryptoPool=t,this.TOKENS=a,this.N_STABLECOINS=n,this.tradingRouteIndex=s,this.poolContract=i,this.depositAddress=d,this.gasConstant=c,this.tokenIndex={},this.tokenIndex=a.reduce(((e,t,a)=>(e[t]=a,e)),{})}static create(e,t,a,n){return new De(t,a,e.tokens,e.nStablecoins,n,e.poolContract,e.address,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.TOKENS.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.TOKENS[t],this.TOKENS[n]],[this.TOKENS[n],this.TOKENS[t]]);return e}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[]}applyCurrentStateFromCalls(e){}max(e,t){return e>t?e:t}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];if(void 0===n||void 0===s)return{amount:0n,gas:0n};let i=a,d=0,c=0;if(s>=this.N_STABLECOINS&&(c=s-(this.N_STABLECOINS-1)),n<this.N_STABLECOINS){let e=Array.from({length:this.N_STABLECOINS},(()=>0n));e[n]=i,i=this.stablePool.getLPMintAmount(e)}else d=n-(this.N_STABLECOINS-1);let r=i;return this.max(d,c)>0&&(r=this.cryptoPool.getDy(d,c,i)),0===c?{amount:this.stablePool.calculateWithdrawOneCoin(r,s).dy,gas:this.gasConstant}:{amount:r,gas:this.gasConstant}}}class we{constructor(e,t,a,n,s,i,d=10n**18n){this.pairContract=e,this.token0=t,this.token1=a,this.depositAddress=n,this.tradingRouteIndex=s,this.gasConstant=i,this.PRECISION=d,this.abiCoder=he,this.err=new ge(we.name),this.reserve0=0n,this.reserve1=0n,this.vReserve0=0n,this.vReserve1=0n,this.feeInPrecision=0n;const c=we.getSortedPair(this.token0,this.token1);this.token0=c[0],this.token1=c[1]}static create(e,t,a){const n=this.getSortedPair(t[0],t[1]),s=e.pools[n[0]][n[1]];return new we(s,n[0],n[1],s,a,e.gas)}static isPairSupported(e,t){const a=void 0!==t[e[0]]&&void 0!==t[e[0]][e[1]],n=void 0!==t[e[1]]&&void 0!==t[e[1]][e[0]];return a||n}getTradablePairs(){return[[this.token0,this.token1],[this.token1,this.token0]]}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.pairContract}getDepositAddress(){return this.depositAddress}static getSortedPair(e,t){return e.localeCompare(t,"en",{sensitivity:"base"})<=0?[e,t]:[t,e]}getReserveInOut(e,t,a){return e===this.token0?{reserveIn:t,reserveOut:a}:{reserveIn:a,reserveOut:t}}getfetchingCurrentStateCalls(){return[{callData:"0xd6694027",target:this.pairContract}]}applyCurrentStateFromCalls(e){if(0!==e.length&&e[0].success){const[t,a,n,s,i]=this.abiCoder.decode(["uint112","uint112","uint112","uint112","uint256"],e[0].returnData);this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt(),this.vReserve0=n.toBigInt(),this.vReserve1=s.toBigInt(),this.feeInPrecision=i.toBigInt()}}getAmountOut(e,t,a){const{reserveIn:n,reserveOut:s}=this.getReserveInOut(e,this.reserve0,this.reserve1),{reserveIn:i,reserveOut:d}=this.getReserveInOut(e,this.vReserve0,this.vReserve1);this.err.require(a>0n,"DMMLibrary: INSUFFICIENT_INPUT_AMOUNT"),this.err.require(n>0n&&s>0n,"DMMLibrary: INSUFFICIENT_LIQUIDITY");const c=a*(this.PRECISION-this.feeInPrecision)/this.PRECISION,r=c*d/(i+c);return this.err.require(s>r,"DMMLibrary: INSUFFICIENT_LIQUIDITY"),{amount:r,gas:this.gasConstant}}}class _e extends ue{constructor(e,t,a,n,s,i,d,c,r,o){super(t,a,n,s,i,d,c,o),this.depositAddress=e,this.err=new ge(_e.name),this.MAX_NUM=0x200000000000000000000000000000000n,this.FIXED_1=0x080000000000000000000000000000000n,this.FIXED_2=0x100000000000000000000000000000000n,this.OPT_LOG_MAX_VAL=0x15bf0a8b1457695355fb8ac404e7a79e3n,this.OPT_EXP_MAX_VAL=0x800000000000000000000000000000000n,this.MIN_PRECISION=32,this.MAX_PRECISION=127,this.ONE=1n,this.LN2_NUMERATOR=0x3f80fe03f80fe03f80fe03f80fe03f8n,this.LN2_DENOMINATOR=0x5b9de1d10bf4103d647b0955897ba80n,this.maxExpArray=[0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0x1c35fedd14ffffffffffffffffffffffffn,0x1b0ce43b323fffffffffffffffffffffffn,0x19f0028ec1ffffffffffffffffffffffffn,0x18ded91f0e7fffffffffffffffffffffffn,0x17d8ec7f0417ffffffffffffffffffffffn,0x16ddc6556cdbffffffffffffffffffffffn,0x15ecf52776a1ffffffffffffffffffffffn,0x15060c256cb2ffffffffffffffffffffffn,0x1428a2f98d72ffffffffffffffffffffffn,0x13545598e5c23fffffffffffffffffffffn,0x1288c4161ce1dfffffffffffffffffffffn,0x11c592761c666fffffffffffffffffffffn,0x110a688680a757ffffffffffffffffffffn,0x1056f1b5bedf77ffffffffffffffffffffn,0x0faadceceeff8bffffffffffffffffffffn,0x0f05dc6b27edadffffffffffffffffffffn,0x0e67a5a25da4107fffffffffffffffffffn,0x0dcff115b14eedffffffffffffffffffffn,0x0d3e7a392431239fffffffffffffffffffn,0x0cb2ff529eb71e4fffffffffffffffffffn,0x0c2d415c3db974afffffffffffffffffffn,0x0bad03e7d883f69bffffffffffffffffffn,0x0b320d03b2c343d5ffffffffffffffffffn,0x0abc25204e02828dffffffffffffffffffn,0x0a4b16f74ee4bb207fffffffffffffffffn,0x09deaf736ac1f569ffffffffffffffffffn,0x0976bd9952c7aa957fffffffffffffffffn,0x09131271922eaa606fffffffffffffffffn,0x08b380f3558668c46fffffffffffffffffn,0x0857ddf0117efa215bffffffffffffffffn,0x07ffffffffffffffffffffffffffffffffn,0x07abbf6f6abb9d087fffffffffffffffffn,0x075af62cbac95f7dfa7fffffffffffffffn,0x070d7fb7452e187ac13fffffffffffffffn,0x06c3390ecc8af379295fffffffffffffffn,0x067c00a3b07ffc01fd6fffffffffffffffn,0x0637b647c39cbb9d3d27ffffffffffffffn,0x05f63b1fc104dbd39587ffffffffffffffn,0x05b771955b36e12f7235ffffffffffffffn,0x057b3d49dda84556d6f6ffffffffffffffn,0x054183095b2c8ececf30ffffffffffffffn,0x050a28be635ca2b888f77fffffffffffffn,0x04d5156639708c9db33c3fffffffffffffn,0x04a23105873875bd52dfdfffffffffffffn,0x0471649d87199aa990756fffffffffffffn,0x04429a21a029d4c1457cfbffffffffffffn,0x0415bc6d6fb7dd71af2cb3ffffffffffffn,0x03eab73b3bbfe282243ce1ffffffffffffn,0x03c1771ac9fb6b4c18e229ffffffffffffn,0x0399e96897690418f785257fffffffffffn,0x0373fc456c53bb779bf0ea9fffffffffffn,0x034f9e8e490c48e67e6ab8bfffffffffffn,0x032cbfd4a7adc790560b3337ffffffffffn,0x030b50570f6e5d2acca94613ffffffffffn,0x02eb40f9f620fda6b56c2861ffffffffffn,0x02cc8340ecb0d0f520a6af58ffffffffffn,0x02af09481380a0a35cf1ba02ffffffffffn,0x0292c5bdd3b92ec810287b1b3fffffffffn,0x0277abdcdab07d5a77ac6d6b9fffffffffn,0x025daf6654b1eaa55fd64df5efffffffffn,0x0244c49c648baa98192dce88b7ffffffffn,0x022ce03cd5619a311b2471268bffffffffn,0x0215f77c045fbe885654a44a0fffffffffn,0x01ffffffffffffffffffffffffffffffffn,0x01eaefdbdaaee7421fc4d3ede5ffffffffn,0x01d6bd8b2eb257df7e8ca57b09bfffffffn,0x01c35fedd14b861eb0443f7f133fffffffn,0x01b0ce43b322bcde4a56e8ada5afffffffn,0x019f0028ec1fff007f5a195a39dfffffffn,0x018ded91f0e72ee74f49b15ba527ffffffn,0x017d8ec7f04136f4e5615fd41a63ffffffn,0x016ddc6556cdb84bdc8d12d22e6fffffffn,0x015ecf52776a1155b5bd8395814f7fffffn,0x015060c256cb23b3b3cc3754cf40ffffffn,0x01428a2f98d728ae223ddab715be3fffffn,0x013545598e5c23276ccf0ede68034fffffn,0x01288c4161ce1d6f54b7f61081194fffffn,0x011c592761c666aa641d5a01a40f17ffffn,0x0110a688680a7530515f3e6e6cfdcdffffn,0x01056f1b5bedf75c6bcb2ce8aed428ffffn,0x00faadceceeff8a0890f3875f008277fffn,0x00f05dc6b27edad306388a600f6ba0bfffn,0x00e67a5a25da41063de1495d5b18cdbfffn,0x00dcff115b14eedde6fc3aa5353f2e4fffn,0x00d3e7a3924312399f9aae2e0f868f8fffn,0x00cb2ff529eb71e41582cccd5a1ee26fffn,0x00c2d415c3db974ab32a51840c0b67edffn,0x00bad03e7d883f69ad5b0a186184e06bffn,0x00b320d03b2c343d4829abd6075f0cc5ffn,0x00abc25204e02828d73c6e80bcdb1a95bfn,0x00a4b16f74ee4bb2040a1ec6c15fbbf2dfn,0x009deaf736ac1f569deb1b5ae3f36c130fn,0x00976bd9952c7aa957f5937d790ef65037n,0x009131271922eaa6064b73a22d0bd4f2bfn,0x008b380f3558668c46c91c49a2f8e967b9n,0x00857ddf0117efa215952912839f6473e6n],this.tokenWeight0=BigInt(r),this.tokenWeight1=BigInt(100-r),this.encodedPairContract=this.abiCoder.encode(["address"],[this.pairContract])}static createPolyDex(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,weight:c,address:r,gas:o}=e;return new _e(r,d,n,s,i,t[0],t[1],a,c,o)}getDepositAddress(){return this.depositAddress}optimalLog(e){let t=0n,a=0n,n=0n,s=0n;return e>=0xd3094c70f034de4b96ff7d5b6f99fcd8n&&(t+=0x40000000000000000000000000000000n,e=e*this.FIXED_1/0xd3094c70f034de4b96ff7d5b6f99fcd8n),e>=0xa45af1e1f40c333b3de1db4dd55f29a7n&&(t+=0x20000000000000000000000000000000n,e=e*this.FIXED_1/0xa45af1e1f40c333b3de1db4dd55f29a7n),e>=0x910b022db7ae67ce76b441c27035c6a1n&&(t+=0x10000000000000000000000000000000n,e=e*this.FIXED_1/0x910b022db7ae67ce76b441c27035c6a1n),e>=0x88415abbe9a76bead8d00cf112e4d4a8n&&(t+=0x08000000000000000000000000000000n,e=e*this.FIXED_1/0x88415abbe9a76bead8d00cf112e4d4a8n),e>=0x84102b00893f64c705e841d5d4064bd3n&&(t+=0x04000000000000000000000000000000n,e=e*this.FIXED_1/0x84102b00893f64c705e841d5d4064bd3n),e>=0x8204055aaef1c8bd5c3259f4822735a2n&&(t+=0x02000000000000000000000000000000n,e=e*this.FIXED_1/0x8204055aaef1c8bd5c3259f4822735a2n),e>=0x810100ab00222d861931c15e39b44e99n&&(t+=0x01000000000000000000000000000000n,e=e*this.FIXED_1/0x810100ab00222d861931c15e39b44e99n),e>=0x808040155aabbbe9451521693554f733n&&(t+=0x00800000000000000000000000000000n,e=e*this.FIXED_1/0x808040155aabbbe9451521693554f733n),n=a=e-this.FIXED_1,s=a*a/this.FIXED_1,t+=n*(0x100000000000000000000000000000000n-a)/0x100000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaan-a)/0x200000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x099999999999999999999999999999999n-a)/0x300000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x092492492492492492492492492492492n-a)/0x400000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x08e38e38e38e38e38e38e38e38e38e38en-a)/0x500000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x08ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8bn-a)/0x600000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x089d89d89d89d89d89d89d89d89d89d89n-a)/0x700000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x088888888888888888888888888888888n-a)/0x800000000000000000000000000000000n,t}floorLog2(e){let t=0;if(e<256n)for(;e>1n;)e>>=1n,t+=1;else for(let a=128;a>0;a>>=1)e>=this.ONE<<BigInt(a)&&(e>>=BigInt(a),t|=a);return t}generalLog(e){let t=0n;if(e>=this.FIXED_2){const a=BigInt(this.floorLog2(e/this.FIXED_1));e>>=a,t=a*this.FIXED_1}if(e>this.FIXED_1)for(let a=this.MAX_PRECISION;a>0;--a)(e=e*e/this.FIXED_1)>=this.FIXED_2&&(e>>=1n,t+=this.ONE<<BigInt(a-1));return t*this.LN2_NUMERATOR/this.LN2_DENOMINATOR}optimalExp(e){let t=0n,a=0n,n=0n;return n=a=e%0x10000000000000000000000000000000n,n=n*a/this.FIXED_1,t+=0x10e1b3be415a0000n*n,n=n*a/this.FIXED_1,t+=0x05a0913f6b1e0000n*n,n=n*a/this.FIXED_1,t+=0x0168244fdac78000n*n,n=n*a/this.FIXED_1,t+=0x004807432bc18000n*n,n=n*a/this.FIXED_1,t+=0x000c0135dca04000n*n,n=n*a/this.FIXED_1,t+=0x0001b707b1cdc000n*n,n=n*a/this.FIXED_1,t+=0x000036e0f639b800n*n,n=n*a/this.FIXED_1,t+=0x00000618fee9f800n*n,n=n*a/this.FIXED_1,t+=0x0000009c197dcc00n*n,n=n*a/this.FIXED_1,t+=0x0000000e30dce400n*n,n=n*a/this.FIXED_1,t+=0x000000012ebd1300n*n,n=n*a/this.FIXED_1,t+=0x0000000017499f00n*n,n=n*a/this.FIXED_1,t+=0x0000000001a9d480n*n,n=n*a/this.FIXED_1,t+=0x00000000001c6380n*n,n=n*a/this.FIXED_1,t+=0x000000000001c638n*n,n=n*a/this.FIXED_1,t+=0x0000000000001ab8n*n,n=n*a/this.FIXED_1,t+=0x000000000000017cn*n,n=n*a/this.FIXED_1,t+=0x0000000000000014n*n,n=n*a/this.FIXED_1,t+=0x0000000000000001n*n,t=t/0x21c3677c82b40000n+a+this.FIXED_1,0n!=(0x010000000000000000000000000000000n&e)&&(t=0x1c3d6a24ed82218787d624d3e5eba95f9n*t/0x18ebef9eac820ae8682b9793ac6d1e776n),0n!=(0x020000000000000000000000000000000n&e)&&(t=0x18ebef9eac820ae8682b9793ac6d1e778n*t/0x1368b2fc6f9609fe7aceb46aa619baed4n),0n!=(0x040000000000000000000000000000000n&e)&&(t=0x1368b2fc6f9609fe7aceb46aa619baed5n*t/0x0bc5ab1b16779be3575bd8f0520a9f21fn),0n!=(0x080000000000000000000000000000000n&e)&&(t=0x0bc5ab1b16779be3575bd8f0520a9f21en*t/0x0454aaa8efe072e7f6ddbab84b40a55c9n),0n!=(0x100000000000000000000000000000000n&e)&&(t=0x0454aaa8efe072e7f6ddbab84b40a55c5n*t/0x00960aadc109e7a3bf4578099615711ean),0n!=(0x200000000000000000000000000000000n&e)&&(t=0x00960aadc109e7a3bf4578099615711d7n*t/0x0002bf84208204f5977f9a8cf01fdce3dn),0n!=(0x400000000000000000000000000000000n&e)&&(t=0x0002bf84208204f5977f9a8cf01fdc307n*t/0x0000003c6ab775dd0b95b4cbee7e65d11n),t}findPositionInMaxExpArray(e){let t=this.MIN_PRECISION,a=this.MAX_PRECISION;for(;t+1<a;){const n=Math.floor((t+a)/2);this.maxExpArray[n]>=e?t=n:a=n}if(this.maxExpArray[a]>=e)return a;if(this.maxExpArray[t]>=e)return t;throw this.err.createRequireViolated("unable to find position in max exp array")}generalExp(e,t){const a=BigInt(t);let n=e,s=0n;return n=n*e>>a,s+=0x3442c4e6074a82f1797f72ac0000000n*n,n=n*e>>a,s+=0x116b96f757c380fb287fd0e40000000n*n,n=n*e>>a,s+=0x045ae5bdd5f0e03eca1ff4390000000n*n,n=n*e>>a,s+=0x00defabf91302cd95b9ffda50000000n*n,n=n*e>>a,s+=0x002529ca9832b22439efff9b8000000n*n,n=n*e>>a,s+=0x00054f1cf12bd04e516b6da88000000n*n,n=n*e>>a,s+=0x0000a9e39e257a09ca2d6db51000000n*n,n=n*e>>a,s+=0x000012e066e7b839fa050c309000000n*n,n=n*e>>a,s+=0x000001e33d7d926c329a1ad1a800000n*n,n=n*e>>a,s+=0x0000002bee513bdb4a6b19b5f800000n*n,n=n*e>>a,s+=0x00000003a9316fa79b88eccf2a00000n*n,n=n*e>>a,s+=0x0000000048177ebe1fa812375200000n*n,n=n*e>>a,s+=0x0000000005263fe90242dcbacf00000n*n,n=n*e>>a,s+=0x000000000057e22099c030d94100000n*n,n=n*e>>a,s+=0x0000000000057e22099c030d9410000n*n,n=n*e>>a,s+=0x00000000000052b6b54569976310000n*n,n=n*e>>a,s+=0x00000000000004985f67696bf748000n*n,n=n*e>>a,s+=0x000000000000003dea12ea99e498000n*n,n=n*e>>a,s+=0x00000000000000031880f2214b6e000n*n,n=n*e>>a,s+=0x000000000000000025bcff56eb36000n*n,n=n*e>>a,s+=0x000000000000000001b722e10ab1000n*n,n=n*e>>a,s+=0x0000000000000000001317c70077000n*n,n=n*e>>a,s+=0x00000000000000000000cba84aafa00n*n,n=n*e>>a,s+=0x00000000000000000000082573a0a00n*n,n=n*e>>a,s+=0x00000000000000000000005035ad900n*n,n=n*e>>a,s+=0x000000000000000000000002f881b00n*n,n=n*e>>a,s+=0x0000000000000000000000001b29340n*n,n=n*e>>a,s+=0x00000000000000000000000000efc40n*n,n=n*e>>a,s+=0x0000000000000000000000000007fe0n*n,n=n*e>>a,s+=0x0000000000000000000000000000420n*n,n=n*e>>a,s+=0x0000000000000000000000000000021n*n,n=n*e>>a,s+=0x0000000000000000000000000000001n*n,s/0x688589cc0e9505e2f2fee5580000000n+e+(this.ONE<<a)}power(e,t,a,n){this.err.require(e>=t,"not support _baseN < _baseD"),this.err.require(e<this.MAX_NUM,"_baseN < this.MAX_NUM");let s=0n;const i=e*this.FIXED_1/t;s=i<this.OPT_LOG_MAX_VAL?this.optimalLog(i):this.generalLog(i);const d=s*a/n;if(d<this.OPT_EXP_MAX_VAL)return{result:this.optimalExp(d),precision:this.MAX_PRECISION};{const e=this.findPositionInMaxExpArray(d);return{result:this.generalExp(d>>BigInt(this.MAX_PRECISION-e),e),precision:e}}}getAmountOut(e,t,a){const{reserveIn:n,reserveOut:s}=this.getReserveInOut(e,this.reserve0,this.reserve1),{reserveIn:i,reserveOut:d}=this.getReserveInOut(e,this.tokenWeight0,this.tokenWeight1);this.err.require(a>0n,"INSUFFICIENT_INPUT_AMOUNT"),this.err.require(n>0n&&s>0n,"INSUFFICIENT_LIQUIDITY");const c=a*(this.feePrecision-this.fee);if(i===d)return{amount:s*c/(n*this.feePrecision+c),gas:this.gasConstant};const r=n*this.feePrecision+c,{result:o,precision:f}=this.power(r,n*this.feePrecision,i,d);return{amount:(s*o-(s<<BigInt(f)))/o,gas:this.gasConstant}}}class ve extends _e{constructor(e,t,a,n,s,i,d,c,r,o){super(e,t,a,n,s,i,d,c,r,o),this.pairContract=this.generatePairAddressWithFeeAndWeight(this.factory,this.token0,this.token1,Number(this.tokenWeight0),Number(this.fee))}static createPolyDex(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,weight:c,address:r,gas:o}=e;return new ve(r,d,n,s,i,t[0],t[1],a,c,o)}generatePairAddressWithFeeAndWeight(t,a,n,s,i){if(void 0!==s)return e.utils.hexDataSlice(e.utils.keccak256(e.utils.concat(["0xff",t,e.utils.solidityKeccak256(["address","address","uint32","uint32"],[a,n,s,i]),this.PAIR_BYTECODE_HASH])),12);throw new Error("Firebird pair address generation failed: missing tokenWeight0")}}class Re extends ye{static create(e,t){return new Re(e.poolContract,e.lpToken,e.tokens,e.rates,e.lendingPrecision,e.precision,e.precisionMul,e.feeDenominator,e.isUnderlying,t,e.address,e.gas,e.aPrecision)}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}else i.warn("unable to find A for Curve pool",this.poolContract),this.A=0n;if(e[1].success){const[,t]=this.abiCoder.decode(["address","uint256","uint256","uint256","uint256","uint256","uint256","uint256"],e[1].returnData);this.fee=t.toBigInt()}else i.warn("unable to find fee for Curve pool",this.poolContract),this.fee=0n;if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.lpTokenTotalSupply=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve pool",this.poolContract),this.lpTokenTotalSupply=0n;for(let t=3,a=this.TOKENS.length;t<3+a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances.push(a.toBigInt())}else i.warn("unable to find balance at index",t-3,"for Curve pool",this.poolContract),this.balances.push(0n)}}}class Be{constructor(t,a,n,s,i,d,c,r){this.AMP_PRECISION=t,this.tokens=a,this.scalingFactors=n,this.poolId=s,this.vaultContract=i,this.routeIndex=d,this.depositAddress=c,this.gasConstant=r,this.err=new ge(Be.name),this.abiCoder=he,this.ONE=1000000000000000000n,this.balances=[],this.fee=0n,this.A=0n,this.tokenIndex={},this.tokenIndex=this.tokens.reduce(((e,t,a)=>(e[t]=a,e)),{}),this.poolIdParam=this.abiCoder.encode(["bytes32"],[this.poolId]),this.poolContract=e.utils.hexZeroPad("0x"+(BigInt(this.poolId)>>96n).toString(16),20),this.balances=Array.from({length:this.tokens.length},(()=>0n))}static create(e,t){return new Be(e.aPrecision,e.tokens,e.scalingFactors,e.poolId,e.vaultContract,t,e.depositAddress,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.tokens.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.tokens[t],this.tokens[n]]),e.push([this.tokens[n],this.tokens[t]]);return e}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[{callData:"0x55c67628",target:this.poolContract},{callData:"0x6daccffa",target:this.poolContract},{callData:e.utils.hexConcat(["0xf94d4668",this.poolIdParam]),target:this.vaultContract}]}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.fee=t.toBigInt()}if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.A=t.toBigInt()}if(e[2].success){const[,t]=this.abiCoder.decode(["address[]","uint256[]","uint256"],e[2].returnData);this.balances=t.map((e=>e.toBigInt()))}}}mulUp(e,t){const a=e*t;return this.err.require(0n===e||a/e===t,"MUL_OVERFLOW"),0n===a?0n:(a-1n)/this.ONE+1n}mulDown(e,t){const a=e*t;return this.err.require(0n===e||a/e===t,"MUL_OVERFLOW"),a/this.ONE}div(e,t,a){return a?this.divUp(e,t):this.divDown(e,t)}divDown(e,t){return this.err.require(0n!==t,"ZERO_DIVISION"),e/t}divUp(e,t){return this.err.require(0n!==t,"ZERO_DIVISION"),0n===e?0n:1n+(e-1n)/t}divDownFixedPoint(e,t){if(this.err.require(0n!==t,"ZERO_DIVISION"),0n===e)return 0n;{const a=e*this.ONE;return this.err.require(a/e===this.ONE,"DIV_INTERNAL"),a/t}}divUpFixedPoint(e,t){if(this.err.require(0n!==t,"ZERO_DIVISION"),0n===e)return 0n;{const a=e*this.ONE;return this.err.require(a/e===this.ONE,"DIV_INTERNAL"),(a-1n)/t+1n}}_calculateInvariant(e,t,a){const n=t.length;let s=0n;for(let e=0;e<n;e++)s+=t[e];if(0n===s)return 0n;let i=0n,d=s;const c=e*BigInt(n);for(let e=0;e<255;e++){let e=t[0]*BigInt(n);for(let s=1;s<n;s++)e=this.div(e*t[s]*BigInt(n),d,a);if(i=d,d=this.div(BigInt(n)*d*d+this.div(c*s*e,this.AMP_PRECISION,a),BigInt(n+1)*d+this.div((c-this.AMP_PRECISION)*e,this.AMP_PRECISION,!a),a),d>i){if(d-i<=1n)return d}else if(i-d<=1n)return d}throw this.err.createRequireViolated("STABLE_GET_BALANCE_DIDNT_CONVERGE")}_getTokenBalanceGivenInvariantAndAllOtherBalances(e,t,a,n){const s=t.length,i=e*BigInt(s);let d=t[0],c=t[0]*BigInt(s);for(let e=1;e<s;e++)c=this.divDown(c*t[e]*BigInt(s),a),d+=t[e];d-=t[n];const r=a*a,o=this.divUp(r,i*c)*this.AMP_PRECISION*t[n],f=d+this.divDown(a,i)*this.AMP_PRECISION;let l=0n,b=this.divUp(r+o,a+f);for(let e=0;e<255;e++)if(l=b,b=this.divUp(b*b+o,2n*b+f-a),b>l){if(b-l<=1n)return b}else if(l-b<=1n)return b;throw this.err.createRequireViolated("STABLE_GET_BALANCE_DIDNT_CONVERGE")}_subtractSwapFeeAmount(e){return e-this.mulUp(e,this.fee)}_upscaleArray(e,t){for(let a=0,n=e.length;a<n;++a)e[a]=this.mulDown(e[a],t[a])}_upscale(e,t){return this.mulDown(e,t)}_downscaleDown(e,t){return this.divDownFixedPoint(e,t)}calcOutGivenIn(e,t,a,n,s){const i=this._calculateInvariant(e,t,!0);t[a]=t[a]+s;const d=this._getTokenBalanceGivenInvariantAndAllOtherBalances(e,t,i,n);return t[a]=t[a]-s,t[n]-d-1n}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];let i=this._subtractSwapFeeAmount(a);const d=[...this.balances];this._upscaleArray(d,this.scalingFactors),i=this._upscale(i,this.scalingFactors[n]);const c=this.calcOutGivenIn(this.A,d,n,s,i);return{amount:this._downscaleDown(c,this.scalingFactors[s]),gas:this.gasConstant}}}class Me{constructor(e,t,a,n,s,i,d,c,r){this.stablePool=e,this.cryptoPool=t,this.TOKENS=a,this.N_STABLECOINS=n,this.N_COINS=s,this.tradingRouteIndex=i,this.poolContract=d,this.depositAddress=c,this.gasConstant=r,this.tokenIndex={},this.tokenIndex=a.reduce(((e,t,a)=>(e[t]=a,e)),{})}static create(e,t,a,n){return new Me(t,a,e.tokens,e.nStablecoins,e.nCoins,n,e.poolContract,e.address,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.TOKENS.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.TOKENS[t],this.TOKENS[n]],[this.TOKENS[n],this.TOKENS[t]]);return e}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[]}applyCurrentStateFromCalls(e){}min(e,t){return e>t?t:e}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];if(void 0===n||void 0===s)return{amount:0n,gas:0n};let i=a;const d=this.min(n,this.N_COINS-1),c=this.min(s,this.N_COINS-1);if(n>=this.N_COINS-1){const e=Array.from({length:this.N_STABLECOINS},(()=>0n));e[n-(this.N_COINS-1)]=i,i=this.stablePool.getLPMintAmount(e)}let r=i;return d!==c&&(r=this.cryptoPool.getDy(d,c,i)),c===this.N_COINS-1?{amount:this.stablePool.calculateWithdrawOneCoin(r,s-(this.N_COINS-1)).dy,gas:this.gasConstant}:{amount:r,gas:this.gasConstant}}}class Fe extends ye{static create(e,t){return new Fe(e.poolContract,e.lpToken,e.tokens,e.rates,e.lendingPrecision,e.precision,e.precisionMul,e.feeDenominator,e.isUnderlying,t,e.address,e.gas,e.aPrecision)}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}else i.warn("unable to find A for Curve pool",this.poolContract),this.A=0n;if(e[1].success){const[,,,,t]=this.abiCoder.decode(["uint256","uint256","uint256","uint256","uint256","uint256","address"],e[1].returnData);this.fee=t.toBigInt()}else i.warn("unable to find fee for Curve pool",this.poolContract),this.fee=0n;if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.lpTokenTotalSupply=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve pool",this.poolContract),this.lpTokenTotalSupply=0n;for(let t=3,a=this.TOKENS.length;t<3+a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances.push(a.toBigInt())}else i.warn("unable to find balance at index",t-3,"for Curve pool",this.poolContract),this.balances.push(0n)}}}class Ue extends ue{static create(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,gas:c}=e;return new Ue(d,n,s,i,t[0],t[1],a,c)}getfetchingCurrentStateCalls(){const t=this.abiCoder.encode(["address"],[this.pairContract]);return[{callData:"0x0902f1ac",target:this.pairContract},{callData:e.utils.hexConcat(["0x6fcca69b",t]),target:this.factory}]}applyCurrentStateFromCalls(e){if(0===e.length||!e[0].success||"0x"===e[0].returnData)return this.reserve0=0n,this.reserve1=0n,void(this.fee=0n);const[t,a]=this.abiCoder.decode(["uint112","uint112","uint32"],e[0].returnData);if(this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt(),e[1].success){const[,,t]=this.abiCoder.decode(["address","bool","uint256"],e[1].returnData);this.fee=t.toBigInt()}else this.fee=this.feePrecision}}class Le extends Be{constructor(e,t,a,n,s,i,d,c,r,o){super(e,t,a,n,s,i,d,o),this.AMP_PRECISION=e,this.tokens=t,this.scalingFactors=a,this.poolId=n,this.vaultContract=s,this.routeIndex=i,this.depositAddress=d,this.rateProviders=c,this.multicall=r,this.gasConstant=o,this.priceRates=Array.from({length:t.length},(()=>0n))}static createMeta(e,t){return new Le(e.aPrecision,e.tokens,e.scalingFactors,e.poolId,e.vaultContract,t,e.depositAddress,e.rateProviders,e.multicall,e.gas)}getfetchingCurrentStateCalls(){const t=super.getfetchingCurrentStateCalls();return t.push({callData:"0x0f28c97d",target:this.multicall}),t.push(...this.tokens.filter(((e,t)=>this.isTokenWithRateProvider(t))).map((t=>{const a=this.abiCoder.encode(["address"],[t]);return{callData:e.utils.hexConcat(["0xb867ee5a",a]),target:this.poolContract}}))),t.push(...this.rateProviders.filter(((e,t)=>this.isTokenWithRateProvider(t))).map((e=>({callData:"0x679aefce",target:e})))),t}isTokenWithRateProvider(e){return""!==this.rateProviders[e]}applyCurrentStateFromCalls(e){super.applyCurrentStateFromCalls(e);const t=this.rateProviders.filter((e=>""!==e)).length;let a=e.length-t,n=a-t,s=n-1;if(!e[s].success||!e[a].success||!e[n].success)return;const[i]=this.abiCoder.decode(["uint256"],e[s].returnData),d=i.toBigInt();for(let t=0,s=this.rateProviders.length;t<s;++t){if(!this.isTokenWithRateProvider(t)){this.priceRates[t]=0n;continue}const[s]=this.abiCoder.decode(["uint256"],e[a].returnData);a++;const i=s.toBigInt(),[c,,r]=this.abiCoder.decode(["uint256","uint256","uint256"],e[n].returnData);n++;const o=c.toBigInt(),f=r.toBigInt();this.priceRates[t]=d>f?i:o}this.scalingFactors=this.scalingFactors.map(((e,t)=>this.isTokenWithRateProvider(t)?this.mulDown(e,this.priceRates[t]):e))}}class Ve{constructor(t,a,n,s,i,d,c,r,o,f,l){this.tradingRouteIndex=t,this.tokens=a,this.scalingFactors=n,this.poolId=s,this.vaultContract=i,this.depositAddress=d,this.mainIndex=c,this.wrappedIndex=r,this.wrappedToken=o,this.bptIndex=f,this.gasConstant=l,this.abiCoder=he,this.err=new ge(Ve.name),this.ONE=1000000000000000000n,this.INITIAL_BPT_SUPPLY=5192296858534827628530496329220095n,this.MAX_UINT256=0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn,this.RAY=1000000000000000000000000000n,this.halfRAY=this.RAY/2n,this.swapFee=0n,this.wrappedTokenRateWad=0n,this.wrappedTokenRate=0n,this.lowerTarget=0n,this.upperTarget=0n,this.tokenIndexes=this.tokens.reduce(((e,t,a)=>(e[t]=a,e)),{}),this.balances=Array.from({length:a.length},(()=>0n)),this.poolIdParam=this.abiCoder.encode(["bytes32"],[this.poolId]),this.poolContract=e.utils.hexZeroPad("0x"+(BigInt(this.poolId)>>96n).toString(16),20)}static create(e,t){return new Ve(t,e.tokens,e.scalingFactors,e.poolId,e.vaultContract,e.depositAddress,e.mainIndex,e.wrappedIndex,e.wrappedToken,e.bptIndex,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.tokens.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.tokens[t],this.tokens[n]]),e.push([this.tokens[n],this.tokens[t]]);return e}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[{callData:"0x55c67628",target:this.poolContract},{callData:e.utils.hexConcat(["0xf94d4668",this.poolIdParam]),target:this.vaultContract},{callData:"0x2c4e722e",target:this.wrappedToken},{callData:"0x63fe3b56",target:this.poolContract}]}mulDownFixedPoint(e,t){const a=e*t;return this.err.require(0n===e||a/e===t,"MUL_OVERFLOW"),a/this.ONE}divDownFixedPoint(e,t){if(this.err.require(0n!==t,"ZERO_DIVISION"),0n===e)return 0n;{const a=e*this.ONE;return this.err.require(a/e===this.ONE,"DIV_INTERNAL"),a/t}}divDown(e,t){return this.err.require(0n!==t,"ZERO_DIVISION"),e/t}divUp(e,t){return this.err.require(0n!==t,"ZERO_DIVISION"),0n===e?0n:1n+(e-1n)/t}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.swapFee=t.toBigInt()}if(e[1].success){const[,t]=this.abiCoder.decode(["address[]","uint256[]","uint256"],e[1].returnData);this.balances=t.map((e=>e.toBigInt()))}if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.wrappedTokenRate=t.toBigInt(),this.wrappedTokenRateWad=this.wrappedTokenRate/10n**9n,this.scalingFactors=[...this.scalingFactors],this.scalingFactors[this.wrappedIndex]=this.mulDownFixedPoint(this.scalingFactors[this.wrappedIndex],this.wrappedTokenRateWad)}if(e[3].success){const[t,a]=this.abiCoder.decode(["uint256","uint256"],e[3].returnData);this.lowerTarget=t.toBigInt(),this.upperTarget=a.toBigInt()}}}getApproximateVirtualSupply(e){return this.INITIAL_BPT_SUPPLY-e}toNominal(e){if(e<this.lowerTarget){return e-this.mulDownFixedPoint(this.lowerTarget-e,this.swapFee)}if(e<=this.upperTarget)return e;return e-this.mulDownFixedPoint(e-this.upperTarget,this.swapFee)}fromNominal(e){return e<this.lowerTarget?this.divDownFixedPoint(e+this.mulDownFixedPoint(this.swapFee,this.lowerTarget),this.ONE+this.swapFee):e<=this.upperTarget?e:e-this.divDownFixedPoint(this.mulDownFixedPoint(this.swapFee,this.upperTarget),this.ONE-this.swapFee)}calcInvariant(e,t){return e+t}calcMainOutPerBptIn(e,t,a,n){const s=this.toNominal(t),i=this.calcInvariant(s,a),d=s-this.divDown(i*e,n);return t-this.fromNominal(d)}calcWrappedOutPerBptIn(e,t,a,n){const s=this.toNominal(t),i=this.calcInvariant(s,a),d=n-e;return a-(this.divUp(d*i,n)-s)}calcBptOutPerMainIn(e,t,a,n){if(0n===n)return this.toNominal(e);const s=this.toNominal(t),i=this.toNominal(t+e)-s,d=this.calcInvariant(s,a);return this.divDown(n*i,d)}calcWrappedOutPerMainIn(e,t){const a=this.toNominal(t);return this.toNominal(t+e)-a}calcBptOutPerWrappedIn(e,t,a,n){if(0n===n)return e;const s=this.toNominal(t),i=this.calcInvariant(s,a),d=a+e,c=this.calcInvariant(s,d);return this.divDown(n*c,i)-n}calcMainOutPerWrappedIn(e,t){const a=this.toNominal(t)-e;return t-this.fromNominal(a)}swapGivenBptIn(e,t,a){return this.err.require(t===this.mainIndex||t===this.wrappedIndex,"INVALID_TOKEN"),t===this.mainIndex?this.calcMainOutPerBptIn(a,e[this.mainIndex],e[this.wrappedIndex],this.getApproximateVirtualSupply(e[this.bptIndex])):this.calcWrappedOutPerBptIn(a,e[this.mainIndex],e[this.wrappedIndex],this.getApproximateVirtualSupply(e[this.bptIndex]))}swapGivenMainIn(e,t,a){return this.err.require(t==this.wrappedIndex||t===this.bptIndex,"INVALID_TOKEN"),t===this.bptIndex?this.calcBptOutPerMainIn(a,e[this.mainIndex],e[this.wrappedIndex],this.getApproximateVirtualSupply(e[this.bptIndex])):this.calcWrappedOutPerMainIn(a,e[this.mainIndex])}swapGivenWrappedIn(e,t,a){return this.err.require(t===this.mainIndex||t===this.bptIndex,"INVALID_TOKEN"),t===this.bptIndex?this.calcBptOutPerWrappedIn(a,e[this.mainIndex],e[this.wrappedIndex],this.getApproximateVirtualSupply(e[this.bptIndex])):this.calcMainOutPerWrappedIn(a,e[this.mainIndex])}onSwapGivenIn(e,t,a,n){if(t===this.bptIndex)return this.swapGivenBptIn(e,a,n);if(t===this.mainIndex)return this.swapGivenMainIn(e,a,n);if(t===this.wrappedIndex)return this.swapGivenWrappedIn(e,a,n);throw this.err.createRequireViolated("INVALID_TOKEN")}upscaleArray(e,t){for(let a=0,n=e.length;a<n;++a)e[a]=this.mulDownFixedPoint(e[a],t[a])}rayDiv(e,t){this.err.require(0n!==t,"MATH_DIVISION_BY_ZERO");const a=t/2n;return this.err.require(e<=(this.MAX_UINT256-a)/this.RAY,"MATH_MULTIPLICATION_OVERFLOW"),(e*this.RAY+a)/t}rayMul(e,t){return 0n===e||0n===t?0n:(this.err.require(e<=(this.MAX_UINT256-this.halfRAY)/t,"MATH_MULTIPLICATION_OVERFLOW"),(e*t+this.halfRAY)/this.RAY)}wrapAmount(e){return this.rayDiv(e,this.wrappedTokenRate)}unwrapAmount(e){return this.rayMul(e,this.wrappedTokenRate)}getAmountOut(e,t,a){const n=this.tokenIndexes[e],s=this.tokenIndexes[t];if(void 0===n||void 0===t)return{amount:0n,gas:0n};let i=a;n===this.wrappedIndex&&(i=this.wrapAmount(i));const d=[...this.balances];this.upscaleArray(d,this.scalingFactors);const c=this.mulDownFixedPoint(i,this.scalingFactors[n]),r=this.onSwapGivenIn(d,n,s,c);let o=this.divDownFixedPoint(r,this.scalingFactors[s]);return s===this.wrappedIndex&&(o=this.unwrapAmount(o)),{amount:o,gas:this.gasConstant}}}class We extends Be{constructor(e,t,a,n,s,i,d,c,r,o){super(e,t,a,n,s,i,d,r),this.AMP_PRECISION=e,this.tokens=t,this.scalingFactors=a,this.poolId=n,this.vaultContract=s,this.routeIndex=i,this.depositAddress=d,this.bptIndex=c,this.gasConstant=r,this.linearPools=o,this.MAX_TOKEN_BALANCE=5192296858534827628530496329220095n,this.dueProtocolFeeBptAmount=0n,this.baseTokenIndex=o.reduce(((e,t,a)=>(t.tokens.forEach((t=>e[t]=a)),e)),{}),this.allTokens=Object.keys({...this.baseTokenIndex,...this.tokenIndex}),this.tokensWithoutBpt=this.tokens.filter(((e,t)=>t!==this.bptIndex))}static createBoosted(e,t,a){return new We(e.aPrecision,e.tokens,e.scalingFactors,e.poolId,e.vaultContract,a,e.depositAddress,e.bptIndex,e.gas,t)}getTradablePairs(){const e=[];for(let t=0,a=this.allTokens.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.allTokens[t],this.allTokens[n]],[this.allTokens[n],this.allTokens[t]]);return e}getfetchingCurrentStateCalls(){const t=super.getfetchingCurrentStateCalls();return t.push({callData:"0x7520e049",target:this.poolContract}),t.push(...this.tokens.map((t=>{const a=this.abiCoder.encode(["address"],[t]);return{callData:e.utils.hexConcat(["0x54dea00a",a]),target:this.poolContract}}))),t}applyCurrentStateFromCalls(e){super.applyCurrentStateFromCalls(e);const t=e.length-this.tokens.length-1;if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.dueProtocolFeeBptAmount=a.toBigInt()}for(let a=t+1,n=0,s=a+this.tokens.length;a<s;++a){if(e[a].success){const[t]=this.abiCoder.decode(["uint256"],e[a].returnData);this.scalingFactors=[...this.scalingFactors],this.scalingFactors[n]=this.mulDown(this.scalingFactors[n],t.toBigInt())}n++}}_dropBptItem(e){const t=this.MAX_TOKEN_BALANCE-e[this.bptIndex]+this.dueProtocolFeeBptAmount,a=Array.from({length:e.length-1},(()=>0n));for(let t=0;t<a.length;++t)a[t]=e[t<this.bptIndex?t:t+1];return{virtualSupply:t,amountsWithoutBpt:a}}calcOutGivenInWithInvarient(e,t,a,n,s,i){t[a]=t[a]+s;const d=this._getTokenBalanceGivenInvariantAndAllOtherBalances(e,t,i,n);return t[a]=t[a]-s,t[n]-d-1n}_skipBptIndex(e){return e<this.bptIndex?e:e-1}_addBptIndex(e){return e>=this.bptIndex?e+1:e}complement(e){return e<this.ONE?this.ONE-e:0n}_calcTokenOutGivenExactBptIn(e,t,a,n,s,i){const d=this._calculateInvariant(e,t,!0),c=this.mulUp(this.divUpFixedPoint(s-n,s),d),r=this._getTokenBalanceGivenInvariantAndAllOtherBalances(e,t,c,a),o=t[a]-r;let f=0n;for(let e=0;e<t.length;e++)f+=t[e];const l=this.divDownFixedPoint(t[a],f),b=this.complement(l),h=this.mulUp(o,b);return o-h+this.mulDown(h,this.ONE-i)}_calcBptOutGivenExactTokensIn(e,t,a,n,s){let i=0n;for(let e=0;e<t.length;e++)i+=t[e];const d=Array.from({length:a.length},(()=>0n));let c=0n;for(let e=0;e<t.length;e++){const n=this.divDownFixedPoint(t[e],i);d[e]=this.divDownFixedPoint(t[e]+a[e],t[e]),c+=this.mulDown(d[e],n)}const r=Array.from({length:t.length},(()=>0n));for(let e=0;e<t.length;e++){let n=0n;if(d[e]>c){const i=this.mulDown(t[e],c-this.ONE),d=a[e]-i;n=i+this.mulDown(d,this.ONE-s)}else n=a[e];r[e]=t[e]+n}const o=this._calculateInvariant(e,t,!0),f=this._calculateInvariant(e,r,!1),l=this.divDownFixedPoint(f,o);return l>this.ONE?this.mulDown(n,l-this.ONE):0n}_onSwapTokenGivenBptIn(e,t,a,n){return this._calcTokenOutGivenExactBptIn(this.A,n,t,e,a,0n)}_onSwapBptGivenTokenIn(e,t,a,n){const s=Array.from({length:this.tokens.length-1},(()=>0n));return s[t]=e,this._calcBptOutGivenExactTokensIn(this.A,n,s,a,0n)}getAmountOutThisPool(e,t,a){const n=[...this.balances];this._upscaleArray(n,this.scalingFactors);const s=this._subtractSwapFeeAmount(a),i=this._upscale(s,this.scalingFactors[e]),{virtualSupply:d,amountsWithoutBpt:c}=this._dropBptItem(n);let r=0n;if(e===this.bptIndex)r=this._onSwapTokenGivenBptIn(i,this._skipBptIndex(t),d,c);else if(t===this.bptIndex)r=this._onSwapBptGivenTokenIn(i,this._skipBptIndex(e),d,c);else{const a=this._calculateInvariant(this.A,c,!0);r=this.calcOutGivenInWithInvarient(this.A,c,this._skipBptIndex(e),this._skipBptIndex(t),i,a)}return r=this._downscaleDown(r,this.scalingFactors[t]),r}getAmountOut(e,t,a){let n=this.tokenIndex[e],s=this.tokenIndex[t],i=this.baseTokenIndex[e],d=this.baseTokenIndex[t];if(void 0!==n&&void 0!==s)return{amount:this.getAmountOutThisPool(n,s,a),gas:this.gasConstant};if(void 0!==n&&void 0!==d){let e={amount:a,gas:0n};n!==this.bptIndex&&this._skipBptIndex(n)===d||(e={amount:this.getAmountOutThisPool(n,this._addBptIndex(d),a),gas:e.gas+this.gasConstant});const s=this.linearPools[d].getAmountOut(this.tokensWithoutBpt[d],t,e.amount);return{amount:s.amount,gas:e.gas+s.gas}}if(void 0!==i&&void 0!==s){let t=this.linearPools[i].getAmountOut(e,this.tokensWithoutBpt[i],a);return s!==this.bptIndex&&this._skipBptIndex(s)===i||(t={amount:this.getAmountOutThisPool(this._addBptIndex(i),s,t.amount),gas:t.gas+this.gasConstant}),t}if(void 0!==i&&void 0!==d){if(i===d)return this.linearPools[i].getAmountOut(e,t,a);let n=this.linearPools[i].getAmountOut(e,this.tokensWithoutBpt[i],a);n={amount:this.getAmountOutThisPool(this._addBptIndex(i),this._addBptIndex(d),n.amount),gas:n.gas+this.gasConstant};const s=this.linearPools[d].getAmountOut(this.tokensWithoutBpt[d],t,n.amount);return{amount:s.amount,gas:n.gas+s.gas}}return{amount:0n,gas:0n}}}class qe extends ue{static create(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,gas:c}=e;return new qe(d,n,s,i,t[0],t[1],a,c)}getfetchingCurrentStateCalls(){return[...super.getfetchingCurrentStateCalls(),{callData:"0x1df4ccfc",target:this.pairContract}]}applyCurrentStateFromCalls(e){if(0===e.length||!1===e[0].success||"0x"===e[0].returnData)return this.reserve0=0n,this.reserve1=0n,void(this.fee=0n);if(super.applyCurrentStateFromCalls(e),e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.fee=this.feePrecision-t.toBigInt()}}}const Xe=0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn,He=0xffffffffffffffffffffffffffffffffffffffffn;class Ge{static mulDiv(e,t,a){Ge.err.require(a>0n,"zero division");const n=e*t/a;return Ge.err.require(n<=Xe,"uint256 overflowed"),n}static mulDivRoundingUp(e,t,a){let n=this.mulDiv(e,t,a);return e*t%a>0&&(Ge.err.require(n<Xe,"mulDivRoundingUp Overflowed"),n++),Ge.err.require(n<=Xe,"mulDivRoundingUp Overflowed"),n}}Ge.err=new ge(Ge.name);const Ke=-887272n,ze=887272n,Qe=4295128739n,Ye=1461446703485210103287273052203988822378723970342n;class Ze{static getSqrtRatioAtTick(e){const t=e<0n?-e:e;this.err.require(t<=ze,"T");let a=0n!==(0x1n&t)?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return 0n!==(0x2n&t)&&(a=0xfff97272373d413259a46990580e213an*a>>128n),0n!==(0x4n&t)&&(a=0xfff2e50f5f656932ef12357cf3c7fdccn*a>>128n),0n!==(0x8n&t)&&(a=0xffe5caca7e10e4e61c3624eaa0941cd0n*a>>128n),0n!==(0x10n&t)&&(a=0xffcb9843d60f6159c9db58835c926644n*a>>128n),0n!==(0x20n&t)&&(a=0xff973b41fa98c081472e6896dfb254c0n*a>>128n),0n!==(0x40n&t)&&(a=0xff2ea16466c96a3843ec78b326b52861n*a>>128n),0n!==(0x80n&t)&&(a=0xfe5dee046a99a2a811c461f1969c3053n*a>>128n),0n!==(0x100n&t)&&(a=0xfcbe86c7900a88aedcffc83b479aa3a4n*a>>128n),0n!==(0x200n&t)&&(a=0xf987a7253ac413176f2b074cf7815e54n*a>>128n),0n!==(0x400n&t)&&(a=0xf3392b0822b70005940c7a398e4b70f3n*a>>128n),0n!==(0x800n&t)&&(a=0xe7159475a2c29b7443b29c7fa6e889d9n*a>>128n),0n!==(0x1000n&t)&&(a=0xd097f3bdfd2022b8845ad8f792aa5825n*a>>128n),0n!==(0x2000n&t)&&(a=0xa9f746462d870fdf8a65dc1f90e061e5n*a>>128n),0n!==(0x4000n&t)&&(a=0x70d869a156d2a1b890bb3df62baf32f7n*a>>128n),0n!==(0x8000n&t)&&(a=0x31be135f97d08fd981231505542fcfa6n*a>>128n),0n!==(0x10000n&t)&&(a=0x9aa508b5b7a84e1c677de54f3e99bc9n*a>>128n),0n!==(0x20000n&t)&&(a=0x5d6af8dedb81196699c329225ee604n*a>>128n),0n!==(0x40000n&t)&&(a=0x2216e584f5fa1ea926041bedfe98n*a>>128n),0n!==(0x80000n&t)&&(a=0x48a170391f7dc42444e8fa2n*a>>128n),e>0n&&(a=Xe/a),(a>>32n)+(a%(1n<<32n)===0n?0n:1n)}static getTickAtSqrtRatio(e){this.err.require(e>=Qe&&e<Ye,"R");const t=e<<32n;let a,n=t,s=0n;a=(n>0xffffffffffffffffffffffffffffffffn?1n:0n)<<7n,s|=a,n>>=a,a=(n>0xffffffffffffffffn?1n:0n)<<6n,s|=a,n>>=a,a=(n>0xffffffffn?1n:0n)<<5n,s|=a,n>>=a,a=(n>0xffffn?1n:0n)<<4n,s|=a,n>>=a,a=(n>0xffn?1n:0n)<<3n,s|=a,n>>=a,a=(n>0xfn?1n:0n)<<2n,s|=a,n>>=a,a=(n>0x3n?1n:0n)<<1n,s|=a,n>>=a,a=n>0x1n?1n:0n,s|=a,n=s>=128n?t>>s-127n:t<<127n-s;let i=s-128n<<64n;n=n*n>>127n,a=n>>128n,i|=a<<63n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<62n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<61n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<60n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<59n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<58n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<57n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<56n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<55n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<54n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<53n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<52n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<51n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<50n;const d=255738958999603826347141n*i,c=d-3402992956809132418596140100660247210n>>128n,r=d+291339464771989622907027621153398088495n>>128n;return c===r?c:this.getSqrtRatioAtTick(r)<=e?r:c}}Ze.err=new ge(Ze.name);const $e=0xffffffffffffffffffffffffffffffffn;class je{static addDelta(e,t){let a;return t<0n?(a=e- -t,je.err.require(a<e&&a>=0n,"LS")):(a=e+t,je.err.require(a>=e&&a<=$e,"LA")),a}}je.err=new ge(je.name);const Je=0x1000000000000000000000000n;class et{static divRoundingUp(e,t){return e%t>0n?e/t+1n:e/t}}class tt{static getAmount0Delta(e,t,a,n){e>t&&([e,t]=[t,e]);const s=a<<96n,i=t-e;return tt.err.require(e>0n,"sqrtRatioAX96 > 0n"),n?et.divRoundingUp(Ge.mulDivRoundingUp(s,i,t),e):Ge.mulDiv(s,i,t)/e}static getAmount1Delta(e,t,a,n){return e>t&&([e,t]=[t,e]),n?Ge.mulDivRoundingUp(a,t-e,Je):Ge.mulDiv(a,t-e,Je)}static getNextSqrtPriceFromAmount0RoundingUp(e,t,a,n){if(0n===a)return e;const s=t<<96n;if(n){let t;if((t=a*e)/a==e){const a=s+t;if(a>=s)return Ge.mulDivRoundingUp(s,e,a)}return et.divRoundingUp(s,s/e+a)}{const t=a*e;tt.err.require(t/a===e&&s>t,"product / amount === sqrtPX96");const n=s-t;return Ge.mulDivRoundingUp(s,e,n)}}static getNextSqrtPriceFromAmount1RoundingDown(e,t,a,n){if(n){const n=a<=He?(a<<96n)/t:Ge.mulDiv(a,Je,t);return tt.err.require(e+n<=He,"result overflowed uint160"),e+n}{const n=a<=He?et.divRoundingUp(a<<96n,t):Ge.mulDivRoundingUp(a,Je,t);return tt.err.require(e>n,"sqrtPX96 > quotient"),tt.err.require(e-n<=He,"result overflowed uint160"),e-n}}static getNextSqrtPriceFromInput(e,t,a,n){return tt.err.require(e>0n,"sqrtPX96 > 0n"),tt.err.require(t>0n,"liquidity > 0n"),n?tt.getNextSqrtPriceFromAmount0RoundingUp(e,t,a,!0):tt.getNextSqrtPriceFromAmount1RoundingDown(e,t,a,!0)}}tt.err=new ge(tt.name);class at{static computeSwapStep(e,t,a,n,s){const i=e>=t,d={sqrtRatioNextX96:0n,amountIn:0n,amountOut:0n,feeAmount:0n},c=Ge.mulDiv(n,1000000n-s,1000000n);d.amountIn=i?tt.getAmount0Delta(t,e,a,!0):tt.getAmount1Delta(e,t,a,!0),c>=d.amountIn?d.sqrtRatioNextX96=t:d.sqrtRatioNextX96=tt.getNextSqrtPriceFromInput(e,a,c,i);const r=t===d.sqrtRatioNextX96;return i?(d.amountIn=r?d.amountIn:tt.getAmount0Delta(d.sqrtRatioNextX96,e,a,!0),d.amountOut=tt.getAmount1Delta(d.sqrtRatioNextX96,e,a,!1)):(d.amountIn=r?d.amountIn:tt.getAmount1Delta(e,d.sqrtRatioNextX96,a,!0),d.amountOut=tt.getAmount0Delta(e,d.sqrtRatioNextX96,a,!1)),d.sqrtRatioNextX96!==t?d.feeAmount=n-d.amountIn:d.feeAmount=Ge.mulDivRoundingUp(d.amountIn,s,1000000n-s),d}}class nt{constructor(){this.tickInfo={}}setTick(e,t){this.tickInfo[e]=t}setTicksAndLiquidity(e){e.forEach((e=>{this.tickInfo[e[0]]={feeGrowthOutside0X128:0n,feeGrowthOutside1X128:0n,initialized:e[1]>0n,liquidityGross:0n,liquidityNet:e[1],secondsOutside:0n,secondsPerLiquidityOutsideX128:0n,tickCumulativeOutside:0n}}))}ticks(e){return this.tickInfo[e]}cross(e,t,a,n,s,i){const d=this.tickInfo[e];return d.feeGrowthOutside0X128=t-d.feeGrowthOutside0X128,d.feeGrowthOutside1X128=a-d.feeGrowthOutside1X128,d.secondsPerLiquidityOutsideX128=n-d.secondsPerLiquidityOutsideX128,d.tickCumulativeOutside=s-d.tickCumulativeOutside,d.secondsOutside=i-d.secondsOutside,d.liquidityNet}}class st{constructor(e,t,a,n,s,i,d,c,r,o,f,l){this.PAIR_BYTECODE_HASH=e,this.factory=t,this.tickQuerier=a,this.fee=n,this.token0=s,this.token1=i,this.maxInitializedTicks=d,this.routeIndex=c,this.depositAddress=r,this.gasConstant=o,this.gasPerInitializedTick=f,this.gasPerTick=l,this.abiCoder=he,this.err=new ge(st.name),this.MAX_UINT160=0xffffffffffffffffffffffffffffffffffffffffn,this.Q128=0x100000000000000000000000000000000n,this.slot0={feeProtocol:0n,sqrtPriceX96:0n,tick:0n,unlocked:!0},this.liquidity=0n,this.tickNextList0=[],this.tickNextList1=[],this.tickNextList0Idx=0,this.tickNextList1Idx=0,this.ticks=new nt;const b=this.getSortedPair(this.token0,this.token1);this.token0=b[0],this.token1=b[1],this.poolContract=this.generatePairAddress(this.factory,this.token0,this.token1,this.fee),this.getSwapStateZeroForOneParam=this.abiCoder.encode(["address","uint256","bool"],[this.poolContract,this.maxInitializedTicks,!0]),this.getSwapStateOneForZeroParam=this.abiCoder.encode(["address","uint256","bool"],[this.poolContract,this.maxInitializedTicks,!1])}static create(e,t,a){const{factory:n,fee:s,pairBytecodeHash:i,maxInitializedTicks:d,tickQuerier:c,depositAddress:r,gas:o,gasPerInitializedTick:f,gasPerTick:l}=e;return new st(i,n,c,s,t[0],t[1],d,a,r,o,f,l)}generatePairAddress(t,a,n,s){return e.utils.hexDataSlice(e.utils.keccak256(e.utils.concat(["0xff",t,e.utils.keccak256(this.abiCoder.encode(["address","address","uint24"],[a,n,Number(s)])),this.PAIR_BYTECODE_HASH])),12)}getSortedPair(e,t){return e.localeCompare(t,"en",{sensitivity:"base"})<=0?[e,t]:[t,e]}getTradablePairs(){return[[this.token0,this.token1],[this.token1,this.token0]]}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[{callData:"0x3850c7bd",target:this.poolContract},{callData:"0x1a686502",target:this.poolContract},{callData:e.utils.hexConcat(["0xa6438a3a",this.getSwapStateZeroForOneParam]),target:this.tickQuerier},{callData:e.utils.hexConcat(["0xa6438a3a",this.getSwapStateOneForZeroParam]),target:this.tickQuerier}]}applyCurrentStateFromCalls(e){if(0!==e.length&&!1!==e[0].success&&"0x"!==e[0].returnData){if(e[0].success){const[t,a,,,,n,s]=this.abiCoder.decode(["uint160","int24","uint16","uint16","uint16","uint8","bool"],e[0].returnData);this.slot0={sqrtPriceX96:t.toBigInt(),tick:BigInt(a),feeProtocol:BigInt(n),unlocked:s}}if(e[1].success){const[t]=this.abiCoder.decode(["uint128"],e[1].returnData);this.liquidity=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[2].returnData);this.tickNextList0=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0]+1,e[1].toBigInt()])))}if(e[3].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[3].returnData);this.tickNextList1=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0],e[1].toBigInt()])))}}}getNextInitializedTick(e,t){if(t){if(e===this.tickNextList0[this.tickNextList0Idx].tick){if(this.tickNextList0Idx+1>=this.tickNextList0.length)return{tick:{tick:0n,initialized:!1},exist:!1};const{initialized:e,tick:t}=this.tickNextList0[++this.tickNextList0Idx];return{tick:{initialized:e,tick:t+1n},exist:!0}}{const{initialized:e,tick:t}=this.tickNextList0[this.tickNextList0Idx];return{tick:{initialized:e,tick:t+1n},exist:!0}}}return e===this.tickNextList1[this.tickNextList1Idx].tick?this.tickNextList1Idx+1>=this.tickNextList1.length?{tick:{tick:0n,initialized:!1},exist:!1}:{tick:this.tickNextList1[++this.tickNextList1Idx],exist:!0}:{tick:this.tickNextList1[this.tickNextList1Idx],exist:!0}}getAmountOut(e,t,a){this.err.require(0n!==a,"AS");const n=e===this.token0,s=n?4295128740n:Ye-1n,i={...this.slot0};this.err.require(n?s<i.sqrtPriceX96&&s>Qe:s>i.sqrtPriceX96&&s<Ye,"SPL");const d={liquidityStart:this.liquidity,feeProtocol:n?i.feeProtocol%16n:i.feeProtocol>>4n},c={amountSpecifiedRemaining:a,amountCalculated:0n,sqrtPriceX96:i.sqrtPriceX96,tick:i.tick,feeGrowthGlobalX128:0n,protocolFee:0n,liquidity:d.liquidityStart};this.tickNextList0Idx=0,this.tickNextList1Idx=0;let r=0n;for(;0n!==c.amountSpecifiedRemaining&&c.sqrtPriceX96!==s&&(n?this.tickNextList0Idx<this.tickNextList0.length:this.tickNextList1Idx<this.tickNextList1.length);){let e={amountIn:0n,amountOut:0n,feeAmount:0n,initialized:!1,sqrtPriceNextX96:0n,sqrtPriceStartX96:0n,tickNext:0n};e.sqrtPriceStartX96=c.sqrtPriceX96;const{tick:t,exist:a}=this.getNextInitializedTick(c.tick,n);if(!a)break;e.tickNext=t.tick,e.initialized=t.initialized,e.tickNext<Ke?e.tickNext=Ke:e.tickNext>ze&&(e.tickNext=ze),e.sqrtPriceNextX96=Ze.getSqrtRatioAtTick(e.tickNext);const i=at.computeSwapStep(c.sqrtPriceX96,(n?e.sqrtPriceNextX96<s:e.sqrtPriceNextX96>s)?s:e.sqrtPriceNextX96,c.liquidity,c.amountSpecifiedRemaining,this.fee);if(e.amountIn=i.amountIn,e.amountOut=i.amountOut,c.sqrtPriceX96=i.sqrtRatioNextX96,e.feeAmount=i.feeAmount,c.amountSpecifiedRemaining-=e.amountIn+e.feeAmount,c.amountCalculated=c.amountCalculated-e.amountOut,d.feeProtocol>0){const t=e.feeAmount/d.feeProtocol;e.feeAmount-=t,c.protocolFee+=t}if(c.sqrtPriceX96==e.sqrtPriceNextX96){if(e.initialized){let t=this.ticks.cross(Number(e.tickNext),0n,0n,0n,0n,0n);r+=this.gasPerInitializedTick,n&&(t=-t),c.liquidity=je.addDelta(c.liquidity,t)}c.tick=n?e.tickNext-1n:e.tickNext}else c.sqrtPriceX96!=e.sqrtPriceStartX96&&(c.tick=Ze.getTickAtSqrtRatio(c.sqrtPriceX96));r+=this.gasPerTick}return c.amountSpecifiedRemaining>0n?{amount:0n,gas:0n}:{amount:-c.amountCalculated,gas:r+this.gasConstant}}}class it extends Oe{static create(e,t){return new it(t,e.tokens,e.scalingFactors,e.weights,e.poolId,e.vaultContract,e.depositAddress,e.gas)}getfetchingCurrentStateCalls(){return[...super.getfetchingCurrentStateCalls(),{callData:"0xf89f27ed",target:this.poolContract}]}applyCurrentStateFromCalls(e){if(super.applyCurrentStateFromCalls(e),e[2].success){const[t]=this.abiCoder.decode(["uint256[]"],e[2].returnData);this.normalizedWeights=t.map((e=>e.toBigInt()))}}}class dt extends Te{static createMeta(e,t,a){return new dt(a,e.multicall,e.baseCacheExpires,e.isCacheExists,e.lpToken,e.poolContract,e.tokens,e.rates,e.precision,e.precisionMul,e.feeDenominator,t,e.address,e.gas,e.aPrecision)}getfetchingCurrentStateCalls(){return[{callData:"0x0ba81959",target:this.poolContract},{callData:"0x5fd65f0f",target:this.poolContract},{callData:"0x2d74d4e9",target:this.poolContract},{callData:"0x18160ddd",target:this.lpToken},{callData:"0x0f28c97d",target:this.multicall},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode(["uint8"],[a]);return{callData:e.utils.hexConcat(["0x91ceb3eb",n]),target:this.poolContract}}))]}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}else i.warn("unable to find A for Curve pool",this.poolContract),this.A=0n;if(e[1].success){const[,,,,t]=this.abiCoder.decode(["uint256","uint256","uint256","uint256","uint256","uint256","address"],e[1].returnData);this.fee=t.toBigInt()}else i.warn("unable to find fee for Curve pool",this.poolContract),this.fee=0n;if(e[2].success){const[,t,a]=this.abiCoder.decode(["address","uint256","uint256"],e[2].returnData);this.baseVirtualPrice=t.toBigInt(),this.baseCacheUpdated=a.toBigInt()}else i.warn("unable to find base virtual price/cache for pool",this.poolContract),this.baseVirtualPrice=0n,this.baseCacheUpdated=0n;if(e[3].success){const[t]=this.abiCoder.decode(["uint256"],e[3].returnData);this.lpTokenTotalSupply=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve pool",this.poolContract),this.lpTokenTotalSupply=0n;if(e[4].success){const[t]=this.abiCoder.decode(["uint256"],e[4].returnData);this.blockTimestamp=t.toBigInt()}else i.warn("unable to find block timestamp for the pool",this.poolContract),this.blockTimestamp=0n;for(let t=5,a=this.TOKENS.length+t;t<a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances.push(a.toBigInt())}else i.warn("unable to find balance at index",t-3,"for Curve pool",this.poolContract),this.balances.push(0n)}}}class ct{constructor(e,t,a,n,s,i,d){this.token0=e,this.token1=t,this.vaultContract=a,this.pricePrecision=n,this.debtTokenContract=s,this.tradingRouteIndex=i,this.gasConstant=d,this.errorFactory=new ge(ct.name),this.abiCoder=he,this.stableSwapFeeBasisPoints=0n,this.swapFeeBasisPoints=0n,this.stableTaxBasisPoints=0n,this.taxBasisPoints=0n,this.hasDynamicFees=!1,this.minPrices={},this.maxPrices={},this.decimals={},this.isTokenStable={},this.usdgAmounts={},this.tokenWeights={},this.isInWhiteList={},this.maxUsdgAmounts={},this.poolAmounts={},this.reservedAmounts={},this.bufferAmounts={},this.totalTokenWeights=0n,this.usdgTotalsupply=0n,this.USDG_DECIMALS=18n,this.BASIS_POINTS_DIVISOR=10000n;const c=this.getSortedPair(this.token0,this.token1);this.token0=c[0],this.token1=c[1]}static create(e,t,a){const{vaultContract:n,pricePrecision:s,debtTokenContract:i,gas:d}=e;return new ct(t[0],t[1],n,s,i,a,d)}getAmountOut(e,t,a){if(this.getMaxAmountIn(e,t)<a||!this.isInWhiteList[e]||!this.isInWhiteList[t])return{amount:0n,gas:0n};const n=this.minPrices[e],s=this.maxPrices[t],i=this.decimals[e],d=this.decimals[t];let c=a*n/this.pricePrecision;c=c*10n**this.USDG_DECIMALS/10n**i;const r=this.isTokenStable[e]&&this.isTokenStable[t],o=r?this.stableSwapFeeBasisPoints:this.swapFeeBasisPoints,f=r?this.stableTaxBasisPoints:this.taxBasisPoints,l=this.getFeeBasisPoints(e,c,o,f,!0),b=this.getFeeBasisPoints(t,c,o,f,!1),h=l>b?l:b;let u=a*n/s;u=u*10n**d/10n**i;return{amount:u*(this.BASIS_POINTS_DIVISOR-h)/this.BASIS_POINTS_DIVISOR,gas:this.gasConstant}}getFeeBasisPoints(e,t,a,n,s){if(!this.hasDynamicFees)return a;const i=this.usdgAmounts[e];let d=i+t;s||(d=t>i?0n:i-t);const c=this.getTargetUsdgAmount(e);if(0n===c)return a;const r=i>c?i-c:c-i,o=d>c?d-c:c-d;if(o<r){const e=n*r/c;return e>a?0n:a-e}let f=(r+o)/2n;f>c&&(f=c);return a+n*f/c}getTargetUsdgAmount(e){const t=this.usdgTotalsupply;if(0n===t)return 0n;return this.tokenWeights[e]*t/this.totalTokenWeights}getMaxAmountIn(e,t){const a=this.minPrices[e],n=this.maxPrices[t];if(void 0===a||void 0===n)return 0n;const s=this.decimals[e],i=this.decimals[t],d=this.poolAmounts[t],c=this.reservedAmounts[t],r=this.bufferAmounts[t],o=c>r?c:r;if(o>=d)return 0n;const f=(d-o)*n/a*10n**s/10n**i,l=this.maxUsdgAmounts[e];if(0n!==l){if(l<this.usdgAmounts[e])return 0n;let t=l-this.usdgAmounts[e];if(t=t*10n**s/10n**this.USDG_DECIMALS,t=t*this.pricePrecision/a,f>t)return t}return f}getfetchingCurrentStateCalls(){const t=[],a=[this.token0,this.token1],n=[this.abiCoder.encode(["address"],[this.token0]),this.abiCoder.encode(["address"],[this.token1])];for(let s=0,i=a.length;s<i;++s){const a=n[s];t.push({callData:e.utils.hexConcat(["0x81a612d6",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0xe124e6d2",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0x8ee573ac",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0x42b60b03",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0x1aa4ace5",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0xab2f3ad4",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0xad1e4f8d",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0x52f55eed",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0xc3c7b9e9",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0x4a993ee9",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0xdaf9c210",a]),target:this.vaultContract})}return t.push({callData:"0xdf73a267",target:this.vaultContract},{callData:"0xa22f2392",target:this.vaultContract},{callData:"0x10eb56c2",target:this.vaultContract},{callData:"0x7a210a2b",target:this.vaultContract},{callData:"0x9f392eb3",target:this.vaultContract},{callData:"0xdc8f5fac",target:this.vaultContract},{callData:"0x18160ddd",target:this.debtTokenContract}),t}applyCurrentStateFromCalls(e){if(0===e.length||!1===e[0].success||!1===e[1].success)return;const t=e.length,a=[this.token0,this.token1],n=11;for(let t=0,s=a.length;t<s;++t){const s=a[t];if(e[n*t].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t].returnData);this.minPrices[s]=a.toBigInt()}if(e[n*t+1].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+1].returnData);this.maxPrices[s]=a.toBigInt()}if(e[n*t+2].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+2].returnData);this.decimals[s]=a.toBigInt()}if(e[n*t+3].success){const[a]=this.abiCoder.decode(["bool"],e[n*t+3].returnData);this.isTokenStable[s]=a}if(e[n*t+4].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+4].returnData);this.usdgAmounts[s]=a.toBigInt()}if(e[n*t+5].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+5].returnData);this.tokenWeights[s]=a.toBigInt()}if(e[n*t+6].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+6].returnData);this.maxUsdgAmounts[s]=a.toBigInt()}if(e[n*t+7].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+7].returnData);this.poolAmounts[s]=a.toBigInt()}if(e[n*t+8].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+8].returnData);this.reservedAmounts[s]=a.toBigInt()}if(e[n*t+9].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+9].returnData);this.bufferAmounts[s]=a.toBigInt()}if(e[n*t+10].success){const[a]=this.abiCoder.decode(["bool"],e[n*t+10].returnData);this.isInWhiteList[s]=a}}if(e[t-1].success){const[a]=this.abiCoder.decode(["uint256"],e[t-1].returnData);this.usdgTotalsupply=a.toBigInt()}if(e[t-2].success){const[a]=this.abiCoder.decode(["uint256"],e[t-2].returnData);this.totalTokenWeights=a.toBigInt()}if(e[t-3].success){const[a]=this.abiCoder.decode(["bool"],e[t-3].returnData);this.hasDynamicFees=a}if(e[t-4].success){const[a]=this.abiCoder.decode(["uint256"],e[t-4].returnData);this.taxBasisPoints=a.toBigInt()}if(e[t-5].success){const[a]=this.abiCoder.decode(["uint256"],e[t-5].returnData);this.stableTaxBasisPoints=a.toBigInt()}if(e[t-6].success){const[a]=this.abiCoder.decode(["uint256"],e[t-6].returnData);this.swapFeeBasisPoints=a.toBigInt()}if(e[t-7].success){const[a]=this.abiCoder.decode(["uint256"],e[t-7].returnData);this.stableSwapFeeBasisPoints=a.toBigInt()}}getTradablePairs(){return[[this.token0,this.token1],[this.token1,this.token0]]}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.vaultContract}getDepositAddress(){return this.vaultContract}getSortedPair(e,t){return e.localeCompare(t,"en",{sensitivity:"base"})<=0?[e,t]:[t,e]}}class rt{constructor(e,t,a,n,s,i,d){this.PAIR_BYTECODE_HASH=e,this.token0=t,this.token1=a,this.factoryContract=n,this.stable=s,this.tradingRouteIndex=i,this.gasConstant=d,this.abiCoder=he,this.err=new ge(rt.name),this.reserve0=0n,this.reserve1=0n,this.decimals0=0n,this.decimals1=0n,this.fee=0n;const c=this.getSortedPair(this.token0,this.token1);this.token0=c[0],this.token1=c[1],this.pairContract=this.generatePairAddress(this.factoryContract,this.token0,this.token1,this.stable)}static create(e,t,a){const{factoryContract:n,isStable:s,pairBytecodeHash:i,gas:d}=e;return new rt(i,t[0],t[1],n,s,a,d)}getTradablePairs(){return[[this.token0,this.token1],[this.token1,this.token0]]}getTradingRouteIndex(){return this.tradingRouteIndex}getDepositAddress(){return this.pairContract}getPoolAddress(){return this.pairContract}getfetchingCurrentStateCalls(){return[{callData:"0x0902f1ac",target:this.pairContract},{callData:e.utils.hexConcat(["0x512b45ea",this.abiCoder.encode(["bool"],[this.stable])]),target:this.factoryContract},{callData:"0x313ce567",target:this.token0},{callData:"0x313ce567",target:this.token1}]}applyCurrentStateFromCalls(e){if(0!==e.length&&!1!==e[0].success&&!1!==e[1].success&&"0x"!==e[0].returnData){if(e[0].success){const[t,a]=this.abiCoder.decode(["uint256","uint256","uint256"],e[0].returnData);this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt()}if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.fee=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["uint8"],e[2].returnData);this.decimals0=BigInt(10**t)}if(e[3].success){const[t]=this.abiCoder.decode(["uint8"],e[3].returnData);this.decimals1=BigInt(10**t)}}}getAmountOut(e,t,a){if(0n===this.decimals0||0n===this.decimals1)return{amount:0n,gas:0n};a-=a*this.fee/10000n;const n=this._getAmountOut(a,e,this.reserve0,this.reserve1);let s,i;e.toLowerCase()===this.token0.toLowerCase()?(s=this.reserve0+a,i=this.reserve1-n):(i=this.reserve1+a,s=this.reserve0-n);const d=this._k(s,i),c=this._k(this.reserve0,this.reserve1);return this.err.require(d>=c,"K"),{amount:n,gas:this.gasConstant}}_getAmountOut(e,t,a,n){if(this.stable){const s=this._k(a,n);a=1000000000000000000n*a/this.decimals0,n=1000000000000000000n*n/this.decimals1;const{reserveA:i,reserveB:d}=t===this.token0?{reserveA:a,reserveB:n}:{reserveA:n,reserveB:a};e=t===this.token0?1000000000000000000n*e/this.decimals0:1000000000000000000n*e/this.decimals1;return(d-this._get_y(e+i,s,d))*(t===this.token0?this.decimals1:this.decimals0)/1000000000000000000n}{const{reserveA:s,reserveB:i}=t===this.token0?{reserveA:a,reserveB:n}:{reserveA:n,reserveB:a};return e*i/(s+e)}}_k(e,t){if(this.stable){const a=1000000000000000000n*e/this.decimals0,n=1000000000000000000n*t/this.decimals1;return a*n/1000000000000000000n*(a*a/1000000000000000000n+n*n/1000000000000000000n)/1000000000000000000n}return e*t}_get_y(e,t,a){for(let n=0;n<255;n++){const n=a,s=this._f(e,a),i=this._d(e,a);if(this.err.require(0n!==i,"D must not be zero"),s<t){a+=1000000000000000000n*(t-s)/i}else{a-=1000000000000000000n*(s-t)/i}if(a>n){if(a-n<=1)return a}else if(n-a<=1)return a}return a}_f(e,t){return e*(t*t/1000000000000000000n*t/1000000000000000000n)/1000000000000000000n+e*e/1000000000000000000n*e/1000000000000000000n*t/1000000000000000000n}_d(e,t){return 3n*e*(t*t/1000000000000000000n)/1000000000000000000n+e*e/1000000000000000000n*e/1000000000000000000n}generatePairAddress(t,a,n,s){return e.utils.hexDataSlice(e.utils.keccak256(e.utils.concat(["0xff",t,e.utils.solidityKeccak256(["address","address","bool"],[a,n,s]),this.PAIR_BYTECODE_HASH])),12)}getSortedPair(e,t){return e.localeCompare(t,"en",{sensitivity:"base"})<=0?[e,t]:[t,e]}}class ot{constructor(e,t,a,n,s,i,d,c,r,o){this.SYNTHS=e,this.exchangeRatesContract=t,this.sUSDContract=a,this.exchangerContract=n,this.synthetixContract=s,this.flexibleStorageContract=i,this.PRECISION_UNIT=d,this.depositAddress=c,this.gasConstant=r,this.routeIndex=o,this.MAX_UINT256=0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn,this.err=new ge(ot.name),this.abiCoder=he,this.rates={},this.fee={},this.maxFee=0n,this.SYSTEM_SETTING_CFG="0x53797374656d53657474696e6773000000000000000000000000000000000000",this.SETTING_EXCHANGE_MAX_DYNAMIC_FEE_CFG="0x65786368616e67654d617844796e616d69634665650000000000000000000000"}static create(e,t){return new ot(e.tokens,e.exchangeRatesContract,e.sUsdContract,e.exchangerContract,e.synthetixContract,e.flexibleStorageContract,e.PRECISION_UNIT,e.address,e.gas,t)}static isPairSupported(e,t){return void 0!==t[e[0]]&&void 0!==t[e[1]]}getTradablePairs(){const e=[],t=Object.keys(this.SYNTHS);for(let a=0,n=t.length;a<n;++a)for(let s=a+1;s<n;++s)e.push([t[a],t[s]]),e.push([t[s],t[a]]);return e}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.synthetixContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){const t=[],a=Object.keys(this.SYNTHS);for(let n=0;n<a.length;++n){const s=e.utils.formatBytes32String(this.SYNTHS[a[n]]);t.push({callData:e.utils.hexConcat(["0xac82f608",s]),target:this.exchangeRatesContract},{callData:e.utils.hexConcat(["0x1a5c6095",s,"0x0000000000000000000000000000000000000000000000000000000000000000"]),target:this.exchangerContract})}return t.push({callData:e.utils.hexConcat(["0x23257c2b",this.SYSTEM_SETTING_CFG,this.SETTING_EXCHANGE_MAX_DYNAMIC_FEE_CFG]),target:this.flexibleStorageContract}),t}applyCurrentStateFromCalls(e){if(0===e.length)return;const t=Object.keys(this.SYNTHS);for(let a=0,n=2*t.length;a<n;a+=2)if(!e[a].success)return;for(let a=0,n=2*t.length;a<n;a+=2){const[n]=this.abiCoder.decode(["uint"],e[a].returnData);if(this.rates[t[a/2]]=n.toBigInt(),e[a+1].success){const[n]=this.abiCoder.decode(["uint256"],e[a+1].returnData);this.fee[t[a/2]]={rate:n.toBigInt(),isVolatile:!1}}else this.fee[t[a/2]]={rate:0n,isVolatile:!0}}const[a]=this.abiCoder.decode(["uint256"],e[e.length-1].returnData);this.maxFee=a.toBigInt()}mul(e,t){const a=e*t;return this.err.require(a<=this.MAX_UINT256,"SafeMath: multiplication overflow"),a}div(e,t){return this.err.require(t>0,"SafeMath: division by zero"),e/t}multiplyDecimal(e,t){return this.mul(e,t)/this.PRECISION_UNIT}multiplyDecimalRound(e,t){let a=this.mul(e,t)/(this.PRECISION_UNIT/10n);return a%10n>=5n&&(a+=10n),a/10n}divideDecimalRound(e,t){let a=this.div(this.mul(e,10n*this.PRECISION_UNIT),t);return a%10n>=5n&&(a+=10n),a/10n}getAmountOut(e,t,a){if(void 0===this.rates[e]||void 0===this.rates[t])return{amount:0n,gas:0n};if(e===t)return{amount:a,gas:this.gasConstant};{const n=this.rates[e],s=this.rates[t];if(s>0){let i=this.divideDecimalRound(this.multiplyDecimalRound(a,n),s),d=this.fee[e].rate+this.fee[t].rate;return this.fee[e].isVolatile||this.fee[t].isVolatile||d>this.maxFee?{amount:0n,gas:0n}:(i=this.multiplyDecimal(i,this.PRECISION_UNIT-d),{amount:i,gas:this.gasConstant})}return{amount:0n,gas:0n}}}}class ft extends st{constructor(e,t,a,n,s,i,d,c,r,o,f,l){super(e,t,a,n,s,i,d,c,r,o,f,l),this.PAIR_BYTECODE_HASH=e,this.poolDeployer=t,this.err=new ge(ft.name),this.PROTOCOL_FEE_DENOMINATOR=10000n,this.PROTOCOL_FEE_SP=65536n,this.poolContract=this.generatePairAddress(this.poolDeployer,this.token0,this.token1,this.fee)}static createPancake(e,t,a){const{poolDeployer:n,fee:s,pairBytecodeHash:i,maxInitializedTicks:d,tickQuerier:c,depositAddress:r,gas:o,gasPerInitializedTick:f,gasPerTick:l}=e;return new ft(i,n,c,s,t[0],t[1],d,a,r,o,f,l)}applyCurrentStateFromCalls(e){if(0!==e.length&&!1!==e[0].success&&"0x"!==e[0].returnData){if(e[0].success){const[t,a,,,,n,s]=this.abiCoder.decode(["uint160","int24","uint16","uint16","uint16","uint32","bool"],e[0].returnData);this.slot0={sqrtPriceX96:t.toBigInt(),tick:BigInt(a),feeProtocol:BigInt(n),unlocked:s}}if(e[1].success){const[t]=this.abiCoder.decode(["uint128"],e[1].returnData);this.liquidity=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[2].returnData);this.tickNextList0=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0]+1,e[1].toBigInt()])))}if(e[3].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[3].returnData);this.tickNextList1=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0],e[1].toBigInt()])))}}}getAmountOut(e,t,a){this.err.require(0n!==a,"AS");const n=e===this.token0,s=n?4295128740n:Ye-1n,i={...this.slot0};this.err.require(n?s<i.sqrtPriceX96&&s>Qe:s>i.sqrtPriceX96&&s<Ye,"SPL");const d={liquidityStart:this.liquidity,feeProtocol:n?i.feeProtocol%this.PROTOCOL_FEE_SP:i.feeProtocol>>16n},c={amountSpecifiedRemaining:a,amountCalculated:0n,sqrtPriceX96:i.sqrtPriceX96,tick:i.tick,feeGrowthGlobalX128:0n,protocolFee:0n,liquidity:d.liquidityStart};this.tickNextList0Idx=0,this.tickNextList1Idx=0;let r=0n;for(;0n!==c.amountSpecifiedRemaining&&c.sqrtPriceX96!==s&&(n?this.tickNextList0Idx<this.tickNextList0.length:this.tickNextList1Idx<this.tickNextList1.length);){let e={amountIn:0n,amountOut:0n,feeAmount:0n,initialized:!1,sqrtPriceNextX96:0n,sqrtPriceStartX96:0n,tickNext:0n};e.sqrtPriceStartX96=c.sqrtPriceX96;const{tick:t,exist:a}=this.getNextInitializedTick(c.tick,n);if(!a)break;e.tickNext=t.tick,e.initialized=t.initialized,e.tickNext<Ke?e.tickNext=Ke:e.tickNext>ze&&(e.tickNext=ze),e.sqrtPriceNextX96=Ze.getSqrtRatioAtTick(e.tickNext);const i=at.computeSwapStep(c.sqrtPriceX96,(n?e.sqrtPriceNextX96<s:e.sqrtPriceNextX96>s)?s:e.sqrtPriceNextX96,c.liquidity,c.amountSpecifiedRemaining,this.fee);if(e.amountIn=i.amountIn,e.amountOut=i.amountOut,c.sqrtPriceX96=i.sqrtRatioNextX96,e.feeAmount=i.feeAmount,c.amountSpecifiedRemaining-=e.amountIn+e.feeAmount,c.amountCalculated=c.amountCalculated-e.amountOut,d.feeProtocol>0){const t=e.feeAmount*d.feeProtocol/this.PROTOCOL_FEE_DENOMINATOR;e.feeAmount-=t,c.protocolFee+=t}if(c.sqrtPriceX96==e.sqrtPriceNextX96){if(e.initialized){let t=this.ticks.cross(Number(e.tickNext),0n,0n,0n,0n,0n);r+=this.gasPerInitializedTick,n&&(t=-t),c.liquidity=je.addDelta(c.liquidity,t)}c.tick=n?e.tickNext-1n:e.tickNext}else c.sqrtPriceX96!=e.sqrtPriceStartX96&&(c.tick=Ze.getTickAtSqrtRatio(c.sqrtPriceX96));r+=this.gasPerTick}return c.amountSpecifiedRemaining>0n?{amount:0n,gas:0n}:{amount:-c.amountCalculated,gas:r+this.gasConstant}}}class lt extends st{constructor(e,t,a,n,s,i,d,c,r,o,f,l){super(e,t,a,0n,s,i,d,c,r,o,f,l),this.PAIR_BYTECODE_HASH=e,this.factory=t,this.tickQuerier=a,this.tickSpacing=n,this.token0=s,this.token1=i,this.maxInitializedTicks=d,this.routeIndex=c,this.depositAddress=r,this.gasConstant=o,this.gasPerInitializedTick=f,this.gasPerTick=l,this.err=new ge(lt.name),this.liquidity=0n,this.tickNextList0=[],this.tickNextList1=[],this.tickNextList0Idx=0,this.tickNextList1Idx=0,this.ticks=new nt;const b=this.getSortedPair(this.token0,this.token1);this.token0=b[0],this.token1=b[1],this.poolContract=this.generatePairAddress(this.factory,this.token0,this.token1,this.tickSpacing),this.getSwapStateZeroForOneParam=this.abiCoder.encode(["address","uint256","bool"],[this.poolContract,this.maxInitializedTicks,!0]),this.getSwapStateOneForZeroParam=this.abiCoder.encode(["address","uint256","bool"],[this.poolContract,this.maxInitializedTicks,!1])}static createVelodrome(e,t,a){const{factory:n,tickSpacing:s,pairBytecodeHash:i,maxInitializedTicks:d,tickQuerier:c,depositAddress:r,gas:o,gasPerInitializedTick:f,gasPerTick:l}=e;return new lt(i,n,c,s,t[0],t[1],d,a,r,o,f,l)}generatePairAddress(t,a,n,s){return e.utils.hexDataSlice(e.utils.keccak256(e.utils.concat(["0xff",t,e.utils.keccak256(this.abiCoder.encode(["address","address","int24"],[a,n,Number(s)])),this.PAIR_BYTECODE_HASH])),12)}getfetchingCurrentStateCalls(){const e=super.getfetchingCurrentStateCalls();return e.push({callData:"0xddca3f43",target:this.poolContract}),e}applyCurrentStateFromCalls(e){if(0!==e.length&&!1!==e[0].success&&"0x"!==e[0].returnData){if(e[0].success){const[t,a,,,,n]=this.abiCoder.decode(["uint160","int24","uint16","uint16","uint16","bool"],e[0].returnData);this.slot0={sqrtPriceX96:t.toBigInt(),tick:BigInt(a),feeProtocol:BigInt(0),unlocked:n}}if(e[1].success){const[t]=this.abiCoder.decode(["uint128"],e[1].returnData);this.liquidity=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[2].returnData);this.tickNextList0=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0]+1,e[1].toBigInt()])))}if(e[3].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[3].returnData);this.tickNextList1=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0],e[1].toBigInt()])))}if(e[4].success){const[t]=this.abiCoder.decode(["uint24"],e[4].returnData);this.fee=BigInt(t)}}}getAmountOut(e,t,a){this.err.require(0n!==a,"AS");const n=e===this.token0,s=n?4295128740n:Ye-1n,i={...this.slot0};this.err.require(n?s<i.sqrtPriceX96&&s>Qe:s>i.sqrtPriceX96&&s<Ye,"SPL");const d={liquidityStart:this.liquidity,feeProtocol:n?i.feeProtocol%16n:i.feeProtocol>>4n},c={amountSpecifiedRemaining:a,amountCalculated:0n,sqrtPriceX96:i.sqrtPriceX96,tick:i.tick,feeGrowthGlobalX128:0n,protocolFee:0n,liquidity:d.liquidityStart};this.tickNextList0Idx=0,this.tickNextList1Idx=0;let r=0n;for(;0n!==c.amountSpecifiedRemaining&&c.sqrtPriceX96!==s&&(n?this.tickNextList0Idx<this.tickNextList0.length:this.tickNextList1Idx<this.tickNextList1.length);){let e={amountIn:0n,amountOut:0n,feeAmount:0n,initialized:!1,sqrtPriceNextX96:0n,sqrtPriceStartX96:0n,tickNext:0n};e.sqrtPriceStartX96=c.sqrtPriceX96;const{tick:t,exist:a}=this.getNextInitializedTick(c.tick,n);if(!a)break;e.tickNext=t.tick,e.initialized=t.initialized,e.tickNext<Ke?e.tickNext=Ke:e.tickNext>ze&&(e.tickNext=ze),e.sqrtPriceNextX96=Ze.getSqrtRatioAtTick(e.tickNext);const i=at.computeSwapStep(c.sqrtPriceX96,(n?e.sqrtPriceNextX96<s:e.sqrtPriceNextX96>s)?s:e.sqrtPriceNextX96,c.liquidity,c.amountSpecifiedRemaining,this.fee);if(e.amountIn=i.amountIn,e.amountOut=i.amountOut,c.sqrtPriceX96=i.sqrtRatioNextX96,e.feeAmount=i.feeAmount,c.amountSpecifiedRemaining-=e.amountIn+e.feeAmount,c.amountCalculated=c.amountCalculated-e.amountOut,d.feeProtocol>0){const t=e.feeAmount/d.feeProtocol;e.feeAmount-=t,c.protocolFee+=t}if(c.sqrtPriceX96==e.sqrtPriceNextX96){if(e.initialized){let t=this.ticks.cross(Number(e.tickNext),0n,0n,0n,0n,0n);r+=this.gasPerInitializedTick,n&&(t=-t),c.liquidity=je.addDelta(c.liquidity,t)}c.tick=n?e.tickNext-1n:e.tickNext}else c.sqrtPriceX96!=e.sqrtPriceStartX96&&(c.tick=Ze.getTickAtSqrtRatio(c.sqrtPriceX96));r+=this.gasPerTick}return c.amountSpecifiedRemaining>0n?{amount:0n,gas:0n}:{amount:-c.amountCalculated,gas:r+this.gasConstant}}}class bt extends rt{constructor(e,t,a,n,s,i,d){super(e,t,a,n,s,i,d),this.PAIR_BYTECODE_HASH=e,this.err=new ge(bt.name),this.isFactoryPaused=!0}static create(e,t,a){const{factoryContract:n,isStable:s,pairBytecodeHash:i,gas:d}=e;return new bt(i,t[0],t[1],n,s,a,d)}getfetchingCurrentStateCalls(){return[{callData:"0x392f37e9",target:this.pairContract},{callData:e.utils.hexConcat(["0xcc56b2c5",this.abiCoder.encode(["address","bool"],[this.pairContract,this.stable])]),target:this.factoryContract},{callData:"0xb187bd26",target:this.factoryContract}]}applyCurrentStateFromCalls(e){if(0!==e.length&&!1!==e[0].success&&!1!==e[1].success&&"0x"!==e[0].returnData){if(e[0].success){const[t,a,n,s,,,]=this.abiCoder.decode(["uint256","uint256","uint256","uint256","bool","address","address"],e[0].returnData);this.decimals0=t.toBigInt(),this.decimals1=a.toBigInt(),this.reserve0=n.toBigInt(),this.reserve1=s.toBigInt()}if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.fee=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["bool"],e[2].returnData);this.isFactoryPaused=t}}}getAmountOut(e,t,a){if(0n===this.decimals0||0n===this.decimals1||this.isFactoryPaused)return{amount:0n,gas:0n};a-=a*this.fee/10000n;const n=this._getAmountOut(a,e,this.reserve0,this.reserve1);let s,i;e.toLowerCase()===this.token0.toLowerCase()?this.err.require(n<this.reserve1,"InsufficientLiquidity1"):this.err.require(n<this.reserve0,"InsufficientLiquidity0"),e.toLowerCase()===this.token0.toLowerCase()?(s=this.reserve0+a,i=this.reserve1-n):(i=this.reserve1+a,s=this.reserve0-n);const d=this._k(s,i),c=this._k(this.reserve0,this.reserve1);return this.err.require(d>=c,"K"),{amount:n,gas:this.gasConstant}}_f(e,t){return e*t/1000000000000000000n*(e*e/1000000000000000000n+t*t/1000000000000000000n)/1000000000000000000n}_get_y(e,t,a){for(let n=0;n<255;n++){const n=this._f(e,a),s=this._d(e,a);if(this.err.require(0n!==s,"D must not be zero"),n<t){let i=1000000000000000000n*(t-n)/s;if(0n===i){if(n==t)return a;if(this._k(e,a+1n)>t)return a+1n;i=1n}a+=i}else{let i=1000000000000000000n*(n-t)/s;if(0n===i){if(n==t||this._f(e,a-1n)<t)return a;i=1n}a-=i}}throw this.err.createRequireViolated("!y")}}var ht;class ut{static sort(e){const t=[...e];let a=t[0];return t[0]<t[1]&&(t[0]=t[1],t[1]=a),t[0]<t[2]&&(a=t[0],t[0]=t[2],t[2]=a),t[1]<t[2]&&(a=t[1],t[1]=t[2],t[2]=a),t}static _geometric_mean(e){const t=e[0]*e[1]/10n**18n*e[2]/10n**18n;return 0n===t?0n:this._cbrt(t)}static max(e,t){return e>t?e:t}static abs(e){return e<0n?0n-e:e}static _snekmate_log_2(e,t){let a=e,n=0n;return e>>128n!==0n&&(a=e>>128n,n=128n),a>>64n!==0n&&(a>>=64n,n+=64n),a>>32n!==0n&&(a>>=32n,n+=32n),a>>16n!==0n&&(a>>=16n,n+=16n),a>>8n!==0n&&(a>>=8n,n+=8n),a>>4n!==0n&&(a>>=4n,n+=4n),a>>2n!==0n&&(a>>=2n,n+=2n),a>>1n!==0n&&(n+=1n),t&&1n<<n<e&&(n+=1n),n}static pow_mod256(e,t){return e**t%2n**256n}static _cbrt(e){let t=0n;t=e>=115792089237316195423570985008687907853269n*10n**18n?e:e>=115792089237316195423570985008687907853269n?e*10n**18n:e*10n**36n;const a=this._snekmate_log_2(t,!1),n=a%3n;let s=this.pow_mod256(2n,a/3n)*this.pow_mod256(1260n,n)/this.pow_mod256(1000n,n);return s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,e>=115792089237316195423570985008687907853269n*10n**18n?s*=10n**12n:e>=11579208923731619e25&&(s*=10n**6n),s}static newton_D(e,t,a,n=0n){const s=this.sort(a);this.err.require(s[0]<this.MAX_UINT256/10n**18n*this.N_COINS**this.N_COINS,"dev: out of limits"),this.err.require(s[0]>0,"dev: empty pool");let i=s[0]+s[1]+s[2],d=0n;d=0n===n?this.N_COINS*this._geometric_mean(s):i>10n**36n?this._cbrt(s[0]*s[1]/10n**36n*s[2]/n*27n*10n**12n):i>10**24?this._cbrt(s[0]*s[1]/10n**24n*s[2]/n*27n*10n**6n):this._cbrt(s[0]*s[1]/10n**18n*s[2]/n*27n);let c=0n,r=0n;for(let a=0;a<255;a++){const a=d,n=10n**18n*s[0]*this.N_COINS/d*s[1]*this.N_COINS/d*s[2]*this.N_COINS/d;let o=t+10n**18n;o=o>n?o-n+1n:n-o+1n;const f=10n**18n*d/t*o/t*o*this.A_MULTIPLIER/e,l=2n*10n**18n*this.N_COINS*n/o,b=i+i*l/10n**18n+f*this.N_COINS/n-l*d/10n**18n;let h=d*(b+i)/b,u=d*d/b;if(10n**18n>n?u+=d*(f/b)/10n**18n*(10n**18n-n)/n:u-=d*(f/b)/10n**18n*(n-10n**18n)/n,d=h>u?h-u:(u-h)/2n,c=d>a?d-a:a-d,c*10n**14n<this.max(10n**16n,d)){for(let e=0,t=s.length;e<t;e++){r=s[e]*10n**18n/d,this.err.require(r>=10**16-1&&r<10**20+1,"Unsafe values x[i]")}return d}}throw this.err.createRequireViolated("Did not converge")}static sqrt(e){let t=e/2n+1n,a=e;for(;t<a;)a=t,t=(e/t+t)/2n;return a}static _newton_y(e,t,a,n,s){let i=0n;for(let e=0;e<3;e++)e!==s&&(i=a[e]*10n**18n/n,this.err.require(i>10n**16n-1n&&i<10n**20n+1n,"Unsafe values x[i]"));let d=n/this.N_COINS,c=10n**18n,r=0n,o=[...a];o[s]=0n,o=this.sort(o);const f=this.max(this.max(o[0]/10n**14n,n/10n**14n),100n);for(let e=2;e<Number(this.N_COINS)+1;e++){const t=o[Number(this.N_COINS)-e];d=d*n/(t*this.N_COINS),r+=t}for(let e=0;e<Number(this.N_COINS)-1;e++)c=c*o[e]*this.N_COINS/n;let l=0n,b=0n,h=0n,u=0n,p=0n,x=0n,g=0n,m=0n,C=0n,I=0n,T=0n,y=0n;for(let a=0;a<255;a++)if(b=d,h=c*d*this.N_COINS/n,u=r+d,p=t+10n**18n,p=p>h?p-h+1n:h-p+1n,x=10n**18n*n/t*p/t*p*this.A_MULTIPLIER/e,g=10n**18n+2n*10n**18n*h/p,m=10n**18n*d+u*g+x,C=n*g,m<C)d=b/2n;else if(m-=C,I=m/d,T=x/I,y=(m+10n**18n*n)/I+T*10n**18n/h,T+=10n**18n*u/I,d=y<T?b/2n:y-T,l=d>b?d-b:b-d,l<this.max(f,d/10n**14n))return i=d*10n**18n/n,this.err.require(i>10n**16n-1n&&i<10n**20n+1n,"Unsafe value for y"),d;throw this.err.createRequireViolated("Did not converge")}static get_y(e,t,a,n,s){this.err.require(e>this.MIN_A-1n&&e<this.MAX_A+1n,"dev: unsafe values A"),this.err.require(t>this.MIN_GAMMA-1n&&t<this.MAX_GAMMA+1n,"dev: unsafe values gamma"),this.err.require(n>10n**17n-1n&&n<10n**15n*10n**18n+1n,"dev: unsafe values D");let i=0n;for(let e=0;e<3;e++)e!==s&&(i=a[e]*10n**18n/n,this.err.require(i>10n**16n-1n&&i<10n**20n+1n,"Unsafe values x[i]"));let d=0,c=0;0===s?(d=1,c=2):1===s?(d=0,c=2):2===s&&(d=0,c=1);const r=e,o=t,f=n,l=a[d],b=a[c],h=o*o;let u=10n**36n/27n,p=10n**36n/9n+2n*10n**18n*o/27n-f*f/l*h*r/729n/this.A_MULTIPLIER/b,x=10n**36n/9n+o*(o+4n*10n**18n)/27n+h*(l+b-f)/f*r/27n/this.A_MULTIPLIER,g=(10n**18n+o)**2n/27n;const m=this.abs(3n*u*x/p-p);let C=0n;C=m>10n**48n?10n**30n:m>10n**44n?10n**26n:m>10n**40n?10n**22n:m>10n**36n?10n**18n:m>10n**32n?10n**14n:m>10n**28n?10n**10n:m>10n**24n?10n**6n:m>10n**20n?100n:1n;let I=0n;this.abs(u)>this.abs(p)?(I=this.abs(u/p),u=u*I/C,p=p*I/C,x=x*I/C,g=g*I/C):(I=this.abs(p/u),u=u/I/C,p=p/I/C,x=x/I/C,g=g/I/C);const T=3n*u*x,y=T/p-p,A=3n*T/p-2n*p-27n*u**2n/p*g/p,k=A**2n+4n*y**2n/p*y;let E=0n;if(!(k>0n))return[this._newton_y(e,t,a,n,s),0n];E=this.sqrt(k);let N=0n;N=p>=0n?this._cbrt(p):0n-this._cbrt(0n-p);let O=0n;O=A>0n?this._cbrt((A+E)/2n):0n-this._cbrt((0n-(A-E))/2n);const P=N*N/10n**18n*O/10n**18n,S=(p+p*y/P-P)/3n,D=[f*f/27n/b*f/l*S/u,10n**18n*S/u];return i=D[0]*10n**18n/n,this.err.require(i>=10n**16n-1n&&i<10n**20n+1n,"Unsafe value for y"),D}static reduction_coefficient(e,t){const a=e[0]+e[1]+e[2];let n=10n**18n*this.N_COINS*e[0]/a;return n=n*this.N_COINS*e[1]/a,n=n*this.N_COINS*e[2]/a,t>0n&&(n=t*10n**18n/(t+10n**18n-n)),n}}ht=ut,ut.N_COINS=3n,ut.A_MULTIPLIER=10000n,ut.MIN_GAMMA=10n**10n,ut.MAX_GAMMA=5n*10n**16n,ut.MIN_A=ht.N_COINS**ht.N_COINS*ht.A_MULTIPLIER/100n,ut.MAX_A=ht.N_COINS**ht.N_COINS*ht.A_MULTIPLIER*1000n,ut.MAX_UINT256=115792089237316195423570985008687907853269984665640564039457584007913129639935n,ut.err=new ge(ht.name);class pt{constructor(e,t,a,n,s,i,d,c,r,o,f,l,b,h){this.poolContract=e,this.multicallContract=t,this.TOKENS=a,this.PRECISION=n,this.PRECISIONS=s,this.NOISE_FEE=i,this.MIN_A=d,this.MAX_A=c,this.MIN_GAMMA=r,this.MAX_GAMMA=o,this.A_MULTIPLIER=f,this.routeIndex=l,this.depositAddress=b,this.gasConstant=h,this.err=new ge(pt.name),this.abiCoder=he,this.tokenIndex={},this.A=0n,this.gamma=0n,this.D=0n,this.feeGamma=0n,this.midFee=0n,this.outFee=0n,this.blockTimestamp=0n,this.futureAGammaTime=0n,this.tokenIndex=a.reduce(((e,t,a)=>(e[t]=a,e)),{}),this.balances=Array.from({length:this.TOKENS.length},(()=>0n)),this.priceScales=Array.from({length:this.TOKENS.length-1},(()=>0n))}static create(e,t){return new pt(e.poolContract,e.multicallContract,e.tokens,e.precision,e.precisions,e.noiseFee,e.minA,e.maxA,e.minGamma,e.maxGamma,e.aMultiplier,t,e.address,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.TOKENS.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.TOKENS[t],this.TOKENS[n]]),e.push([this.TOKENS[n],this.TOKENS[t]]);return e}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){const t=[{callData:"0xf446c1d0",target:this.poolContract},{callData:"0x0f529ba2",target:this.poolContract},{callData:"0xb1373929",target:this.poolContract},{callData:"0x72d4f0e2",target:this.poolContract},{callData:"0x92526c0c",target:this.poolContract},{callData:"0xee8de675",target:this.poolContract},{callData:"0x0f28c97d",target:this.multicallContract},{callData:"0xf9ed9597",target:this.poolContract},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode(["uint256"],[a]);return{callData:e.utils.hexConcat(["0x4903b0d1",n]),target:this.poolContract}}))];return t.push(...this.TOKENS.slice(0,this.TOKENS.length-1).map(((t,a)=>{const n=this.abiCoder.encode(["uint256"],[a]);return{callData:e.utils.hexConcat(["0xa3f7cdd5",n]),target:this.poolContract}}))),t}applyCurrentStateFromCalls(e){if(0===e.length)return;if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.D=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.gamma=t.toBigInt()}if(e[3].success){const[t]=this.abiCoder.decode(["uint256"],e[3].returnData);this.feeGamma=t.toBigInt()}if(e[4].success){const[t]=this.abiCoder.decode(["uint256"],e[4].returnData);this.midFee=t.toBigInt()}if(e[5].success){const[t]=this.abiCoder.decode(["uint256"],e[5].returnData);this.outFee=t.toBigInt()}if(e[6].success){const[t]=this.abiCoder.decode(["uint256"],e[6].returnData);this.blockTimestamp=t.toBigInt()}if(e[7].success){const[t]=this.abiCoder.decode(["uint256"],e[7].returnData);this.futureAGammaTime=t.toBigInt()}let t=0;for(let a=8,n=a+this.TOKENS.length;a<n;++a)if(e[a].success){const[n]=this.abiCoder.decode(["uint256"],e[a].returnData);this.balances[t]=n.toBigInt(),t+=1}t=0;for(let a=this.TOKENS.length+8,n=a+this.TOKENS.length-1;a<n;++a)if(e[a].success){const[n]=this.abiCoder.decode(["uint256"],e[a].returnData);this.priceScales[t]=n.toBigInt(),t+=1}}_fee(e){const t=[this.midFee,this.outFee,this.feeGamma],a=ut.reduction_coefficient(e,t[2]);return(t[0]*a+t[1]*(10n**18n-a))/10n**18n}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t],i=this.TOKENS.length;this.err.require(void 0!==n&&void 0!==s,"untradable pair");const d=[this.A,this.gamma];let c=[...this.balances];c[n]+=a;let r=c[n]-a;c[0]*=this.PRECISIONS[0];for(let e=1;e<i;e++)c[e]=c[e]*this.priceScales[e-1]*this.PRECISIONS[e]/this.PRECISION;const o=this.PRECISIONS[n];if(this.futureAGammaTime>this.blockTimestamp){r*=o,n>0&&(r=r*this.priceScales[n-1]/this.PRECISION);const e=c[n];c[n]=r,this.D=ut.newton_D(d[0],d[1],c,0n),c[n]=e}const f=this.D,l=ut.get_y(d[0],d[1],c,f,s);let b=c[s]-l[0]-1n;c[s]=l[0],s>0&&(b=b*this.PRECISION/this.priceScales[s-1]),b/=this.PRECISIONS[s];return b-=this._fee(c)*b/10n**10n,{amount:b,gas:this.gasConstant}}}class xt{constructor(e,t,a,n){this.DEX_ROUTES=e,this.CORRESPONDENT_TOKENS=t,this.multicall=a,this.opt=n,this.corrTokenDecimals={},this.models=[],this.indexedModels={},this.amountOutCache={},this.corrTokens=this.CORRESPONDENT_TOKENS.map((e=>e.address));for(let e=0,t=this.CORRESPONDENT_TOKENS.length;e<t;++e)this.corrTokenDecimals[this.CORRESPONDENT_TOKENS[e].address]=this.CORRESPONDENT_TOKENS[e].decimals;this.DEX_ROUTES_ID_IDX=this.DEX_ROUTES.reduce(((e,t,a)=>(e[t.id]=a,e)),{}),this.DEX_ROUTES_ADDRESS_IDX=this.DEX_ROUTES.reduce(((e,t,a)=>(e[t.address]=a,e)),{})}updateIndexedModel(e,t,a){void 0===this.indexedModels[e[0]]&&(this.indexedModels[e[0]]={}),void 0===this.indexedModels[e[0]][e[1]]&&(this.indexedModels[e[0]][e[1]]={tradableList:[],mapping:{}}),this.indexedModels[e[0]][e[1]].mapping[t]=a,this.isModelTradingAllowed(t)&&this.indexedModels[e[0]][e[1]].tradableList.push(a)}isModelIndexed(e,t,a){return void 0!==this.indexedModels[e]&&void 0!==this.indexedModels[e][t]&&void 0!==this.indexedModels[e][t].mapping[a]}isModelTradingAllowed(e){return this.DEX_ROUTES[e].isTradingAllowed}getModel(e,t,a){if(void 0!==this.indexedModels[e]&&void 0!==this.indexedModels[e][t]&&void 0!==this.indexedModels[e][t].mapping[a])return this.models[this.indexedModels[e][t].mapping[a]]}getTradableModels(e,t){return void 0===this.indexedModels[e]||void 0===this.indexedModels[e][t]?[]:this.indexedModels[e][t].tradableList}getDepositAddress(e,t,a){const n=this.DEX_ROUTES_ADDRESS_IDX[a];let s=this.getModel(e,t,n);return void 0===s&&(this.registerSingle([e,t],n),s=this.getModel(e,t,n),void 0===s)?"":s.getDepositAddress()}generateAllTokenPairs(e,t){const a=[];a.push([e,t]);for(let n=0,s=this.corrTokens.length;n<s;++n){const i=this.corrTokens[n];e!==i&&i!==t&&(a.push([e,i]),a.push([i,t]));for(let n=0;n<s;++n){const s=this.corrTokens[n];i!==s&&i!==e&&s!==t&&a.push([i,s])}}return a}unregisterAll(){this.models=[],this.indexedModels={},this.amountOutCache={}}registerSingle(e,t){const a=this.DEX_ROUTES[t];if(this.isModelIndexed(e[0],e[1],t))return;let n=null;switch(a.model){case ee.UniswapV2:n=ue.create(a,e,t);break;case ee.UniswapV3:n=st.create(a,e,t);break;case ee.PancakeV3:n=ft.createPancake(a,e,t);break;case ee.VelodromeSS:n=lt.createVelodrome(a,e,t);break;case ee.Mdex:n=ke.create(a,e,t);break;case ee.Mars:n=Ue.create(a,e,t);break;case ee.Biswap:n=pe.create(a,e,t);break;case ee.Shibaswap:n=qe.create(a,e,t);break;case ee.CurvePlain:me.isPairSupported(e,a.tokens)&&(n=me.create(a,t));break;case ee.CurvePlainSol:ye.isPairSupported(e,a.tokens)&&(n=ye.create(a,t));break;case ee.Iron:Re.isPairSupported(e,a.tokens)&&(n=Re.create(a,t));break;case ee.Synapse:Fe.isPairSupported(e,a.tokens)&&(n=Fe.create(a,t));break;case ee.CurveMeta:{const s=this.DEX_ROUTES_ID_IDX[a.basePoolRouteId],i=this.DEX_ROUTES[s];if(i.model!==ee.CurvePlain&&i.model!==ee.CurveLendingA)throw new Error(`expected curve plain/lending pool for the meta pool, but receive model ID: ${i.model}`);if(Te.isPairSupportedMeta(e,a.tokens,i.tokens,i.lpToken)){this.registerSingle([i.tokens[0],i.tokens[1]],s);let e=this.getModel(i.tokens[0],i.tokens[1],s);n=Te.createMeta(a,t,e)}break}case ee.CurveMetaSol:{const s=this.DEX_ROUTES_ID_IDX[a.basePoolRouteId],i=this.DEX_ROUTES[s];if(i.model!==ee.CurvePlainSol&&i.model!==ee.Synapse&&i.model!==ee.Iron)throw new Error(`expected curve plain sol pool for the meta sol pool, but receive model ID: ${i.model}`);if(dt.isPairSupportedMeta(e,a.tokens,i.tokens,i.lpToken)){this.registerSingle([i.tokens[0],i.tokens[1]],s);let e=this.getModel(i.tokens[0],i.tokens[1],s);n=dt.createMeta(a,t,e)}break}case ee.CurveCrypto:Pe.isPairSupported(e,a.tokens)&&(n=Pe.create(a,t));break;case ee.CurveTriCryptoNG:pt.isPairSupported(e,a.tokens)&&(n=pt.create(a,t));break;case ee.DodoV2:Ae.isPairSupported(e,a.pools)&&(n=Ae.create(a,e,t));break;case ee.DodoV1:Ne.isPairSupported(e,a.pools)&&(n=Ne.create(a,e,t));break;case ee.Smoothy:Ee.isPairSupported(e,a.expectedTokens)&&(n=Ee.create(a,t));break;case ee.BalancerWeighted:Oe.isPairSupported(e,a.tokens)&&(n=Oe.create(a,t));break;case ee.BalancerStable:Be.isPairSupported(e,a.tokens)&&(n=Be.create(a,t));break;case ee.DMM:we.isPairSupported(e,a.pools)&&(n=we.create(a,e,t));break;case ee.PolyDex:n=_e.createPolyDex(a,e,t);break;case ee.FireBirdWeighted:n=ve.createPolyDex(a,e,t);break;case ee.CurveLendingA:Se.isPairSupported(e,a.tokens)&&(n=Se.createLendingA(a,t));break;case ee.CurveLendingCryptoZap:case ee.CurveLendingCryptoTwoZap:{const s=this.DEX_ROUTES_ID_IDX[a.basePoolId],i=this.DEX_ROUTES[s],d=this.DEX_ROUTES_ID_IDX[a.poolId],c=this.DEX_ROUTES[d];if(i.model!==ee.CurveLendingA)throw new Error(`expected curve lending pool for the zap's base pool, but receive model ID: ${i.model}`);if(c.model!==ee.CurveCrypto)throw new Error(`expected curve crypto pool for the zap's pool, but receive model ID: ${i.model}`);if(a.model===ee.CurveLendingCryptoZap&&De.isPairSupported(e,a.tokens)){this.registerSingle([i.tokens[0],i.tokens[1]],s),this.registerSingle([c.tokens[0],c.tokens[1]],d);const e=this.getModel(i.tokens[0],i.tokens[1],s),r=this.getModel(c.tokens[0],c.tokens[1],d);n=De.create(a,e,r,t)}else if(a.model===ee.CurveLendingCryptoTwoZap&&Me.isPairSupported(e,a.tokens)){this.registerSingle([i.tokens[0],i.tokens[1]],s),this.registerSingle([c.tokens[0],c.tokens[1]],d);const e=this.getModel(i.tokens[0],i.tokens[1],s),r=this.getModel(c.tokens[0],c.tokens[1],d);n=Me.create(a,e,r,t)}}break;case ee.BalancerMetaStable:Le.isPairSupported(e,a.tokens)&&Le.createMeta(a,t);break;case ee.BalancerLinear:Ve.isPairSupported(e,a.tokens)&&Ve.create(a,t);break;case ee.BalancerLiquidityBootstrapping:it.isPairSupported(e,a.tokens)&&it.create(a,t);break;case ee.BalancerBoostedStable:if(We.isPairSupported(e,a.tokens)){const e=a.linearPoolIds.map((e=>{const t=this.DEX_ROUTES_ID_IDX[e],a=this.DEX_ROUTES[t];if(a.model!==ee.BalancerLinear)throw new Error(`expected Balancer Linear pool for Balancer boosted pool, but receive model ID: ${a.model}`);return this.registerSingle([a.tokens[0],a.tokens[1]],t),this.getModel(a.tokens[0],a.tokens[1],t)}));We.createBoosted(a,e,t)}break;case ee.GmxDex:n=ct.create(a,e,t);break;case ee.Solidly:n=rt.create(a,e,t);break;case ee.VelodromeV2:n=bt.create(a,e,t);break;case ee.Synthetix:ot.isPairSupported(e,a.tokens)&&(n=ot.create(a,t));break;default:throw new Error(`Unknown DEX model: ${a.model}`)}if(null!==n){this.models.push(n);const e=n.getTradablePairs();for(let a=0,n=e.length;a<n;++a)this.updateIndexedModel(e[a],t,this.models.length-1)}}register(e,t){const a=this.generateAllTokenPairs(e,t);i.debug("[Model Manager]","Registering models");for(let e=0,t=a.length;e<t;++e)for(let t=0,n=this.DEX_ROUTES.length;t<n;++t)this.registerSingle(a[e],t);i.debug("[Model Manager]","Total model registered:",this.models.length)}getRouteInfo(e){const{id:t,name:a,address:n}=this.DEX_ROUTES[e];return{id:t,name:a,address:n}}async fetchAllReserves(){let t=[],a=[];i.log("[Model Manager]","Fetching...");for(let e=0,n=this.models.length;e<n;++e){const n=this.models[e].getfetchingCurrentStateCalls();a.push(t.length+n.length),t.push(...n)}t.push({callData:"0x42cbb15c",target:this.multicall.address});let n=await be(t,this.opt.multicall,this.multicall),s=0;for(let e=0,t=a.length;e<t;++e){try{this.models[e].applyCurrentStateFromCalls(n.slice(s,a[e]))}catch(e){throw i.error("unable to decode received data"),e}s=a[e]}const[d]=e.utils.defaultAbiCoder.decode(["uint256"],n[n.length-1].returnData);return d.toNumber()}tryGetAmountOut(e,t,a,n){let s={amount:0n,gas:0n};try{s=e.getAmountOut(t,a,n)}catch(e){if(e instanceof xe)return{amount:0n,gas:0n};throw e}return s}getMaxAmountOutWithCache(e,t,a,n,s){const i=this.getTradableModels(e,t);let d=[];const c=a.toString(),r=s?1:0,o=[e,t,c,r];if(function(e,t){const a=t.length;for(var n=0;n<a;++n){if("object"!=typeof e)return!1;const a=t[n];if(!(a in e))return!1;e=e[a]}return!0}(this.amountOutCache,o))d=this.amountOutCache[e][t][c][r];else{for(let n=0,c=i.length;n<c;++n){const c=this.models[i[n]],r=c.getTradingRouteIndex(),o=c.getPoolAddress(),f=this.tryGetAmountOut(c,e,t,a);let l=f.amount;void 0!==s&&(l-=f.gas*N(s[t].fee,E,s[t].decimals)),f.amount>0n&&d.push({amountOut:f,amountOutGasDeducted:l,poolAddress:o,routeIndex:r})}d.sort(((e,t)=>e.amountOutGasDeducted<t.amountOutGasDeducted?1:e.amountOutGasDeducted>t.amountOutGasDeducted?-1:0)),function(e,t,a){const n=t.length-1;for(var s=0;s<n&&"object"==typeof e;++s){const a=t[s];a in e||(e[a]={}),e=e[a]}if("object"!=typeof e)throw new Error(`Object at key ${t[s]} is not an object`);e[t[n]]=a}(this.amountOutCache,o,d)}for(let e=0,t=d.length;e<t;++e)if(void 0===n||!n.has(d[e].poolAddress))return{amountOut:d[e].amountOut,poolAddress:d[e].poolAddress,routeIndex:d[e].routeIndex};return{amountOut:{amount:0n,gas:0n},poolAddress:"",routeIndex:-1}}getAmountOutByPath(e,t,a,n,s){if(0===n.length)return{amount:0n,gas:0n};let i={amount:a,gas:0n};for(let a=0,d=n.length;a<d&&0n!==i.amount;++a){const c=0===a?e:s[a-1],r=a===d-1?t:s[a],o=this.getModel(c,r,n[a]),f=this.tryGetAmountOut(o,c,r,i.amount);i.amount=f.amount,i.gas+=f.gas}return i}getPathCombinationRecursively(e,t,a,n,s,i,d,c){const r=n[n.length-1];if(0!==e||r===a)if(r!==a)for(let o=0,f=t.length;o<f;++o)r!==t[o]&&(n.push(t[o]),this.getPathCombinationRecursively(e-1,t,a,n,s,i,d,c),n.pop());else{const e=new Set;for(let t=0;t<d;++t){let t=s;const a=[];for(let s=0,i=n.length-1;s<i;++s){const i=c(n[s],n[s+1],t,e);if(i.routeIndex<0)break;t=i.amountOut.amount,e.add(i.poolAddress),a.push(i)}if(a.length<n.length-1){for(let t=0,n=a.length;t<n;++t)e.delete(a[t].poolAddress);break}const d=a[a.length-1];i.push({amountOut:d.amountOut.amount,gas:a.reduce(((e,t)=>e+t.amountOut.gas),0n),pools:a.map((e=>e.poolAddress)),routeIndexes:a.map((e=>e.routeIndex)),tokens:n.filter(((e,t)=>t>0&&t<n.length-1))})}}}getAllRoutesSingle(e,t,a,n){const s=[...new Set([...this.corrTokens,t])],i=[];return this.getPathCombinationRecursively(3,s,t,[e],a,i,1,((e,t,a,s)=>this.getMaxAmountOutWithCache(e,t,a,s,n))),i}getTokenPriceRoutes(e,t,a){const n={},s=[...new Set([...a,...this.corrTokens])],d=100n*10n**BigInt(t);for(let t=0,a=s.length;t<a;++t)if(s[t]!==e&&(n[s[t]]=this.getAllRoutesSingle(e,s[t],d),0===n[s[t]].length))throw i.error(`Unable to find usd price for token ${s[t]}`),new Error("UNKNOWN_DEST_TOKEN_PRICE");return n}getCandidatePaths(e,t,a,n,s){const i=n/2n,d=[...new Set([...this.corrTokens,a])],c=[],r=[];this.getPathCombinationRecursively(3,d,a,[t],i,r,10,((e,t,a,n)=>this.getMaxAmountOutWithCache(e,t,a,n,s))),r.sort(((e,t)=>e.amountOut<t.amountOut?1:e.amountOut>t.amountOut?-1:0));const o=new Set;for(let e=0,t=r.length;e<t;++e){const t=r[e];let a=!1;for(let e=0,n=t.pools.length;e<n;++e)if(o.has(t.pools[e])){a=!0;break}if(!a){for(let e=0,a=t.pools.length;e<a;++e)o.add(t.pools[e]);c.push(t)}}return c.length>e?c.slice(0,e):c}getAllRoutesSplit(e,t,a,n){const s=this.getCandidatePaths(this.opt.maxCandidatePaths,e,t,a,n);i.debug("CANDIDATE POOLS LENGTH",s.length),i.table((()=>s));const d=Array.from({length:s.length},(()=>Array.from({length:B.length},(()=>null)))),c=Array.from({length:s.length},(()=>Array.from({length:B.length},(()=>null))));for(let n=0,i=s.length;n<i;++n){const i=s[n];for(let s=0,r=B.length;s<r;++s){const r=a*BigInt(B[s])/BigInt(100),o=this.getAmountOutByPath(e,t,r,i.routeIndexes,i.tokens);d[n][s]=o.amount,c[n][s]=o.gas}}return{paths:s,amountOuts:d,gas:c}}}const gt={arbitrum:{maxCallsPerBatch:10},avalanche:{maxCallsPerBatch:500},bsc:{maxCallsPerBatch:500},ethereum:{maxCallsPerBatch:500},optimism:{maxCallsPerBatch:500},polygon:{maxCallsPerBatch:500}};class mt{constructor(e,t,a){this.networkName=e,this.provider=t,this.multicallOptions=a,this.MAX_UINT24=16777215n,this.MAX_UINT32=4294967295n,this.MAX_UINT64=18446744073709551615n,this.MAX_UINT80=1208925819614629174706175n,this.MAX_UINT96=79228162514264337593543950335n,this.MAX_UINT112=5192296858534827628530496329220095n,this.multicall=V.connect(I[this.networkName],this.provider),this.addressTableContract=C[this.networkName],this.multicallOptions={...gt[this.networkName],...this.multicallOptions}}async fetchAddressIndex(t){const a=Array.from({length:t.length},(()=>({callData:"0xd4b6b5da",target:this.addressTableContract})));for(let n=0,s=a.length;n<s;++n){const s=he.encode(["address"],[t[n]]);a[n].callData=e.utils.hexConcat([a[n].callData,s])}const n=await be(a,this.multicallOptions,this.multicall),s=[];for(let e=0,t=n.length;e<t;++e)if(n[e].success){const[t]=he.decode(["uint256"],n[e].returnData);if(t.isZero()){s.push(null);continue}s.push(t)}else s.push(null);return s}encodeAddress(t,a){if(t===e.constants.AddressZero)return{type:["uint8"],data:[3]};if(null===a)return{type:["uint8","address"],data:[0,t]};if(a.lte(this.MAX_UINT24))return{type:["uint8","uint24"],data:[2,a.toBigInt()]};if(a.lte(this.MAX_UINT32))return{type:["uint8","uint32"],data:[1,a.toBigInt()]};throw new Error(`Unable to encode address: ${t}, index: ${a}`)}encodeAmount(t){const a=e.BigNumber.from(t).toBigInt();if(0n===a)return{type:["uint8"],data:[4]};if(a<=this.MAX_UINT64)return{type:["uint8","uint64"],data:[0,a]};if(a<=this.MAX_UINT80)return{type:["uint8","uint80"],data:[1,a]};if(a<=this.MAX_UINT96)return{type:["uint8","uint96"],data:[2,a]};if(a<=this.MAX_UINT112)return{type:["uint8","uint112"],data:[3,a]};throw new Error(`unable to encode amount: ${a.toString()}`)}encodePathResult(e,t){const a=[],n=[];a.push("uint8"),n.push(e.routes.length);for(let s=0,i=e.routes.length;s<i;++s){const i=e.routes[s].address,d=this.encodeAddress(i,t[i]);a.push(...d.type),n.push(...d.data)}for(let s=0,i=e.tokens.length;s<i;++s){const i=e.tokens[s],d=this.encodeAddress(i,t[i]);a.push(...d.type),n.push(...d.data)}return{type:a,data:n}}addPathResultAddressesToArray(e,t){for(let a=0,n=t.length;a<n;++a)e.push(...t[a].routes.map((e=>e.address)));for(let a=0,n=t.length;a<n;++a)e.push(...t[a].tokens)}createAddressIndexMap(e,t){const a={};for(let n=0,s=e.length;n<s;++n)a[e[n]]=t[n];return a}async encodeSwapDataL2(t,a,n){let s=[],i=[];if(void 0===n){const e=[];Array.isArray(t)?this.addPathResultAddressesToArray(e,t):this.addPathResultAddressesToArray(e,[t]);const a=await this.fetchAddressIndex(e);n=this.createAddressIndexMap(e,a)}if(Array.isArray(t)){i.push("uint8"),s.push(t.length);for(let e=0,t=a.length;e<t-1;++e){const t=this.encodeAmount(a[e]);i.push(...t.type),s.push(...t.data)}for(let e=0,a=t.length;e<a;++e){const a=this.encodePathResult(t[e],n);s.push(...a.data),i.push(...a.type)}}else{const e=this.encodePathResult(t,n);s=e.data,i=e.type}return e.utils.solidityPack(i,s)}encodeSwapData(t){return Array.isArray(t)?e.utils.defaultAbiCoder.encode(["address[][]","address[][]"],[t.map((e=>e.routes.map((e=>e.address)))),t.map((e=>e.tokens))]):e.utils.defaultAbiCoder.encode(["address[]","address[]"],[t.routes.map((e=>e.address)),t.tokens])}async compress(t,a,n,s,i,d,c,r,o,f){const l=[c,t,a,r],b=[n,s,i,d];Array.isArray(o)?this.addPathResultAddressesToArray(l,o):this.addPathResultAddressesToArray(l,[o]);const h=await this.fetchAddressIndex(l),u=this.createAddressIndexMap(l,h),p=await this.encodeSwapDataL2(o,f,u),x=[],g=[];for(let e=0;e<4;++e){const t=this.encodeAddress(l[e],h[e]);x.push(...t.type),g.push(...t.data)}for(let e=0,t=b.length;e<t;++e){const t=this.encodeAmount(b[e]);x.push(...t.type),g.push(...t.data)}return x.push("bytes"),g.push(p),e.utils.solidityPack(x,g)}}const Ct={maxCallsPerFetch:500,maxCandidatePathsCount:50},It={maxCallsPerFetch:500,maxCandidatePathsCount:50},Tt={maxCallsPerFetch:50,maxCandidatePathsCount:50},yt={maxCallsPerFetch:500,maxCandidatePathsCount:50},At={maxCallsPerFetch:500,maxCandidatePathsCount:50},kt={maxCallsPerFetch:500,maxCandidatePathsCount:50},Et={enableSplit:!0};class Nt{constructor(e,t,a={}){switch(this.provider=e,t){case"bsc":this.network=u.bsc,this.options={...Ct,...a};break;case"arbitrum":this.network=u.arbitrum,this.options={...Tt,...a};break;case"polygon":this.network=u.polygon,this.options={...It,...a};break;case"ethereum":this.network=u.ethereum,this.options={...yt,...a};break;case"avalanche":this.network=u.avalanche,this.options={...At,...a};break;case"optimism":this.network=u.optimism,this.options={...kt,...a};break;default:throw new Error("Unknown chain")}this.multicall2=function(e,t){const a=I[t];return V.connect(a,e)}(e,this.network)}getTradeType(e,t){const a=G(this.network);return e===K&&t===a?z.ETH2WETH:e===a&&t===K?z.WETH2ETH:z.BESTRATE}getDepositAddresses(t,a){return t=t.map((e=>({src:Q(e.src,this.network).toLowerCase(),dest:Q(e.dest,this.network).toLowerCase(),routeAddress:e.routeAddress.toLowerCase()}))),void 0===a&&(a=new xt(fe[this.network],le[this.network],this.multicall2,{maxCandidatePaths:this.options.maxCandidatePathsCount,multicall:{maxCallsPerBatch:this.options.maxCallsPerFetch}}),t.forEach((({src:e,dest:t})=>{a.register(e,t)}))),t.map((({src:t,dest:n,routeAddress:s})=>e.utils.getAddress(a.getDepositAddress(t,n,s))))}async _fetch(t,a,n,s,d,c){const r=Q(y[this.network].address,this.network),o=T[this.network],f=Q(t,this.network),l=Q(a,this.network);i.debug("[Best Rate Quote]","registering wrappedSrc/wrappedDest..."),d.register(f,l),i.debug("[Best Rate Quote]","registering gas tokens..."),d.register(o.address,l),d.register(o.address,r);const b=U.connect(l,this.provider);let[h,u]=await Promise.all([d.fetchAllReserves(),b.decimals()]);const p={address:l,decimals:u},x=J(d,s,y[this.network].decimals,A[this.network],p,o,void 0!==c.gasPriceL2?e.BigNumber.from(c.gasPriceL2).toBigInt():void 0),g=void 0!==c.gasPriceL2?x.l2:x.l1,m=d.getAllRoutesSingle(f,l,n,g);let C;if(c.enableSplit){const e=d.getAllRoutesSplit(f,l,n,g);C={paths:e.paths,amountOuts:e.amountOuts,gas:e.gas}}return{blockNumber:h,gasPriceTokens:P(x,p.address,o.address),singleRouteRates:m,splitRouteRates:C}}async _quoteETHWETH(e,t,a,n,s,i){const d=Q(y[this.network].address,this.network),c=T[this.network],f=Q(t,this.network);s.register(c.address,f),s.register(c.address,d),await Promise.all([s.fetchAllReserves()]);const l=P(J(s,a,y[this.network].decimals,A[this.network],A[this.network],c,i),f,c.address);if(e===z.ETH2WETH){const e=function(e){const t={execution:r[e]};return p(e)&&(t.l2Calldata=h[e].ethWeth),t}(this.network);let t=S(e.execution,l.l1);return void 0!==l.l2&&(t=S(e.l2Calldata,l.l1,S(e.execution,l.l2))),{type:"ethToWeth",amountOut:n.toString(),routerAddress:m[this.network],gasFees:w(t)}}if(e===z.WETH2ETH){const e=function(e){const t={execution:o[e]};return p(e)&&(t.l2Calldata=h[e].wethEth),t}(this.network);let t=S(e.execution,l.l1);return void 0!==l.l2&&(t=S(e.l2Calldata,l.l1,S(e.execution,l.l2))),{type:"wethToEth",amountOut:n.toString(),routerAddress:m[this.network],gasFees:w(t)}}}async sendTx(e,t,...a){const n=t,s=a[a.length-1];if(void 0===s.gasLimit){const t=await e.estimateGas[n](...a);i.log("[Send Tx]","Fetched Gas Limit:",t.toString()),s.gasLimit=t.mul(k[this.network]+100).div(100)}return i.log("[Send Tx]","Final Gas Limit:",a[a.length-1].gasLimit.toString()),e[n](...a)}async approve(t,a,n=e.constants.MaxUint256,s={}){if(a.toLowerCase()===K)return null;const i=U.connect(a,t);return await this.sendTx(i,"approve",m[this.network],n,s)}async swap(t,a,n,s,d,c,r=0,o=0,f=e.constants.AddressZero,l={}){if(a.toLowerCase()===K&&(l.value=s),"split"===c.type||"strategies"===c.type){if(p(this.network)){const e=H.connect(m[this.network],t),b=new mt(this.network,t.provider,{maxCallsPerBatch:this.options.maxCallsPerFetch});i.log("Prepare Tx...");const h=await b.compress(a,n,s,d,r,o,g[this.network],f,"strategies"===c.type?c.path:c.paths,"strategies"===c.type?[]:c.volumns);let u;return i.log("Sending Tx..."),u="strategies"===c.type?await this.sendTx(e,"swapCompressed",h,l):await this.sendTx(e,"swapSplitCompressed",h,l),i.log("Tx Hash:",u.hash),u}{const e=q.connect(m[this.network],t),b=new mt(this.network,t.provider,{maxCallsPerBatch:this.options.maxCallsPerFetch}).encodeSwapData("strategies"===c.type?c.path:c.paths);let h;return i.log("Sending Tx..."),h="strategies"===c.type?await this.sendTx(e,"swap",g[this.network],b,c.depositAddress,a,s,n,d,f,r,o,l):await this.sendTx(e,"swapSplit",g[this.network],b,c.depositAddresses,c.volumns,a,s,n,d,f,r,o,l),i.log("Tx Hash:",h.hash),h}}{const e=q.connect(m[this.network],t);let a;return i.log("Sending Tx..."),a="ethToWeth"===c.type?await this.sendTx(e,"tradeEthToWeth",f,l):await this.sendTx(e,"tradeWethToEth",s,f,l),i.log("Tx Hash:",a.hash),a}}async getQuote(t,a,n,s,r={}){if(r={...Et,...r},t=e.utils.getAddress(t).toLowerCase(),a=e.utils.getAddress(a).toLowerCase(),p(this.network)&&void 0===r.gasPriceL2)throw new Error("L2 Gas Price option is required. Please specify `gasPriceL2` inside `opts` argument");const o=e.BigNumber.from(n).toBigInt(),u=e.BigNumber.from(s).toBigInt(),x=void 0!==r.gasPriceL2?e.BigNumber.from(r.gasPriceL2).toBigInt():void 0,C=new xt(fe[this.network],le[this.network],this.multicall2,{maxCandidatePaths:this.options.maxCandidatePathsCount,multicall:{maxCallsPerBatch:this.options.maxCallsPerFetch}}),I=this.getTradeType(t,a);if(I!==z.BESTRATE){return await this._quoteETHWETH(I,a,u,o,C,x)}i.log("[Best Rate Quote]","Fetching data");const{blockNumber:T,splitRouteRates:y,singleRouteRates:A,gasPriceTokens:k}=await this._fetch(t,a,o,u,C,r);i.log("[Best Rate Quote]","Compute best rate");const E=_(A,{gas:{price:k,execution:{initial:c[this.network],variable:l[this.network],pathVariable:0n},l2Calldata:h[this.network]}}),N=r.enableSplit?function(e,t,a,n){if(0===t.length)return{amountOut:0n,gasFee:{usd:0n,dest:0n,unit:0n},paths:[],volumns:[]};const s=Array.from({length:t.length},(()=>Array.from({length:t[0].length},(()=>null)))),d=Array.from({length:t.length},(()=>Array.from({length:t[0].length},(()=>null)))),c=t.length,r=t[0].length,o=void 0!==n.gas.price.l2?n.gas.price.l2:n.gas.price.l1,f=n.gas.execution,l=n.gas.l2Calldata,b=n.gas.price.l1;for(let i=0;i<c;++i){const{routeIndexes:c}=e[i];let h=f.variable.constant+f.variable.multiplier*BigInt(c.length)+f.pathVariable,u={dest:0n,unit:0n,usd:0n};void 0!==n.gas.price.l2&&(u=S(l.perPath+l.perRoute*BigInt(c.length),b));for(let e=0;e<r;e++){d[i][e]=S(h+a[i][e],o,u);const n=t[i][e];s[i][e]=n-d[i][e].dest}}i.log("[Best Rate Split]","Finding Best Rate");let h={amountOut:0n,paths:[],volumns:[],gasFee:{dest:0n,unit:0n,usd:0n}},u=Array.from({length:s.length},((e,t)=>t));const p=[];for(let e=0,t=u.length;e<t;++e){p.push([]);for(let t=0,a=B.length;t<a;++t)p[e].push([B[t],s[u[e]][t]])}const x=new R(p,100).compute();return i.debug("[Best Rate Split]","=== ChosenLearn ==="),i.table((()=>x)),i.debug("[Best Rate Split]","=== Amount outs ==="),i.table((()=>x.map((e=>({pathIndex:u[e[0]],amountOut:s[u[e[0]]][e[1]].toString()}))))),h.amountOut=x.reduce(((e,a)=>{const[n,s]=a;return e+t[u[n]][s]}),0n),h.paths=x.map((t=>{const[a,n]=t,{routeIndexes:s,tokens:i}=e[u[a]];return{routeIndexes:s,tokens:i}})),h.volumns=x.map((e=>{const[t,a]=e;return B[a]})),h.gasFee=x.reduce(((e,t)=>{const[a,n]=t,s=u[a];return{usd:e.usd+d[s][n].usd,dest:e.dest+d[s][n].dest,unit:e.unit+d[s][n].unit}}),h.gasFee),i.debug((()=>`[Best Rate Split] Gas fee before initial gas deduction ${JSON.stringify(w(h.gasFee),null,2)}`)),h.gasFee=S(f.initial,o,h.gasFee),void 0!==n.gas.price.l2&&(h.gasFee=S(l.initialSplit,b,h.gasFee)),i.debug((()=>`[Best Rate Split] FINAL RESULT: ${JSON.stringify(M(h),null,2)}`)),h}(y.paths,y.amountOuts,y.gas,{gas:{price:k,execution:{initial:d[this.network],variable:f[this.network],pathVariable:b[this.network]},l2Calldata:h[this.network]}}):{amountOut:0n,gasFee:{usd:0n,dest:0n,unit:0n},paths:[],volumns:[]},O=N.amountOut-N.gasFee.dest,P=E.amountOut-E.gasFee.dest;let D;if(i.log("[Best Rate Quote]","SINGLE",v(E,C)),i.log("[Best Rate Quote]","Block number:",T),i.log("[Best Rate Quote]","Best rate for single-route trading (without gas deduction):",E.amountOut),i.log("[Best Rate Quote]","Best rate for single-route trading (gas deducted):",P),i.log("[Best Rate Quote]","SPLIT",M(N,C)),i.log("[Best Rate Quote]","Best rate for split trading (without gas deduction):",N.amountOut),i.log("[Best Rate Quote]","Best rate for split trading (gas deducted):",O),O>P&&N.paths.length>1){const t=N.paths.map((t=>t.routeIndexes.map((e=>C.getRouteInfo(e))).map((({address:t,...a})=>({address:e.utils.getAddress(t),...a})))));D={type:"split",paths:N.paths.map((({tokens:a},n)=>({routes:t[n],tokens:a.map((t=>e.utils.getAddress(t)))}))),volumns:N.volumns,amountOut:N.amountOut.toString(),gasFees:w(N.gasFee),blockNumber:T,routerAddress:m[this.network],swapAddress:g[this.network],depositAddresses:[]}}else{D={type:"strategies",path:{routes:E.routeIndexes.map((e=>C.getRouteInfo(e))).map((({address:t,...a})=>({address:e.utils.getAddress(t),...a}))),tokens:E.tokens.map((t=>e.utils.getAddress(t)))},amountOut:E.amountOut.toString(),gasFees:w(E.gasFee),blockNumber:T,routerAddress:m[this.network],swapAddress:g[this.network],depositAddress:""}}if("split"===D.type)p(this.network)?D.depositAddresses=Array.from({length:D.paths.length},(()=>g[this.network])):D.depositAddresses=this.getDepositAddresses(D.paths.map((e=>({src:t,dest:0===e.tokens.length?a:e.tokens[0],routeAddress:e.routes[0].address}))),C);else if("strategies"===D.type&&D.path.routes.length>0)if(p(this.network))D.depositAddress=g[this.network];else{const e=this.getDepositAddresses([{src:t,dest:0===D.path.tokens.length?a:D.path.tokens[0],routeAddress:D.path.routes[0].address}],C);D.depositAddress=e[0]}return D}}function Ot(t,a,n){const s={url:t,user:a,password:n,allowGzip:!0};return new e.providers.JsonRpcProvider(s)}export{u as BESTRATE_NETWORK,E as GAS_TOKEN_DECIMALS,n as LogLevel,s as Logger,Nt as WardenBestRate,mt as WardenPayloadCompressor,Ot as initProvider,i as log,D as zeroGasOptions};
|
1
|
+
import{ethers as e,utils as t,Contract as a}from"ethers";var n;!function(e){e[e.DEBUG=8]="DEBUG",e[e.LOG=4]="LOG",e[e.WARN=2]="WARN",e[e.ERROR=1]="ERROR",e[e.SILENT=0]="SILENT"}(n||(n={}));class s{constructor(e){this.level=e}static overrideLogger(e){i=e}log(e,...t){if(this.level>=n.LOG){let a=e;e instanceof Function&&(a=e()),console.log((new Date).toISOString(),"INFO",a,...t)}}error(e,...t){if(this.level>=n.ERROR){let a=e;e instanceof Function&&(a=e()),console.error((new Date).toISOString(),"ERROR",a,...t)}}warn(e,...t){if(this.level>=n.WARN){let a=e;e instanceof Function&&(a=e()),console.warn((new Date).toISOString(),"WARN",a,...t)}}debug(e,...t){if(this.level>=n.DEBUG){let a=e;e instanceof Function&&(a=e()),console.debug((new Date).toISOString(),"DEBUG",a,...t)}}table(e,t){if(this.level>=n.DEBUG){let a=e;e instanceof Function&&(a=e()),void 0===t?console.table(a):console.table(a,t)}}}let i=new s(n.SILENT);const d={bsc:92360n,polygon:80662n,arbitrum:414810n,ethereum:94906n,avalanche:102011n,optimism:109683n},c={bsc:95785n,polygon:100000n,arbitrum:341712n,ethereum:97983n,avalanche:107322n,optimism:106373n},r={bsc:76191n,polygon:55000n,arbitrum:294000n,ethereum:67200n,avalanche:83930n,optimism:64000n},o={bsc:93650n,polygon:66000n,arbitrum:281000n,ethereum:65000n,avalanche:80450n,optimism:51000n},f={bsc:{constant:0n,multiplier:4700n},polygon:{constant:0n,multiplier:4700n},arbitrum:{constant:0n,multiplier:3000n},ethereum:{constant:0n,multiplier:2000n},avalanche:{constant:0n,multiplier:5000n},optimism:{constant:0n,multiplier:3000n}},l={bsc:{constant:0n,multiplier:4700n},polygon:{constant:0n,multiplier:4700n},arbitrum:{constant:0n,multiplier:3700n},ethereum:{constant:0n,multiplier:3700n},avalanche:{constant:0n,multiplier:4700n},optimism:{constant:0n,multiplier:3700n}},b={bsc:20000n,polygon:20000n,arbitrum:25000n,ethereum:15000n,avalanche:15000n,optimism:25000n},h={optimism:{perRoute:48n,perPath:0n,initialSingle:5278n,initialSplit:5278n,ethWeth:1000n,wethEth:3500n},arbitrum:{perRoute:108n,perPath:60n,initialSingle:2788n,initialSplit:2884n,ethWeth:1964n,wethEth:2188n}};var u;function p(e){return e===u.arbitrum||e===u.optimism}!function(e){e.bsc="bsc",e.arbitrum="arbitrum",e.polygon="polygon",e.ethereum="ethereum",e.avalanche="avalanche",e.optimism="optimism"}(u||(u={}));const x={bsc:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",arbitrum:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",polygon:"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",ethereum:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",avalanche:"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",optimism:"0x4200000000000000000000000000000000000006"},g={bsc:"0x9cbd1322c3d029d32357808665dcae5c286c7081",polygon:"0x2a1beadcebbb72ed3f1c6eda4a86c7f3fd963b1c",arbitrum:"0xd02e02821ed3a648a028918840fed818933610f7",ethereum:"0x6b7ac96a0698bbcd80dbb7b17130d0a94284bd4d",avalanche:"0x5781d7645ad1c0e3d19365324f0b910e8a977974",optimism:"0xe2f50042766bdea8bcbfa0ff6a94bab65f897826"},m={bsc:"0x451ef8d6b645a60115eb8b8bea76b39c0c761004",polygon:"0x030b8b7bf245e762736e65c0903295447b898c30",arbitrum:"0x79a556ef2c5b613db3dfa8797e6772c5aaf86834",ethereum:"0x39f97198c5dbc193eb962c4b3b7e447091a18eab",avalanche:"0x5ef960eb78b8cfc11e654d03beeb313badf5c7c0",optimism:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},C={arbitrum:"0x0000000000000000000000000000000000000066",optimism:"0x71762f1fdc36afc769a25dcd73226c6edca6832a",bsc:"0x0000000000000000000000000000000000000000",polygon:"0x0000000000000000000000000000000000000000",ethereum:"0x0000000000000000000000000000000000000000",avalanche:"0x0000000000000000000000000000000000000000"},I={bsc:"0xca11bde05977b3631167028862be2a173976ca11",arbitrum:"0xca11bde05977b3631167028862be2a173976ca11",polygon:"0xca11bde05977b3631167028862be2a173976ca11",ethereum:"0xca11bde05977b3631167028862be2a173976ca11",avalanche:"0xca11bde05977b3631167028862be2a173976ca11",optimism:"0xca11bde05977b3631167028862be2a173976ca11"},T={bsc:{address:"0xe9e7cea3dedca5984780bafc599bd69add087d56",decimals:18},arbitrum:{address:"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",decimals:6},polygon:{address:"0x2791bca1f2de4661ed88a30c99a7a9449aa84174",decimals:6},ethereum:{address:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",decimals:6},avalanche:{address:"0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664",decimals:6},optimism:{address:"0x7f5c764cbc14f9669b88837ca1490cca17c31607",decimals:6}},A={bsc:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18},arbitrum:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18},polygon:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18},ethereum:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18},avalanche:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18},optimism:{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18}},y={bsc:{address:x.bsc,decimals:18},arbitrum:{address:x.arbitrum,decimals:18},polygon:{address:x.polygon,decimals:18},ethereum:{address:x.ethereum,decimals:18},avalanche:{address:x.avalanche,decimals:18},optimism:{address:x.optimism,decimals:18}},E={bsc:25,arbitrum:25,polygon:25,ethereum:25,avalanche:25,optimism:10},k=18;function N(e,t,a){return t>a?e/10n**BigInt(t-a):t<a?e*10n**BigInt(a-t):e}function O(e,t,a){return N(e*t,k,a)}function S(e,t,a){const n={l1:{dest:e.l1[t],usd:e.l1[a].fee}};return void 0!==e.l2&&(n.l2={dest:e.l2[t],usd:e.l2[a].fee}),n}function P(e,t,a){const n=O(e,t.dest.fee,t.dest.decimals),s=O(e,t.usd,k);return void 0===a?{dest:n,unit:e,usd:s}:{dest:a.dest+n,unit:a.unit+e,usd:a.usd+s}}function D(){return{execution:{initial:0n,variable:{constant:0n,multiplier:0n},pathVariable:0n},price:{l1:{dest:{decimals:0,fee:0n},usd:0n}}}}function w(t){const{dest:a,unit:n,usd:s}=t;return{dest:a.toString(),unit:n.toString(),usd:e.utils.formatUnits(s,k)}}function _(e,t,a=!0){a&&i.log("[Best Rate Single]","Finding best rate");let n=e.map((()=>({dest:0n,unit:0n,usd:0n})));const s=void 0!==t.gas.price.l2?t.gas.price.l2:t.gas.price.l1,d=t.gas.execution;if(n=n.map((e=>P(d.initial,s,e))),n=n.map(((t,a)=>P(e[a].gas,s,t))),n=n.map(((t,a)=>P(d.variable.constant+d.variable.multiplier*BigInt(e[a].routeIndexes.length),s,t))),void 0!==t.gas.price.l2){const a=t.gas.l2Calldata,s=t.gas.price.l1;n=n.map(((t,n)=>(t=P(a.initialSingle,s,t),P(a.perRoute*BigInt(e[n].routeIndexes.length),s,t))))}a&&(i.debug("[Best Rate Single]","=== Gas Fees ==="),i.table((()=>n.map((e=>w(e))))));const c=e.map((({amountOut:e,gas:t,...a},s)=>({amountOut:e-n[s].dest,gasFee:n[s],...a})));let r=c.reduce(((e,t)=>{return a=e,(n=t).amountOut>a.amountOut?n:a;var a,n}),c.length>0?c[0]:{amountOut:0n,tokens:[],gasFee:{dest:0n,unit:0n,usd:0n},routeIndexes:[]});return a&&(i.debug("[Best Rate Single]","All possible results (gas deducted):"),i.table((()=>c.map((e=>{const{gasFee:t,...a}=v(e);return{...a,gasFee:t.dest}}))))),r.amountOut=r.amountOut+r.gasFee.dest,r}function v(e,t){const{amountOut:a,tokens:n,routeIndexes:s,gasFee:i}=e;let d=s;return void 0!==t&&(d=s.map((e=>t.getRouteInfo(e).name))),{amountOut:a.toString(),routes:d,tokens:n,gasFee:w(i)}}class R{constructor(e,t){this.itemWV=e,this.maxWeight=t;for(let e=0,t=this.itemWV.length;e<t;++e)this.itemWV[e].push([0,0n])}compute(){if(0===this.itemWV.length)return[];this.previousMaxValueMem=Array.from({length:this.maxWeight+1},(()=>-1n)),this.previousItemSelection=Array.from({length:this.maxWeight+1},(()=>[]));for(let e=0,t=this.itemWV[0].length;e<t;++e)for(let t=this.itemWV[0][e][0],a=this.maxWeight;t<=a;++t){const a=this.itemWV[0][e][1];this.previousMaxValueMem[t]<a&&(this.previousMaxValueMem[t]=a,this.previousItemSelection[t]=[[0,e]])}for(let e=1,t=this.itemWV.length;e<t;++e){this.currentMaxValueMem=Array.from({length:this.maxWeight+1},(()=>-1n)),this.currentItemSelection=Array.from({length:this.maxWeight+1},(()=>[]));for(let t=0,a=this.itemWV[e].length;t<a;++t){for(let a=this.itemWV[e][t][0],n=this.maxWeight;a<=n;++a){const n=a-this.itemWV[e][t][0],s=this.itemWV[e][t][1];this.previousMaxValueMem[n]>=0&&this.currentMaxValueMem[a]<s+this.previousMaxValueMem[n]&&(this.currentMaxValueMem[a]=s+this.previousMaxValueMem[n],this.currentItemSelection[a]=this.previousItemSelection[n].map((e=>[...e])),this.currentItemSelection[a].push([e,t]))}}let t=this.previousMaxValueMem;this.previousMaxValueMem=this.currentMaxValueMem,this.currentMaxValueMem=t;let a=this.previousItemSelection;this.previousItemSelection=this.currentItemSelection,this.currentItemSelection=a}return this.previousItemSelection[this.maxWeight].filter((e=>e[1]<this.itemWV[e[0]].length-1))}}const B=Array.from({length:100},((e,t)=>t+1));function M(e,t){return{paths:e.paths.map((e=>{let a="src -",n=e.routeIndexes;return void 0!==t&&(n=e.routeIndexes.map((e=>t.getRouteInfo(e).name))),e.tokens.forEach(((e,t)=>{a+=`${n[t]}-> ${e} -`})),a+=`${n[n.length-1]}-> dest`,a})),volumes:e.volumns,amount:e.amountOut.toString(),gasFee:{usd:e.gasFee.usd.toString(),dest:e.gasFee.dest.toString(),unit:e.gasFee.unit.toString()}}}const F=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",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:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],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:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",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:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",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:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}];class U{static createInterface(){return new t.Interface(F)}static connect(e,t){return new a(e,F,t)}}U.abi=F;const L=[{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall2.Call[]",name:"calls",type:"tuple[]"}],name:"aggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes[]",name:"returnData",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall2.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 Multicall2.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"nonpayable",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:"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 Multicall2.Call[]",name:"calls",type:"tuple[]"}],name:"tryAggregate",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall2.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bool",name:"requireSuccess",type:"bool"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall2.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 Multicall2.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"nonpayable",type:"function"}];class V{static createInterface(){return new t.Interface(L)}static connect(e,t){return new a(e,L,t)}}V.abi=L;const W=[{inputs:[{internalType:"contract IWardenPreTrade2",name:"_preTrade",type:"address"},{internalType:"contract IWETH",name:"_weth",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"partnerId",type:"uint256"},{indexed:!0,internalType:"contract IERC20",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"PartnerFee",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract IERC20",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ProtocolFee",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"srcAsset",type:"address"},{indexed:!1,internalType:"uint256",name:"srcAmount",type:"uint256"},{indexed:!0,internalType:"address",name:"destAsset",type:"address"},{indexed:!1,internalType:"uint256",name:"destAmount",type:"uint256"},{indexed:!0,internalType:"address",name:"trader",type:"address"},{indexed:!1,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"bool",name:"hasSplitted",type:"bool"}],name:"Trade",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract IWardenPreTrade2",name:"preTrade",type:"address"}],name:"UpdatedWardenPreTrade",type:"event"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"collectRemainingEther",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"_token",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"collectRemainingToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"preTrade",outputs:[{internalType:"contract IWardenPreTrade2",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IWardenSwap2",name:"_swap",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"address",name:"_deposits",type:"address"},{internalType:"contract IERC20",name:"_src",type:"address"},{internalType:"uint256",name:"_srcAmount",type:"uint256"},{internalType:"contract IERC20",name:"_dest",type:"address"},{internalType:"uint256",name:"_minDestAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"},{internalType:"uint256",name:"_partnerId",type:"uint256"},{internalType:"uint256",name:"_metaData",type:"uint256"}],name:"swap",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract IWardenSwap2",name:"_swap",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"address[]",name:"_deposits",type:"address[]"},{internalType:"uint256[]",name:"_volumes",type:"uint256[]"},{internalType:"contract IERC20",name:"_src",type:"address"},{internalType:"uint256",name:"_totalSrcAmount",type:"uint256"},{internalType:"contract IERC20",name:"_dest",type:"address"},{internalType:"uint256",name:"_minDestAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"},{internalType:"uint256",name:"_partnerId",type:"uint256"},{internalType:"uint256",name:"_metaData",type:"uint256"}],name:"swapSplit",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_receiver",type:"address"}],name:"tradeEthToWeth",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"_srcAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"}],name:"tradeWethToEth",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IWardenPreTrade2",name:"_preTrade",type:"address"}],name:"updateWardenPreTrade",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"weth",outputs:[{internalType:"contract IWETH",name:"",type:"address"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}];class q{static createInterface(){return new t.Interface(W)}static connect(e,t){return new a(e,W,t)}}q.abi=W;const X=[{inputs:[{internalType:"contract IWardenPreTrade2",name:"_preTrade",type:"address"},{internalType:"contract IWETH",name:"_weth",type:"address"},{internalType:"contract IArbAddressTable",name:"_addressTable",type:"address"},{internalType:"bool",name:"_autoRegisterAddressMapping",type:"bool"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"partnerId",type:"uint256"},{indexed:!0,internalType:"contract IERC20",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"PartnerFee",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract IERC20",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"wallet",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ProtocolFee",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"_enable",type:"bool"}],name:"SetAutoRegisterAddressMapping",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"srcAsset",type:"address"},{indexed:!1,internalType:"uint256",name:"srcAmount",type:"uint256"},{indexed:!0,internalType:"address",name:"destAsset",type:"address"},{indexed:!1,internalType:"uint256",name:"destAmount",type:"uint256"},{indexed:!0,internalType:"address",name:"trader",type:"address"},{indexed:!1,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"bool",name:"hasSplitted",type:"bool"}],name:"Trade",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract IWardenPreTrade2",name:"preTrade",type:"address"}],name:"UpdatedWardenPreTrade",type:"event"},{inputs:[],name:"addressTable",outputs:[{internalType:"contract IArbAddressTable",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"autoRegisterAddressMapping",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"collectRemainingEther",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"_token",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"collectRemainingToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"uint256",name:"_cursor",type:"uint256"}],name:"decodeSwapData",outputs:[{components:[{internalType:"address",name:"swap",type:"address"},{internalType:"address",name:"src",type:"address"},{internalType:"address",name:"dest",type:"address"},{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"srcAmount",type:"uint256"},{internalType:"uint256",name:"minDestAmount",type:"uint256"},{internalType:"uint256",name:"partnerId",type:"uint256"},{internalType:"uint256",name:"metaData",type:"uint256"}],internalType:"struct WardenDataDeserialize2.SwapData",name:"_swapData",type:"tuple"},{internalType:"uint256",name:"_newCursor",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"preTrade",outputs:[{internalType:"contract IWardenPreTrade2",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bool",name:"_enable",type:"bool"}],name:"setAutoRegisterAddressMapping",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IWardenSwap2",name:"_swap",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"address",name:"_deposits",type:"address"},{internalType:"contract IERC20",name:"_src",type:"address"},{internalType:"uint256",name:"_srcAmount",type:"uint256"},{internalType:"contract IERC20",name:"_dest",type:"address"},{internalType:"uint256",name:"_minDestAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"},{internalType:"uint256",name:"_partnerId",type:"uint256"},{internalType:"uint256",name:"_metaData",type:"uint256"}],name:"swap",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"swapCompressed",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract IWardenSwap2",name:"_swap",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"address[]",name:"_deposits",type:"address[]"},{internalType:"uint256[]",name:"_volumes",type:"uint256[]"},{internalType:"contract IERC20",name:"_src",type:"address"},{internalType:"uint256",name:"_totalSrcAmount",type:"uint256"},{internalType:"contract IERC20",name:"_dest",type:"address"},{internalType:"uint256",name:"_minDestAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"},{internalType:"uint256",name:"_partnerId",type:"uint256"},{internalType:"uint256",name:"_metaData",type:"uint256"}],name:"swapSplit",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"swapSplitCompressed",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_receiver",type:"address"}],name:"tradeEthToWeth",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"_srcAmount",type:"uint256"},{internalType:"address",name:"_receiver",type:"address"}],name:"tradeWethToEth",outputs:[{internalType:"uint256",name:"_destAmount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IWardenPreTrade2",name:"_preTrade",type:"address"}],name:"updateWardenPreTrade",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"weth",outputs:[{internalType:"contract IWETH",name:"",type:"address"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}];class H{static createInterface(){return new t.Interface(X)}static connect(e,t){return new a(e,X,t)}}function G(e){return x[e]}H.abi=X;const K="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";var z;function Q(e,t){return e.toLocaleLowerCase()===K&&(e=G(t)),e}!function(e){e[e.ETH2WETH=0]="ETH2WETH",e[e.WETH2ETH=1]="WETH2ETH",e[e.BESTRATE=2]="BESTRATE"}(z||(z={}));const Y=10n**BigInt(k),Z=100n*10n**BigInt(k);function $(e,t,a){return void 0!==a?a/e:e*t}function j(e,t,a,n,s,d){const c={};a=N(a,n,k);const r=$(e[s.address],a),o=Object.keys(e);for(let n=0,i=o.length;n<i;++n)if(o[n]===s.address)c[s.address]={fee:a,decimals:s.decimals};else{const s=t[o[n]];c[o[n]]={fee:$(e[o[n]],a,r),decimals:s}}const f={[d.address]:{fee:r/Y,decimals:d.decimals},...c};return i.log("[Gas Estimation]","Gas Price Unit",a.toString()),i.log("[Gas Estimation]","Gas price:",{usd:f[d.address].fee.toString()}),f}function J(e,t,a,n,s,d,c){const r=e.getTokenPriceRoutes(d.address,d.decimals,[s.address,n.address]),o={[s.address]:s.decimals,[n.address]:n.decimals,...e.corrTokenDecimals},f=function(e,t){const a=Object.keys(e),n={},s={};for(let d=0,c=a.length;d<c;++d){const c=_(e[a[d]],{gas:{execution:{initial:0n,variable:{constant:0n,multiplier:0n},pathVariable:0n},price:{l1:{dest:{decimals:0,fee:0n},usd:0n}}}},!1);i.debug(`Token price for ${a[d]}: ${c.amountOut}`),n[a[d]]=c,s[a[d]]=Z*Y/N(c.amountOut,t[a[d]],k)}return s}(r,o);i.debug((()=>f)),i.debug((()=>o));const l={l1:j(f,o,t,a,n,d)};return void 0!==c&&(l.l2=j(f,o,c,a,n,d)),l}var ee;!function(e){e[e.UniswapV2=0]="UniswapV2",e[e.UniswapV3=1]="UniswapV3",e[e.PancakeV3=2]="PancakeV3",e[e.VelodromeSS=3]="VelodromeSS",e[e.DMM=4]="DMM",e[e.CurvePlain=5]="CurvePlain",e[e.CurveMeta=6]="CurveMeta",e[e.CurvePlainSol=7]="CurvePlainSol",e[e.Iron=8]="Iron",e[e.Synapse=9]="Synapse",e[e.CurveMetaSol=10]="CurveMetaSol",e[e.CurveCrypto=11]="CurveCrypto",e[e.CurveTriCryptoNG=12]="CurveTriCryptoNG",e[e.CurveStableNG=13]="CurveStableNG",e[e.CurveLendingA=14]="CurveLendingA",e[e.CurveLendingCryptoZap=15]="CurveLendingCryptoZap",e[e.CurveLendingCryptoTwoZap=16]="CurveLendingCryptoTwoZap",e[e.CurveLido=17]="CurveLido",e[e.PolyDex=18]="PolyDex",e[e.FireBirdWeighted=19]="FireBirdWeighted",e[e.BalancerWeighted=20]="BalancerWeighted",e[e.BalancerStable=21]="BalancerStable",e[e.BalancerMetaStable=22]="BalancerMetaStable",e[e.BalancerBoostedStable=23]="BalancerBoostedStable",e[e.BalancerLinear=24]="BalancerLinear",e[e.BalancerLiquidityBootstrapping=25]="BalancerLiquidityBootstrapping",e[e.Biswap=26]="Biswap",e[e.DodoV1=27]="DodoV1",e[e.DodoV2=28]="DodoV2",e[e.Mdex=29]="Mdex",e[e.Mars=30]="Mars",e[e.Smoothy=31]="Smoothy",e[e.Shibaswap=32]="Shibaswap",e[e.GmxDex=33]="GmxDex",e[e.Solidly=34]="Solidly",e[e.VelodromeV2=35]="VelodromeV2",e[e.Synthetix=36]="Synthetix",e[e.Unknown=37]="Unknown"}(ee||(ee={}));const te=I.arbitrum,ae=[{id:"66d95ca4-28ff-45ab-b82a-15d54ed4197a",address:"0xdcc3a56e97a7448c64341e38867241f65168817d",name:"SUSHI",gas:80933n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xc35dadb65012ec5796536bd9864ed8773abc74c4",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"},{id:"35ae2524-0570-452c-ad57-8e0e627a9886",address:"0x493f1b81b05e29e86d9a4762944ed8b5fd2924a5",name:"UNI:V3F500",gas:111091n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:500n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:20,tickQuerier:"0x3ffecb3df6c24b3676cafd408b561065337326c9"},{id:"8db6276e-5297-49aa-a005-2182ba762857",address:"0x02800d3d33e7e9d32c586fcaaea0412e5a57792d",name:"UNI:V3F3000",gas:121189n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:3000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:20,tickQuerier:"0x3ffecb3df6c24b3676cafd408b561065337326c9"},{id:"3bb43bcb-170f-4b9a-97ac-95050f157714",address:"0x2c49bdff3acb931491d1c0231952d9718c516539",name:"UNI:V3F10000",gas:96497n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:10000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:20,tickQuerier:"0x3ffecb3df6c24b3676cafd408b561065337326c9"},{id:"2cb63ea5-b2d9-4edc-afdd-5f4028216a7b",address:"0x166612320d53575c91c8988ba73ca8b34297fcd5",name:"BALANCER:WETHWBTCUSDC",gas:125837n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x64541216bafffeec8ea535bb71fbc927831d0595000100000000000000000002",scalingFactors:[10000000000n,1n,1000000000000n],tokens:["0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f","0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[333333333333333333n,333333333333333334n,333333333333333333n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"a3bd5712-7180-4181-8ed9-fce7f095acfa",address:"0x2208705b6f232ef498d46514b5130192789e9dc8",name:"BALANCER:DAIUSDTUSDC",gas:161222n,model:ee.BalancerStable,isTradingAllowed:!0,aPrecision:1000n,scalingFactors:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0xda10009cbd5d07dd0cecc66161fc93d7c9000da1","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9","0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",poolId:"0x1533a3278f3f9141d5f820a184ea4b017fce2382000000000000000000000016",depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"aae33579-5d27-4c8e-acd7-cc3c00402552",address:"0x815f667a542653d89d44ff9d09b11dd7d4d78004",name:"BALANCER:BALWETH",gas:119645n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xcc65a812ce382ab909a11e434dbf75b34f1cc59d000200000000000000000001",scalingFactors:[1n,1n],tokens:["0x040d1edc9569d4bab2d15287dc5a4f10f56a56b8","0x82af49447d8a07e3bd95bd0d56f35241523fbab1"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[600000000000000000n,400000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"a29709c4-157d-462b-a2e5-7e0c7b364f9e",address:"0x81d10cbea2b7e2ce9589cfe48442a83f013885ab",name:"BALANCER:LINKWETH",gas:119150n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x651e00ffd5ecfa7f3d4f33d62ede0a97cf62ede2000200000000000000000006",scalingFactors:[1n,1n],tokens:["0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0xf97f4df75117a78c1a5a0dbb814af92458539fb4"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[200000000000000000n,800000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"3d8e0b66-8831-43bc-b2d6-361c43c4d419",address:"0xe2f50042766bdea8bcbfa0ff6a94bab65f897826",name:"BALANCER:STGUSDC",gas:116392n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x3a4c6d2404b5eb14915041e01f63200a82f4a343000200000000000000000065",scalingFactors:[1n,1000000000000n],tokens:["0x6694340fc020c5e6b96567843da2df01b2ce1eb6","0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"fa7866bc-f73c-4fba-8094-a4afc356385e",address:"0xafeb1dc3f5a10577ba84bc9df63cb74930b86bf0",name:"BALANCER:WETHVSTA",gas:109084n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xc61ff48f94d801c1ceface0289085197b5ec44f000020000000000000000004d",scalingFactors:[1n,1n],tokens:["0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0xa684cd057951541187f288294a1e1c2646aa2d24"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"71937b88-7990-4882-8d42-a4938505ef01",address:"0x24928cfc2688407061615ad76d9d396ded9b2f2b",name:"BALANCER:COMPWETH",gas:119161n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xa6625f741400f90d31e39a17b0d429a92e347a6000020000000000000000000e",scalingFactors:[1n,1n],tokens:["0x354a6da3fcde098f8389cad84b0182725c6c91de","0x82af49447d8a07e3bd95bd0d56f35241523fbab1"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[800000000000000000n,200000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"8e5c3a47-103e-4bb6-a753-d477db1a4f18",address:"0x7d125de51f4bbaabb1ba40791f88ffebe44d26d1",name:"BALANCER:GNOWETH",gas:119150n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x4a3a22a3e7fee0ffbb66f1c28bfac50f75546fc7000200000000000000000008",scalingFactors:[1n,1n],tokens:["0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0xa0b862f60edef4452f25b4160f177db44deb6cf1"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[200000000000000000n,800000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"7796b71c-fbd8-4344-9c92-4c738757eb37",address:"0xc9784ea2327b530fd57ee62abc8e8f0352943fd1",name:"BALANCER:MAIUSDTUSDC",gas:164646n,model:ee.BalancerStable,isTradingAllowed:!0,aPrecision:1000n,scalingFactors:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x3f56e0c36d275367b8c502090edf38289b3dea0d","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9","0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",poolId:"0x0510ccf9eb3ab03c1508d3b9769e8ee2cfd6fdcf00000000000000000000005d",depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"a8576203-25fb-4957-8b61-b07a01f1ca3b",address:"0xdc9c24fe7f44d9787fd381a65079b2a6fad4a557",name:"BALANCER:MCBWETH",gas:116190n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xb5b77f1ad2b520df01612399258e7787af63025d000200000000000000000010",scalingFactors:[1n,1n],tokens:["0x4e352cf164e64adcbad318c3a1e222e9eba4ce42","0x82af49447d8a07e3bd95bd0d56f35241523fbab1"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[600000000000000000n,400000000000000000n],depositAddress:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696"},{id:"7a6871f9-aee1-49ae-bd27-674641a0333b",address:"0x49ab6b33c750a6ffee148ad581aa34311b3898dd",name:"DODO:V1USDC",gas:255326n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0xbcc3401e16c25eaf4d3fed632ce3288503883b1f",pools:{"0x82af49447d8a07e3bd95bd0d56f35241523fbab1":{"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8":"0xfe176a2b1e1f67250d2903b8d25f56c0dabcd6b2"},"0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9":{"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8":"0xe4b2dfc82977dd2dce7e8d37895a6a8f50cbb4fb"},"0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f":{"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8":"0xb42a054d950dafd872808b3c839fbb7afb86e14c"}}},{id:"65bdfea2-439a-4217-a5ba-1a11b575068b",address:"0x521902ac8079bad162abc6636c8bd0b3e2de0f5e",name:"DODO:V2DVMUSDC",gas:141696n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xda4c4411c55b0785e501332354a036c04833b72b",pools:{"0x69eb4fa4a2fbd498c257c57ea8b7655a2559a581":{"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8":"0x6a58c68ff5c4e4d90eb6561449cc74a64f818da5"}}},{id:"00679168-e748-466e-9899-a00f2e26d7de",address:"0x719239a2521f5ad2451a5a6988a12454786b8575",name:"CURVE:TRICRYPTO",gas:363199n,model:ee.CurveCrypto,isTradingAllowed:!0,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0x8e0b8c8bb9db49a46697f3a5bb8a308e744821d2",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0x960ea3e3c7fb317332d990873d354e18d7645590",precision:1000000000000000000n,precisions:[1000000000000n,10000000000n,1n],tokens:["0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9","0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f","0x82af49447d8a07e3bd95bd0d56f35241523fbab1"]},{id:"f456db5b-5dd5-44d8-8288-03139af11572",address:"0x767e3e758ecf1bb294c7d948ab7333f02cca1d6e",name:"CURVE:2POOL",gas:138176n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x7f90122bf0700f9e7e1f688fe926940e8839f353",poolContract:"0x7f90122bf0700f9e7e1f688fe926940e8839f353",precision:1000000000000000000n,precisionMul:[1000000000000n,1000000000000n],aPrecision:100n,rates:[1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0xff970a61a04b1ca14834a43f5de4533ebddb5cc8","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"]},{id:"9625dc8d-5021-4682-a622-43638f5e9019",address:"0x294921d3d09dfa64f3b4f4e2e6025c49fb291718",name:"CURVE:REN",gas:132496n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x3e01dd8a5e1fb3481f0f589056b428fc308af0fb",poolContract:"0x3e01dd8a5e1fb3481f0f589056b428fc308af0fb",precision:1000000000000000000n,precisionMul:[10000000000n,10000000000n],aPrecision:100n,rates:[10000000000000000000000000000n,10000000000000000000000000000n],tokens:["0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f","0xdbf31df14b66535af65aac99c32e9ea844e14501"]},{id:"0edb879b-f7d0-4a38-8385-b80ff81aff7f",address:"0xda930db9e0636d3e21c5ec1641a1360ecd576a2d",name:"CURVE:MIM",model:ee.CurveMeta,isTradingAllowed:!0,gas:231322n,baseCacheExpires:0n,basePoolRouteId:"f456db5b-5dd5-44d8-8288-03139af11572",feeDenominator:10000000000n,aPrecision:100n,isCacheExists:!1,lpToken:"0x30df229cefa463e991e29d42db0bae2e122b2ac7",multicall:te,poolContract:"0x30df229cefa463e991e29d42db0bae2e122b2ac7",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a","0x7f90122bf0700f9e7e1f688fe926940e8839f353"]},{id:"33225472-5542-4d12-b4b8-4ffa7818928f",address:"0x8a632a907cd186c046a388cbf40abcd69f9f6144",name:"CURVE:FRAX+2CRV",model:ee.CurveMeta,isTradingAllowed:!0,gas:231322n,baseCacheExpires:0n,basePoolRouteId:"f456db5b-5dd5-44d8-8288-03139af11572",feeDenominator:10000000000n,aPrecision:100n,isCacheExists:!1,lpToken:"0xf07d553b195080f84f582e88ecdd54baa122b279",multicall:te,poolContract:"0xf07d553b195080f84f582e88ecdd54baa122b279",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x17fc002b466eec40dae837fc4be5c67993ddbd6f","0x7f90122bf0700f9e7e1f688fe926940e8839f353"]},{id:"b4aa5d7d-d596-41b9-bb78-0646f1bfd67c",address:"0x8b4102ce74e7615a1327e4307d3f584eb8ff07c5",name:"GMX",model:ee.GmxDex,isTradingAllowed:!0,gas:309213n,vaultContract:"0x489ee077994b6658eafa855c308275ead8097c4a",pricePrecision:1000000000000000000000000000000n,debtTokenContract:"0x45096e7aa921f27590f8f19e457794eb09678141"}],ne=[{id:"0",address:"0x0dea19cab88f45301a83c6b5eaa18e8387546afe",name:"WARDEN",gas:65916n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x3657952d7ba5a0a4799809b5b6fdff9ec5b46293",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xfbbcb3ce9944dd53a7ef447076d0e4e4811911365339bab292e4733d5b37a120"},{id:"1",address:"0xdb36b4bf9167ead6822db522d9b667fbb6e75c5d",name:"PANCAKEV2",gas:75294n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xca143ce32fe78f1f7019d7d551a6402fc5350c73",fee:9975n,feePrecision:10000n,pairBytecodeHash:"0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5"},{id:"2",address:"0x120b8d7102bd8abb7adfac5a93516db5229497d0",name:"PANCAKE",gas:66364n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xbcfccbde45ce874adcb698cc183debcf17952812",fee:998n,feePrecision:1000n,pairBytecodeHash:"0xd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66"},{id:"3",address:"0xd4f319ea1ee46595e1f48443bcadff0bfeee7f10",name:"DEFINIX",gas:72540n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x43ebb0cb9bd53a3ed928dd662095ace1cef92d19",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x898b8e59fbd4e8d6538b7d59d469440d56e24a77616ec248916ca9b36712dfe2"},{id:"4",address:"0xf632b0ad2e44cf40e3fb2369a11998a8de56dc4b",name:"APE",gas:66368n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x0841bd0b734e4f5853f0dd8d7ea041c241fb0da6",fee:998n,feePrecision:1000n,pairBytecodeHash:"0xf4ccce374816856d11f00e4069e7cada164065686fbef53c6167a63ec2fd8c5b"},{id:"5",address:"0x677ee749ba8ae558795f659440f7fbe78176321e",name:"TWIN",gas:63162n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x4e66fda7820c53c1a2f601f84918c375205eac3e",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x652b5a4fa6b1efd55c9821e56279c871f9999588a5472d22ab78b8ec61e2521e"},{id:"6",address:"0x6b75377a56f27d6eeabea6589547e2a863d4cf95",name:"WAULT",gas:75294n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xb42e3fe71b7e0673335b3331b3e1053bd9822570",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x9599db1eaa37ab366bf260f51beefce9296eb6197de387c533d905e9b82debe9"},{id:"7",address:"0x63d7897cef3a91167da5ca0f1c1e48714cad32ab",name:"PANTHER",gas:66364n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x670f55c6284c629c23bae99f585e3f17e8b9fc31",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x867d1354ae93986b4c49f35d8d7884f174264895ad8501d50d2cd365933d4aa5"},{id:"8",address:"0x6c216de4acc409777cc022b0cc255d5a958ffc62",name:"FAT",gas:63162n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xaba5ca9729294c2a49cb6e741f2b97b988e80407",fee:9975n,feePrecision:10000n,pairBytecodeHash:"0x2cfacfa13b2d16c4bb67512dc8c809e331070f22dd2bd6a1052984f835eb0121"},{id:"9",address:"0xe22231cc0e4c7ffbef23504ca072b15616c4500e",name:"BAKERY",gas:66483n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x01bf7c66c6bd861915cdaae475042d3c4bae16a7",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe2e87433120e32c4738a7d8f3271f3d872cbe16241d67537139158d90bac61d3"},{id:"10",address:"0x3b242e8b3b2ebb09cbb80ee8b73051a798e64f36",name:"JUL",gas:66345n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x553990f2cba90272390f62c5bdb1681ffc899675",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xb1e98e21a5335633815a8cfb3b580071c2e4561c50afd57a8746def9ed890b18"},{id:"11",address:"0x01e25c2bb785791ca48978b14a62a9b904346aed",name:"MDEX",gas:79901n,model:ee.Mdex,isTradingAllowed:!0,factory:"0x3cd1c46068daea5ebb0d3f55f6915b10648062b8",fee:0n,feePrecision:10000n,pairBytecodeHash:"0x0d994d996174b05cfc7bed897dc1b20b4c458fc8d64fe98bc78b3c64a6b4d093"},{id:"12",address:"0xb53f17b7bd19bee6153579ea8ca95ebe00e1eae2",name:"ELLIPSIS",gas:167762n,model:ee.CurvePlain,isTradingAllowed:!0,aPrecision:1n,feeDenominator:10000000000n,isUnderlying:!0,lendingPrecision:1000000000000000000n,lpToken:"0xaf4de8e872131ae328ce21d909c74705d3aaf452",poolContract:"0x160caed03795365f3a589f10c379ffa7d75d4e76",precision:1000000000000000000n,precisionMul:[1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0xe9e7cea3dedca5984780bafc599bd69add087d56","0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d","0x55d398326f99059ff775485246999027b3197955"]},{id:"13",address:"0x0cd12512ac262fff5441d34b72f4e9e921a39d92",name:"ACRYPTOS:ACS4",gas:159324n,model:ee.CurvePlain,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x83d69ef5c9837e21e2389d47d791714f5771f29b",poolContract:"0xb3f0c9ea1f05e312093fdb031e789a756659b0ac",precision:1000000000000000000n,precisionMul:[1n,1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955","0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3","0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d"]},{id:"14",address:"0x0e826d7f0fcda8fb22b4e5ddc1b13df2294f053f",name:"ACRYPTOS:VAI",gas:292815n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:600n,feeDenominator:10000000000n,lpToken:"0xeb7dc7b3bff60a450eff31edf1330355361ea5ad",multicall:I.bsc,poolContract:"0x191409d5a4effe25b0f4240557ba2192d18a191e",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x4bd17003473389a42daf6a0a729f6fdb328bbbd7","0x83d69ef5c9837e21e2389d47d791714f5771f29b"],basePoolRouteId:"13",isCacheExists:!0},{id:"15",address:"0x8314bc047114a9cb253787303dca9a54992488f7",name:"ACRYPTOS:UST",gas:292815n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:600n,feeDenominator:10000000000n,lpToken:"0xd3debe4a971e4492d0d61ab145468a5b2c23301b",multicall:I.bsc,poolContract:"0x99c92765efc472a9709ced86310d64c4573c4b77",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x23396cf899ca06c4472205fc903bdb4de249d6fc","0x83d69ef5c9837e21e2389d47d791714f5771f29b"],basePoolRouteId:"13",isCacheExists:!0},{id:"16",address:"0x32e33d9d8717bf0059b25d7f606114a9b35049f0",name:"ACRYPTOS:QUSD",gas:292815n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:600n,feeDenominator:10000000000n,lpToken:"0x49440376254290b3264183807a16450457f02b28",multicall:I.bsc,poolContract:"0x3919874c7bc0699cf59c981c5eb668823fa4f958",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xb8c540d00dd0bf76ea12e4b4b95efc90804f924e","0x83d69ef5c9837e21e2389d47d791714f5771f29b"],basePoolRouteId:"13",isCacheExists:!0},{id:"17",address:"0xe2582b433059463e83c5e8dddd015b3b9830f946",name:"NERVE",gas:207104n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0xf2511b5e4fb0e5e2d123004b672ba14850478c14",poolContract:"0x1b3771a66ee31180906972580ade9b81afc5fcdc",precision:1000000000000000000n,precisionMul:[1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955","0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d"]},{id:"18",address:"0xac8339448234237ce6311eb661cfa4578c9957e4",name:"DOP:4P",gas:212741n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x9116f04092828390799514bac9986529d70c3791",poolContract:"0x5162f992edf7101637446ecccd5943a9dcc63a8a",precision:1000000000000000000n,precisionMul:[1n,1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3","0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955","0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d"]},{id:"19",address:"0x0e7dbd5e56ffdb53cd098732598c4082eb8fe872",name:"DOP:UST",gas:207884n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x7edcdc8cd062948ce9a9bc38c477e6aa244dd545",poolContract:"0x830e287ac5947b1c0da865dfb3afd7cdf7900464",precision:1000000000000000000n,precisionMul:[1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0x23396cf899ca06c4472205fc903bdb4de249d6fc","0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955"]},{id:"20",address:"0x5f30620586c6c635c38535f9811e8ce29ef57a27",name:"DOP:2P",gas:197708n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x124166103814e5a033869c88e0f40c61700fca17",poolContract:"0x449256e20ac3ed7f9ae81c2583068f7508d15c02",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955"]},{id:"21",address:"0x02c66a602ab5b9866d58839ec14cb9ed157b88a4",name:"DOP:DOLLY",gas:205200n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0xaa5509ce0ecea324bff504a46fc61eb75cb68b0c",poolContract:"0x61f864a7dfe66cc818a4fd0baabe845323d70454",precision:1000000000000000000n,precisionMul:[1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0xe9e7cea3dedca5984780bafc599bd69add087d56","0x55d398326f99059ff775485246999027b3197955","0xff54da7caf3bc3d34664891fc8f3c9b6dea6c7a5"]},{id:"22",address:"0x174db639683104e39bb5537d759963fb646c26a1",name:"DODO:V2DPPBUSD",gas:89223n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xafe0a75dffb395eaabd0a7e1bbbd0b11f8609eef",pools:{"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x0fe261aee0d1c4dfddee4102e82dd425999065f4"},"0x2170ed0880ac9a755fd29b2688956bd959f933f8":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x9ba8966b706c905e594acbb946ad5e29509f45eb"},"0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0xe3c58d202d4047ba227e437b79871d51982deeb7"},"0x4691937a7508860f876c9c0a2a617e7d9e945d4b":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x88cbf433471a0cd8240d2a12354362988b4593e5"}}},{id:"23",address:"0x1a48f4827d96bfd03e1d5a4b3c34f6d2313cba08",name:"BISWAP",gas:69620n,model:ee.Biswap,isTradingAllowed:!0,factory:"0x858e3312ed3a876947ea49d572a7c42de08af7ee",fee:0n,feePrecision:1000n,pairBytecodeHash:"0xfea293c909d87cd4153593f077b76bb7e94340200f4ee84211ae8e4f9bd7ffdf"},{id:"24",address:"0x384041cd83125b669f9e692b03ae536a00acc5b1",name:"JETSWAP",gas:76212n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x0eb58e5c8aa63314ff5547289185cc4583dfcbd5",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x3125d0a15fa7af49ce234ba1cf5f931bad0504242e0e1ee9fcd7d1d7aa88c651"},{id:"25",address:"0x5ad333eaf52e48ab19095805f552a0734bb57252",name:"SMOOTHY",gas:141572n,model:ee.Smoothy,isTradingAllowed:!0,poolContract:"0xe5859f4efc09027a9b718781dcb2c6910cac6e91",expectedImplAddress:"0x965cc658158a7689fbb6c4df735aa435c500c29b",expectedTokens:{"0xe9e7cea3dedca5984780bafc599bd69add087d56":0,"0x55d398326f99059ff775485246999027b3197955":1,"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d":2,"0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3":3,"0xb7f8cd00c5a06c0537e2abff0b58033d02e5e094":4,"0x23396cf899ca06c4472205fc903bdb4de249d6fc":5}},{id:"29",address:"0xd4c354e0ec0a0866b418cf9007a9f6dba7e9721f",name:"LATTE",gas:67220n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x4dce5bdb81b8d5edb66ca1b8b2616a8e0dd5f807",fee:9975n,feePrecision:10000n,pairBytecodeHash:"0xd186cd0235b0839707c25b5e4a518a7e67159a1c74f36680d920c0d82097db36"},{id:"30",address:"0xa3bad596dfbaac51e28f1015b7bc3f0644073ce8",name:"BABY",gas:66407n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x86407bea2078ea5f5eb5a52b2caa963bc1f889da",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x48c8bec5512d397a5d512fbb7d83d515e7b6d91e9838730bd1aa1b16575da7f5"},{id:"31",address:"0x96c7427837db437875c6f5ae439417571db4bec5",name:"DSG",gas:63483n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x73d9f93d53505cb8c4c7f952ae42450d9e859d10",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x772d76e02b5a3aeeef00b07a18a744c893227f52ecb6e3d431da85a229ed6a1d"},{id:"32",address:"0x579543fa36cef7d00111e0ec9d8991cde71a57de",name:"SUSHI",gas:66302n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xc35dadb65012ec5796536bd9864ed8773abc74c4",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"},{id:"33",address:"0xf049f5a5917c6f036756b4abc7e1c0bfb4cd824e",name:"DODO:V1BUSD",gas:246497n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0xca459456a45e300aa7ef447dbb60f87cccb42828",pools:{"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x6064dbd0ff10bfed5a797807042e9f63f18cfe10"}}},{id:"34",address:"0x6be09f2b3c69476f7a3942f6cb0f5717656a9ee0",name:"DODO:V1USDT",gas:239380n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0xca459456a45e300aa7ef447dbb60f87cccb42828",pools:{"0xe9e7cea3dedca5984780bafc599bd69add087d56":{"0x55d398326f99059ff775485246999027b3197955":"0xbe60d4c4250438344bec816ec2dec99925deb4c7"}}},{id:"35",address:"0xe0eb29dd528ab01ab2ca93d47c283ab97ef726e2",name:"DODO:V2DPPBUSD2",gas:102565n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xafe0a75dffb395eaabd0a7e1bbbd0b11f8609eef",pools:{"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x9a24b2051bf094219ab7b435671b77cba06415f6"}}},{id:"36",address:"0xe66ed920794f1f7d29062f20bf40df0802352d37",name:"AUTOSHARK",gas:78722n,model:ee.Biswap,isTradingAllowed:!0,factory:"0xe759dd4b9f99392be64f1050a6a8018f73b53a13",fee:0n,feePrecision:10000n,pairBytecodeHash:"0x024c8482358faf5eeea4ff7f0a18734bc482bf2e61ec04711fcee726756287ee"},{id:"37",address:"0x58a3a7d39dfa18fdba2bb4321857dc2852c8a88b",name:"MARS",gas:90714n,model:ee.Mars,isTradingAllowed:!0,factory:"0x6f12482d9869303b998c54d91bcd8bccba81f3be",fee:0n,feePrecision:1000n,pairBytecodeHash:"0x1bebc382ef02a42adebba8056f178019d890f3b232007a868603393bddd2f1ab"},{id:"38",address:"0xa6b93c5e9c1646513fda96583624d7219311596d",name:"KYBER",gas:112657n,model:ee.DMM,isTradingAllowed:!0,pools:{"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":{"0xfe56d5892bdffc7bf58f2e84be1b2c32d21c308b":"0x6170b6d96167346896169b35e1e9585feab873bb","0xd6cce248263ea1e2b8cb765178c944fc16ed0727":"0x97dbaf4ad688aed04817121301a005b710e6067a"},"0x55d398326f99059ff775485246999027b3197955":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0xc3dac2049616326e7d596ce52062789d96373b55","0x633237c6fa30fae46cc5bb22014da30e50a718cc":"0xf81e106c5b44ba9a993fc1f456a4c8e54c47cf34","0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":"0xec303ce1edbebf7e71fc7b350341bb6a6a7a6381"},"0x3944ac66b9b9b40a6474022d6962b6caa001b5e3":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0xf8e61e301a44df4e2dbaba570d2cb09039289b31"},"0xd07e82440a395f3f3551b42da9210cd1ef4f8b24":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x3e95e07550e9798272130ab65b58f2f17b3f7c57"},"0xe83ce6bfb580583bd6a62b4be7b34fc25f02910d":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0x3a853210ef83a75ef4a7c406f22b9f861cdf3c94"}}},{id:"39",address:"0x59254c308831f6ed3a88cc61c81e1e33d8957ed3",name:"SYNAPSE:STABLESWAP",gas:198274n,model:ee.Synapse,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0xa4b7bc06ec817785170c2dbc1dd3ff86cdcdcc4c",poolContract:"0x28ec0b36f0819ecb5005cab836f4ed5a2eca4d13",precision:1000000000000000000n,precisionMul:[1n,1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0x23b891e5c62e0955ae2bd185990103928ab817b3","0xe9e7cea3dedca5984780bafc599bd69add087d56","0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d","0x55d398326f99059ff775485246999027b3197955"]},{id:"40",name:"DODO:V2DPPUSDT",address:"0xebcb90d057cc5363787f5918ad5cbb71a3d18853",gas:101414n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xafe0a75dffb395eaabd0a7e1bbbd0b11f8609eef",pools:{"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":{"0x55d398326f99059ff775485246999027b3197955":"0x6098a5638d8d7e9ed2f952d35b2b67c34ec6b476"},"0x59802ac95f2399c929a096171c1bee93c27dae90":{"0x55d398326f99059ff775485246999027b3197955":"0x9dd96e239cf22806af02671518fada1c9f614339"}}},{id:"41",name:"DODO:V2DVMWBNB",address:"0xd3c1e9276f5ea8ec2e503d8106378f81f188ee1f",gas:108925n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x790b4a80fb1094589a3c0efc8740aa9b0c1733fb",pools:{"0x67ee3cb086f8a16f34bee3ca72fad36f7db929e2":{"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c":"0xd534fae679f7f02364d177e9d44f1d15963c0dd7"}}},{id:"42",name:"DODO:V2DVMBUSD",address:"0xf35d96492d59b7f279c1d1a50a653c8fd53cdb79",gas:127590n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x790b4a80fb1094589a3c0efc8740aa9b0c1733fb",pools:{"0xca1acab14e85f30996ac83c64ff93ded7586977c":{"0xe9e7cea3dedca5984780bafc599bd69add087d56":"0xdd2ec03c97381f0cb591bc62a26d0508a0388a32"}}},{id:"935b41a7-d9ed-4218-aed6-005449ae441d",name:"ELK",address:"0x02800d3d33e7e9d32c586fcaaea0412e5a57792d",gas:81064n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x31affd875e9f68cd6cd12cee8943566c9a4bba13",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x84845e7ccb283dec564acfcd3d9287a491dec6d675705545a2ab8be22ad78f31"},{id:"09b62e64-0e42-49dd-abba-3b450337c174",name:"UNI:V3F100",address:"0x0261fe3d25e470c387f456cd68b69eaf20b21063",gas:100559n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,factory:"0xdb1d10011ad0ff90774d0c6bb92e5c5c8b4461f7",fee:100n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",depositAddress:"0x9db45b627ee95ac86b059171cb17dc266be857fb",maxInitializedTicks:15,tickQuerier:"0xb964976c3c4f60278fc755ffc5a65008a147b014"},{id:"6b17220c-7dd8-4418-8900-e235218055c3",name:"UNI:V3F500",address:"0x2eca6cfc9f78c9dd10e03520613a647ac8b5fdcf",gas:94279n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,factory:"0xdb1d10011ad0ff90774d0c6bb92e5c5c8b4461f7",fee:500n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",depositAddress:"0x9db45b627ee95ac86b059171cb17dc266be857fb",maxInitializedTicks:15,tickQuerier:"0xb964976c3c4f60278fc755ffc5a65008a147b014"},{id:"31fe588e-0ed9-47cf-985a-32b9dab462f1",name:"UNI:V3F3000",address:"0x156928f341f8618ec88820f85b4ea52468d088e3",gas:121189n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,factory:"0xdb1d10011ad0ff90774d0c6bb92e5c5c8b4461f7",fee:3000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",depositAddress:"0x9db45b627ee95ac86b059171cb17dc266be857fb",maxInitializedTicks:15,tickQuerier:"0xb964976c3c4f60278fc755ffc5a65008a147b014"},{id:"a5cf8539-b979-415b-94d1-323bf5675c6c",name:"UNI:V3F10000",address:"0xa2b12a2816d2cbe083b45367e97824ec2bb2d97a",gas:93957n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,factory:"0xdb1d10011ad0ff90774d0c6bb92e5c5c8b4461f7",fee:10000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",depositAddress:"0x9db45b627ee95ac86b059171cb17dc266be857fb",maxInitializedTicks:15,tickQuerier:"0xb964976c3c4f60278fc755ffc5a65008a147b014"},{id:"24e64ee3-d46d-4767-b5f0-545fe7ef21bb",name:"PNCK:V3F100",address:"0xb048ed7234277fe37db6fa00ed4d3d54296c275b",gas:126259n,gasPerInitializedTick:30363n,gasPerTick:4171n,model:ee.PancakeV3,isTradingAllowed:!0,poolDeployer:"0x41ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9",fee:100n,pairBytecodeHash:"0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2",depositAddress:"0x5781d7645ad1c0e3d19365324f0b910e8a977974",maxInitializedTicks:15,tickQuerier:"0xc05d55315c78d8884d31656d56b20c14f89ef68e"},{id:"623fc76e-7140-4aa0-b191-7b8c45e51490",name:"PNCK:V3F500",address:"0x5ef960eb78b8cfc11e654d03beeb313badf5c7c0",gas:119984n,gasPerInitializedTick:30363n,gasPerTick:4171n,model:ee.PancakeV3,isTradingAllowed:!0,poolDeployer:"0x41ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9",fee:500n,pairBytecodeHash:"0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2",depositAddress:"0x5781d7645ad1c0e3d19365324f0b910e8a977974",maxInitializedTicks:15,tickQuerier:"0xc05d55315c78d8884d31656d56b20c14f89ef68e"},{id:"e413625b-abdb-479b-b2e7-aaabefc295af",name:"PNCK:V3F2500",address:"0x2e92474af285b41b39a0701109ebc22195f3583f",gas:146894n,gasPerInitializedTick:30363n,gasPerTick:4171n,model:ee.PancakeV3,isTradingAllowed:!0,poolDeployer:"0x41ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9",fee:2500n,pairBytecodeHash:"0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2",depositAddress:"0x5781d7645ad1c0e3d19365324f0b910e8a977974",maxInitializedTicks:15,tickQuerier:"0xc05d55315c78d8884d31656d56b20c14f89ef68e"},{id:"46296528-4057-448c-a1cc-5e06dc93463d",name:"PNCK:V3F10000",address:"0xac35f8f91ddc8eb19acb3c5374f1191a748353c6",gas:119662n,gasPerInitializedTick:30363n,gasPerTick:4171n,model:ee.PancakeV3,isTradingAllowed:!0,poolDeployer:"0x41ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9",fee:10000n,pairBytecodeHash:"0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2",depositAddress:"0x5781d7645ad1c0e3d19365324f0b910e8a977974",maxInitializedTicks:15,tickQuerier:"0xc05d55315c78d8884d31656d56b20c14f89ef68e"}],se=I.ethereum,ie=[{id:"e8297329-0ece-4e9c-bf6b-781042b78c83",address:"0x7968edaef6e70a406bcbc799682e05e512a42b68",name:"UNI:V2",gas:75475n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f"},{id:"17e4b849-5bdf-40c2-b130-a801dc63d1f3",address:"0x3a24e3d0c1cac841478ff6d7de5d7cefd7350724",name:"SUSHI",gas:76113n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xc0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"},{id:"272c8b87-e3c5-4f11-8dc4-7df2d87c9fe7",address:"0xe9f10830f90bac287e16dc70875786e9a6d97eb4",name:"SHIBA",gas:84935n,model:ee.Shibaswap,isTradingAllowed:!0,factory:"0x115934131916c8b277dd010ee02de363c09d037c",fee:0n,feePrecision:1000n,pairBytecodeHash:"0x65d1a3b1e46c6e4f1be1ad5f99ef14dc488ae0549dc97db9b30afe2241ce1c7a"},{id:"422c9fbd-66df-4a5f-8134-541a20cd3174",address:"0x30e679d1743e866842026f81fc2c91fcbff19857",name:"UNI:V3F100",gas:99193n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,depositAddress:"0xeb1f1b38cbc17b4eb123d560b463eff774bdae02",isTradingAllowed:!0,factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:100n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:15,tickQuerier:"0x8b4102ce74e7615a1327e4307d3f584eb8ff07c5"},{id:"6705b39c-e1e8-4293-9f3a-a9b4f34e9cf7",address:"0x679ee78d6c5829eb5d9f82390f78c5fd893ba51e",name:"UNI:V3F500",gas:111091n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0xeb1f1b38cbc17b4eb123d560b463eff774bdae02",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:500n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:15,tickQuerier:"0x8b4102ce74e7615a1327e4307d3f584eb8ff07c5"},{id:"23450784-75d9-408d-b310-6efea9533fff",address:"0x4f065eefac4be3b4a6ed77770acb54fa1b9ab36e",name:"UNI:V3F3000",gas:121189n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0xeb1f1b38cbc17b4eb123d560b463eff774bdae02",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:3000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:15,tickQuerier:"0x8b4102ce74e7615a1327e4307d3f584eb8ff07c5"},{id:"1ca886d6-09e2-48f1-a197-f350b4c71da5",address:"0xdf4abddf946bd2741b37bc8c96b8dc0094eb0b6d",name:"UNI:V3F10000",gas:96497n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0xeb1f1b38cbc17b4eb123d560b463eff774bdae02",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:10000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:15,tickQuerier:"0x8b4102ce74e7615a1327e4307d3f584eb8ff07c5"},{id:"43bfe1d7-999d-42c3-a644-981bc0e2b207",address:"0xa4a9f50628716091425d861179a6cd8395665931",name:"CURVE:3POOL",gas:190858n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!0,lendingPrecision:1000000000000000000n,lpToken:"0x6c3f90f043a72fa612cbac8115ee7e52bde6e490",poolContract:"0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x6b175474e89094c44da98b954eedeac495271d0f","0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","0xdac17f958d2ee523a2206206994597c13d831ec7"]},{id:"6c6c80c3-1bc6-4974-9bbf-2d8cf7ca192e",address:"0x31568cbfe0722e9d25fb7805d515f4974aa18bef",name:"CURVE:TRICRYPTO2",gas:392159n,model:ee.CurveCrypto,isTradingAllowed:!0,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0xc4ad29ba4b3c580e6d59105fff484999997675ff",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0xd51a44d3fae010294c616388b506acda1bfaae46",precision:1000000000000000000n,precisions:[1000000000000n,10000000000n,1n],tokens:["0xdac17f958d2ee523a2206206994597c13d831ec7","0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"]},{id:"57296e7b-3033-44f2-8790-49fc98fa9ac9",address:"0x35ff8cfd744f3289200b59cfe392f13b8e03d40f",name:"CURVE:MIM",gas:317380n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:0n,basePoolRouteId:"43bfe1d7-999d-42c3-a644-981bc0e2b207",feeDenominator:10000000000n,isCacheExists:!1,lpToken:"0x5a6a4d54456819380173272a5e8e9b9904bdf41b",multicall:se,poolContract:"0x5a6a4d54456819380173272a5e8e9b9904bdf41b",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3","0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"]},{id:"c78a0ce9-8048-4c3c-9ca8-2964fa5af914",address:"0xf3fd9b964dbb6f4071c41af2202aa34670ca244a",name:"CURVE:MIMUST",gas:139443n,model:ee.CurvePlain,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x55a8a39bc9694714e2874c1ce77aa1e599461e18",poolContract:"0x55a8a39bc9694714e2874c1ce77aa1e599461e18",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3","0xa47c8bf37f92abed4a126bda807a7b7498661acd"]},{id:"13053082-9871-4681-9b0c-0365bae2de08",address:"0xd28136e0566ebfaa826bca532673f41f3415c351",name:"CURVE:UST",gas:313462n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:600n,basePoolRouteId:"43bfe1d7-999d-42c3-a644-981bc0e2b207",feeDenominator:10000000000n,isCacheExists:!0,lpToken:"0x94e131324b6054c0d789b190b2dac504e4361b53",multicall:se,poolContract:"0x890f4e345b1daed0367a877a1612f86a1f86985f",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xa47c8bf37f92abed4a126bda807a7b7498661acd","0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"]},{id:"114dd100-de92-4f35-b159-3a76feaddb28",address:"0x773cfb4b1028400cf92d6177ceb95b223a4e2eb3",name:"CURVE:CVXETH",gas:366025n,model:ee.CurveCrypto,isTradingAllowed:!0,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0x3a283d9c08e8b55966afb64c515f5143cf907611",maxA:4000000000n,minA:4000n,maxGamma:20000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0xb576491f1e6e5e62f1d8f26062ee822b40b0e0d4",precision:1000000000000000000n,precisions:[1n,1n],tokens:["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b"]},{id:"0ff7b35f-948c-4b68-b46f-7526eb58e373",address:"0xddd82e011c1ae7c035085e714d4fa8b916b3bd42",name:"CURVE:FRAX",gas:349642n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:0n,basePoolRouteId:"43bfe1d7-999d-42c3-a644-981bc0e2b207",feeDenominator:10000000000n,isCacheExists:!1,lpToken:"0xd632f22692fac7611d2aa1c0d552930d43caed3b",multicall:se,poolContract:"0xd632f22692fac7611d2aa1c0d552930d43caed3b",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x853d955acef822db058eb8505911ed77f175b99e","0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"]},{id:"89b6f314-eaa8-4bdb-b300-a9bca162e16a",address:"0xbda10b763bfc6faf7e2733fb00efb610e859fb8e",name:"CURVE:REN",gas:173168n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!0,lendingPrecision:1000000000000000000n,lpToken:"0x49849c98ae39fff122806c06791fa73784fb3675",poolContract:"0x93054188d876f558f4a66b2ef1d97d16edf0895b",precision:1000000000000000000n,precisionMul:[10000000000n,10000000000n],rates:[10000000000000000000000000000n,10000000000000000000000000000n],tokens:["0xeb4c2781e4eba804ce9a9803c67d0893436bb27d","0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"],balancesArgs:"int128"},{id:"8ee937cc-24a5-41d4-ab22-8b076163bd0a",address:"0x402b6aaf6eae5b5d71608726dac9ec644273d7ed",name:"CURVE:STETH",gas:206038n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x06325440d014e39736583c165c2963ba99faf14e",poolContract:"0xdc24316b9ae028f1497c275eb9192a3ea0f67022",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0xae7ab96520de3a18e5e111b5eaab095312d7fe84"],aPrecision:100n},{id:"68b1ec16-4de5-4e06-969e-93127ae1c119",address:"0x09664deaf1ad177a17a7d82942bedca87eac6574",name:"CURVE:CRVETH",gas:259851n,model:ee.CurveCrypto,isTradingAllowed:!0,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0xed4064f376cb8d68f770fb1ff088a3d0f3ff5c4d",maxA:4000000000n,minA:4000n,maxGamma:20000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0x8301ae4fc9c624d1d396cbdaa1ed877821d7c511",precision:1000000000000000000n,precisions:[1n,1n],tokens:["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0xd533a949740bb3306d119cc777fa900ba034cd52"]},{id:"8be72d56-5eda-4f7b-a37c-e7a08252a4a8",address:"0x3a194cde5026d745a0fd6e83d26b083592ecc6a0",name:"CURVE:LUSD",gas:347516n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:0n,basePoolRouteId:"43bfe1d7-999d-42c3-a644-981bc0e2b207",feeDenominator:10000000000n,isCacheExists:!1,lpToken:"0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca",multicall:se,poolContract:"0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x5f98805a4e8be255a32880fdec7f6728c6568ba0","0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"]},{id:"b2c2e45c-4cc2-4bd3-8eed-4f6f8c4948e7",address:"0xc1d0e72135d38c9b84ade2689e992f656dd31cd4",name:"CURVE:GUSD",gas:361077n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:600n,basePoolRouteId:"43bfe1d7-999d-42c3-a644-981bc0e2b207",feeDenominator:10000000000n,isCacheExists:!0,lpToken:"0xd2967f45c4f384deea880f807be904762a3dea07",multicall:se,poolContract:"0x4f062658eaaf2c1ccf8c8e36d6824cdf41167956",precision:1000000000000000000n,precisionMul:[10000000000000000n,1n],rates:[10000000000000000000000000000000000n,1000000000000000000n],tokens:["0x056fd409e1d7a124bd7017459dfea2f387b6d5cd","0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"]},{id:"56cf1fc3-79a8-460e-b9d7-4d8254639c2c",address:"0xdbf093f64a60b7abcc9721f52903537ab5f74699",name:"DODO:V1USDC",gas:225458n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0x3a97247df274a17c59a3bd12735ea3fcdfb49950",pools:{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0x75c23271661d9d143dcb617222bc4bec783eff34"},"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0x2109f78b46a789125598f5ad2b7f243751c2934d"},"0xdac17f958d2ee523a2206206994597c13d831ec7":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0xc9f93163c99695c6526b799ebca2207fdf7d61ad"}}},{id:"bd8299ed-2dbc-4b30-aa0b-c9ec5975a4bc",address:"0xd5c8c2cfed4237dfb50234500829c2d92170a840",name:"DODO:V1USDT",gas:198904n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0x3a97247df274a17c59a3bd12735ea3fcdfb49950",pools:{"0x43dfc4159d86f3a37a5a4b3d4580b888ad7d4ddd":{"0xdac17f958d2ee523a2206206994597c13d831ec7":"0x8876819535b48b551c9e97ebc07332c7482b4b2d"}}},{id:"a32c5f86-6752-45fd-9451-c4d13027c03d",address:"0xcde8b956ffd7b7f719347cd1ace76f5272f2d575",name:"DODO:V2DVMUSDC",gas:198150n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x72d220ce168c4f361dd4dee5d826a01ad8598f6c",pools:{"0xd502f487e1841fdc805130e13eae80c61186bc98":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0x22591994bc89174a5bdcec57c82c881b65f9b121"}}},{id:"dea21c2d-ed5e-41af-98ca-8777c8499ba1",address:"0x2b50b463b20183b350d3d2bf5df4da6e2918a360",name:"DODO:V2DSPUSDT",gas:114344n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x6fddb76c93299d985f4d3fc7ac468f9a168577a4",pools:{"0x6b175474e89094c44da98b954eedeac495271d0f":{"0xdac17f958d2ee523a2206206994597c13d831ec7":"0x3058ef90929cb8180174d74c507176cca6835d73"}}},{id:"99a252b5-67fa-4c50-9107-5fdacf5922df",address:"0xcde8b956ffd7b7f719347cd1ace76f5272f2d575",name:"DODO:V2DSPUSDC",gas:148288n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x6fddb76c93299d985f4d3fc7ac468f9a168577a4",pools:{"0xca37530e7c5968627be470081d1c993eb1deaf90":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0xaa89cab926dcd65b3779aa98d9342fd9a21e5d1c"}}},{id:"9a998ecc-efde-4a2c-9b02-421519667be0",address:"0x436d12651df7ac472c12b52d103d5487cc24cddc",name:"DODO:V2DVMNEAR",gas:120083n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x72d220ce168c4f361dd4dee5d826a01ad8598f6c",pools:{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":{"0x85f17cf997934a597031b2e18a9ab6ebd4b9f6a4":"0x983dfba1c0724786598af0e63a9a6f94aabd24a1"}}},{id:"419c7577-4d18-4694-be70-897a8db765d4",address:"0x30d2a6159438cc53026dfe8b518e839646498f5f",name:"DODO:V2DVMWETH",gas:118808n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x72d220ce168c4f361dd4dee5d826a01ad8598f6c",pools:{"0x03e173ad8d1581a4802d3b532ace27a62c5b81dc":{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":"0x031816fd297228e4fd537c1789d51509247d0b43"}}},{id:"2a5decdc-da75-4442-a5ad-7bc58d1640b",address:"0xc954074bef805afa738eb8015ad91f2c6ae91b55",name:"SYNAPSE:STABLESWAP",gas:197928n,model:ee.Synapse,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x1b84765de8b7566e4ceaf4d0fd3c5af52d3dde4f",poolContract:"0x1116898dda4015ed8ddefb84b6e8bc24528af2d8",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x6b175474e89094c44da98b954eedeac495271d0f","0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","0xdac17f958d2ee523a2206206994597c13d831ec7"]},{id:"d3129387-f6ea-46b1-9c3c-12d11b7cb736",address:"0x5369806f04c3079035d296681614d1d12a479467",name:"SMOOTHY",gas:215284n,model:ee.Smoothy,isTradingAllowed:!0,expectedImplAddress:"0x965cc658158a7689fbb6c4df735aa435c500c29b",expectedTokens:{"0xdac17f958d2ee523a2206206994597c13d831ec7":0,"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":1,"0x6b175474e89094c44da98b954eedeac495271d0f":2,"0x0000000000085d4780b73119b644ae5ecd22b376":3,"0x57ab1ec28d129707052df4df418d58a2d46d5f51":4,"0x4fabb145d64652a948d72533023f6e7a623c7c53":5,"0x8e870d67f660d95d5be530380d0ec0bd388289e1":6,"0x056fd409e1d7a124bd7017459dfea2f387b6d5cd":7},poolContract:"0xe5859f4efc09027a9b718781dcb2c6910cac6e91"},{id:"5ae0403e-fadc-4251-b845-a1334b3519ec",address:"0x29790cfc03790dfdbf28b745cf8bf9c15ca1085e",name:"KYBER",gas:102847n,model:ee.DMM,isTradingAllowed:!0,pools:{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":{"0xdac17f958d2ee523a2206206994597c13d831ec7":"0x306121f1344ac5f84760998484c0176d7bfb7134"},"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":{"0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202":"0x61639d6ec06c13a96b5eb9560b359d7c648c7759","0xdac17f958d2ee523a2206206994597c13d831ec7":"0xce9874c42dce7fffbe5e48b026ff1182733266cb","0xd7dcd9b99787c619b4d57979521258d1a7267ad7":"0xe69ba3f5ffe577bba3a2bf8ce949f7875d4c67db"},"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599":{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":"0x1cf68bbc2b6d3c6cfe1bd3590cf0e10b06a05f17","0xdac17f958d2ee523a2206206994597c13d831ec7":"0xd343d5dba2fba55eef58189619c05e33cab95ca1"},"0x9f52c8ecbee10e00d9faaac5ee9ba0ff6550f511":{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":"0x9a56f30ff04884cb06da80cb3aef09c6132f5e77"},"0x0c0f2b41f758d66bb8e694693b0f9e6fae726499":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0xe0ca51b6cfac04b215c3b6e473e3ec1412c93fc7"},"0x8f8221afbb33998d8584a2b05749ba73c37a938a":{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":"0xa97642500517c728ce1339a466de0f10c19034cd"},"0x3845badade8e6dff049820680d1f14bd3903a5d0":{"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":"0x5ba740fcc020d5b9e39760cbd2fe236586b9dc0a"},"0x196f4727526ea7fb1e17b2071b3d8eaa38486988":{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"0xa07c19d92985f6b0de939678b32cf23b305d8ca9"},"0xd7dcd9b99787c619b4d57979521258d1a7267ad7":{"0xdac17f958d2ee523a2206206994597c13d831ec7":"0xdeb01e683ff0d2e3adb852a03df28e1ba7c99774"},"0x656c00e1bcd96f256f224ad9112ff426ef053733":{"0xdac17f958d2ee523a2206206994597c13d831ec7":"0x898e2fef4cef5592485251fab6da7c819a2df291"}}},{id:"8bef5a14-69ec-4d4d-b84f-3ee0118ede0e",address:"0xf374c9ef1fbd5c431417e6d07abadc0a7963a52d",name:"BALANCER:BTCWETH",gas:139901n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xa6f548df93de924d73be7d25dc02554c6bd66db500020000000000000000000e",scalingFactors:[10000000000n,1n],tokens:["0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"11d99fc2-f942-43fa-97f0-231f6e28dfed",address:"0x7421a865675c1c084d5ba55456c226f683b1768f",name:"BALANCER:LIDOETH",gas:218502n,model:ee.BalancerMetaStable,isTradingAllowed:!0,aPrecision:1000n,tokens:["0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],poolId:"0x32296969ef14eb0c6d29669c550d4a0449130230000200000000000000000080",scalingFactors:[1000000000000000000n,1000000000000000000n],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",multicall:se,rateProviders:["0x72d07d7dca67b8a406ad1ec34ce969c90bfee768",""],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"96c17720-7963-41e7-a9a3-bab09f4fd1c5",address:"0x82694a1aa56b32f99c8c14d9f5194d0c4f95d2fe",name:"BALANCER:3USD",gas:162412n,model:ee.BalancerStable,isTradingAllowed:!0,aPrecision:1000n,scalingFactors:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x6b175474e89094c44da98b954eedeac495271d0f","0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","0xdac17f958d2ee523a2206206994597c13d831ec7"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",poolId:"0x06df3b2bbb68adc8b0e302443692037ed9f91b42000000000000000000000063",depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"05e24f50-9715-448a-b968-04f0a2934947",address:"0xa2484cdf796d806b67ffcfead8b2cfd946938956",name:"BALANCER:BALWETH",gas:145877n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x5c6ee304399dbdb9c8ef030ab642b10820db8f56000200000000000000000014",scalingFactors:[1n,1n],tokens:["0xba100000625a3754423978a60c9317c58a424e3d","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[800000000000000000n,200000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"9ff164b5-1a93-45d1-843b-b58562768358",address:"0x78d1ab83bc2624f4df6f651c3db0502482087ad7",name:"BALANCER:DAIWETH",gas:120337n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x0b09dea16768f0799065c475be02919503cb2a3500020000000000000000001a",scalingFactors:[1n,1n],tokens:["0x6b175474e89094c44da98b954eedeac495271d0f","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[400000000000000000n,600000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"d51cd9a7-257b-4a9b-b804-ee134bfa3098",address:"0x1d13a3e25e0a2ff1bd55847c498571707b4bf4da",name:"BALANCER:EGLWETH",gas:130122n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xb0401ab1108bd26c85a07243dfdf09f4821d76a200020000000000000000007f",scalingFactors:[1n,1n],tokens:["0x1e83916ea2ef2d7a6064775662e163b2d4c330a7","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"06050b9f-0713-46f1-8ee2-6e46cd56efb7",address:"0x62e58e7640e4bc480f705cb9a70f5cf75b70412a",name:"BALANCER:GNOWETH",gas:136594n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xf4c0dd9b82da36c07605df83c8a416f11724d88b000200000000000000000026",scalingFactors:[1n,1n],tokens:["0x6810e776880c02933d47db1b9fc05908e5386b96","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[800000000000000000n,200000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"86d078d8-4dd0-420e-ae70-29241a81c2a2",address:"0x58d05b6724aaab423489620a5ed09500ef1aa7f4",name:"BALANCER:MKRWETH",gas:139610n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xaac98ee71d4f8a156b6abaa6844cdb7789d086ce00020000000000000000001b",scalingFactors:[1n,1n],tokens:["0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[600000000000000000n,400000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"3fb31f34-95ef-4f18-8179-997487f80dde",address:"0x097fd5ec9974ad81647dac7357b5cd224c39f81a",name:"BALANCER:LINKWETH",gas:137413n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xe99481dc77691d8e2456e5f3f61c1810adfc1503000200000000000000000018",scalingFactors:[1n,1n],tokens:["0x514910771af9ca656af840dff83e8264ecf986ca","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"b84b0d1e-e3bc-462d-8ec0-c937f2578f1f",address:"0x96276f37c91b0c1d0ac819b38cc22af7fb7543a2",name:"BALANCER:USDCWETH",gas:151951n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x96646936b91d6b9d7d0c47c496afbf3d6ec7b6f8000200000000000000000019",scalingFactors:[1000000000000n,1n],tokens:["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"9c606808-b23f-4b0a-af9c-444247586d6a",address:"0xb3699f2caea2f8e974fece2bab5455ae0c6a4933",name:"BALANCER:SNXWETH",gas:194764n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x072f14b85add63488ddad88f855fda4a99d6ac9b000200000000000000000027",scalingFactors:[1n,1n],tokens:["0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"f2d268f4-5056-4bd6-b2a1-5da7cbde2d52",address:"0x77156558864426a16c740dc552043cdcd407a004",name:"BALANCER:BTCSTABLE",gas:193784n,model:ee.BalancerStable,isTradingAllowed:!0,scalingFactors:[10000000000000000000000000000n,10000000000000000000000000000n,1000000000000000000n],tokens:["0x2260fac5e5542a773aa44fbcfedf7c193bc2c599","0xeb4c2781e4eba804ce9a9803c67d0893436bb27d","0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6"],aPrecision:1000n,poolId:"0xfeadd389a5c427952d8fdb8057d6c8ba1156cc56000000000000000000000066",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"cd6e7fa3-6a67-4cf5-95e3-d8b86f847b02",address:"0x642a715580a2856c9c881ef0454f1a52ae00c090",name:"BALANCER:FEIWETH",gas:145313n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1n,1n],tokens:["0x956f47f50a910163d8bf957cf5846d573e7f87ca","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],weights:[300000000000000000n,700000000000000000n],poolId:"0x90291319f1d4ea3ad4db0dd8fe9e12baf749e84500020000000000000000013c",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"479e5b0a-187d-44f3-9755-7276ed7da403",address:"0x5600247239afd0ada239119fe68e33b78937a456",name:"BALANCER:SRMWETH",gas:140273n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x231e687c9961d3a27e6e266ac5c433ce4f8253e4000200000000000000000023",scalingFactors:[1n,1n],tokens:["0x476c5e26a75bd202a9683ffd34359c0cc15be0ff","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"},{id:"4b057398-e168-4b06-8159-bc492fff66f6",address:"0x25c74baefd70e06f9dabfa149f59189f45d7c0e7",name:"BALANCER:AKITAWETH",gas:131202n,model:ee.BalancerLiquidityBootstrapping,isTradingAllowed:!0,poolId:"0xc065798f227b49c150bcdc6cdc43149a12c4d75700020000000000000000010b",scalingFactors:[1n,1n],tokens:["0x3301ee63fb29f863f2333bd4466acb46cd8323e6","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[0n,0n],depositAddress:"0xd31b571125c872dc16c4c6c9279b41b311958468"}],de=[{id:"0",address:"0xaffadeecff79052817701ea2196d96b3be0418dd",name:"QUICK",gas:65220n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x5757371414417b8c6caad45baef941abc7d3ab32",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f"},{id:"1",address:"0xd0d4d6434a80d19b023cf44a67ecab1ee8a62dec",name:"SUSHI",gas:62341n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xc35dadb65012ec5796536bd9864ed8773abc74c4",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"},{id:"2-1",address:"0x6ea2d9125d3bfe30b1f2cd6262d9d9eb88919434",name:"CURVE:AAVE",gas:712619n,model:ee.CurveLendingA,isTradingAllowed:!0,poolContract:"0x445fe580ef8d70ff569ab36e80c647af338db351",lpToken:"0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171",aPrecision:100n,feeDenominator:10000000000n,precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],tokens:["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"]},{id:"2-2",address:"0x19f5fa8937fd18dd2f8c00768fe5d7bf48a69cfd",name:"CURVE:ATRICRYPTO",gas:0n,model:ee.CurveCrypto,isTradingAllowed:!1,lpToken:"0x8096ac61db23291252574d49f036f0f9ed8ab390",aMultiplier:100n,feeDenominator:10000000000n,noiseFee:100000n,minA:2700n,maxA:27000000n,isAPrecise:!0,minGamma:10000000000n,maxGamma:10000000000000000n,poolContract:"0x751b1e21756bdbc307cbcc5085c042a0e9aaef36",precision:1000000000000000000n,precisions:[1n,10000000000n,1n],tokens:["0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171","0x5c2ed810328349100a66b82b78a1791b101c9d61","0x28424507fefb6f7f8e9d3860f56504e4e5f5f390"]},{id:"2",address:"0x19f5fa8937fd18dd2f8c00768fe5d7bf48a69cfd",name:"CURVE:ATRICRYPTOZAP",gas:1199223n,model:ee.CurveLendingCryptoZap,isTradingAllowed:!0,basePoolId:"2-1",poolId:"2-2",poolContract:"0x3fcd5de6a9fc8a99995c406c77dda3ed7e406f81",nStablecoins:3,tokens:["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"]},{id:"3",address:"0x9686824e88fe37987e8c6f17e1c699bfa9de7652",name:"WAULT",gas:64333n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xa98ea6356a316b44bf710d5f9b6b4ea0081409ef",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x1cdc2246d318ab84d8bc7ae2a3d81c235f3db4e113f4c6fdc1e2211a9291be47"},{id:"4",address:"0x06331385f30d0ac565cc5a2e5742efa69470a4a1",name:"DFYN",gas:62341n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xe7fb3e833efe5f9c441105eb65ef8b261266423b",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xf187ed688403aa4f7acfada758d8d53698753b998a3071b06f1b777f4330eaf3"},{id:"5",address:"0x0a5aef7dad9c0e1d9f5ac06796a623f0cff18237",name:"APE",gas:61955n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xcf083be4164828f00cae704ec15a36d711491284",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x511f0f358fe530cda0859ec20becf391718fdf5a329be02f4c95361f3d6a42d8"},{id:"6",address:"0xbc924a6716226ae350f1241e6e44dcfd22fe4c65",name:"KYBER",gas:95221n,model:ee.DMM,isTradingAllowed:!0,pools:{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"0x3904ac366d348636694cb6720aa1540e76441b1b","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063":"0x7018c0bd73255c8966d0b26634e0bc0c7595d255","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619":"0x95d708e9ee04b0136b98579141624d19c89b9d68","0x4e3decbb3645551b8a19f0ea1678079fcb33fb4c":"0xa1219dbe76eecbf7571fed6b020dd9154396b70e","0x767058f11800fba6a682e73a6e79ec5eb74fac8c":"0xbb2d00675b775e0f8acd590e08da081b2a36d3a6","0xbd1463f02f61676d53fd183c2b19282bff93d099":"0x439e6a13a5ce7fdca2cc03bf31fb631b3f5ef157","0x6fb2415463e949af08ce50f83e94b7e008babf07":"0xa623aacf9eb4fc0a29515f08bdabb0d8ce385cf7","0xfade2934b8e7685070149034384fb7863860d86e":"0xa0fb4487c0935f01cbf9f0274fe3cdb21a965340","0x3a3e7650f8b9f667da98f236010fbf44ee4b2975":"0x2616f7285bdcb9c3d0422745b1c8a5751e0ea204"},"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270":{"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063":"0x45963db838a070cf7be8e7046fd63e23d376c665","0x1c954e8fe737f99f68fa1ccda3e51ebdb291948c":"0x37e6449b0e99befd2a708ea048d970f4ff4dc65d"},"0x1c954e8fe737f99f68fa1ccda3e51ebdb291948c":{"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619":"0xd8b9e9444fcbf26bea4badd6142dd6a962bca86a"},"0xc1c93d475dc82fe72dbc7074d55f5a734f8ceeae":{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"0x3f1f398887525d2d9acd154ec5e4a3979adffae6"}}},{id:"7",address:"0x0a175cdfae27b92609f8cae4a860673ca62a3c6d",name:"BALANCER:P1",gas:110586n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1n,1000000000000n,1n,1n],tokens:["0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3"],weights:[250000000000000000n,250000000000000000n,250000000000000000n,250000000000000000n],poolId:"0x0297e37f1873d2dab4487aa67cd56b58e2f27875000100000000000000000002",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x0a175cdfae27b92609f8cae4a860673ca62a3c6d"},{id:"8",address:"0x62ae64f166d35dd97daab85ce55ef440baeec3b9",name:"BALANCER:P2",gas:117068n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1000000000000n,1n,1n,1n,1n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3","0xd6df932a45c0f255f85145f286ea0b292b21c90b"],weights:[200000000000000000n,200000000000000000n,200000000000000000n,200000000000000000n,200000000000000000n],poolId:"0x36128d5436d2d70cab39c9af9cce146c38554ff0000100000000000000000008",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x62ae64f166d35dd97daab85ce55ef440baeec3b9"},{id:"9",address:"0xfefbaba274204bfc9af7da6c932fb80b47218f7f",name:"BALANCER:P3",gas:112183n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[10000000000n,1000000000000n,1n],tokens:["0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"],weights:[333333333333333333n,333333333333333333n,333333333333333334n],poolId:"0x03cd191f589d12b0582a99808cf19851e468e6b500010000000000000000000a",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0xfefbaba274204bfc9af7da6c932fb80b47218f7f"},{id:"10",address:"0x2246f96a0f1ff0bb9006a7cddd3d521dc78f23db",name:"BALANCER:P4",gas:114192n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1n,1n,1n,1n],tokens:["0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3","0xd6df932a45c0f255f85145f286ea0b292b21c90b"],weights:[250000000000000000n,250000000000000000n,250000000000000000n,250000000000000000n],poolId:"0xce66904b68f1f070332cbc631de7ee98b650b499000100000000000000000009",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x2246f96a0f1ff0bb9006a7cddd3d521dc78f23db"},{id:"11",address:"0x026b25ffad87be1dce9d8fc675b9f27b2dc7e94a",name:"BALANCER:P5",gas:116983n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1n,1000000000000n,1n,1n,1n],tokens:["0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x580a84c73811e1839f75d86d75d88cca0c241ff4","0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3","0xa3fa99a148fa48d14ed51d610c367c61876997f1"],weights:[200000000000000000n,200000000000000000n,200000000000000000n,200000000000000000n,200000000000000000n],poolId:"0xf461f2240b66d55dcf9059e26c022160c06863bf000100000000000000000006",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x026b25ffad87be1dce9d8fc675b9f27b2dc7e94a"},{id:"12",address:"0x88447266354c276d9cf46c875d1d1c518baf8f5c",name:"BALANCER:P6",gas:111005n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1n,1n,1000000000000n,1n,1n,1n,1n,1n],tokens:["0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a","0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x580a84c73811e1839f75d86d75d88cca0c241ff4","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x831753dd7087cac61ab5644b308642cc1c33dc13","0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3","0xc3fdbadc7c795ef1d6ba111e06ff8f16a20ea539"],weights:[125000000000000000n,125000000000000000n,125000000000000000n,125000000000000000n,125000000000000000n,125000000000000000n,125000000000000000n,125000000000000000n],poolId:"0x32fc95287b14eaef3afa92cccc48c285ee3a280a000100000000000000000005",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x88447266354c276d9cf46c875d1d1c518baf8f5c"},{id:"13",address:"0x1af67ed784fd304005ebdbcdf5f0cfa6807d50a1",name:"BALANCER:P7",gas:113861n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[1000000000000n,1n,1n,1n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x50b728d8d964fd00c2d0aad81718b71311fef68a","0x5fe2b58c013d7601147dcdd68c143a77499f5531","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"],weights:[250000000000000000n,250000000000000000n,250000000000000000n,250000000000000000n],poolId:"0x4e7f40cd37cee710f5e87ad72959d30ef8a01a5d00010000000000000000000b",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x1af67ed784fd304005ebdbcdf5f0cfa6807d50a1"},{id:"14",address:"0x2751f56399ae84650f385d7d6d014d5310371ee1",name:"BALANCER:P8",gas:109224n,model:ee.BalancerWeighted,isTradingAllowed:!0,scalingFactors:[10000000000n,1n,1n],tokens:["0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x85955046df4668e1dd369d2de9f3aeb98dd2a369"],weights:[333333333333000000n,333333333334000000n,333333333333000000n],poolId:"0x991aeafbe1b1c7ac8348dc623ae350768d0c65b3000100000000000000000007",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x2751f56399ae84650f385d7d6d014d5310371ee1"},{id:"16",address:"0x279b280bc5ad9115214dff935ee588aafe582caa",name:"JETSWAP",gas:60000n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x668ad0ed2622c62e24f0d5ab6b6ac1b9d2cd4ac7",fee:999n,feePrecision:1000n,pairBytecodeHash:"0x505c843b83f01afef714149e8b174427d552e1aca4834b4f9b4b525f426ff3c6"},{id:"17",address:"0x46d33aba505136d81a26a3329ec2be264e144c47",name:"POLYDEX",gas:300000n,model:ee.PolyDex,isTradingAllowed:!0,factory:"0xeaa98f7b5f7bfbcd1af14d0efaa9d9e68d82f640",fee:10n,feePrecision:10000n,pairBytecodeHash:"0xf60eec85709051eb86026776e0ece6269f1ab16f3af55442e19958beb5239ae2",weight:50},{id:"18",address:"0x315dc0e454f4904df58f2da90decf6167059ce8a",name:"IRON:IS3USD",gas:180728n,model:ee.Iron,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0xb4d09ff3da7f9e9a2ba029cb0a81a989fd7b8f17",poolContract:"0x837503e8a8753ae17fb8c8151b8e6f586defcb57",precision:1000000000000000000n,precisionMul:[1000000000000n,1000000000000n,1n],rates:[1000000000000000000000000000000n,1000000000000000000000000000000n,1000000000000000000n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063"]},{id:"19",address:"0xbb47628fa97409b85eb317e5a45a810b0bfddf69",name:"FIREBIRD:W50",gas:133478n,model:ee.FireBirdWeighted,isTradingAllowed:!0,factory:"0x5de74546d3b86c8df7feec30253865e1149818c8",fee:20n,feePrecision:10000n,pairBytecodeHash:"0x585665f39ba6ff2e62371f7788ded6b903667db133ab8153a17136b5033ab330",weight:50},{id:"20",address:"0x5d39269949945618239c1e9142f0b3d72acf305b",name:"FIREBIRD:3FBIRD",gas:193614n,model:ee.CurvePlainSol,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x4a592de6899ff00fbc2c99d7af260b5e7f88d1b4",poolContract:"0x01c9475dbd36e46d1961572c8de24b74616bae9e",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"]},{id:"21",address:"0x1e2e128eec94a5a33f962c2375495e91fd2aae85",name:"BALANCER:P9",gas:156629n,model:ee.BalancerStable,isTradingAllowed:!0,scalingFactors:[1000000000000000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000000000000000n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x2e1ad108ff1d8c782fcbbb89aad783ac49586756","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"],aPrecision:1000n,poolId:"0x0d34e5dd4d8f043557145598e4e2dc286b35fd4f000000000000000000000068",vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x1e2e128eec94a5a33f962c2375495e91fd2aae85"},{id:"22",address:"0x7fce0fa189c47714bd0f1d7ee49c1c7aec6ad93f",name:"BALANCER:P10",gas:155206n,model:ee.BalancerStable,isTradingAllowed:!0,tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0xa3fa99a148fa48d14ed51d610c367c61876997f1","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"],aPrecision:1000n,poolId:"0x06df3b2bbb68adc8b0e302443692037ed9f91b42000000000000000000000012",scalingFactors:[1000000000000000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000000000000000n],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0x7fce0fa189c47714bd0f1d7ee49c1c7aec6ad93f"},{id:"23",address:"0x4cbfba4a1b4e7c3de12541dd27fccd04029ddd2c",name:"BALANCER:P11",gas:103806n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xcf354603a9aebd2ff9f33e1b04246d8ea204ae9500020000000000000000005a",scalingFactors:[10000000000n,1n],tokens:["0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0x4cbfba4a1b4e7c3de12541dd27fccd04029ddd2c"},{id:"24",address:"0xab78027f63bc71db1ce49a879d36c8c0b9acc531",name:"BALANCER:P12",gas:131590n,model:ee.BalancerStable,isTradingAllowed:!0,aPrecision:1000n,poolId:"0xfeadd389a5c427952d8fdb8057d6c8ba1156cc5600020000000000000000001e",scalingFactors:[10000000000000000000000000000n,10000000000000000000000000000n],tokens:["0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0xdbf31df14b66535af65aac99c32e9ea844e14501"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",depositAddress:"0xab78027f63bc71db1ce49a879d36c8c0b9acc531"},{id:"25",address:"0x51fce76156230322bc7ef329466de03a17cac55a",name:"BALANCER:P13",gas:108223n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x10f21c9bd8128a29aa785ab2de0d044dcdd79436000200000000000000000059",scalingFactors:[1000000000000n,1n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0x51fce76156230322bc7ef329466de03a17cac55a"},{id:"26",address:"0x26ca72487e89131ef99bb7ea7d01e370bffd9266",name:"BALANCER:P14",gas:108101n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0xb2634e2bfab9664f603626afc3d270be63c09ade000200000000000000000021",scalingFactors:[10000000000n,1n],tokens:["0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xe2aa7db6da1dae97c5f5c6914d285fbfcc32a128"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[500000000000000000n,500000000000000000n],depositAddress:"0x26ca72487e89131ef99bb7ea7d01e370bffd9266"},{id:"27",address:"0xd947938e917c3395074a0d5cc9b9490521bfbfb2",name:"BALANCER:P15",gas:114430n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x7c9cf12d783821d5c63d8e9427af5c44bad92445000100000000000000000051",scalingFactors:[1n,1n,1n],tokens:["0x2c89bbc92bd86f8075d1decc58c7f4e0107f286b","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0x7dff46370e9ea5f0bad3c4e29711ad50062ea7a4"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[333333333333333333n,333333333333333333n,333333333333333334n],depositAddress:"0xd947938e917c3395074a0d5cc9b9490521bfbfb2"},{id:"28",address:"0xaa20d3409991b61adc8213b103798863c8fbdfc5",name:"BALANCER:P16",gas:107109n,model:ee.BalancerWeighted,isTradingAllowed:!0,poolId:"0x614b5038611729ed49e0ded154d8a5d3af9d1d9e00010000000000000000001d",scalingFactors:[1n,1n,1n],tokens:["0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619","0xf501dd45a1198c2e1b5aef5314a68b9006d842e0"],vaultContract:"0xba12222222228d8ba445958a75a0704d566bf2c8",weights:[400000000000000000n,200000000000000000n,400000000000000000n],depositAddress:"0xaa20d3409991b61adc8213b103798863c8fbdfc5"},{id:"29-1",address:"0x458a2a773a4be86cd3197aaaff8b23b122b8637f",name:"CURVE:ATRICRYPTO3",gas:0n,model:ee.CurveCrypto,isTradingAllowed:!1,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0xdad97f7713ae9437fa9249920ec8507e5fbb23d3",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0x92215849c439e1f8612b6646060b4e3e5ef822cc",precision:1000000000000000000n,precisions:[1n,10000000000n,1n],tokens:["0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171","0x5c2ed810328349100a66b82b78a1791b101c9d61","0x28424507fefb6f7f8e9d3860f56504e4e5f5f390"]},{id:"29",address:"0x458a2a773a4be86cd3197aaaff8b23b122b8637f",name:"CURVE:ATRICRYPTO3ZAP",gas:1348065n,model:ee.CurveLendingCryptoZap,isTradingAllowed:!0,basePoolId:"2-1",poolId:"29-1",nStablecoins:3,poolContract:"0x1d8b86e3d88cdb2d34688e87e72f388cb541b7c8",tokens:["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"]},{id:"30-1",address:"0xd89cdbd3c1299ed978248cc59091c9ac40ae44c4",name:"CURVE:EURTUSD",gas:0n,model:ee.CurveCrypto,isTradingAllowed:!1,poolContract:"0xb446bf7b8d6d4276d0c75ec0e3ee8dd7fe15783a",aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0x600743b1d8a96438bd46836fd34977a00293f6aa",maxA:4000000000n,minA:4000n,maxGamma:20000000000000000n,minGamma:10000000000n,noiseFee:100000n,precision:1000000000000000000n,precisions:[1000000000000n,1n],tokens:["0x7bdf330f423ea880ff95fc41a280fd5ecfd3d09f","0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171"]},{id:"30",address:"0xd89cdbd3c1299ed978248cc59091c9ac40ae44c4",name:"CURVE:EURTUSDZAP",gas:976835n,model:ee.CurveLendingCryptoTwoZap,isTradingAllowed:!0,basePoolId:"2-1",nCoins:2,nStablecoins:3,poolContract:"0x225fb4176f0e20cdb66b4a3df70ca3063281e855",poolId:"30-1",tokens:["0x7bdf330f423ea880ff95fc41a280fd5ecfd3d09f","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"]},{id:"31",address:"0x374fd28edf5e7191f804d622c6bc821d11a89975",name:"CURVE:FRAX3CRV",gas:1152286n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:0n,basePoolRouteId:"2-1",feeDenominator:10000000000n,isCacheExists:!1,lpToken:"0x5e5a23b52cb48f5e70271be83079ca5bc9c9e9ac",multicall:I.polygon,poolContract:"0x5e5a23b52cb48f5e70271be83079ca5bc9c9e9ac",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x45c32fa6df82ead1e2ef74d17b76547eddfaff89","0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171"]},{id:"32",address:"0xd7acd8e1f8aeb18722ce69a46acc776271ebf839",name:"CURVE:REN",gas:470804n,model:ee.CurveLendingA,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,lpToken:"0xf8a57c1d3b9629b77b6726a042ca48990a84fb49",poolContract:"0xc2d95eef97ec6c17551d45e77b590dc1f9117c67",precision:1000000000000000000n,precisionMul:[10000000000n,10000000000n],tokens:["0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6","0xdbf31df14b66535af65aac99c32e9ea844e14501"]},{id:"33",address:"0x1f9c96e6e7679671e9ae14e70b23bef7d8537621",name:"CURVE:2JPY",gas:131951n,model:ee.CurvePlain,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,lpToken:"0xe8dcea7fb2baf7a9f4d9af608f06d78a687f8d9a",poolContract:"0xe8dcea7fb2baf7a9f4d9af608f06d78a687f8d9a",precision:1000000000000000000n,precisionMul:[1n,1n],tokens:["0x8343091f2499fd4b6174a46d067a920a3b851ff9","0x6ae7dfc73e0dde2aa99ac063dcf7e8a63265108c"],isUnderlying:!1,lendingPrecision:1000000000000000000n,rates:[1000000000000000000n,1000000000000000000n]},{id:"34",address:"0x3b0425caff209ff2f5a942c9a7529a8ecdc61c3d",name:"CURVE:4EUR",gas:155296n,model:ee.CurvePlain,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0xad326c253a84e9805559b73a08724e11e49ca651",poolContract:"0xad326c253a84e9805559b73a08724e11e49ca651",precision:1000000000000000000n,precisionMul:[1n,1n,10000000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000n,10000000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x4e3decbb3645551b8a19f0ea1678079fcb33fb4c","0xe2aa7db6da1dae97c5f5c6914d285fbfcc32a128","0xe111178a87a3bff0c8d18decba5798827539ae99","0x7bdf330f423ea880ff95fc41a280fd5ecfd3d09f"]},{id:"35",address:"0x35d0697dda64e1a95c107e539c772c8dc6944117",name:"DODO:V1USDT",gas:219602n,model:ee.DodoV1,isTradingAllowed:!0,factoryContract:"0x357c5e9cfa8b834edcef7c7aabd8f9db09119d11",pools:{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"0x813fddeccd0401c4fa73b092b074802440544e52"}}},{id:"36",address:"0x1cbff260f27085cb1ef0af9874a75216e9ad8a2f",name:"DODO:V2DVMUSDT",gas:114801n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0x79887f65f83bdf15bcc8736b5e5bcdb48fb8fe13",pools:{"0xe4bf2864ebec7b7fdf6eeca9bacae7cdfdaffe78":{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"0x581c7db44f2616781c86c331d31c1f09db87a746"}}},{id:"37",address:"0x95053b0cc0828437d0de875743cb052d560daf02",name:"DODO:V2DPPUSDC",gas:78608n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xd24153244066f0afa9415563bfc7ba248bfb7a51",pools:{"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619":{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"0x5333eb1e32522f1893b7c9fea3c263807a02d561"},"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270":{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"0x10dd6d8a29d489bede472cc1b22dc695c144c5c7"},"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"0xa0020444b98f67b77a3d6de6e66af11c87da086e"},"0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6":{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"0xe020008465cd72301a18b97d33d73bf44858a4b7"}}},{id:"38",address:"0x5444b8415293c350ed8bdabfc3f419f8be075f97",name:"SYNAPSE:STABLESWAP",gas:197636n,model:ee.Synapse,isTradingAllowed:!0,aPrecision:100n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x7479e1bc2f2473f9e78c89b4210eb6d55d33b645",poolContract:"0x85fcd7dd0a1e1a9fcd5fd886ed522de8221c3ee5",precision:1000000000000000000n,precisionMul:[1n,1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0xb6c473756050de474286bed418b77aeac39b02af","0x8f3cf7ad23cd3cadbd9735aff958023239c6a063","0x2791bca1f2de4661ed88a30c99a7a9449aa84174","0xc2132d05d31c914a87c6611c10748aeb04b58e8f"]},{id:"39",address:"0xb262f442b264d499041bb034588fc80f816a2705",name:"DODO:V2DPPUSDC2",gas:98449n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xd24153244066f0afa9415563bfc7ba248bfb7a51",pools:{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"0x38c56f05a7b4e4dc79eac6c264829c7b21fbf7a8"}}},{id:"40",address:"0xcf42c6d7d5ca8f7d4a472cc94f48f82b99444e3e",name:"DODO:V2DPPUSDT",gas:102671n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xd24153244066f0afa9415563bfc7ba248bfb7a51",pools:{"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270":{"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"0x2144ee9e47998e0d7ea990252d6fe63107a31018"}}},{id:"41",address:"0xc6c24c98ad811338a1785cff80ba20465d82f5c3",name:"DODO:V2DPPDAI",gas:106532n,model:ee.DodoV2,isTradingAllowed:!0,factoryContract:"0xd24153244066f0afa9415563bfc7ba248bfb7a51",pools:{"0x2791bca1f2de4661ed88a30c99a7a9449aa84174":{"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063":"0xaae10fa31e73287687ce56ec90f81a800361b898"},"0xc2132d05d31c914a87c6611c10748aeb04b58e8f":{"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063":"0xda43a4aab20d313ab3aa07d8e09f3521f32a3d83"}}}],ce=I.avalanche,re=[{id:"55f72e4f-4737-4a9a-93db-05aff805eaa4",name:"SUSHI",address:"0x537b067958afbc9327958fb7441f086b71888a4b",gas:72958n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xc35dadb65012ec5796536bd9864ed8773abc74c4",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"},{id:"66ed9e07-610a-484b-a984-86f8e91326bf",name:"PANGOLIN",address:"0x493f1b81b05e29e86d9a4762944ed8b5fd2924a5",gas:69022n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xefa94de7a4656d787667c749f7e1223d71e9fd88",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x40231f6b438bce0797c9ada29b718a87ea0a5cea3fe9a771abdd76bd41a3e545"},{id:"190cecab-a63f-4f08-ac7e-8af670ad9247",name:"OLIVECASH",address:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",gas:68434n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x4fe4d8b01a56706bc6cad26e8c59d0c7169976b3",fee:998n,feePrecision:1000n,pairBytecodeHash:"0xb7145948956af92afd2ae97eff039ada60998237282c1687ca23ce1ad5e1d282"},{id:"6dd410ef-7fb5-44c1-8600-152441f72a77",name:"BAGUETTE",address:"0x2c7a8122a1b512adc848024ce72e837001ecb586",gas:69791n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x3587b8c0136c2c3605a9e5b03ab54da3e4044b50",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x81dbf51ab39dc634785936a3b34def28bf8007e6dfa30d4284c4b8547cb47a51"},{id:"a078434d-f618-4e01-b98a-569903721272",name:"CANARY",address:"0x71762f1fdc36afc769a25dcd73226c6edca6832a",gas:69781n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xcfba329d49c24b70f3a8b9cc0853493d4645436b",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x60df5edf580dff3274fff5a3d83ad2b6ef6e296f71c3bc28c939e641888bd5b0"},{id:"a30073d1-29b6-4df0-9ed5-28c3960b0c39",name:"ELK",address:"0x8860dc637a513027e4883a77a5567cfeaa718ae2",gas:88320n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x091d35d7f63487909c863001ddca481c6de47091",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x33c4831a098654d3d20a78641a198ee6ffc1ceed49f2196b75bb244891c260e3"},{id:"cfe5944f-c6bf-47fe-9128-d4c4e317d70c",name:"HAKU",address:"0x7ea8c22e6dcd7bd69eb180664da68e1f1f11d696",gas:74029n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x2db46feb38c57a6621bca4d97820e1fc1de40f41",fee:998n,feePrecision:1000n,pairBytecodeHash:"0xf0a389c88c385a3fa20755278000aabbe86028f1b77659475569f3575b2aebe3"},{id:"6dd92be7-2330-4215-a152-20322b7ebedf",name:"LYDIA",address:"0xdcc3a56e97a7448c64341e38867241f65168817d",gas:67409n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xe0c1bb6df4851feeedc3e14bd509feaf428f7655",fee:998n,feePrecision:1000n,pairBytecodeHash:"0x47cc4f3a5e7a237c464e09c6758ac645084f198b8f64eedc923317ac4481a10c"},{id:"f36b19a0-6a5c-48b9-a7f4-e12d03894869",name:"THORUS",address:"0x02800d3d33e7e9d32c586fcaaea0412e5a57792d",gas:69421n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0xa98ea6356a316b44bf710d5f9b6b4ea0081409ef",fee:999n,feePrecision:1000n,pairBytecodeHash:"0xc6b4cc64699496d0514c783d6aca5142c3b61e327524db01cabfa4248e430e49"},{id:"c2d346e3-8d17-4dee-9d31-f3e2755f6cb2",name:"TRADERJOE",address:"0x2c49bdff3acb931491d1c0231952d9718c516539",gas:67340n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x9ad6c38be94206ca50bb0d90783181662f0cfa10",fee:997n,feePrecision:1000n,pairBytecodeHash:"0x0bbca9af0511ad1a1da383135cf3a8d2ac620e549ef9f6ae3a4c33c2fed0af91"},{id:"776400cb-8bf7-4960-9c24-e1b5b1c84909",name:"YETI",address:"0x2208705b6f232ef498d46514b5130192789e9dc8",gas:69349n,model:ee.UniswapV2,isTradingAllowed:!0,factory:"0x58c8cd291fa36130119e6deb9e520fbb6aca1c3a",fee:997n,feePrecision:1000n,pairBytecodeHash:"0xcc133f6dd9577d2022e9f47ec90dd24049584e73131095c170715fa7c950a64a"},{id:"c504617b-5fb4-43a2-939d-c6f1fbf19383",name:"KYBER",address:"0x81d10cbea2b7e2ce9589cfe48442a83f013885ab",gas:90276n,model:ee.DMM,isTradingAllowed:!0,pools:{"0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664":{"0xc7198437980c041c805a1edcba50c1ce5db95118":"0x108695e4e46e8232efebe63c421cc302cc780d45","0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e":"0xd87cd5aa7efdc4de73ef8c7166d4d1daa37e2330","0xe19a1684873fab5fb694cfd06607100a632ff21c":"0xd03367dd753dbf46f6e2bb7253b2f17ef947aeb8","0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7":"0x475d13a015d478aa8271655584348f3268007cbd"},"0x39fc9e94caeacb435842fadedecb783589f50f5f":{"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7":"0x4797d61a80fbb90aa060c6d8fe9991c41c4868bf"},"0x130966628846bfd36ff31a822705796e8cb8c18d":{"0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664":"0xc6710e83abbbbaa6d1576dd30df3baf6147823d8"},"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7":{"0xd1c3f94de7e5b45fa4edbba472491a9f4b166fc4":"0xb34068e28a7853123afafc936c972123eb9895a2"},"0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7":{"0xc7198437980c041c805a1edcba50c1ce5db95118":"0x88d23fc2df1e5d07e58105301a560cf92a4e6ecb"},"0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab":{"0x50b7545627a5162f82a992c33b87adc75187b218":"0x3e2673e7dcad191470d489959aba0e6e7ed2d5a3","0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7":"0x0f0fc5a5029e3d155708356b422d22cc29f8b3d4"}}},{id:"4c9c984f-d409-4049-804f-ff133bd50dcf",address:"0x815f667a542653d89d44ff9d09b11dd7d4d78004",name:"CURVE:ATRICRYPTO",model:ee.CurveCrypto,isTradingAllowed:!1,gas:0n,aMultiplier:10000n,feeDenominator:10000000000n,isAPrecise:!1,lpToken:"0x1dab6560494b04473a0be3e7d83cf3fdf3a51828",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0xb755b949c126c04e0348dd881a5cf55d424742b2",precision:1000000000000000000n,precisions:[1n,10000000000n,1n],tokens:["0x1337bedc9d22ecbe766df105c9623922a27963ec","0x686bef2417b6dc32c50a3cbfbcc3bb60e1e9a15d","0x53f7c5869a859f0aec3d334ee8b4cf01e3492f21"]},{id:"b0f9d06f-de5a-42dc-8c47-3b6a73132a4e",address:"0xb1fae488e9cc7eb03a2b8ed5ef2f5475f4aaf1e9",name:"CURVE:AAVE",model:ee.CurveLendingA,isTradingAllowed:!0,gas:688788n,aPrecision:100n,feeDenominator:10n**10n,lpToken:"0x1337bedc9d22ecbe766df105c9623922a27963ec",poolContract:"0x7f90122bf0700f9e7e1f688fe926940e8839f353",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],tokens:["0xd586e7f844cea2f87f50152665bcbc2c279d8d70","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664","0xc7198437980c041c805a1edcba50c1ce5db95118"]},{id:"6928b0db-5314-4682-b63c-ea556e4d4d60",address:"0x815f667a542653d89d44ff9d09b11dd7d4d78004",name:"CURVE:ATRICRYPTOZAP",model:ee.CurveLendingCryptoZap,isTradingAllowed:!0,gas:1162362n,basePoolId:"b0f9d06f-de5a-42dc-8c47-3b6a73132a4e",nStablecoins:3,poolContract:"0x58e57cA18B7A47112b877E31929798Cd3D703b0f",poolId:"4c9c984f-d409-4049-804f-ff133bd50dcf",tokens:["0xd586e7f844cea2f87f50152665bcbc2c279d8d70","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664","0xc7198437980c041c805a1edcba50c1ce5db95118","0x50b7545627a5162f82a992c33b87adc75187b218","0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab"]},{id:"2ea7dd4a-39cf-4a90-8b5b-dbb2c87bc677",address:"0x3ffecb3df6c24b3676cafd408b561065337326c9",name:"CURVE:3POOLV2",model:ee.CurvePlain,isTradingAllowed:!0,gas:146636n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0xaea2e71b631fa93683bcf256a8689dfa0e094fcd",poolContract:"0xaea2e71b631fa93683bcf256a8689dfa0e094fcd",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0x130966628846bfd36ff31a822705796e8cb8c18d","0xc7198437980c041c805a1edcba50c1ce5db95118","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664"]},{id:"89d9ffc2-8a1e-4517-8124-8292d56c29c5",address:"0xa3a8412c853043d4390d715b133d6c60214585de",name:"CURVE:USDC",model:ee.CurvePlain,isTradingAllowed:!0,gas:161812n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0x3a43a5851a3e3e0e25a3c1089670269786be1577",poolContract:"0x3a43a5851a3e3e0e25a3c1089670269786be1577",precision:1000000000000000000n,precisionMul:[1000000000000n,1000000000000n],rates:[1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664","0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e"]},{id:"1a3858a7-a4cc-4e0c-9166-d20d830d1bd5",address:"0x58ace9e109d9e34bb12b0afb3d09e9d94b849544",name:"CURVE:REN",model:ee.CurveLendingA,isTradingAllowed:!0,gas:469877n,aPrecision:100n,feeDenominator:10000000000n,lpToken:"0xc2b1df84112619d190193e48148000e3990bf627",poolContract:"0x16a7da911a4dd1d83f3ff066fe28f3c792c50d90",precision:1000000000000000000n,precisionMul:[10000000000n,10000000000n],tokens:["0x50b7545627a5162F82A992c33b87aDc75187B218","0xDBf31dF14B66535aF65AaC99C32e9eA844e14501"]},{id:"42be668f-c0bb-4255-a5e3-bc7745c88c41",address:"0x9db45b627ee95ac86b059171cb17dc266be857fb",name:"CURVE:MIM",model:ee.CurveMeta,isTradingAllowed:!0,gas:1144681n,baseCacheExpires:0n,basePoolRouteId:"b0f9d06f-de5a-42dc-8c47-3b6a73132a4e",feeDenominator:10000000000n,aPrecision:100n,isCacheExists:!1,lpToken:"0x30df229cefa463e991e29d42db0bae2e122b2ac7",multicall:ce,poolContract:"0x30df229cefa463e991e29d42db0bae2e122b2ac7",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x130966628846bfd36ff31a822705796e8cb8c18d","0x1337bedc9d22ecbe766df105c9623922a27963ec"]},{id:"215bc9e9-1fc5-4b98-8585-9d137d5b7e58",address:"0x672c44cba94c08b9a7d079d79a25107da5d4f585",name:"CURVE:FRAX",model:ee.CurveMeta,isTradingAllowed:!0,gas:1151134n,baseCacheExpires:0n,basePoolRouteId:"b0f9d06f-de5a-42dc-8c47-3b6a73132a4e",feeDenominator:10000000000n,isCacheExists:!1,aPrecision:100n,lpToken:"0xe013593cea239e445d2271106836b00c9e7356ae",multicall:ce,poolContract:"0xe013593cea239e445d2271106836b00c9e7356ae",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64","0x1337bedc9d22ecbe766df105c9623922a27963ec"]},{id:"5c59b646-7647-4d75-8ce9-eb70136cdd0b",address:"0x2eca6cfc9f78c9dd10e03520613a647ac8b5fdcf",name:"AXIAL:AS4D",model:ee.Synapse,isTradingAllowed:!0,gas:202535n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0x3a7387f8ba3ebffa4a0eccb1733e940ce2275d3f",poolContract:"0x2a716c4933a20cd8b9f9d9c39ae7196a85c24228",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000n,1000000000000000000000000000000n],tokens:["0x1c20e891bab6b1727d14da358fae2984ed9b59eb","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664","0xd586e7f844cea2f87f50152665bcbc2c279d8d70","0xc7198437980c041c805a1edcba50c1ce5db95118"]},{id:"0af16355-4a47-424b-99b6-9b7064f49fa4",address:"0x0261fe3d25e470c387f456cd68b69eaf20b21063",name:"AXIAL:AC4D",model:ee.Synapse,isTradingAllowed:!0,gas:201543n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0x4da067e13974a4d32d342d86fbbbe4fb0f95f382",poolContract:"0x8c3c1c6f971c01481150ca7942bd2bbb9bc27bc7",precision:1000000000000000000n,precisionMul:[1n,1n,1n,1n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000n,1000000000000000000n],tokens:["0x4fbf0429599460d327bd5f55625e30e4fc066095","0x130966628846bfd36ff31a822705796e8cb8c18d","0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64","0xd586e7f844cea2f87f50152665bcbc2c279d8d70"]},{id:"bbb66c85-4039-406b-abba-f85275a20b50",address:"0x156928f341f8618ec88820f85b4ea52468d088e3",name:"AXIAL:AM3D",model:ee.Synapse,isTradingAllowed:!0,gas:189820n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0xc161e4b11faf62584efcd2100ccb461a2dde64d1",poolContract:"0x90c7b96ad2142166d001b27b5fbc128494cdfbc8",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000n],tokens:["0x130966628846bfd36ff31a822705796e8cb8c18d","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664","0xd586e7f844cea2f87f50152665bcbc2c279d8d70"]},{id:"acef3dc9-6b67-42d8-8bd4-0b621485a4be",address:"0xa2b12a2816d2cbe083b45367e97824ec2bb2d97a",name:"AXIAL:AA3D",model:ee.Synapse,isTradingAllowed:!0,gas:209560n,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,aPrecision:100n,lpToken:"0xad556e7dc377d9089c6564f9e8d275f5ee4da22d",poolContract:"0x6efbc734d91b229be29137cf9fe531c1d3bf4da6",precision:1000000000000000000n,precisionMul:[1n,1n,1000000000000n],rates:[1000000000000000000n,1000000000000000000n,1000000000000000000000000000000n],tokens:["0x346a59146b9b4a77100d369a3d18e8007a9f46a6","0x130966628846bfd36ff31a822705796e8cb8c18d","0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664"]},{id:"d937f8aa-fd88-4ee0-905a-b18b98992052",address:"0x5731a6b2c7e485a954f2545850a3849e4154d7a8",name:"GMX",model:ee.GmxDex,isTradingAllowed:!0,gas:291899n,vaultContract:"0x9ab2de34a33fb459b538c43f251eb825645e8595",pricePrecision:1000000000000000000000000000000n,debtTokenContract:"0xc0253c3cc6aa5ab407b5795a04c28fb063273894"}],oe=I.optimism,fe={arbitrum:ae,polygon:de,bsc:ne,ethereum:ie,avalanche:re,optimism:[{id:"29631de7-9ff1-43c4-aa38-eece4fc168df",address:"0x815f667a542653d89d44ff9d09b11dd7d4d78004",name:"CURVE:3POOL",gas:148774n,model:ee.CurvePlain,isTradingAllowed:!0,feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x1337bedc9d22ecbe766df105c9623922a27963ec",poolContract:"0x1337bedc9d22ecbe766df105c9623922a27963ec",precision:1000000000000000000n,precisionMul:[1n,1000000000000n,1000000000000n],rates:[1000000000000000000n,1000000000000000000000000000000n,1000000000000000000000000000000n],tokens:["0xda10009cbd5d07dd0cecc66161fc93d7c9000da1","0x7f5c764cbc14f9669b88837ca1490cca17c31607","0x94b008aa00579c1307b0ef2c499ad98a8ce58e58"]},{id:"afd121db-1f0c-47ac-8633-9e71673df159",address:"0x81d10cbea2b7e2ce9589cfe48442a83f013885ab",name:"CURVE:SYNTHETIX",gas:338475n,model:ee.CurveMeta,isTradingAllowed:!0,aPrecision:100n,baseCacheExpires:0n,basePoolRouteId:"29631de7-9ff1-43c4-aa38-eece4fc168df",feeDenominator:10000000000n,isCacheExists:!1,lpToken:"0x061b87122ed14b9526a813209c8a59a633257bab",multicall:oe,poolContract:"0x061b87122ed14b9526a813209c8a59a633257bab",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],tokens:["0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9","0x1337bedc9d22ecbe766df105c9623922a27963ec"]},{id:"21dd33fd-a10a-4e84-8343-0c06048d4b42",address:"0x02800d3d33e7e9d32c586fcaaea0412e5a57792d",name:"UNI:V3F500",gas:148155n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:500n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:30,tickQuerier:"0x2c7a8122a1b512adc848024ce72e837001ecb586"},{id:"a1ed973b-f136-496b-944a-5dde3cb73962",address:"0x2c49bdff3acb931491d1c0231952d9718c516539",name:"UNI:V3F3000",gas:92387n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:3000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:30,tickQuerier:"0x2c7a8122a1b512adc848024ce72e837001ecb586"},{id:"6605bbed-0e36-46f9-80c7-aebf66e3e2cc",address:"0x2208705b6f232ef498d46514b5130192789e9dc8",name:"UNI:V3F10000",gas:98398n,gasPerInitializedTick:19820n,gasPerTick:4171n,model:ee.UniswapV3,isTradingAllowed:!0,depositAddress:"0x755db0a2c1041b20ad123792181c55a3d6e2ffde",factory:"0x1f98431c8ad98523631ae4a59f267346ea31f984",fee:10000n,pairBytecodeHash:"0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",maxInitializedTicks:30,tickQuerier:"0x2c7a8122a1b512adc848024ce72e837001ecb586"},{id:"20054883-b7d7-4068-869b-898279bc9b62",address:"0x156928f341f8618ec88820f85b4ea52468d088e3",name:"VELODROME:STABLE",gas:238696n,model:ee.Solidly,isTradingAllowed:!0,factoryContract:"0x25cbddb98b35ab1ff77413456b31ec81a6b6b746",isStable:!0,pairBytecodeHash:"0xc1ac28b1c4ebe53c0cff67bab5878c4eb68759bb1e9f73977cd266b247d149f0"},{id:"09c33f3b-9aec-4c02-b455-6af01efce4c1",address:"0x2eca6cfc9f78c9dd10e03520613a647ac8b5fdcf",name:"VELODROME:VOLATILE",gas:126168n,model:ee.Solidly,isTradingAllowed:!0,factoryContract:"0x25cbddb98b35ab1ff77413456b31ec81a6b6b746",isStable:!1,pairBytecodeHash:"0xc1ac28b1c4ebe53c0cff67bab5878c4eb68759bb1e9f73977cd266b247d149f0"},{id:"f56c67ba-84f7-446a-8591-ad9156041f4d",address:"0xb964976c3c4f60278fc755ffc5a65008a147b014",name:"SYNTHETIX",gas:327223n,model:ee.Synthetix,isTradingAllowed:!0,sUsdContract:"0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9",exchangeRatesContract:"0x22602469d704bffb0936c7a7cfcd18f7aa269375",exchangerContract:"0xcc02f000b0aa8a0efc2b55c9cf2305fb3531cca1",synthetixContract:"0x8700daec35af8ff88c16bdf0418774cb3d7599b4",flexibleStorageContract:"0x47649022380d182da8010ae5d257fea4227b21ff",tokens:{"0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9":"sUSD","0x00b8d5a5e1ac97cb4341c4bc4367443c8776e8d9":"sAAVE","0xb2b42b231c68cbb0b4bf2ffebf57782fd97d3da4":"sAVAX","0x298b9b95708152ff6968aafd889c6586e9169f1d":"sBTC","0xe405de8f52ba7559f9df3c368500b6e6ae6cee49":"sETH","0xfbc4198702e81ae77c06d58f81b629bdf36f0a71":"sEUR","0xa3a538ea5d5838dc32dde15946ccd74bdd5652ff":"sINR","0xc5db22719a06418028a40a9b5e9a7c02959d0d08":"sLINK","0x81ddfac111913d3d5218dea999216323b7cd6356":"sMATIC","0x8b2f7ae8ca8ee8428b6d76de88326bb413db2766":"sSOL","0xf5a6115aa582fd1beea22bc93b7dc7a785f60d03":"sUNI"},PRECISION_UNIT:1000000000000000000n},{id:"10e4169c-3485-449f-8da1-cb3271746aec",address:"0x357c495fede59bc878d79bb50f1ab407ac18d359",name:"VELO:CL1",gas:134971n,gasPerInitializedTick:50513n,gasPerTick:10060n,model:ee.VelodromeSS,isTradingAllowed:!0,depositAddress:"0xcdd097847f685031fd3f43d2f4be90dfa27aaa56",factory:"0x548118c7e0b865c2cfa94d15ec86b666468ac758",tickSpacing:1n,pairBytecodeHash:"0x3e17c3f6d9f39d14b65192404b8d70a2f921655d3f7f5e7481ab3fcf0756e8ea",maxInitializedTicks:30,tickQuerier:"0xc08d052983c1c72fa3f80d65f4aca61caacb4305"},{id:"75fa546a-eaec-449a-ab28-535f786b2de2",address:"0x44fa71edcf6b490a5037e44ca1941e530487e59a",name:"VELO:CL50",gas:141276n,gasPerInitializedTick:50513n,gasPerTick:10060n,model:ee.VelodromeSS,isTradingAllowed:!0,depositAddress:"0xcdd097847f685031fd3f43d2f4be90dfa27aaa56",factory:"0x548118c7e0b865c2cfa94d15ec86b666468ac758",tickSpacing:50n,pairBytecodeHash:"0x3e17c3f6d9f39d14b65192404b8d70a2f921655d3f7f5e7481ab3fcf0756e8ea",maxInitializedTicks:30,tickQuerier:"0xc08d052983c1c72fa3f80d65f4aca61caacb4305"},{id:"e49e5196-a257-48ff-86df-162cf6e3de1c",address:"0xdebe380b9450dc33886f25662426d000b4f5e2e9",name:"VELO:CL100",gas:149438n,gasPerInitializedTick:50513n,gasPerTick:10060n,model:ee.VelodromeSS,isTradingAllowed:!0,depositAddress:"0xcdd097847f685031fd3f43d2f4be90dfa27aaa56",factory:"0x548118c7e0b865c2cfa94d15ec86b666468ac758",tickSpacing:100n,pairBytecodeHash:"0x3e17c3f6d9f39d14b65192404b8d70a2f921655d3f7f5e7481ab3fcf0756e8ea",maxInitializedTicks:30,tickQuerier:"0xc08d052983c1c72fa3f80d65f4aca61caacb4305"},{id:"4aab6422-95da-4594-9144-aae093841016",address:"0xe591203b0322b9774f5ddd5973dd6e062c27fbae",name:"VELO:CL200",gas:144128n,gasPerInitializedTick:50513n,gasPerTick:10060n,model:ee.VelodromeSS,isTradingAllowed:!0,depositAddress:"0xcdd097847f685031fd3f43d2f4be90dfa27aaa56",factory:"0x548118c7e0b865c2cfa94d15ec86b666468ac758",tickSpacing:200n,pairBytecodeHash:"0x3e17c3f6d9f39d14b65192404b8d70a2f921655d3f7f5e7481ab3fcf0756e8ea",maxInitializedTicks:30,tickQuerier:"0xc08d052983c1c72fa3f80d65f4aca61caacb4305"},{id:"b7b62aba-c38c-4f4e-bf57-3327e6aa4a1b",address:"0x86112f7888d068f5e805b12a1503dd23d2a62e86",name:"VELO:CL2000",gas:136567n,gasPerInitializedTick:50513n,gasPerTick:10060n,model:ee.VelodromeSS,isTradingAllowed:!0,depositAddress:"0xcdd097847f685031fd3f43d2f4be90dfa27aaa56",factory:"0x548118c7e0b865c2cfa94d15ec86b666468ac758",tickSpacing:2000n,pairBytecodeHash:"0x3e17c3f6d9f39d14b65192404b8d70a2f921655d3f7f5e7481ab3fcf0756e8ea",maxInitializedTicks:30,tickQuerier:"0xc08d052983c1c72fa3f80d65f4aca61caacb4305"},{id:"a5d339ba-9014-4522-8666-02bcf44f3a43",address:"0xb33d7906e308037a53a54502159a88dfdbd4ab9a",name:"VELODROME:V2STABLE",gas:228946n,model:ee.VelodromeV2,isTradingAllowed:!0,factoryContract:"0xf1046053aa5682b4f9a81b5481394da16be5ff5a",isStable:!0,pairBytecodeHash:"0xc0629f1c7daa09624e54d4f711ba99922a844907cce02997176399e4cc7e8fcf"},{id:"a73d3d9f-4b42-41d5-8df3-545b296e6762",address:"0x3e0bb9c5695ebbe20bc3cbf29dcf21422310dcce",name:"VELODROME:V2VOLATILE",gas:208223n,model:ee.VelodromeV2,isTradingAllowed:!0,factoryContract:"0xf1046053aa5682b4f9a81b5481394da16be5ff5a",isStable:!1,pairBytecodeHash:"0xc0629f1c7daa09624e54d4f711ba99922a844907cce02997176399e4cc7e8fcf"},{id:"f50ca1c0-f842-4872-9fe8-de95a3015081",address:"0xec7f1a405b2e516740cc5e4f9e017bdff4aeb945",name:"CURVE:TRICRYPTONG:CRVUSD",gas:183867n,model:ee.CurveTriCryptoNG,isTradingAllowed:!0,aMultiplier:10000n,multicallContract:"0xca11bde05977b3631167028862be2a173976ca11",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0x4456d13fc6736e8e8330394c0c622103e06ea419",precisions:[1n,10000000000n,1n],precision:1000000000000000000n,tokens:["0xc52d7f23a2e460248db6ee192cb23dd12bddcbf6","0x68f180fcce6836688e9084f035309e29bf0a2095","0x4200000000000000000000000000000000000006"]},{id:"73076b5c-56f4-498e-b3a6-5e945baf9967",address:"0x961ae74511a8ecb6e88badbd0285e1838ac47e27",name:"CURVE:TRICRYPTONG:OP",gas:192412n,model:ee.CurveTriCryptoNG,isTradingAllowed:!0,aMultiplier:10000n,multicallContract:"0xca11bde05977b3631167028862be2a173976ca11",maxA:270000000n,minA:2700n,maxGamma:50000000000000000n,minGamma:10000000000n,noiseFee:100000n,poolContract:"0xd8dd9a8b2aca88e68c46af9008259d0ec04b7751",precisions:[1n,1n,1n],precision:1000000000000000000n,tokens:["0xc52d7f23a2e460248db6ee192cb23dd12bddcbf6","0x4200000000000000000000000000000000000042","0x0994206dfe8de6ec6920ff4d779b0d950605fb53"]},{id:"0f16faf7-7483-4fa6-a480-79a7f88f1cc1",address:"0x8815e3327e1f96b37cde83ed0613dc2ddf27a317",name:"CURVE:STABLENG:CRVUSDUSDCE",gas:119021n,model:ee.CurveStableNG,isTradingAllowed:!0,poolContract:"0x05fa06d4fb883f67f1cfea0889edbff9e8358101",tokens:["0xc52d7f23a2e460248db6ee192cb23dd12bddcbf6","0x7f5c764cbc14f9669b88837ca1490cca17c31607"],aPrecision:100n,feeDenominator:10000000000n,precision:1000000000000000000n},{id:"7e2c5f08-9b37-4129-a693-12158a179adc",address:"0x538861cf739ad4319d4fefba3bb353d2834f670d",name:"CURVE:STABLENG:CRVUSDUSDT",gas:113532n,model:ee.CurveStableNG,isTradingAllowed:!0,poolContract:"0xd1b30ba128573fcd7d141c8a987961b40e047bb6",tokens:["0xc52d7f23a2e460248db6ee192cb23dd12bddcbf6","0x94b008aa00579c1307b0ef2c499ad98a8ce58e58"],aPrecision:100n,feeDenominator:10000000000n,precision:1000000000000000000n},{id:"cc7e5c34-6134-464d-a6f6-335b27f83136",address:"0x3e982dd2c00f96369342a843de5f87a48b41bf83",name:"CURVE:STABLENG:CRVUSDUSDC",gas:116730n,model:ee.CurveStableNG,isTradingAllowed:!0,poolContract:"0x03771e24b7c9172d163bf447490b142a15be3485",tokens:["0xc52d7f23a2e460248db6ee192cb23dd12bddcbf6","0x0b2c639c533813f4aa9d7837caf62653d097ff85"],aPrecision:100n,feeDenominator:10000000000n,precision:1000000000000000000n},{id:"1aa93dec-08ab-4f09-92e2-55b220500d1f",address:"0xfaed3b8a666f8ebfca1c4da66c83552e7e9e2722",name:"CURVE:STABLENG:CRVUSDSUSD",gas:179636n,model:ee.CurveStableNG,isTradingAllowed:!0,poolContract:"0x56771e7a9df6e977164b48e07aa3f5dadf448402",tokens:["0xc52d7f23a2e460248db6ee192cb23dd12bddcbf6","0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9"],aPrecision:100n,feeDenominator:10000000000n,precision:1000000000000000000n},{id:"e14755d2-045f-494d-a012-eb5e7d2c073b",address:"0xa0ad162c3914796b8ca0ee22afd994c79f1da8b7",name:"CURVE:SBTCWBTC",gas:159875n,model:ee.CurvePlain,isTradingAllowed:!0,poolContract:"0x9f2fe3500b1a7e285fdc337acace94c480e00130",tokens:["0x298b9b95708152ff6968aafd889c6586e9169f1d","0x68f180fcce6836688e9084f035309e29bf0a2095"],feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x9f2fe3500b1a7e285fdc337acace94c480e00130",precision:1000000000000000000n,precisionMul:[1n,10000000000n],rates:[1000000000000000000n,10000000000000000000000000000n],aPrecision:100n},{id:"66db7f4a-6e9c-4c7a-8009-3530e90727a9",address:"0xa38575ea72aff716753f78c23b0f2d456c66ab28",name:"CURVE:WSTETH",gas:120827n,model:ee.CurveLido,isTradingAllowed:!0,poolContract:"0xb90b9b1f91a01ea22a182cd84c1e22222e39b415",oracleAddress:"0xe59eba0d492ca53c6f46015eea00517f2707dc77",stethCoinIdx:1,tokens:["0x4200000000000000000000000000000000000006","0x1f32b1c2345538c0c6f582fcb022739c4a194ebb"],feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0xefde221f306152971d8e9f181bfe998447975810",precision:1000000000000000000n,precisionMul:[1n,1n],rates:[1000000000000000000n,1000000000000000000n],aPrecision:100n},{id:"30ddc561-254f-477f-8674-f37d6e2f8e30",address:"0xff197f5d62e00f2c447cb152eeb621032337ce77",name:"CURVE:TBTCWBTC",gas:85875n,model:ee.CurvePlain,isTradingAllowed:!0,poolContract:"0x1dc5c0f8668a9f54ed922171d578011850ca0341",tokens:["0x6c84a8f1c29108f47a79964b5fe888d4f4d0de40","0x68f180fcce6836688e9084f035309e29bf0a2095"],feeDenominator:10000000000n,isUnderlying:!1,lendingPrecision:1000000000000000000n,lpToken:"0x1dc5c0f8668a9f54ed922171d578011850ca0341",precision:1000000000000000000n,precisionMul:[1n,10000000000n],rates:[1000000000000000000n,10000000000000000000000000000n],aPrecision:100n}]},le={bsc:[{address:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",decimals:18},{address:"0xe9e7cea3dedca5984780bafc599bd69add087d56",decimals:18},{address:"0x55d398326f99059ff775485246999027b3197955",decimals:18},{address:"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",decimals:18},{address:"0x23396cf899ca06c4472205fc903bdb4de249d6fc",decimals:18},{address:"0x2170ed0880ac9a755fd29b2688956bd959f933f8",decimals:18},{address:"0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",decimals:18},{address:"0x9c65ab58d8d978db963e63f2bfb7121627e3a739",decimals:18},{address:"0x844fa82f1e54824655470970f7004dd90546bb28",decimals:18},{address:"0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95",decimals:18}],polygon:[{address:"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",decimals:18},{address:"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",decimals:18},{address:"0x831753dd7087cac61ab5644b308642cc1c33dc13",decimals:18},{address:"0x2791bca1f2de4661ed88a30c99a7a9449aa84174",decimals:6},{address:"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",decimals:18},{address:"0xc2132d05d31c914a87c6611c10748aeb04b58e8f",decimals:6},{address:"0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6",decimals:8},{address:"0x4c4bf319237d98a30a929a96112effa8da3510eb",decimals:18},{address:"0x9719d867a500ef117cc201206b8ab51e794d3f82",decimals:18}],arbitrum:[{address:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",decimals:18},{address:"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",decimals:6},{address:"0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",decimals:6},{address:"0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",decimals:18},{address:"0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",decimals:8},{address:"0x3f56e0c36d275367b8c502090edf38289b3dea0d",decimals:18}],ethereum:[{address:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",decimals:18},{address:"0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",decimals:18},{address:"0xdac17f958d2ee523a2206206994597c13d831ec7",decimals:6},{address:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",decimals:6},{address:"0x6b175474e89094c44da98b954eedeac495271d0f",decimals:18},{address:"0x4fabb145d64652a948d72533023f6e7a623c7c53",decimals:18},{address:"0xa47c8bf37f92abed4a126bda807a7b7498661acd",decimals:18},{address:"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",decimals:8},{address:"0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0",decimals:18}],avalanche:[{address:"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",decimals:18},{address:"0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664",decimals:6},{address:"0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",decimals:6},{address:"0xc7198437980c041c805a1edcba50c1ce5db95118",decimals:6},{address:"0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",decimals:6},{address:"0x19860ccb0a68fd4213ab9d8266f7bbf05a8dde98",decimals:18},{address:"0x50b7545627a5162f82a992c33b87adc75187b218",decimals:8},{address:"0xd586e7f844cea2f87f50152665bcbc2c279d8d70",decimals:18},{address:"0x5947bb275c521040051d82396192181b413227a3",decimals:18},{address:"0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab",decimals:18}],optimism:[{address:"0x4200000000000000000000000000000000000006",decimals:18},{address:"0x7f5c764cbc14f9669b88837ca1490cca17c31607",decimals:6},{address:"0x94b008aa00579c1307b0ef2c499ad98a8ce58e58",decimals:6},{address:"0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",decimals:18},{address:"0x68f180fcce6836688e9084f035309e29bf0a2095",decimals:8},{address:"0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9",decimals:18},{address:"0xe405de8f52ba7559f9df3c368500b6e6ae6cee49",decimals:18}]};async function be(e,t,a){const{maxCallsPerBatch:n}=t,s=[];for(let t=0,i=e.length;t<i;t+=n){const d=e.slice(t,Math.min(t+n,i));s.push(a.callStatic.tryAggregate(!1,d))}i.log("[Multicall]","Perform Multicall; Total:",e.length,"Calls:",s.length);return(await Promise.all(s)).flatMap((e=>e))}V.createInterface(),U.createInterface();const he=e.utils.defaultAbiCoder;class ue{constructor(e,t,a,n,s,i,d,c){this.PAIR_BYTECODE_HASH=e,this.factory=t,this.fee=a,this.feePrecision=n,this.token0=s,this.token1=i,this.tradingRouteIndex=d,this.gasConstant=c,this.abiCoder=he,this.reserve0=0n,this.reserve1=0n;const r=this.getSortedPair(this.token0,this.token1);this.token0=r[0],this.token1=r[1],this.pairContract=this.generatePairAddress(this.factory,this.token0,this.token1)}static create(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,gas:c}=e;return new ue(d,n,s,i,t[0],t[1],a,c)}getTradablePairs(){return[[this.token0,this.token1],[this.token1,this.token0]]}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.pairContract}getDepositAddress(){return this.pairContract}getSortedPair(e,t){return e.localeCompare(t,"en",{sensitivity:"base"})<=0?[e,t]:[t,e]}getReserveInOut(e,t,a){return e===this.token0?{reserveIn:t,reserveOut:a}:{reserveIn:a,reserveOut:t}}generatePairAddress(t,a,n){return e.utils.hexDataSlice(e.utils.keccak256(e.utils.concat(["0xff",t,e.utils.solidityKeccak256(["address","address"],[a,n]),this.PAIR_BYTECODE_HASH])),12)}getfetchingCurrentStateCalls(){return[{callData:"0x0902f1ac",target:this.pairContract}]}applyCurrentStateFromCalls(e){if(0===e.length||!1===e[0].success||"0x"===e[0].returnData)return this.reserve0=0n,void(this.reserve1=0n);const[t,a]=this.abiCoder.decode(["uint112","uint112","uint32"],e[0].returnData);this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt()}getAmountOut(e,t,a){if(a<=0n||this.reserve0<=0n||this.reserve1<=0n)return{amount:0n,gas:0n};const{reserveIn:n,reserveOut:s}=this.getReserveInOut(e,this.reserve0,this.reserve1),i=a*this.fee,d=i*s,c=n*this.feePrecision+i;return 0n===c?{amount:0n,gas:0n}:{amount:d/c,gas:this.gasConstant}}}class pe extends ue{static create(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,gas:c}=e;return new pe(d,n,s,i,t[0],t[1],a,c)}getfetchingCurrentStateCalls(){return[{callData:"0x0902f1ac",target:this.pairContract},{callData:"0x54cf2aeb",target:this.pairContract}]}applyCurrentStateFromCalls(e){if(0===e.length||!e[0].success||"0x"===e[0].returnData)return this.reserve0=0n,this.reserve1=0n,void(this.fee=0n);const[t,a]=this.abiCoder.decode(["uint112","uint112","uint32"],e[0].returnData);if(this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt(),e[1].success){const[t]=this.abiCoder.decode(["uint32"],e[1].returnData);this.fee=this.feePrecision-BigInt(t)}else this.fee=this.feePrecision}}class xe extends Error{}class ge{constructor(e){this.contractName=e}createRequireViolated(e){return new xe(`[${this.contractName}]: ${e}`)}require(e,t){if(!e)throw this.createRequireViolated(t)}}class me{constructor(e,t,a,n,s,i,d,c,r,o,f,l,b=1n,h="uint256"){this.poolContract=e,this.lpToken=t,this.TOKENS=a,this.RATES=n,this.LENDING_PRECISION=s,this.PRECISION=i,this.PRECISION_MUL=d,this.FEE_DENOMINATOR=c,this.isUnderlying=r,this.routeIndex=o,this.depositAddress=f,this.gasConstant=l,this.A_PRECISION=b,this.balancesArgs=h,this.errorFactory=new ge(me.name),this.abiCoder=he,this.tokenIndex={},this.balances=[],this.A=0n,this.lpTokenTotalSupply=0n,this.tokenIndex=a.reduce(((e,t,a)=>(e[t]=a,e)),{})}static create(e,t){return new me(e.poolContract,e.lpToken,e.tokens,e.rates,e.lendingPrecision,e.precision,e.precisionMul,e.feeDenominator,e.isUnderlying,t,e.address,e.gas,e.aPrecision,e.balancesArgs)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.TOKENS.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.TOKENS[t],this.TOKENS[n]]),e.push([this.TOKENS[n],this.TOKENS[t]]);return e}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}calculateTokenAmount(e,t){const a=this.TOKENS.length,n=this.A,s=[...this.balances],i=this.getDMem(s,n);for(let n=0;n<a;n++)t?s[n]+=e[n]:s[n]-=e[n];const d=this.getDMem(s,n);let c=0n;return c=t?d-i:i-d,c*this.lpTokenTotalSupply/i}getDy(e,t,a){return this.getDyOrUnderlying(e,t,a,!1)}calculateWithdrawOneCoin(e,t){const a=this.TOKENS.length,n=this.A,s=this.xp(),i=this.getD(s,n),d=this.lpTokenTotalSupply,c=i-e*i/d,r=this.getYD(n,t,s,c);let o=s;const f=this.fee*BigInt(a)/(4n*(BigInt(a)-1n));for(let e=0;e<a;++e){let a=0n;a=e===t?s[e]*c/i-r:s[e]-s[e]*c/i,o[e]-=f*a/this.FEE_DENOMINATOR}let l=o[t]-this.getYD(n,t,o,c);const b=this.PRECISION_MUL;l=(l-1n)/b[t];return{dy:l,dyDiff:(s[t]-r)/b[t]-l,totalSupply:d}}getLPMintAmount(e){const t=this.TOKENS.length;let a=Array.from({length:t},(()=>0n)),n=this.fee*BigInt(t)/(4n*(BigInt(t)-1n)),s=this.A,i=this.lpTokenTotalSupply,d=0n,c=[...this.balances];i>0n&&(d=this.getDMem(c,s));let r=[...c];for(let a=0;a<t;a++){let t=e[a];if(0n===i&&t<=0n)throw this.errorFactory.createRequireViolated("initial deposit requires all coins");t>0n&&(r[a]=c[a]+t)}let o=this.getDMem(r,s);if(o<=d)throw this.errorFactory.createRequireViolated("D1 must more than D0");let f=o;if(i>0n){for(let e=0;e<t;e++){let t=o*c[e]/d,s=0n;s=t>r[e]?t-r[e]:r[e]-t,a[e]=n*s/this.FEE_DENOMINATOR,r[e]-=a[e]}f=this.getDMem(r,s)}let l=0n;return l=0n===i?o:i*(f-d)/d,l}getVirtualPrice(){const e=this.getD(this.xp(),this.A),t=this.lpTokenTotalSupply;return e*this.PRECISION/t}getfetchingCurrentStateCalls(){return[{callData:1n===this.A_PRECISION?"0xf446c1d0":"0x76a2f0f0",target:this.poolContract},{callData:"0xddca3f43",target:this.poolContract},{callData:"0x18160ddd",target:this.lpToken},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode([this.balancesArgs],[a]);let s="0x4903b0d1";return"int128"===this.balancesArgs&&(s="0x065a80d8"),{callData:e.utils.hexConcat([s,n]),target:this.poolContract}}))]}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=(this.A_PRECISION,this.abiCoder.decode(["uint256"],e[0].returnData));this.A=t.toBigInt()}else i.warn("unable to find A for Curve pool",this.poolContract),this.A=0n;if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.fee=t.toBigInt()}else i.warn("unable to find fee for Curve pool",this.poolContract),this.fee=0n;if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.lpTokenTotalSupply=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve pool",this.poolContract),this.lpTokenTotalSupply=0n;for(let t=3,a=this.TOKENS.length;t<3+a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances.push(a.toBigInt())}else i.warn("unable to find balance at index",t-3,"for Curve pool",this.poolContract),this.balances.push(0n)}}xp(){return this.RATES.map(((e,t)=>e*this.balances[t]/this.LENDING_PRECISION))}xpMem(e){return this.RATES.map(((t,a)=>t*e[a]/this.LENDING_PRECISION))}getYD(e,t,a,n){const s=this.TOKENS.length;if(t<0||t>=s)throw this.errorFactory.createRequireViolated(`invalid index; i=${t}`);const i=e*BigInt(s);let d=n,c=0n,r=0n,o=0n;for(let e=0;e<s;++e)e!=t&&(r=a[e],c+=r,d=d*n/(r*BigInt(s)));d=d*n*this.A_PRECISION/(i*BigInt(s));const f=c+n*this.A_PRECISION/i;let l=n;for(let e=0;e<255;++e)if(o=l,l=(l*l+d)/(2n*l+f-n),l>o){if(l-o<=1n)break}else if(o-l<=1n)break;return l}getDMem(e,t){return this.getD(this.xpMem(e),t)}getD(e,t){const a=BigInt(this.TOKENS.length);let n=0n;for(let t=0,a=e.length;t<a;++t)n+=e[t];if(0n===n)return 0n;let s=0n,i=n;const d=t*a;for(let t=0;t<255;++t){let t=i;for(let n=0,s=e.length;n<s;++n)t=t*i/(e[n]*a);if(s=i,i=(d*n/this.A_PRECISION+t*a)*i/((d-this.A_PRECISION)*i/this.A_PRECISION+(a+1n)*t),i>s){if(i-s<=1n)return i}else if(s-i<=1n)return i}throw this.errorFactory.createRequireViolated("getD does not converge")}getY(e,t,a,n){const s=this.TOKENS.length;if(e===t||t<0||t>=s||e<0||e>=s)throw this.errorFactory.createRequireViolated(`invalid given token index; i=${e},j=${t}`);const i=this.A,d=this.getD(n,i);let c=d,r=0n;const o=i*BigInt(s);let f=0n;for(let i=0;i<s;++i){if(i===e)f=a;else{if(i===t)continue;f=n[i]}r+=f,c=c*d/(f*BigInt(s))}c=c*d*this.A_PRECISION/(o*BigInt(s));const l=r+d*this.A_PRECISION/o;let b=0n,h=d;for(let e=0;e<255;++e)if(b=h,h=(h*h+c)/(2n*h+l-d),h>b){if(h-b<=1n)return h}else if(b-h<=1n)return h;throw this.errorFactory.createRequireViolated("getY does not converge")}getDyOrUnderlying(e,t,a,n){const s=this.xp();if(n){const n=this.PRECISION_MUL,i=s[e]+a*n[e],d=this.getY(e,t,i,s),c=(s[t]-d-1n)/n[t];return c-this.fee*c/this.FEE_DENOMINATOR}{const n=s[e]+a*this.RATES[e]/this.PRECISION,i=this.getY(e,t,n,s),d=s[t]-i-1n;return(d-this.fee*d/this.FEE_DENOMINATOR)*this.PRECISION/this.RATES[t]}}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];return{amount:this.getDyOrUnderlying(n,s,a,this.isUnderlying),gas:this.gasConstant}}}var Ce,Ie;!function(e){e[e.PLAIN=0]="PLAIN",e[e.META=1]="META",e[e.LENDING=2]="LENDING"}(Ce||(Ce={}));class Te extends me{constructor(e,t,a,n,s,i,d,c,r,o,f,l,b,h,u=1n){super(i,s,d,c,0n,r,o,f,!0,l,b,h,u),this.basePool=e,this.multicall=t,this.BASE_CACHE_EXPIRES=a,this.isCacheExist=n,this.errorFactory=new ge(Te.name);let p=0;this.tokenIndex=d.concat(e.TOKENS).reduce(((t,a)=>(a===e.lpToken||(t[a]=p,++p),t)),{})}static createMeta(e,t,a){return new Te(a,e.multicall,e.baseCacheExpires,e.isCacheExists,e.lpToken,e.poolContract,e.tokens,e.rates,e.precision,e.precisionMul,e.feeDenominator,t,e.address,e.gas,e.aPrecision)}static isPairSupportedMeta(e,t,a,n){const s=t.filter((e=>e!==n));return s.includes(e[0])&&a.includes(e[1])||s.includes(e[1])&&a.includes(e[0])}getTradablePairs(){const e=[],t=this.TOKENS,a=this.basePool;for(let n=0,s=t.length;n<s;++n)if(t[n]!==a.lpToken)for(let s=0,i=a.TOKENS.length;s<i;++s)e.push([t[n],a.TOKENS[s]]),e.push([a.TOKENS[s],t[n]]);return e}getfetchingCurrentStateCalls(){const e=super.getfetchingCurrentStateCalls();return this.isCacheExist&&e.push({callData:"0x0f28c97d",target:this.multicall},{callData:"0x8296f84f",target:this.poolContract},{callData:"0x95ccc02f",target:this.poolContract}),e}applyCurrentStateFromCalls(e){if(0!==e.length&&(super.applyCurrentStateFromCalls(e),this.isCacheExist)){if(e[e.length-1].success){const[t]=this.abiCoder.decode(["uint256"],e[e.length-1].returnData);this.baseVirtualPrice=t.toBigInt()}else this.baseVirtualPrice=0n;if(e[e.length-2].success){const[t]=this.abiCoder.decode(["uint256"],e[e.length-2].returnData);this.baseCacheUpdated=t.toBigInt()}else this.baseCacheUpdated=0n;if(e[e.length-3].success){const[t]=this.abiCoder.decode(["uint256"],e[e.length-3].returnData);this.blockTimestamp=t.toBigInt()}else this.blockTimestamp=0n}}getRateWithVpRate(e){const t=[...this.RATES];return t[this.TOKENS.length-1]=e,t}xpWithCustomRates(e){return e.map(((e,t)=>e*this.balances[t]/this.PRECISION))}vpRateReadOnly(){return!this.isCacheExist||this.blockTimestamp>this.baseCacheUpdated+this.BASE_CACHE_EXPIRES?this.basePool.getVirtualPrice():this.baseVirtualPrice}xpVpRate(e){const t=this.TOKENS.length,a=t-1,n=[...this.RATES];n[a]=e;for(let e=0;e<t;++e)n[e]=n[e]*this.balances[e]/this.PRECISION;return n}getDyOrUnderlying(e,t,a,n){const s=this.TOKENS.length-1;if(n)return this.simulateExchangeUnderlying(e,t,a);{const n=[...this.RATES];n[s]=this.vpRateReadOnly();const i=this.xpVpRate(n[s]),d=i[e]+a*n[e]/this.PRECISION,c=this.getY(e,t,d,i),r=i[t]-c-1n;return(r-this.fee*r/this.FEE_DENOMINATOR)*this.PRECISION/n[t]}}simulateExchangeUnderlying(e,t,a){let n,s,i,d=0,c=0,r=0,o=0,f=this.vpRateReadOnly(),l=this.getRateWithVpRate(f),b=this.xpWithCustomRates(l);const h=this.TOKENS.length-1;if(0!==e&&(d=e-h,r=1),0!==t&&(c=t-h,o=1),n=a,0===e||0===t){if(0===e)s=b[e]+n*l[e]/this.PRECISION;else{let e=Array.from({length:this.basePool.TOKENS.length},(()=>0n));e[d]=n,n=this.basePool.getLPMintAmount(e),s=n*l[h]/this.PRECISION,s+=b[h]}let a=this.getY(r,o,s,b);i=b[o]-a-1n,i=(i-i*this.fee/this.FEE_DENOMINATOR)*this.PRECISION/l[o],t>0&&(i=this.basePool.calculateWithdrawOneCoin(i,c).dy)}else i=this.basePool.getDy(d,c,n);return i}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];return this.errorFactory.require(void 0!==n&&void 0!==s,"Unknown token"),{amount:this.getDyOrUnderlying(n,s,a,this.isUnderlying),gas:this.gasConstant}}}class Ae extends me{static create(e,t){return new Ae(e.poolContract,e.lpToken,e.tokens,e.rates,e.lendingPrecision,e.precision,e.precisionMul,e.feeDenominator,e.isUnderlying,t,e.address,e.gas,e.aPrecision)}getfetchingCurrentStateCalls(){return[{callData:"0x0ba81959",target:this.poolContract},{callData:"0x5fd65f0f",target:this.poolContract},{callData:"0x18160ddd",target:this.lpToken},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode(["uint8"],[a]);return{callData:e.utils.hexConcat(["0x91ceb3eb",n]),target:this.poolContract}}))]}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}else i.warn("unable to find A for Curve pool",this.poolContract),this.A=0n;if(e[1].success){const[,,,,t]=this.abiCoder.decode(["uint256","uint256","uint256","uint256","uint256","uint256","uint256","address"],e[1].returnData);this.fee=t.toBigInt()}else i.warn("unable to find fee for Curve pool",this.poolContract),this.fee=0n;if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.lpTokenTotalSupply=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve pool",this.poolContract),this.lpTokenTotalSupply=0n;for(let t=3,a=this.TOKENS.length;t<3+a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances.push(a.toBigInt())}else i.warn("unable to find balance at index",t-3,"for Curve pool",this.poolContract),this.balances.push(0n)}}xp(){return this.PRECISION_MUL.map(((e,t)=>e*this.balances[t]))}xpMem(e){return this.PRECISION_MUL.map(((t,a)=>t*e[a]))}getDyOrUnderlying(e,t,a,n){const s=this.xp(),i=s[e]+a*this.PRECISION_MUL[e],d=this.getY(e,t,i,s),c=s[t]-d-1n;return(c-this.fee*c/this.FEE_DENOMINATOR)/this.PRECISION_MUL[t]}}!function(e){e[e.ONE=0]="ONE",e[e.ABOVE_ONE=1]="ABOVE_ONE",e[e.BELOW_ONE=2]="BELOW_ONE"}(Ie||(Ie={}));class ye{constructor(e,t,a,n,s,i,d){this.factoryContract=e,this.traderAddress=t,this.baseToken=a,this.quoteToken=n,this.poolContract=s,this.routeIndex=i,this.gasConstant=d,this.abiCoder=he,this.errorFactory=new ge(ye.name),this.W_ONE=1000000000000000000n,this.pmmState={B:0n,B0:0n,K:0n,Q:0n,Q0:0n,R:0,i:0n},this.lpFeeRate=0n,this.mtFeeRate=0n}static getBaseQuoteTokens(e,t){const{pools:a}=e,n=void 0!==a[t[0]]&&void 0!==a[t[0]][t[1]],s=void 0!==a[t[1]]&&void 0!==a[t[1]][t[0]];let i="",d="";if(n?(d=t[0],i=t[1]):s&&(d=t[1],i=t[0]),""===i||""===d)throw new Error("expected DODOv2 to successfully identify base/quote tokens, but got empty string");return{btkn:d,qtkn:i}}static create(e,t,a){const{btkn:n,qtkn:s}=ye.getBaseQuoteTokens(e,t);return new ye(e.factoryContract,e.address,n,s,e.pools[n][s],a,e.gas)}static isPairSupported(e,t){const a=void 0!==t[e[0]]&&void 0!==t[e[0]][e[1]],n=void 0!==t[e[1]]&&void 0!==t[e[1]][e[0]];return a||n}getTradablePairs(){return[[this.baseToken,this.quoteToken],[this.quoteToken,this.baseToken]]}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.poolContract}getfetchingCurrentStateCalls(){const t=this.abiCoder.encode(["address"],[this.traderAddress]);return[{callData:"0xa382d1b9",target:this.poolContract},{callData:e.utils.hexConcat(["0x44096609",t]),target:this.poolContract}]}applyCurrentStateFromCalls(e){if(0===e.length)return;const[t]=this.abiCoder.decode(["tuple(uint256,uint256,uint256,uint256,uint256,uint256,uint8)"],e[0].returnData),[a,n]=this.abiCoder.decode(["uint256","uint256"],e[1].returnData);this.pmmState={i:t[0].toBigInt(),K:t[1].toBigInt(),B:t[2].toBigInt(),Q:t[3].toBigInt(),B0:t[4].toBigInt(),Q0:t[5].toBigInt(),R:t[6]},this.mtFeeRate=n.toBigInt(),this.lpFeeRate=a.toBigInt()}mulFloor(e,t){return e*t/this.W_ONE}divFloor(e,t){return e*this.W_ONE/t}divCeil(e,t){const a=e*this.W_ONE,n=a/t;return a-n*t>0?n+1n:n}reciprocalFloor(e){return this.W_ONE*this.W_ONE/e}sqrt(e){let t=e/2n+1n,a=e;for(;t<a;)a=t,t=(e/t+t)/2n;return a}solveQuadraticFunctionForTrade(e,t,a,n,s){if(e<=0n)throw this.errorFactory.createRequireViolated("TARGET_IS_ZERO");if(0n===a)return 0n;if(0n===s)return this.mulFloor(n,a)>t?t:this.mulFloor(n,a);if(s==this.W_ONE){let s;const i=n*a;return s=0n===i?0n:i*t/i===t?i*t/(e*e):a*t/e*n/e,t*s/(s+this.W_ONE)}const i=s*e/t*e+n*a;let d,c=(this.W_ONE-s)*t;c>=i?(c-=i,d=!1):(c=i-c,d=!0),c/=this.W_ONE;let r=this.mulFloor(4n*(this.W_ONE-s),this.mulFloor(s,e)*e);r=this.sqrt(c*c+r);let o,f=2n*(this.W_ONE-s);o=d?r-c:c+r;const l=this.divCeil(o,f);return l>t?0n:t-l}generalIntegrate(e,t,a,n,s){if(e<=0n)throw this.errorFactory.createRequireViolated("TARGET_IS_ZERO");const i=n*(t-a);if(0n===s)return i/this.W_ONE;const d=this.divFloor(e*e/t,a),c=this.mulFloor(s,d);return(this.W_ONE-s+c)*i/(this.W_ONE*this.W_ONE)}ROneSellBaseToken(e,t){return this.solveQuadraticFunctionForTrade(e.Q0,e.Q0,t,e.i,e.K)}RAboveSellBaseToken(e,t){return this.generalIntegrate(e.B0,e.B+t,e.B,e.i,e.K)}RBelowSellBaseToken(e,t){return this.solveQuadraticFunctionForTrade(e.Q0,e.Q,t,e.i,e.K)}ROneSellQuoteToken(e,t){return this.solveQuadraticFunctionForTrade(e.B0,e.B0,t,this.reciprocalFloor(e.i),e.K)}RAboveSellQuoteToken(e,t){return this.solveQuadraticFunctionForTrade(e.B0,e.B,t,this.reciprocalFloor(e.i),e.K)}RBelowSellQuoteToken(e,t){return this.generalIntegrate(e.Q0,e.Q+t,e.Q,this.reciprocalFloor(e.i),e.K)}sellBaseToken(e,t){let a=0n,n=Ie.BELOW_ONE;if(e.R===Ie.ONE)a=this.ROneSellBaseToken(e,t),n=Ie.BELOW_ONE;else if(e.R===Ie.ABOVE_ONE){const s=e.B0-e.B,i=e.Q-e.Q0;t<s?(a=this.RAboveSellBaseToken(e,t),n=Ie.ABOVE_ONE,a>i&&(a=i)):t==s?(a=i,n=Ie.ONE):(a=i+this.ROneSellBaseToken(e,t-s),n=Ie.BELOW_ONE)}else a=this.RBelowSellBaseToken(e,t),n=Ie.BELOW_ONE;return{receiveQuoteAmount:a,newR:n}}sellQuoteToken(e,t){let a=0n,n=Ie.BELOW_ONE;if(e.R===Ie.ONE)a=this.ROneSellQuoteToken(e,t),n=Ie.ABOVE_ONE;else if(e.R===Ie.ABOVE_ONE)a=this.RAboveSellQuoteToken(e,t),n=Ie.ABOVE_ONE;else{const s=e.Q0-e.Q,i=e.B-e.B0;t<s?(a=this.RBelowSellQuoteToken(e,t),n=Ie.BELOW_ONE,a>i&&(a=i)):t===s?(a=i,n=Ie.ONE):(a=i+this.ROneSellQuoteToken(e,t-s),n=Ie.ABOVE_ONE)}return{receiveBaseAmount:a,newR:n}}querySellBase(e){let{receiveQuoteAmount:t,newR:a}=this.sellBaseToken(this.pmmState,e);const n=this.lpFeeRate,s=this.mtFeeRate,i=this.mulFloor(t,s);t=t-this.mulFloor(t,n)-i;return{mtFee:i,newTarget:this.pmmState.B0,newRState:a,receiveAmount:t}}querySellQuote(e){let{receiveBaseAmount:t,newR:a}=this.sellQuoteToken(this.pmmState,e);const n=this.lpFeeRate,s=this.mtFeeRate,i=this.mulFloor(t,s);t=t-this.mulFloor(t,n)-i;return{mtFee:i,newTarget:this.pmmState.Q0,newRState:a,receiveAmount:t}}getAmountOut(e,t,a){return""===this.poolContract?{amount:0n,gas:0n}:e===this.quoteToken?{amount:this.querySellQuote(a).receiveAmount,gas:this.gasConstant}:{amount:this.querySellBase(a).receiveAmount,gas:this.gasConstant}}}class Ee extends ue{static create(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,gas:c}=e;return new Ee(d,n,s,i,t[0],t[1],a,c)}getfetchingCurrentStateCalls(){const t=this.abiCoder.encode(["address"],[this.pairContract]);return[{callData:"0x0902f1ac",target:this.pairContract},{callData:e.utils.hexConcat(["0x4c2fc06f",t]),target:this.factory}]}applyCurrentStateFromCalls(e){if(0===e.length||!e[0].success||"0x"===e[0].returnData)return this.reserve0=0n,this.reserve1=0n,void(this.fee=0n);const[t,a]=this.abiCoder.decode(["uint112","uint112","uint32"],e[0].returnData);if(this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt(),e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.fee=this.feePrecision-t.toBigInt()}else this.fee=this.feePrecision}}class ke{constructor(e,t,a,n,s,i,d){this.poolContract=e,this.expectedImplementation=t,this.expectedTokens=a,this.expectedTokenIdx=n,this.depositAddress=s,this.routeIndex=i,this.gasConstant=d,this.errorFactory=new ge(ke.name),this.abiCoder=he,this.W_ONE=1000000000000000000n,this.MASK_128=340282366920938463463374607431768211455n,this.DECM_OFF=41n,this.YENABLE_OFF=40n,this.implementation="",this.tokens=[],this.tokenIndex={},this.tokenInfos=[],this.balances=[],this.softWeights=[],this.hardWeights=[],this.decimalMultipliers=[],this.normalizedDecimals=[],this.swapFee=0n,this.totalBalance=0n}static create(e,t){const a=Object.keys(e.expectedTokens);return new ke(e.poolContract,e.expectedImplAddress,a,a.map((t=>e.expectedTokens[t])),e.address,t,e.gas)}static isPairSupported(e,t){return void 0!==t[e[0]]&&void 0!==t[e[1]]}getTradablePairs(){const e=[];for(let t=0,a=this.expectedTokens.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.expectedTokens[t],this.expectedTokens[n]]),e.push([this.expectedTokens[n],this.expectedTokens[t]]);return e}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){const t=[{callData:"0x252f7b49",target:this.poolContract},{callData:"0x83278155",target:this.poolContract},{callData:"0x5c60da1b",target:this.poolContract}];for(let a=0,n=this.expectedTokenIdx.length;a<n;++a){const n=this.abiCoder.encode(["uint256"],[this.expectedTokenIdx[a]]);t.push({callData:e.utils.hexConcat(["0x1e010439",n]),target:this.poolContract}),t.push({callData:e.utils.hexConcat(["0x8676192b",n]),target:this.poolContract})}return t}applyCurrentStateFromCalls(e){if(0===e.length)return;const[t]=this.abiCoder.decode(["uint256"],e[0].returnData),[a]=this.abiCoder.decode(["uint256"],e[1].returnData),[n]=this.abiCoder.decode(["address"],e[2].returnData);if(this.implementation=n.toLowerCase(),this.implementation!==this.expectedImplementation)return;this.totalBalance=t.toBigInt(),this.swapFee=a.toBigInt();const s=[],i=[];for(let t=3,a=2,n=t+a*this.expectedTokenIdx.length;t<n;t+=a){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData),[n]=this.abiCoder.decode(["uint256"],e[t+1].returnData);s.push(a.toBigInt()),i.push(n.toBigInt())}this.balances=s,this.tokenInfos=i,this.softWeights=this.tokenInfos.map((e=>this.getSoftWeight(e))),this.hardWeights=this.tokenInfos.map((e=>this.getHardWeight(e))),this.decimalMultipliers=this.tokenInfos.map((e=>this.getDecimalMultiplier(e))),this.normalizedDecimals=this.tokenInfos.map((e=>this.normalizeBalance(e))),this.tokens=this.tokenInfos.map((e=>this.getAddress(e))),this.tokenIndex=this.tokens.reduce(((e,t,a)=>(e[t]=a,e)),{})}getAddress(t){const a=t&(1n<<160n)-1n;return e.utils.hexZeroPad("0x"+a.toString(16),20)}getSoftWeight(e){return 1000000000000n*(e>>160n&1048575n)}getHardWeight(e){return 1000000000000n*(e>>180n&1048575n)}getDecimalMultiplier(e){return e>>160n+this.DECM_OFF&31n}isYEnabled(e){return 1n===(e>>160n+this.YENABLE_OFF&1n)}normalizeBalance(e){return 10n**this.getDecimalMultiplier(e)}lg2(e){let t=0n,a=e;a>=18446744073709551616n&&(a>>=64n,t+=64n),a>=4294967296n&&(a>>=32n,t+=32n),a>=65536n&&(a>>=16n,t+=16n),a>=256n&&(a>>=8n,t+=8n),a>=16n&&(a>>=4n,t+=4n),a>=4n&&(a>>=2n,t+=2n),a>=2n&&(t+=1n);let n=t-64n<<64n,s=e<<127n-t;for(let e=9223372036854775808n;e>8796093022208n;e>>=1n){s*=s;const t=s>>255n;s>>=127n+t,n+=e*t}return n}logApprox(e){const t=this.W_ONE;if(e<t)throw this.errorFactory.createRequireViolated("logApprox: x must >= 1");const a=e-t,n=a*a/t,s=n*a/t,i=s*a/t;return a-n/2n+s/3n-i/4n+i*a/t/5n}log(e){if(e<this.W_ONE)throw this.errorFactory.createRequireViolated("log(x): x must be greater than 1");if(e>this.W_ONE<<63n)throw this.errorFactory.createRequireViolated("log(x): x is too large");if(e<=this.W_ONE+this.W_ONE/10n)return this.logApprox(e);const t=(e<<64n)/this.W_ONE&this.MASK_128;return 693147180559945344n*this.lg2(t)>>64n}min(e,t){return e<=t?e:t}getMintAmount(e,t,a,n,s){const i=t+e,d=a+e;if(d*this.W_ONE<=n*i)return e;if(d*this.W_ONE>s*i)throw this.errorFactory.createRequireViolated("mint: new percentage exceeds hard weight");let c=0n;a*this.W_ONE<=n*t&&(c=(t*n-a*this.W_ONE)/(this.W_ONE-n));let r=(t-a)*this.log(i*this.W_ONE/(t+c));if(r-=(e-c)*(this.W_ONE-s),r/=s-n,c+=r,c>e)throw this.errorFactory.createRequireViolated("penalty should be positive");return c}redeemPenaltyFor(e,t,a,n,s){const i=e-a;if(t*this.W_ONE<=i*n)return 0n;if(t*this.W_ONE>i*s)throw this.errorFactory.createRequireViolated("redeem: hard-limit weight is broken");let d=0n;t*this.W_ONE<e*n&&(d=e-t*this.W_ONE/n);return t*this.log(this.W_ONE+(a-d)*s/(s*i/this.W_ONE-t))*(s-n)/s/s-(a-d)*n/s}redeemPenaltyDerivativeForOne(e,t,a,n,s){const i=this.W_ONE,d=e-a;if(t*this.W_ONE<=d*n)return i;const c=s*d/this.W_ONE-t;return i+(t*this.W_ONE-d*n)/c}redeemFindOne(e,t,a,n,s,i){let d=this.min(n,999n*e/1000n);for(let c=0;c<256;c++){const c=d+this.redeemPenaltyFor(t,a,d,s,i);let r=0n;if(r=c>n?c-n:n-c,r<d/100000n){if(d>n)throw this.errorFactory.createRequireViolated("Redeem error: out amount > lp amount");if(d>e)throw this.errorFactory.createRequireViolated("Redeem error: insufficient balance");return d}const o=this.redeemPenaltyDerivativeForOne(t,a,d,s,i);c>n?d-=r*this.W_ONE/o:d+=r*this.W_ONE/o}throw this.errorFactory.createRequireViolated("cannot find proper resolution of fx")}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];if(void 0===n||void 0===s||a<=0n)return{amount:0n,gas:0n};let i=this.totalBalance,d=this.balances[n],c=0n;const r=this.softWeights[n],o=this.hardWeights[n],f=a*this.normalizedDecimals[n];c=this.getMintAmount(f,i,d,r,o),i+=f,d+=f;const l=this.balances[s],b=this.redeemFindOne(l,i,d,c,r,o)/this.normalizedDecimals[s];return{amount:b-b*this.swapFee/this.W_ONE,gas:this.gasConstant}}}class Ne extends ye{constructor(e,t,a,n,s,i,d,c){super(e,t,a,n,s,i,d),this.depositAddress=c}static create(e,t,a){const{btkn:n,qtkn:s}=ye.getBaseQuoteTokens(e,t);return new Ne(e.factoryContract,e.address,n,s,e.pools[n][s],a,e.gas,e.address)}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[{callData:"0xffa64225",target:this.poolContract},{callData:"0x17be952e",target:this.poolContract},{callData:"0x796da7af",target:this.poolContract},{callData:"0x7c9b8e89",target:this.poolContract},{callData:"0xeab5d20e",target:this.poolContract},{callData:"0xec2fd46d",target:this.poolContract},{callData:"0xc0ffa178",target:this.poolContract},{callData:"0xab44a7a3",target:this.poolContract}]}applyCurrentStateFromCalls(e){if(0===e.length)return;const[t,a]=this.abiCoder.decode(["uint256","uint256"],e[0].returnData),[n]=this.abiCoder.decode(["uint8"],e[1].returnData),[s]=this.abiCoder.decode(["uint256"],e[2].returnData),[i]=this.abiCoder.decode(["uint256"],e[3].returnData),[d]=this.abiCoder.decode(["uint256"],e[4].returnData),[c]=this.abiCoder.decode(["uint256"],e[5].returnData),[r]=this.abiCoder.decode(["uint256"],e[6].returnData),[o]=this.abiCoder.decode(["uint256"],e[7].returnData);this.pmmState={B:d.toBigInt(),B0:t.toBigInt(),K:c.toBigInt(),Q:i.toBigInt(),Q0:a.toBigInt(),i:s.toBigInt(),R:n},this.mtFeeRate=r.toBigInt(),this.lpFeeRate=o.toBigInt()}generalIntegrate(e,t,a,n,s){const i=this.mulFloor(n,t-a),d=this.divCeil(e*e/t,a),c=this.mulFloor(s,d);return this.mulFloor(i,this.W_ONE-s+c)}solveQuadraticFunctionForTradeV1(e,t,a,n,s){this.errorFactory.require(t>0n,"TARGET_IS_ZERO");let i=this.mulFloor(s,e)*e/t,d=this.mulFloor(this.W_ONE-s,t),c=!0;n?d+=a:i+=a,d>=i?(d-=i,c=!0):(d=i-d,c=!1);let r=this.mulFloor(4n*(this.W_ONE-s),this.mulFloor(s,e)*e);r=this.sqrt(d*d+r);const o=2n*(this.W_ONE-s);let f;return f=c?d+r:r-d,n?this.divFloor(f,o):this.divCeil(f,o)}ROneSellBaseToken(e,t){const a=this.solveQuadraticFunctionForTradeV1(e.Q0,e.Q0,this.mulFloor(e.i,t),!1,e.K);return e.Q0-a}RBelowSellBaseToken(e,t){const a=this.solveQuadraticFunctionForTradeV1(e.Q0,e.Q,this.mulFloor(e.i,t),!1,e.K);return e.Q-a}ROneSellQuoteToken(e,t){const a=this.divFloor(this.W_ONE,e.i),n=this.solveQuadraticFunctionForTradeV1(e.B0,e.B0,this.mulFloor(a,t),!1,e.K);return e.B0-n}RAboveSellQuoteToken(e,t){const a=this.divFloor(this.W_ONE,e.i),n=this.solveQuadraticFunctionForTradeV1(e.B0,e.B,this.mulFloor(a,t),!1,e.K);return e.B-n}sellQuoteToken(e,t){let a=0n;if(e.R===Ie.ONE)a=this.ROneSellQuoteToken(e,t);else if(e.R===Ie.ABOVE_ONE)a=this.RAboveSellQuoteToken(e,t);else{const n=e.B-e.B0,s=e.Q0-e.Q;a=t<=s?this.RBelowSellQuoteToken(e,t):n+this.ROneSellQuoteToken(e,t-s)}return{receiveBaseAmount:a,newR:Ie.ONE}}querySellQuote(e){let{receiveBaseAmount:t,newR:a}=this.sellQuoteToken(this.pmmState,e);const n=this.mulFloor(t,this.mtFeeRate);t=this.divFloor(t,this.W_ONE+this.mtFeeRate+this.lpFeeRate);return{mtFee:n,newTarget:this.pmmState.Q0,newRState:a,receiveAmount:t}}}class Oe{constructor(t,a,n,s,i,d,c,r){this.tradingRouteIndex=t,this.tokens=a,this.scalingFactors=n,this.normalizedWeights=s,this.poolId=i,this.vaultContract=d,this.depositAddress=c,this.gasConstant=r,this.abiCoder=he,this.err=new ge(Oe.name),this.ONE=1000000000000000000n,this.ONE_36=1000000000000000000000000000000000000n,this.MAX_POW_RELATIVE_ERROR=10000n,this.ONE_20=100000000000000000000n,this.MILD_EXPONENT_BOUND=289480223093290488558927462521719769633174961664101410098n,this.X_BOUND=57896044618658097711785492504343953926634992332820282019728792003956564819968n,this.LN_36_LOWER_BOUND=900000000000000000n,this.LN_36_UPPER_BOUND=1100000000000000000n,this.MIN_NATURAL_EXPONENT=-41000000000000000000n,this.MAX_NATURAL_EXPONENT=130000000000000000000n,this.MAX_IN_RATIO=300000000000000000n,this.x0=128000000000000000000n,this.a0=38877084059945950922200000000000000000000000000000000000n,this.x1=64000000000000000000n,this.a1=6235149080811616882910000000n,this.x2=3200000000000000000000n,this.a2=7896296018268069516100000000000000n,this.x3=1600000000000000000000n,this.a3=888611052050787263676000000n,this.x4=800000000000000000000n,this.a4=298095798704172827474000n,this.x5=400000000000000000000n,this.a5=5459815003314423907810n,this.x6=200000000000000000000n,this.a6=738905609893065022723n,this.x7=100000000000000000000n,this.a7=271828182845904523536n,this.x8=50000000000000000000n,this.a8=164872127070012814685n,this.x9=25000000000000000000n,this.a9=128402541668774148407n,this.x10=12500000000000000000n,this.a10=113314845306682631683n,this.x11=6250000000000000000n,this.a11=106449445891785942956n,this.swapFee=0n,this.tokenIndexes=this.tokens.reduce(((e,t,a)=>(e[t]=a,e)),{}),this.balances=Array.from({length:a.length},(()=>0n)),this.balancesUpScaled=Array.from({length:a.length},(()=>0n)),this.poolIdParam=this.abiCoder.encode(["bytes32"],[this.poolId]),this.poolContract=e.utils.hexZeroPad("0x"+(BigInt(this.poolId)>>96n).toString(16),20)}static create(e,t){return new Oe(t,e.tokens,e.scalingFactors,e.weights,e.poolId,e.vaultContract,e.depositAddress,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.tokens.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.tokens[t],this.tokens[n]]),e.push([this.tokens[n],this.tokens[t]]);return e}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[{callData:"0x55c67628",target:this.poolContract},{callData:e.utils.hexConcat(["0xf94d4668",this.poolIdParam]),target:this.vaultContract}]}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.swapFee=t.toBigInt()}if(e[1].success){const[,t]=this.abiCoder.decode(["address[]","uint256[]","uint256"],e[1].returnData);this.balances=t.map((e=>e.toBigInt())),this.balancesUpScaled=this.balances.map(((e,t)=>e*this.scalingFactors[t]))}}}mulDown(e,t){const a=e*t;return this.err.require(0n===e||a/e===t,"MUL_OVERFLOW"),a/this.ONE}mulUp(e,t){const a=e*t;return this.err.require(0n===e||a/e===t,"MUL_OVERFLOW"),0n===a?0n:(a-1n)/this.ONE+1n}divUp(e,t){if(this.err.require(0n!==t,"ZERO_DIVISION"),0n===e)return 0n;{const a=e*this.ONE;return this.err.require(a/e===this.ONE,"DIV_INTERNAL"),(a-1n)/t+1n}}ln_36(e){const t=((e*=this.ONE)-this.ONE_36)*this.ONE_36/(e+this.ONE_36),a=t*t/this.ONE_36;let n=t,s=n;return n=n*a/this.ONE_36,s+=n/3n,n=n*a/this.ONE_36,s+=n/5n,n=n*a/this.ONE_36,s+=n/7n,n=n*a/this.ONE_36,s+=n/9n,n=n*a/this.ONE_36,s+=n/11n,n=n*a/this.ONE_36,s+=n/13n,n=n*a/this.ONE_36,s+=n/15n,2n*s}ln(e){if(this.err.require(e>0n,"OUT_OF_BOUNDS"),e<this.ONE)return-this.ln(this.ONE*this.ONE/e);let t=0n;e>=this.a0*this.ONE&&(e/=this.a0,t+=this.x0),e>=this.a1*this.ONE&&(e/=this.a1,t+=this.x1),t*=100n,(e*=100n)>=this.a2&&(e=e*this.ONE_20/this.a2,t+=this.x2),e>=this.a3&&(e=e*this.ONE_20/this.a3,t+=this.x3),e>=this.a4&&(e=e*this.ONE_20/this.a4,t+=this.x4),e>=this.a5&&(e=e*this.ONE_20/this.a5,t+=this.x5),e>=this.a6&&(e=e*this.ONE_20/this.a6,t+=this.x6),e>=this.a7&&(e=e*this.ONE_20/this.a7,t+=this.x7),e>=this.a8&&(e=e*this.ONE_20/this.a8,t+=this.x8),e>=this.a9&&(e=e*this.ONE_20/this.a9,t+=this.x9),e>=this.a10&&(e=e*this.ONE_20/this.a10,t+=this.x10),e>=this.a11&&(e=e*this.ONE_20/this.a11,t+=this.x11);const a=(e-this.ONE_20)*this.ONE_20/(e+this.ONE_20),n=a*a/this.ONE_20;let s=a,i=s;return s=s*n/this.ONE_20,i+=s/3n,s=s*n/this.ONE_20,i+=s/5n,s=s*n/this.ONE_20,i+=s/7n,s=s*n/this.ONE_20,i+=s/9n,s=s*n/this.ONE_20,i+=s/11n,i*=2n,(t+i)/100n}exp(e){if(this.err.require(e>=this.MIN_NATURAL_EXPONENT&&e<=this.MAX_NATURAL_EXPONENT,"INVALID_EXPONENT"),e<0n)return this.ONE*this.ONE/this.exp(-e);let t=0n;e>=this.x0?(e-=this.x0,t=this.a0):e>=this.x1?(e-=this.x1,t=this.a1):t=1n,e*=100n;let a=this.ONE_20;e>=this.x2&&(e-=this.x2,a=a*this.a2/this.ONE_20),e>=this.x3&&(e-=this.x3,a=a*this.a3/this.ONE_20),e>=this.x4&&(e-=this.x4,a=a*this.a4/this.ONE_20),e>=this.x5&&(e-=this.x5,a=a*this.a5/this.ONE_20),e>=this.x6&&(e-=this.x6,a=a*this.a6/this.ONE_20),e>=this.x7&&(e-=this.x7,a=a*this.a7/this.ONE_20),e>=this.x8&&(e-=this.x8,a=a*this.a8/this.ONE_20),e>=this.x9&&(e-=this.x9,a=a*this.a9/this.ONE_20);let n=this.ONE_20,s=e;return n+=s,s=s*e/this.ONE_20/2n,n+=s,s=s*e/this.ONE_20/3n,n+=s,s=s*e/this.ONE_20/4n,n+=s,s=s*e/this.ONE_20/5n,n+=s,s=s*e/this.ONE_20/6n,n+=s,s=s*e/this.ONE_20/7n,n+=s,s=s*e/this.ONE_20/8n,n+=s,s=s*e/this.ONE_20/9n,n+=s,s=s*e/this.ONE_20/10n,n+=s,s=s*e/this.ONE_20/11n,n+=s,s=s*e/this.ONE_20/12n,n+=s,a*n/this.ONE_20*t/100n}powExp(e,t){if(0n===t)return this.ONE;if(0n===e)return 0n;this.err.require(e<this.X_BOUND,"X_OUT_OF_BOUNDS");const a=e;this.err.require(t<this.MILD_EXPONENT_BOUND,"Y_OUT_OF_BOUNDS");const n=t;let s=0n;if(this.LN_36_LOWER_BOUND<a&&a<this.LN_36_UPPER_BOUND){const e=this.ln_36(a);s=e/this.ONE*n+e%this.ONE*n/this.ONE}else s=this.ln(a)*n;return s/=this.ONE,this.err.require(this.MIN_NATURAL_EXPONENT<=s&&s<=this.MAX_NATURAL_EXPONENT,"PRODUCT_OUT_OF_BOUNDS"),this.exp(s)}powUp(e,t){const a=this.powExp(e,t);return a+(this.mulUp(a,this.MAX_POW_RELATIVE_ERROR)+1n)}complement(e){return e<this.ONE?this.ONE-e:0n}calcOutGivenIn(e,t,a,n,s){this.err.require(s<=this.mulDown(e,this.MAX_IN_RATIO),"MAX_IN_RATIO");const i=e+s,d=this.divUp(e,i),c=this.divDown(t,n),r=this.powUp(d,c);return this.mulDown(a,this.complement(r))}divDown(e,t){if(this.err.require(0n!==t,"ZERO_DIVISION"),0n===e)return 0n;{const a=e*this.ONE;return this.err.require(a/e===this.ONE,"DIV_INTERNAL"),a/t}}getAmountOut(e,t,a){const n=this.tokenIndexes[e],s=this.tokenIndexes[t];let i=a-this.mulUp(a,this.swapFee);i*=this.scalingFactors[n];return{amount:this.calcOutGivenIn(this.balancesUpScaled[n],this.normalizedWeights[n],this.balancesUpScaled[s],this.normalizedWeights[s],i)/this.scalingFactors[s],gas:this.gasConstant}}}class Se{constructor(e,t,a,n,s,i,d,c,r,o,f,l,b,h,u,p){this.poolContract=e,this.lpToken=t,this.TOKENS=a,this.PRECISION=n,this.PRECISIONS=s,this.FEE_DENOMINATOR=i,this.NOISE_FEE=d,this.MIN_A=c,this.MAX_A=r,this.MIN_GAMMA=o,this.MAX_GAMMA=f,this.A_MULTIPLIER=l,this.isAPrecise=b,this.routeIndex=h,this.depositAddress=u,this.gasConstant=p,this.err=new ge(Se.name),this.abiCoder=he,this.tokenIndex={},this.W_ONE=10n**18n,this.TENe9=10n**9n,this.TENe11=10n**11n,this.TENe14=10n**14n,this.TENe15=10n**15n,this.TENe16=10n**16n,this.TENe17=10n**17n,this.TENe20=10n**20n,this.A=0n,this.gamma=0n,this.D=0n,this.feeGamma=0n,this.midFee=0n,this.outFee=0n,this.lpTokenTotalSupply=0n,this.tokenIndex=a.reduce(((e,t,a)=>(e[t]=a,e)),{}),this.balances=Array.from({length:this.TOKENS.length},(()=>0n)),this.priceScales=Array.from({length:this.TOKENS.length-1},(()=>0n))}getLPMintAmount(e){throw new Error("TODO: Method not implemented.")}static create(e,t){return new Se(e.poolContract,e.lpToken,e.tokens,e.precision,e.precisions,e.feeDenominator,e.noiseFee,e.minA,e.maxA,e.minGamma,e.maxGamma,e.aMultiplier,e.isAPrecise,t,e.address,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}get fee(){return this.feeCalc(this.xp())}getTradablePairs(){const e=[];for(let t=0,a=this.TOKENS.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.TOKENS[t],this.TOKENS[n]]),e.push([this.TOKENS[n],this.TOKENS[t]]);return e}xp(){const e=this.TOKENS.length,t=[...this.balances],a=this.PRECISIONS;t[0]*=this.PRECISIONS[0];for(let n=1;n<e;++n){const e=this.priceScales[n-1]*a[n];t[n]=t[n]*e/this.PRECISION}return t}getDy(e,t,a){const n=this.TOKENS.length;if(e===t||e>=n||t>=n)throw this.err.createRequireViolated("coin index out of range");if(a<=0n)throw this.err.createRequireViolated("do not exchange 0 coins");const s=this.PRECISIONS,i=[...this.balances];i[e]+=a,i[0]*=s[0];for(let e=0,t=n-1;e<t;++e)i[e+1]=i[e+1]*this.priceScales[e]*s[e+1]/this.PRECISION;const d=this.newtonY(this.A,this.gamma,i,this.D,t);let c=i[t]-d-1n;return i[t]=d,t>0&&(c=c*this.PRECISION/this.priceScales[t-1]),c/=s[t],c-=this.feeCalc(i)*c/this.FEE_DENOMINATOR,c}calculateWithdrawOneCoin(e,t){throw new Error("Method not implemented.")}getVirtualPrice(){throw new Error("Method not implemented.")}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){const t=[{callData:this.isAPrecise?"0x76a2f0f0":"0xf446c1d0",target:this.poolContract},{callData:"0x0f529ba2",target:this.poolContract},{callData:"0xb1373929",target:this.poolContract},{callData:"0x72d4f0e2",target:this.poolContract},{callData:"0x92526c0c",target:this.poolContract},{callData:"0xee8de675",target:this.poolContract},{callData:"0x18160ddd",target:this.lpToken},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode(["uint256"],[a]);return{callData:e.utils.hexConcat(["0x4903b0d1",n]),target:this.poolContract}}))];return 2===this.TOKENS.length?t.push({callData:"0xb9e8c9fd",target:this.poolContract}):t.push(...this.TOKENS.slice(0,this.TOKENS.length-1).map(((t,a)=>{const n=this.abiCoder.encode(["uint256"],[a]);return{callData:e.utils.hexConcat(["0xa3f7cdd5",n]),target:this.poolContract}}))),t}applyCurrentStateFromCalls(e){if(0===e.length)return;if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.D=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.gamma=t.toBigInt()}if(e[3].success){const[t]=this.abiCoder.decode(["uint256"],e[3].returnData);this.feeGamma=t.toBigInt()}if(e[4].success){const[t]=this.abiCoder.decode(["uint256"],e[4].returnData);this.midFee=t.toBigInt()}if(e[5].success){const[t]=this.abiCoder.decode(["uint256"],e[5].returnData);this.outFee=t.toBigInt()}if(e[6].success){const[t]=this.abiCoder.decode(["uint256"],e[6].returnData);this.lpTokenTotalSupply=t.toBigInt()}let t=0;for(let a=7,n=a+this.TOKENS.length;a<n;++a)if(e[a].success){const[n]=this.abiCoder.decode(["uint256"],e[a].returnData);this.balances[t]=n.toBigInt(),t+=1}t=0;for(let a=this.TOKENS.length+7,n=a+this.TOKENS.length-1;a<n;++a)if(e[a].success){const[n]=this.abiCoder.decode(["uint256"],e[a].returnData);this.priceScales[t]=n.toBigInt(),t+=1}}max(e,t){return e>t?e:t}reductionCoefficient(e,t){const a=this.TOKENS.length;let n=this.W_ONE,s=0n;return e.forEach((e=>{s+=e})),e.forEach((e=>{n=n*BigInt(a)*e/s})),t>0&&(n=t*this.W_ONE/(t+this.W_ONE-n)),n}newtonY(e,t,a,n,s){const i=this.TOKENS.length;this.err.require(e>this.MIN_A-1n&&e<this.MAX_A+1n,"unsafe values A"),this.err.require(t>this.MIN_GAMMA-1n&&t<this.MAX_GAMMA+1n,"unsafe values gamma"),this.err.require(n>this.TENe17-1n&&n<this.TENe15*this.W_ONE+1n,"unsafe values D");for(let e=0;e<i;++e)if(e!==s){const t=a[e]*this.W_ONE/n;this.err.require(t>this.TENe16-1n&&t<this.TENe20+1n,"unsafe values x[i]")}let d=n;i>2&&(d/=BigInt(i));let c=this.W_ONE,r=0n,o=[...a];o[s]=0n,o.sort(((e,t)=>e<t?1:t<e?-1:0));const f=this.max(this.max(o[0]/this.TENe14,n/this.TENe14),100n);for(let e=2,t=i+1;e<t;++e){const t=o[i-e];d=2===e&&2===i?d*n/(t*BigInt(i)*BigInt(i)):d*n/(t*BigInt(i)),r+=t}for(let e=0,t=i-1;e<t;++e)c=c*o[e]*BigInt(i)/n;for(let a=0;a<255;++a){const a=d,s=c*d*BigInt(i)/n,o=r+d;let l=t+this.W_ONE;l=l>s?l-s+1n:s-l+1n;const b=this.W_ONE*n/t*l/t*l*this.A_MULTIPLIER/e,h=this.W_ONE+2n*this.W_ONE*s/l;let u=this.W_ONE*d+o*h+b;const p=n*h;if(u<p){d=a/2n;continue}u-=p;const x=u/d;let g=b/x;const m=(u+this.W_ONE*n)/x+g*this.W_ONE/s;g+=this.W_ONE*o/x,d=m<g?a/2n:m-g;let C=0n;if(C=d>a?d-a:a-d,C<this.max(f,d/this.TENe14)){const e=d*this.W_ONE/n;return this.err.require(e>this.TENe16-1n&&e<this.TENe20+1n,"unsafe value for y"),d}}throw this.err.createRequireViolated("Did not converge")}geometricMean(e,t=!0){const a=this.TOKENS.length;let n=[...e];t&&(n=n.sort(((e,t)=>e>t?-1:e<t?1:0)));let s=n[0],i=0n;for(let e=0;e<255;++e){let e=s,t=this.W_ONE;for(let e=0,a=n.length;e<a;++e)t=t*n[e]/s;if(s=s*(BigInt(a-1)*this.W_ONE+t)/(BigInt(a)*this.W_ONE),i=s>e?s-e:e-s,i<=1n||i*this.W_ONE<s)return s}throw this.err.createRequireViolated("Did not converge")}newtonD(e,t,a){const n=this.TOKENS.length;this.err.require(e>this.MIN_A-1n&&e<this.MAX_A+1n,"unsafe values A"),this.err.require(t>this.MIN_GAMMA-1n&&t<this.MAX_GAMMA+1n,"unsafe values gamma");const s=[...a].sort(((e,t)=>e>t?-1:e<t?1:0));this.err.require(s[0]>this.TENe9-1n&&s[0]<this.TENe15*this.W_ONE+1n,"unsafe values x[0]");for(let e=1;e<n;++e){const t=s[e]*this.W_ONE/s[0];this.err.require(t>this.TENe11-1n,"unsafe values x[i]")}let i=BigInt(n)*this.geometricMean(s,!1),d=s.reduce(((e,t)=>t+e),0n);for(let a=0;a<255;++a){let a=i,c=this.W_ONE;c=s.reduce(((e,t)=>e*t*BigInt(n)/i),c);let r=t+this.W_ONE;r=r>c?r-c+1n:c-r+1n;const o=this.W_ONE*i/t*r/t*r*this.A_MULTIPLIER/e,f=2n*this.W_ONE*BigInt(n)*c/r,l=d+d*f/this.W_ONE+o*BigInt(n)/c-f*i/this.W_ONE,b=i*(l+d)/l;let h=i*i/l;this.W_ONE>c?h+=i*(o/l)/this.W_ONE*(this.W_ONE-c)/c:h-=i*(o/l)/this.W_ONE*(c-this.W_ONE)/c,i=b>h?b-h:(h-b)/2n;let u=0n;if(u=i>a?i-a:a-i,u*this.TENe14<this.max(this.TENe16,i)){for(let e=0,t=s.length;e<t;++e){const t=s[e]*this.W_ONE/i;this.err.require(t>this.TENe16-1n&&t<this.TENe20+1n,"unsafe values x[i]")}return i}}throw this.err.createRequireViolated("Did not converge")}feeCalc(e){const t=this.reductionCoefficient(e,this.feeGamma);return(this.midFee*t+this.outFee*(this.W_ONE-t))/this.W_ONE}calculateTokenFee(e,t){const a=this.TOKENS.length,n=this.feeCalc(t)*BigInt(a)/BigInt(4*(a-1));let s=0n;for(let t=0,a=e.length;t<a;++t)s+=e[t];const i=s/BigInt(a);let d=0n;for(let t=0,a=e.length;t<a;++t){const a=e[t];d+=a>i?a-i:i-a}return n*d/s+this.NOISE_FEE}calculateTokenAmount(e,t){const a=this.TOKENS.length,n=this.PRECISIONS;let s=[...this.balances],i=[...e];if(t)for(let t=0;t<a;++t)s[t]+=e[t];else for(let t=0;t<a;++t)s[t]-=e[t];s[0]*=n[0],i[0]*=n[0];for(let e=0;e<a-1;++e){const t=this.priceScales[e]*n[e+1];s[e+1]=s[e+1]*t/this.PRECISION,i[e+1]=i[e+1]*t/this.PRECISION}const d=this.newtonD(this.A,this.gamma,s);let c=this.lpTokenTotalSupply*d/this.D;return t?c-=this.lpTokenTotalSupply:c=this.lpTokenTotalSupply-c,c-=this.calculateTokenFee(i,s)*c/this.FEE_DENOMINATOR+1n,c}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];return{amount:this.getDy(n,s,a),gas:this.gasConstant}}}class Pe extends me{constructor(e,t,a,n,s,i,d,c,r,o=1n){super(e,t,a,s.map((e=>e*n)),n,n,s,i,!1,d,c,r,o),this.offpegFeeMultiplier=0n}static createLendingA(e,t){return new Pe(e.poolContract,e.lpToken,e.tokens,e.precision,e.precisionMul,e.feeDenominator,t,e.address,e.gas,e.aPrecision)}dynamicFee(e,t,a,n){if(n<=this.FEE_DENOMINATOR)return a;{let s=e+t;return s*=s,n*a/(4n*(n-this.FEE_DENOMINATOR)*e*t/s+this.FEE_DENOMINATOR)}}getfetchingCurrentStateCalls(){const e=super.getfetchingCurrentStateCalls();return e.push({callData:"0x8edfdd5f",target:this.poolContract}),e}applyCurrentStateFromCalls(e){super.applyCurrentStateFromCalls(e);const t=e.length;if(e[t-1].success){const[a]=this.abiCoder.decode(["uint256"],e[t-1].returnData);this.offpegFeeMultiplier=a.toBigInt()}}getD(e,t){const a=BigInt(this.TOKENS.length);let n=0n;for(let t=0,a=e.length;t<a;++t)n+=e[t];if(0n===n)return 0n;let s=0n,i=n;const d=t*a;for(let t=0;t<255;++t){let t=i;for(let n=0,s=e.length;n<s;++n)t=t*i/(e[n]*a+1n);if(s=i,i=(d*n/this.A_PRECISION+t*a)*i/((d-this.A_PRECISION)*i/this.A_PRECISION+(a+1n)*t),i>s){if(i-s<=1n)return i}else if(s-i<=1n)return i}throw this.errorFactory.createRequireViolated("getD does not converge")}getDPrecision(e,t){const a=[...this.PRECISION_MUL].map(((t,a)=>t*e[a]));return this.getD(a,t)}getVirtualPrice(){const e=this.getDPrecision(this.balances,this.A),t=this.lpTokenTotalSupply;return e*this.PRECISION/t}getLPMintAmount(e){const t=this.A,a=[...this.balances];let n=0n;0n!==this.lpTokenTotalSupply&&(n=this.getDPrecision(a,t));const s=[...a],i=this.TOKENS.length;for(let t=0;t<i;++t)0n===this.lpTokenTotalSupply&&this.errorFactory.require(0n!==e[t],"initial deposit requires all coins"),s[t]+=e[t];const d=this.getDPrecision(s,t);this.errorFactory.require(d>n,"D1 > D0");const c=Array.from({length:i},(()=>0n));let r=0n;if(0n!==this.lpTokenTotalSupply){const e=(n+d)/BigInt(i),o=this.fee*BigInt(i)/(4n*(BigInt(i)-1n)),f=this.offpegFeeMultiplier;let l=0n;for(let t=0;t<i;++t){const i=d*a[t]/n,r=s[t];l=i>r?i-r:r-i;const b=a[t]+r;c[t]=this.dynamicFee(b,e,o,f)*l/this.FEE_DENOMINATOR,s[t]=r-c[t]}const b=this.getDPrecision(s,t);r=this.lpTokenTotalSupply*(b-n)/n}else r=d;return r}calculateWithdrawOneCoin(e,t){const a=this.TOKENS.length,n=this.A,s=[...this.balances],i=this.PRECISION_MUL;for(let e=0;e<a;++e)s[e]*=i[e];const d=this.getD(s,n),c=d-e*d/this.lpTokenTotalSupply,r=this.getYD(n,t,s,c),o=[...s],f=(d+c)/(2n*BigInt(a)),l=this.fee*BigInt(a)/(4n*(BigInt(a)-1n)),b=this.offpegFeeMultiplier;for(let e=0;e<a;++e){let a=0n,n=0n;e===t?(a=s[e]*c/d-r,n=(s[e]+r)/2n):(a=s[e]-s[e]*c/d,n=s[e]),o[e]-=this.dynamicFee(n,f,l,b)*a/this.FEE_DENOMINATOR}const h=o[t]-this.getYD(n,t,o,c),u=(s[t]-r)/i[t];return{dy:(h-1n)/i[t],dyDiff:u-h,totalSupply:this.lpTokenTotalSupply}}getDyOrUnderlying(e,t,a,n){const s=this.TOKENS.length,i=[...this.balances],d=this.PRECISION_MUL;for(let e=0;e<s;++e)i[e]*=d[e];const c=i[e]+a*d[e],r=this.getY(e,t,c,i),o=i[t]-r;return(o-this.dynamicFee((i[e]+c)/2n,(i[t]+r)/2n,this.fee,this.offpegFeeMultiplier)*o/this.FEE_DENOMINATOR)/d[t]}}class De{constructor(e,t,a,n,s,i,d,c){this.stablePool=e,this.cryptoPool=t,this.TOKENS=a,this.N_STABLECOINS=n,this.tradingRouteIndex=s,this.poolContract=i,this.depositAddress=d,this.gasConstant=c,this.tokenIndex={},this.tokenIndex=a.reduce(((e,t,a)=>(e[t]=a,e)),{})}static create(e,t,a,n){return new De(t,a,e.tokens,e.nStablecoins,n,e.poolContract,e.address,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.TOKENS.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.TOKENS[t],this.TOKENS[n]],[this.TOKENS[n],this.TOKENS[t]]);return e}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[]}applyCurrentStateFromCalls(e){}max(e,t){return e>t?e:t}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];if(void 0===n||void 0===s)return{amount:0n,gas:0n};let i=a,d=0,c=0;if(s>=this.N_STABLECOINS&&(c=s-(this.N_STABLECOINS-1)),n<this.N_STABLECOINS){let e=Array.from({length:this.N_STABLECOINS},(()=>0n));e[n]=i,i=this.stablePool.getLPMintAmount(e)}else d=n-(this.N_STABLECOINS-1);let r=i;return this.max(d,c)>0&&(r=this.cryptoPool.getDy(d,c,i)),0===c?{amount:this.stablePool.calculateWithdrawOneCoin(r,s).dy,gas:this.gasConstant}:{amount:r,gas:this.gasConstant}}}class we{constructor(e,t,a,n,s,i,d=10n**18n){this.pairContract=e,this.token0=t,this.token1=a,this.depositAddress=n,this.tradingRouteIndex=s,this.gasConstant=i,this.PRECISION=d,this.abiCoder=he,this.err=new ge(we.name),this.reserve0=0n,this.reserve1=0n,this.vReserve0=0n,this.vReserve1=0n,this.feeInPrecision=0n;const c=we.getSortedPair(this.token0,this.token1);this.token0=c[0],this.token1=c[1]}static create(e,t,a){const n=this.getSortedPair(t[0],t[1]),s=e.pools[n[0]][n[1]];return new we(s,n[0],n[1],s,a,e.gas)}static isPairSupported(e,t){const a=void 0!==t[e[0]]&&void 0!==t[e[0]][e[1]],n=void 0!==t[e[1]]&&void 0!==t[e[1]][e[0]];return a||n}getTradablePairs(){return[[this.token0,this.token1],[this.token1,this.token0]]}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.pairContract}getDepositAddress(){return this.depositAddress}static getSortedPair(e,t){return e.localeCompare(t,"en",{sensitivity:"base"})<=0?[e,t]:[t,e]}getReserveInOut(e,t,a){return e===this.token0?{reserveIn:t,reserveOut:a}:{reserveIn:a,reserveOut:t}}getfetchingCurrentStateCalls(){return[{callData:"0xd6694027",target:this.pairContract}]}applyCurrentStateFromCalls(e){if(0!==e.length&&e[0].success){const[t,a,n,s,i]=this.abiCoder.decode(["uint112","uint112","uint112","uint112","uint256"],e[0].returnData);this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt(),this.vReserve0=n.toBigInt(),this.vReserve1=s.toBigInt(),this.feeInPrecision=i.toBigInt()}}getAmountOut(e,t,a){const{reserveIn:n,reserveOut:s}=this.getReserveInOut(e,this.reserve0,this.reserve1),{reserveIn:i,reserveOut:d}=this.getReserveInOut(e,this.vReserve0,this.vReserve1);this.err.require(a>0n,"DMMLibrary: INSUFFICIENT_INPUT_AMOUNT"),this.err.require(n>0n&&s>0n,"DMMLibrary: INSUFFICIENT_LIQUIDITY");const c=a*(this.PRECISION-this.feeInPrecision)/this.PRECISION,r=c*d/(i+c);return this.err.require(s>r,"DMMLibrary: INSUFFICIENT_LIQUIDITY"),{amount:r,gas:this.gasConstant}}}class _e extends ue{constructor(e,t,a,n,s,i,d,c,r,o){super(t,a,n,s,i,d,c,o),this.depositAddress=e,this.err=new ge(_e.name),this.MAX_NUM=0x200000000000000000000000000000000n,this.FIXED_1=0x080000000000000000000000000000000n,this.FIXED_2=0x100000000000000000000000000000000n,this.OPT_LOG_MAX_VAL=0x15bf0a8b1457695355fb8ac404e7a79e3n,this.OPT_EXP_MAX_VAL=0x800000000000000000000000000000000n,this.MIN_PRECISION=32,this.MAX_PRECISION=127,this.ONE=1n,this.LN2_NUMERATOR=0x3f80fe03f80fe03f80fe03f80fe03f8n,this.LN2_DENOMINATOR=0x5b9de1d10bf4103d647b0955897ba80n,this.maxExpArray=[0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0n,0x1c35fedd14ffffffffffffffffffffffffn,0x1b0ce43b323fffffffffffffffffffffffn,0x19f0028ec1ffffffffffffffffffffffffn,0x18ded91f0e7fffffffffffffffffffffffn,0x17d8ec7f0417ffffffffffffffffffffffn,0x16ddc6556cdbffffffffffffffffffffffn,0x15ecf52776a1ffffffffffffffffffffffn,0x15060c256cb2ffffffffffffffffffffffn,0x1428a2f98d72ffffffffffffffffffffffn,0x13545598e5c23fffffffffffffffffffffn,0x1288c4161ce1dfffffffffffffffffffffn,0x11c592761c666fffffffffffffffffffffn,0x110a688680a757ffffffffffffffffffffn,0x1056f1b5bedf77ffffffffffffffffffffn,0x0faadceceeff8bffffffffffffffffffffn,0x0f05dc6b27edadffffffffffffffffffffn,0x0e67a5a25da4107fffffffffffffffffffn,0x0dcff115b14eedffffffffffffffffffffn,0x0d3e7a392431239fffffffffffffffffffn,0x0cb2ff529eb71e4fffffffffffffffffffn,0x0c2d415c3db974afffffffffffffffffffn,0x0bad03e7d883f69bffffffffffffffffffn,0x0b320d03b2c343d5ffffffffffffffffffn,0x0abc25204e02828dffffffffffffffffffn,0x0a4b16f74ee4bb207fffffffffffffffffn,0x09deaf736ac1f569ffffffffffffffffffn,0x0976bd9952c7aa957fffffffffffffffffn,0x09131271922eaa606fffffffffffffffffn,0x08b380f3558668c46fffffffffffffffffn,0x0857ddf0117efa215bffffffffffffffffn,0x07ffffffffffffffffffffffffffffffffn,0x07abbf6f6abb9d087fffffffffffffffffn,0x075af62cbac95f7dfa7fffffffffffffffn,0x070d7fb7452e187ac13fffffffffffffffn,0x06c3390ecc8af379295fffffffffffffffn,0x067c00a3b07ffc01fd6fffffffffffffffn,0x0637b647c39cbb9d3d27ffffffffffffffn,0x05f63b1fc104dbd39587ffffffffffffffn,0x05b771955b36e12f7235ffffffffffffffn,0x057b3d49dda84556d6f6ffffffffffffffn,0x054183095b2c8ececf30ffffffffffffffn,0x050a28be635ca2b888f77fffffffffffffn,0x04d5156639708c9db33c3fffffffffffffn,0x04a23105873875bd52dfdfffffffffffffn,0x0471649d87199aa990756fffffffffffffn,0x04429a21a029d4c1457cfbffffffffffffn,0x0415bc6d6fb7dd71af2cb3ffffffffffffn,0x03eab73b3bbfe282243ce1ffffffffffffn,0x03c1771ac9fb6b4c18e229ffffffffffffn,0x0399e96897690418f785257fffffffffffn,0x0373fc456c53bb779bf0ea9fffffffffffn,0x034f9e8e490c48e67e6ab8bfffffffffffn,0x032cbfd4a7adc790560b3337ffffffffffn,0x030b50570f6e5d2acca94613ffffffffffn,0x02eb40f9f620fda6b56c2861ffffffffffn,0x02cc8340ecb0d0f520a6af58ffffffffffn,0x02af09481380a0a35cf1ba02ffffffffffn,0x0292c5bdd3b92ec810287b1b3fffffffffn,0x0277abdcdab07d5a77ac6d6b9fffffffffn,0x025daf6654b1eaa55fd64df5efffffffffn,0x0244c49c648baa98192dce88b7ffffffffn,0x022ce03cd5619a311b2471268bffffffffn,0x0215f77c045fbe885654a44a0fffffffffn,0x01ffffffffffffffffffffffffffffffffn,0x01eaefdbdaaee7421fc4d3ede5ffffffffn,0x01d6bd8b2eb257df7e8ca57b09bfffffffn,0x01c35fedd14b861eb0443f7f133fffffffn,0x01b0ce43b322bcde4a56e8ada5afffffffn,0x019f0028ec1fff007f5a195a39dfffffffn,0x018ded91f0e72ee74f49b15ba527ffffffn,0x017d8ec7f04136f4e5615fd41a63ffffffn,0x016ddc6556cdb84bdc8d12d22e6fffffffn,0x015ecf52776a1155b5bd8395814f7fffffn,0x015060c256cb23b3b3cc3754cf40ffffffn,0x01428a2f98d728ae223ddab715be3fffffn,0x013545598e5c23276ccf0ede68034fffffn,0x01288c4161ce1d6f54b7f61081194fffffn,0x011c592761c666aa641d5a01a40f17ffffn,0x0110a688680a7530515f3e6e6cfdcdffffn,0x01056f1b5bedf75c6bcb2ce8aed428ffffn,0x00faadceceeff8a0890f3875f008277fffn,0x00f05dc6b27edad306388a600f6ba0bfffn,0x00e67a5a25da41063de1495d5b18cdbfffn,0x00dcff115b14eedde6fc3aa5353f2e4fffn,0x00d3e7a3924312399f9aae2e0f868f8fffn,0x00cb2ff529eb71e41582cccd5a1ee26fffn,0x00c2d415c3db974ab32a51840c0b67edffn,0x00bad03e7d883f69ad5b0a186184e06bffn,0x00b320d03b2c343d4829abd6075f0cc5ffn,0x00abc25204e02828d73c6e80bcdb1a95bfn,0x00a4b16f74ee4bb2040a1ec6c15fbbf2dfn,0x009deaf736ac1f569deb1b5ae3f36c130fn,0x00976bd9952c7aa957f5937d790ef65037n,0x009131271922eaa6064b73a22d0bd4f2bfn,0x008b380f3558668c46c91c49a2f8e967b9n,0x00857ddf0117efa215952912839f6473e6n],this.tokenWeight0=BigInt(r),this.tokenWeight1=BigInt(100-r),this.encodedPairContract=this.abiCoder.encode(["address"],[this.pairContract])}static createPolyDex(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,weight:c,address:r,gas:o}=e;return new _e(r,d,n,s,i,t[0],t[1],a,c,o)}getDepositAddress(){return this.depositAddress}optimalLog(e){let t=0n,a=0n,n=0n,s=0n;return e>=0xd3094c70f034de4b96ff7d5b6f99fcd8n&&(t+=0x40000000000000000000000000000000n,e=e*this.FIXED_1/0xd3094c70f034de4b96ff7d5b6f99fcd8n),e>=0xa45af1e1f40c333b3de1db4dd55f29a7n&&(t+=0x20000000000000000000000000000000n,e=e*this.FIXED_1/0xa45af1e1f40c333b3de1db4dd55f29a7n),e>=0x910b022db7ae67ce76b441c27035c6a1n&&(t+=0x10000000000000000000000000000000n,e=e*this.FIXED_1/0x910b022db7ae67ce76b441c27035c6a1n),e>=0x88415abbe9a76bead8d00cf112e4d4a8n&&(t+=0x08000000000000000000000000000000n,e=e*this.FIXED_1/0x88415abbe9a76bead8d00cf112e4d4a8n),e>=0x84102b00893f64c705e841d5d4064bd3n&&(t+=0x04000000000000000000000000000000n,e=e*this.FIXED_1/0x84102b00893f64c705e841d5d4064bd3n),e>=0x8204055aaef1c8bd5c3259f4822735a2n&&(t+=0x02000000000000000000000000000000n,e=e*this.FIXED_1/0x8204055aaef1c8bd5c3259f4822735a2n),e>=0x810100ab00222d861931c15e39b44e99n&&(t+=0x01000000000000000000000000000000n,e=e*this.FIXED_1/0x810100ab00222d861931c15e39b44e99n),e>=0x808040155aabbbe9451521693554f733n&&(t+=0x00800000000000000000000000000000n,e=e*this.FIXED_1/0x808040155aabbbe9451521693554f733n),n=a=e-this.FIXED_1,s=a*a/this.FIXED_1,t+=n*(0x100000000000000000000000000000000n-a)/0x100000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaan-a)/0x200000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x099999999999999999999999999999999n-a)/0x300000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x092492492492492492492492492492492n-a)/0x400000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x08e38e38e38e38e38e38e38e38e38e38en-a)/0x500000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x08ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8bn-a)/0x600000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x089d89d89d89d89d89d89d89d89d89d89n-a)/0x700000000000000000000000000000000n,n=n*s/this.FIXED_1,t+=n*(0x088888888888888888888888888888888n-a)/0x800000000000000000000000000000000n,t}floorLog2(e){let t=0;if(e<256n)for(;e>1n;)e>>=1n,t+=1;else for(let a=128;a>0;a>>=1)e>=this.ONE<<BigInt(a)&&(e>>=BigInt(a),t|=a);return t}generalLog(e){let t=0n;if(e>=this.FIXED_2){const a=BigInt(this.floorLog2(e/this.FIXED_1));e>>=a,t=a*this.FIXED_1}if(e>this.FIXED_1)for(let a=this.MAX_PRECISION;a>0;--a)(e=e*e/this.FIXED_1)>=this.FIXED_2&&(e>>=1n,t+=this.ONE<<BigInt(a-1));return t*this.LN2_NUMERATOR/this.LN2_DENOMINATOR}optimalExp(e){let t=0n,a=0n,n=0n;return n=a=e%0x10000000000000000000000000000000n,n=n*a/this.FIXED_1,t+=0x10e1b3be415a0000n*n,n=n*a/this.FIXED_1,t+=0x05a0913f6b1e0000n*n,n=n*a/this.FIXED_1,t+=0x0168244fdac78000n*n,n=n*a/this.FIXED_1,t+=0x004807432bc18000n*n,n=n*a/this.FIXED_1,t+=0x000c0135dca04000n*n,n=n*a/this.FIXED_1,t+=0x0001b707b1cdc000n*n,n=n*a/this.FIXED_1,t+=0x000036e0f639b800n*n,n=n*a/this.FIXED_1,t+=0x00000618fee9f800n*n,n=n*a/this.FIXED_1,t+=0x0000009c197dcc00n*n,n=n*a/this.FIXED_1,t+=0x0000000e30dce400n*n,n=n*a/this.FIXED_1,t+=0x000000012ebd1300n*n,n=n*a/this.FIXED_1,t+=0x0000000017499f00n*n,n=n*a/this.FIXED_1,t+=0x0000000001a9d480n*n,n=n*a/this.FIXED_1,t+=0x00000000001c6380n*n,n=n*a/this.FIXED_1,t+=0x000000000001c638n*n,n=n*a/this.FIXED_1,t+=0x0000000000001ab8n*n,n=n*a/this.FIXED_1,t+=0x000000000000017cn*n,n=n*a/this.FIXED_1,t+=0x0000000000000014n*n,n=n*a/this.FIXED_1,t+=0x0000000000000001n*n,t=t/0x21c3677c82b40000n+a+this.FIXED_1,0n!=(0x010000000000000000000000000000000n&e)&&(t=0x1c3d6a24ed82218787d624d3e5eba95f9n*t/0x18ebef9eac820ae8682b9793ac6d1e776n),0n!=(0x020000000000000000000000000000000n&e)&&(t=0x18ebef9eac820ae8682b9793ac6d1e778n*t/0x1368b2fc6f9609fe7aceb46aa619baed4n),0n!=(0x040000000000000000000000000000000n&e)&&(t=0x1368b2fc6f9609fe7aceb46aa619baed5n*t/0x0bc5ab1b16779be3575bd8f0520a9f21fn),0n!=(0x080000000000000000000000000000000n&e)&&(t=0x0bc5ab1b16779be3575bd8f0520a9f21en*t/0x0454aaa8efe072e7f6ddbab84b40a55c9n),0n!=(0x100000000000000000000000000000000n&e)&&(t=0x0454aaa8efe072e7f6ddbab84b40a55c5n*t/0x00960aadc109e7a3bf4578099615711ean),0n!=(0x200000000000000000000000000000000n&e)&&(t=0x00960aadc109e7a3bf4578099615711d7n*t/0x0002bf84208204f5977f9a8cf01fdce3dn),0n!=(0x400000000000000000000000000000000n&e)&&(t=0x0002bf84208204f5977f9a8cf01fdc307n*t/0x0000003c6ab775dd0b95b4cbee7e65d11n),t}findPositionInMaxExpArray(e){let t=this.MIN_PRECISION,a=this.MAX_PRECISION;for(;t+1<a;){const n=Math.floor((t+a)/2);this.maxExpArray[n]>=e?t=n:a=n}if(this.maxExpArray[a]>=e)return a;if(this.maxExpArray[t]>=e)return t;throw this.err.createRequireViolated("unable to find position in max exp array")}generalExp(e,t){const a=BigInt(t);let n=e,s=0n;return n=n*e>>a,s+=0x3442c4e6074a82f1797f72ac0000000n*n,n=n*e>>a,s+=0x116b96f757c380fb287fd0e40000000n*n,n=n*e>>a,s+=0x045ae5bdd5f0e03eca1ff4390000000n*n,n=n*e>>a,s+=0x00defabf91302cd95b9ffda50000000n*n,n=n*e>>a,s+=0x002529ca9832b22439efff9b8000000n*n,n=n*e>>a,s+=0x00054f1cf12bd04e516b6da88000000n*n,n=n*e>>a,s+=0x0000a9e39e257a09ca2d6db51000000n*n,n=n*e>>a,s+=0x000012e066e7b839fa050c309000000n*n,n=n*e>>a,s+=0x000001e33d7d926c329a1ad1a800000n*n,n=n*e>>a,s+=0x0000002bee513bdb4a6b19b5f800000n*n,n=n*e>>a,s+=0x00000003a9316fa79b88eccf2a00000n*n,n=n*e>>a,s+=0x0000000048177ebe1fa812375200000n*n,n=n*e>>a,s+=0x0000000005263fe90242dcbacf00000n*n,n=n*e>>a,s+=0x000000000057e22099c030d94100000n*n,n=n*e>>a,s+=0x0000000000057e22099c030d9410000n*n,n=n*e>>a,s+=0x00000000000052b6b54569976310000n*n,n=n*e>>a,s+=0x00000000000004985f67696bf748000n*n,n=n*e>>a,s+=0x000000000000003dea12ea99e498000n*n,n=n*e>>a,s+=0x00000000000000031880f2214b6e000n*n,n=n*e>>a,s+=0x000000000000000025bcff56eb36000n*n,n=n*e>>a,s+=0x000000000000000001b722e10ab1000n*n,n=n*e>>a,s+=0x0000000000000000001317c70077000n*n,n=n*e>>a,s+=0x00000000000000000000cba84aafa00n*n,n=n*e>>a,s+=0x00000000000000000000082573a0a00n*n,n=n*e>>a,s+=0x00000000000000000000005035ad900n*n,n=n*e>>a,s+=0x000000000000000000000002f881b00n*n,n=n*e>>a,s+=0x0000000000000000000000001b29340n*n,n=n*e>>a,s+=0x00000000000000000000000000efc40n*n,n=n*e>>a,s+=0x0000000000000000000000000007fe0n*n,n=n*e>>a,s+=0x0000000000000000000000000000420n*n,n=n*e>>a,s+=0x0000000000000000000000000000021n*n,n=n*e>>a,s+=0x0000000000000000000000000000001n*n,s/0x688589cc0e9505e2f2fee5580000000n+e+(this.ONE<<a)}power(e,t,a,n){this.err.require(e>=t,"not support _baseN < _baseD"),this.err.require(e<this.MAX_NUM,"_baseN < this.MAX_NUM");let s=0n;const i=e*this.FIXED_1/t;s=i<this.OPT_LOG_MAX_VAL?this.optimalLog(i):this.generalLog(i);const d=s*a/n;if(d<this.OPT_EXP_MAX_VAL)return{result:this.optimalExp(d),precision:this.MAX_PRECISION};{const e=this.findPositionInMaxExpArray(d);return{result:this.generalExp(d>>BigInt(this.MAX_PRECISION-e),e),precision:e}}}getAmountOut(e,t,a){const{reserveIn:n,reserveOut:s}=this.getReserveInOut(e,this.reserve0,this.reserve1),{reserveIn:i,reserveOut:d}=this.getReserveInOut(e,this.tokenWeight0,this.tokenWeight1);this.err.require(a>0n,"INSUFFICIENT_INPUT_AMOUNT"),this.err.require(n>0n&&s>0n,"INSUFFICIENT_LIQUIDITY");const c=a*(this.feePrecision-this.fee);if(i===d)return{amount:s*c/(n*this.feePrecision+c),gas:this.gasConstant};const r=n*this.feePrecision+c,{result:o,precision:f}=this.power(r,n*this.feePrecision,i,d);return{amount:(s*o-(s<<BigInt(f)))/o,gas:this.gasConstant}}}class ve extends _e{constructor(e,t,a,n,s,i,d,c,r,o){super(e,t,a,n,s,i,d,c,r,o),this.pairContract=this.generatePairAddressWithFeeAndWeight(this.factory,this.token0,this.token1,Number(this.tokenWeight0),Number(this.fee))}static createPolyDex(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,weight:c,address:r,gas:o}=e;return new ve(r,d,n,s,i,t[0],t[1],a,c,o)}generatePairAddressWithFeeAndWeight(t,a,n,s,i){if(void 0!==s)return e.utils.hexDataSlice(e.utils.keccak256(e.utils.concat(["0xff",t,e.utils.solidityKeccak256(["address","address","uint32","uint32"],[a,n,s,i]),this.PAIR_BYTECODE_HASH])),12);throw new Error("Firebird pair address generation failed: missing tokenWeight0")}}class Re extends Ae{static create(e,t){return new Re(e.poolContract,e.lpToken,e.tokens,e.rates,e.lendingPrecision,e.precision,e.precisionMul,e.feeDenominator,e.isUnderlying,t,e.address,e.gas,e.aPrecision)}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}else i.warn("unable to find A for Curve pool",this.poolContract),this.A=0n;if(e[1].success){const[,t]=this.abiCoder.decode(["address","uint256","uint256","uint256","uint256","uint256","uint256","uint256"],e[1].returnData);this.fee=t.toBigInt()}else i.warn("unable to find fee for Curve pool",this.poolContract),this.fee=0n;if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.lpTokenTotalSupply=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve pool",this.poolContract),this.lpTokenTotalSupply=0n;for(let t=3,a=this.TOKENS.length;t<3+a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances.push(a.toBigInt())}else i.warn("unable to find balance at index",t-3,"for Curve pool",this.poolContract),this.balances.push(0n)}}}class Be{constructor(t,a,n,s,i,d,c,r){this.AMP_PRECISION=t,this.tokens=a,this.scalingFactors=n,this.poolId=s,this.vaultContract=i,this.routeIndex=d,this.depositAddress=c,this.gasConstant=r,this.err=new ge(Be.name),this.abiCoder=he,this.ONE=1000000000000000000n,this.balances=[],this.fee=0n,this.A=0n,this.tokenIndex={},this.tokenIndex=this.tokens.reduce(((e,t,a)=>(e[t]=a,e)),{}),this.poolIdParam=this.abiCoder.encode(["bytes32"],[this.poolId]),this.poolContract=e.utils.hexZeroPad("0x"+(BigInt(this.poolId)>>96n).toString(16),20),this.balances=Array.from({length:this.tokens.length},(()=>0n))}static create(e,t){return new Be(e.aPrecision,e.tokens,e.scalingFactors,e.poolId,e.vaultContract,t,e.depositAddress,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.tokens.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.tokens[t],this.tokens[n]]),e.push([this.tokens[n],this.tokens[t]]);return e}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[{callData:"0x55c67628",target:this.poolContract},{callData:"0x6daccffa",target:this.poolContract},{callData:e.utils.hexConcat(["0xf94d4668",this.poolIdParam]),target:this.vaultContract}]}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.fee=t.toBigInt()}if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.A=t.toBigInt()}if(e[2].success){const[,t]=this.abiCoder.decode(["address[]","uint256[]","uint256"],e[2].returnData);this.balances=t.map((e=>e.toBigInt()))}}}mulUp(e,t){const a=e*t;return this.err.require(0n===e||a/e===t,"MUL_OVERFLOW"),0n===a?0n:(a-1n)/this.ONE+1n}mulDown(e,t){const a=e*t;return this.err.require(0n===e||a/e===t,"MUL_OVERFLOW"),a/this.ONE}div(e,t,a){return a?this.divUp(e,t):this.divDown(e,t)}divDown(e,t){return this.err.require(0n!==t,"ZERO_DIVISION"),e/t}divUp(e,t){return this.err.require(0n!==t,"ZERO_DIVISION"),0n===e?0n:1n+(e-1n)/t}divDownFixedPoint(e,t){if(this.err.require(0n!==t,"ZERO_DIVISION"),0n===e)return 0n;{const a=e*this.ONE;return this.err.require(a/e===this.ONE,"DIV_INTERNAL"),a/t}}divUpFixedPoint(e,t){if(this.err.require(0n!==t,"ZERO_DIVISION"),0n===e)return 0n;{const a=e*this.ONE;return this.err.require(a/e===this.ONE,"DIV_INTERNAL"),(a-1n)/t+1n}}_calculateInvariant(e,t,a){const n=t.length;let s=0n;for(let e=0;e<n;e++)s+=t[e];if(0n===s)return 0n;let i=0n,d=s;const c=e*BigInt(n);for(let e=0;e<255;e++){let e=t[0]*BigInt(n);for(let s=1;s<n;s++)e=this.div(e*t[s]*BigInt(n),d,a);if(i=d,d=this.div(BigInt(n)*d*d+this.div(c*s*e,this.AMP_PRECISION,a),BigInt(n+1)*d+this.div((c-this.AMP_PRECISION)*e,this.AMP_PRECISION,!a),a),d>i){if(d-i<=1n)return d}else if(i-d<=1n)return d}throw this.err.createRequireViolated("STABLE_GET_BALANCE_DIDNT_CONVERGE")}_getTokenBalanceGivenInvariantAndAllOtherBalances(e,t,a,n){const s=t.length,i=e*BigInt(s);let d=t[0],c=t[0]*BigInt(s);for(let e=1;e<s;e++)c=this.divDown(c*t[e]*BigInt(s),a),d+=t[e];d-=t[n];const r=a*a,o=this.divUp(r,i*c)*this.AMP_PRECISION*t[n],f=d+this.divDown(a,i)*this.AMP_PRECISION;let l=0n,b=this.divUp(r+o,a+f);for(let e=0;e<255;e++)if(l=b,b=this.divUp(b*b+o,2n*b+f-a),b>l){if(b-l<=1n)return b}else if(l-b<=1n)return b;throw this.err.createRequireViolated("STABLE_GET_BALANCE_DIDNT_CONVERGE")}_subtractSwapFeeAmount(e){return e-this.mulUp(e,this.fee)}_upscaleArray(e,t){for(let a=0,n=e.length;a<n;++a)e[a]=this.mulDown(e[a],t[a])}_upscale(e,t){return this.mulDown(e,t)}_downscaleDown(e,t){return this.divDownFixedPoint(e,t)}calcOutGivenIn(e,t,a,n,s){const i=this._calculateInvariant(e,t,!0);t[a]=t[a]+s;const d=this._getTokenBalanceGivenInvariantAndAllOtherBalances(e,t,i,n);return t[a]=t[a]-s,t[n]-d-1n}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];let i=this._subtractSwapFeeAmount(a);const d=[...this.balances];this._upscaleArray(d,this.scalingFactors),i=this._upscale(i,this.scalingFactors[n]);const c=this.calcOutGivenIn(this.A,d,n,s,i);return{amount:this._downscaleDown(c,this.scalingFactors[s]),gas:this.gasConstant}}}class Me{constructor(e,t,a,n,s,i,d,c,r){this.stablePool=e,this.cryptoPool=t,this.TOKENS=a,this.N_STABLECOINS=n,this.N_COINS=s,this.tradingRouteIndex=i,this.poolContract=d,this.depositAddress=c,this.gasConstant=r,this.tokenIndex={},this.tokenIndex=a.reduce(((e,t,a)=>(e[t]=a,e)),{})}static create(e,t,a,n){return new Me(t,a,e.tokens,e.nStablecoins,e.nCoins,n,e.poolContract,e.address,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.TOKENS.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.TOKENS[t],this.TOKENS[n]],[this.TOKENS[n],this.TOKENS[t]]);return e}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[]}applyCurrentStateFromCalls(e){}min(e,t){return e>t?t:e}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];if(void 0===n||void 0===s)return{amount:0n,gas:0n};let i=a;const d=this.min(n,this.N_COINS-1),c=this.min(s,this.N_COINS-1);if(n>=this.N_COINS-1){const e=Array.from({length:this.N_STABLECOINS},(()=>0n));e[n-(this.N_COINS-1)]=i,i=this.stablePool.getLPMintAmount(e)}let r=i;return d!==c&&(r=this.cryptoPool.getDy(d,c,i)),c===this.N_COINS-1?{amount:this.stablePool.calculateWithdrawOneCoin(r,s-(this.N_COINS-1)).dy,gas:this.gasConstant}:{amount:r,gas:this.gasConstant}}}class Fe extends Ae{static create(e,t){return new Fe(e.poolContract,e.lpToken,e.tokens,e.rates,e.lendingPrecision,e.precision,e.precisionMul,e.feeDenominator,e.isUnderlying,t,e.address,e.gas,e.aPrecision)}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}else i.warn("unable to find A for Curve pool",this.poolContract),this.A=0n;if(e[1].success){const[,,,,t]=this.abiCoder.decode(["uint256","uint256","uint256","uint256","uint256","uint256","address"],e[1].returnData);this.fee=t.toBigInt()}else i.warn("unable to find fee for Curve pool",this.poolContract),this.fee=0n;if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.lpTokenTotalSupply=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve pool",this.poolContract),this.lpTokenTotalSupply=0n;for(let t=3,a=this.TOKENS.length;t<3+a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances.push(a.toBigInt())}else i.warn("unable to find balance at index",t-3,"for Curve pool",this.poolContract),this.balances.push(0n)}}}class Ue extends ue{static create(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,gas:c}=e;return new Ue(d,n,s,i,t[0],t[1],a,c)}getfetchingCurrentStateCalls(){const t=this.abiCoder.encode(["address"],[this.pairContract]);return[{callData:"0x0902f1ac",target:this.pairContract},{callData:e.utils.hexConcat(["0x6fcca69b",t]),target:this.factory}]}applyCurrentStateFromCalls(e){if(0===e.length||!e[0].success||"0x"===e[0].returnData)return this.reserve0=0n,this.reserve1=0n,void(this.fee=0n);const[t,a]=this.abiCoder.decode(["uint112","uint112","uint32"],e[0].returnData);if(this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt(),e[1].success){const[,,t]=this.abiCoder.decode(["address","bool","uint256"],e[1].returnData);this.fee=t.toBigInt()}else this.fee=this.feePrecision}}class Le extends Be{constructor(e,t,a,n,s,i,d,c,r,o){super(e,t,a,n,s,i,d,o),this.AMP_PRECISION=e,this.tokens=t,this.scalingFactors=a,this.poolId=n,this.vaultContract=s,this.routeIndex=i,this.depositAddress=d,this.rateProviders=c,this.multicall=r,this.gasConstant=o,this.priceRates=Array.from({length:t.length},(()=>0n))}static createMeta(e,t){return new Le(e.aPrecision,e.tokens,e.scalingFactors,e.poolId,e.vaultContract,t,e.depositAddress,e.rateProviders,e.multicall,e.gas)}getfetchingCurrentStateCalls(){const t=super.getfetchingCurrentStateCalls();return t.push({callData:"0x0f28c97d",target:this.multicall}),t.push(...this.tokens.filter(((e,t)=>this.isTokenWithRateProvider(t))).map((t=>{const a=this.abiCoder.encode(["address"],[t]);return{callData:e.utils.hexConcat(["0xb867ee5a",a]),target:this.poolContract}}))),t.push(...this.rateProviders.filter(((e,t)=>this.isTokenWithRateProvider(t))).map((e=>({callData:"0x679aefce",target:e})))),t}isTokenWithRateProvider(e){return""!==this.rateProviders[e]}applyCurrentStateFromCalls(e){super.applyCurrentStateFromCalls(e);const t=this.rateProviders.filter((e=>""!==e)).length;let a=e.length-t,n=a-t,s=n-1;if(!e[s].success||!e[a].success||!e[n].success)return;const[i]=this.abiCoder.decode(["uint256"],e[s].returnData),d=i.toBigInt();for(let t=0,s=this.rateProviders.length;t<s;++t){if(!this.isTokenWithRateProvider(t)){this.priceRates[t]=0n;continue}const[s]=this.abiCoder.decode(["uint256"],e[a].returnData);a++;const i=s.toBigInt(),[c,,r]=this.abiCoder.decode(["uint256","uint256","uint256"],e[n].returnData);n++;const o=c.toBigInt(),f=r.toBigInt();this.priceRates[t]=d>f?i:o}this.scalingFactors=this.scalingFactors.map(((e,t)=>this.isTokenWithRateProvider(t)?this.mulDown(e,this.priceRates[t]):e))}}class Ve{constructor(t,a,n,s,i,d,c,r,o,f,l){this.tradingRouteIndex=t,this.tokens=a,this.scalingFactors=n,this.poolId=s,this.vaultContract=i,this.depositAddress=d,this.mainIndex=c,this.wrappedIndex=r,this.wrappedToken=o,this.bptIndex=f,this.gasConstant=l,this.abiCoder=he,this.err=new ge(Ve.name),this.ONE=1000000000000000000n,this.INITIAL_BPT_SUPPLY=5192296858534827628530496329220095n,this.MAX_UINT256=0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn,this.RAY=1000000000000000000000000000n,this.halfRAY=this.RAY/2n,this.swapFee=0n,this.wrappedTokenRateWad=0n,this.wrappedTokenRate=0n,this.lowerTarget=0n,this.upperTarget=0n,this.tokenIndexes=this.tokens.reduce(((e,t,a)=>(e[t]=a,e)),{}),this.balances=Array.from({length:a.length},(()=>0n)),this.poolIdParam=this.abiCoder.encode(["bytes32"],[this.poolId]),this.poolContract=e.utils.hexZeroPad("0x"+(BigInt(this.poolId)>>96n).toString(16),20)}static create(e,t){return new Ve(t,e.tokens,e.scalingFactors,e.poolId,e.vaultContract,e.depositAddress,e.mainIndex,e.wrappedIndex,e.wrappedToken,e.bptIndex,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.tokens.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.tokens[t],this.tokens[n]]),e.push([this.tokens[n],this.tokens[t]]);return e}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[{callData:"0x55c67628",target:this.poolContract},{callData:e.utils.hexConcat(["0xf94d4668",this.poolIdParam]),target:this.vaultContract},{callData:"0x2c4e722e",target:this.wrappedToken},{callData:"0x63fe3b56",target:this.poolContract}]}mulDownFixedPoint(e,t){const a=e*t;return this.err.require(0n===e||a/e===t,"MUL_OVERFLOW"),a/this.ONE}divDownFixedPoint(e,t){if(this.err.require(0n!==t,"ZERO_DIVISION"),0n===e)return 0n;{const a=e*this.ONE;return this.err.require(a/e===this.ONE,"DIV_INTERNAL"),a/t}}divDown(e,t){return this.err.require(0n!==t,"ZERO_DIVISION"),e/t}divUp(e,t){return this.err.require(0n!==t,"ZERO_DIVISION"),0n===e?0n:1n+(e-1n)/t}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.swapFee=t.toBigInt()}if(e[1].success){const[,t]=this.abiCoder.decode(["address[]","uint256[]","uint256"],e[1].returnData);this.balances=t.map((e=>e.toBigInt()))}if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.wrappedTokenRate=t.toBigInt(),this.wrappedTokenRateWad=this.wrappedTokenRate/10n**9n,this.scalingFactors=[...this.scalingFactors],this.scalingFactors[this.wrappedIndex]=this.mulDownFixedPoint(this.scalingFactors[this.wrappedIndex],this.wrappedTokenRateWad)}if(e[3].success){const[t,a]=this.abiCoder.decode(["uint256","uint256"],e[3].returnData);this.lowerTarget=t.toBigInt(),this.upperTarget=a.toBigInt()}}}getApproximateVirtualSupply(e){return this.INITIAL_BPT_SUPPLY-e}toNominal(e){if(e<this.lowerTarget){return e-this.mulDownFixedPoint(this.lowerTarget-e,this.swapFee)}if(e<=this.upperTarget)return e;return e-this.mulDownFixedPoint(e-this.upperTarget,this.swapFee)}fromNominal(e){return e<this.lowerTarget?this.divDownFixedPoint(e+this.mulDownFixedPoint(this.swapFee,this.lowerTarget),this.ONE+this.swapFee):e<=this.upperTarget?e:e-this.divDownFixedPoint(this.mulDownFixedPoint(this.swapFee,this.upperTarget),this.ONE-this.swapFee)}calcInvariant(e,t){return e+t}calcMainOutPerBptIn(e,t,a,n){const s=this.toNominal(t),i=this.calcInvariant(s,a),d=s-this.divDown(i*e,n);return t-this.fromNominal(d)}calcWrappedOutPerBptIn(e,t,a,n){const s=this.toNominal(t),i=this.calcInvariant(s,a),d=n-e;return a-(this.divUp(d*i,n)-s)}calcBptOutPerMainIn(e,t,a,n){if(0n===n)return this.toNominal(e);const s=this.toNominal(t),i=this.toNominal(t+e)-s,d=this.calcInvariant(s,a);return this.divDown(n*i,d)}calcWrappedOutPerMainIn(e,t){const a=this.toNominal(t);return this.toNominal(t+e)-a}calcBptOutPerWrappedIn(e,t,a,n){if(0n===n)return e;const s=this.toNominal(t),i=this.calcInvariant(s,a),d=a+e,c=this.calcInvariant(s,d);return this.divDown(n*c,i)-n}calcMainOutPerWrappedIn(e,t){const a=this.toNominal(t)-e;return t-this.fromNominal(a)}swapGivenBptIn(e,t,a){return this.err.require(t===this.mainIndex||t===this.wrappedIndex,"INVALID_TOKEN"),t===this.mainIndex?this.calcMainOutPerBptIn(a,e[this.mainIndex],e[this.wrappedIndex],this.getApproximateVirtualSupply(e[this.bptIndex])):this.calcWrappedOutPerBptIn(a,e[this.mainIndex],e[this.wrappedIndex],this.getApproximateVirtualSupply(e[this.bptIndex]))}swapGivenMainIn(e,t,a){return this.err.require(t==this.wrappedIndex||t===this.bptIndex,"INVALID_TOKEN"),t===this.bptIndex?this.calcBptOutPerMainIn(a,e[this.mainIndex],e[this.wrappedIndex],this.getApproximateVirtualSupply(e[this.bptIndex])):this.calcWrappedOutPerMainIn(a,e[this.mainIndex])}swapGivenWrappedIn(e,t,a){return this.err.require(t===this.mainIndex||t===this.bptIndex,"INVALID_TOKEN"),t===this.bptIndex?this.calcBptOutPerWrappedIn(a,e[this.mainIndex],e[this.wrappedIndex],this.getApproximateVirtualSupply(e[this.bptIndex])):this.calcMainOutPerWrappedIn(a,e[this.mainIndex])}onSwapGivenIn(e,t,a,n){if(t===this.bptIndex)return this.swapGivenBptIn(e,a,n);if(t===this.mainIndex)return this.swapGivenMainIn(e,a,n);if(t===this.wrappedIndex)return this.swapGivenWrappedIn(e,a,n);throw this.err.createRequireViolated("INVALID_TOKEN")}upscaleArray(e,t){for(let a=0,n=e.length;a<n;++a)e[a]=this.mulDownFixedPoint(e[a],t[a])}rayDiv(e,t){this.err.require(0n!==t,"MATH_DIVISION_BY_ZERO");const a=t/2n;return this.err.require(e<=(this.MAX_UINT256-a)/this.RAY,"MATH_MULTIPLICATION_OVERFLOW"),(e*this.RAY+a)/t}rayMul(e,t){return 0n===e||0n===t?0n:(this.err.require(e<=(this.MAX_UINT256-this.halfRAY)/t,"MATH_MULTIPLICATION_OVERFLOW"),(e*t+this.halfRAY)/this.RAY)}wrapAmount(e){return this.rayDiv(e,this.wrappedTokenRate)}unwrapAmount(e){return this.rayMul(e,this.wrappedTokenRate)}getAmountOut(e,t,a){const n=this.tokenIndexes[e],s=this.tokenIndexes[t];if(void 0===n||void 0===t)return{amount:0n,gas:0n};let i=a;n===this.wrappedIndex&&(i=this.wrapAmount(i));const d=[...this.balances];this.upscaleArray(d,this.scalingFactors);const c=this.mulDownFixedPoint(i,this.scalingFactors[n]),r=this.onSwapGivenIn(d,n,s,c);let o=this.divDownFixedPoint(r,this.scalingFactors[s]);return s===this.wrappedIndex&&(o=this.unwrapAmount(o)),{amount:o,gas:this.gasConstant}}}class We extends Be{constructor(e,t,a,n,s,i,d,c,r,o){super(e,t,a,n,s,i,d,r),this.AMP_PRECISION=e,this.tokens=t,this.scalingFactors=a,this.poolId=n,this.vaultContract=s,this.routeIndex=i,this.depositAddress=d,this.bptIndex=c,this.gasConstant=r,this.linearPools=o,this.MAX_TOKEN_BALANCE=5192296858534827628530496329220095n,this.dueProtocolFeeBptAmount=0n,this.baseTokenIndex=o.reduce(((e,t,a)=>(t.tokens.forEach((t=>e[t]=a)),e)),{}),this.allTokens=Object.keys({...this.baseTokenIndex,...this.tokenIndex}),this.tokensWithoutBpt=this.tokens.filter(((e,t)=>t!==this.bptIndex))}static createBoosted(e,t,a){return new We(e.aPrecision,e.tokens,e.scalingFactors,e.poolId,e.vaultContract,a,e.depositAddress,e.bptIndex,e.gas,t)}getTradablePairs(){const e=[];for(let t=0,a=this.allTokens.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.allTokens[t],this.allTokens[n]],[this.allTokens[n],this.allTokens[t]]);return e}getfetchingCurrentStateCalls(){const t=super.getfetchingCurrentStateCalls();return t.push({callData:"0x7520e049",target:this.poolContract}),t.push(...this.tokens.map((t=>{const a=this.abiCoder.encode(["address"],[t]);return{callData:e.utils.hexConcat(["0x54dea00a",a]),target:this.poolContract}}))),t}applyCurrentStateFromCalls(e){super.applyCurrentStateFromCalls(e);const t=e.length-this.tokens.length-1;if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.dueProtocolFeeBptAmount=a.toBigInt()}for(let a=t+1,n=0,s=a+this.tokens.length;a<s;++a){if(e[a].success){const[t]=this.abiCoder.decode(["uint256"],e[a].returnData);this.scalingFactors=[...this.scalingFactors],this.scalingFactors[n]=this.mulDown(this.scalingFactors[n],t.toBigInt())}n++}}_dropBptItem(e){const t=this.MAX_TOKEN_BALANCE-e[this.bptIndex]+this.dueProtocolFeeBptAmount,a=Array.from({length:e.length-1},(()=>0n));for(let t=0;t<a.length;++t)a[t]=e[t<this.bptIndex?t:t+1];return{virtualSupply:t,amountsWithoutBpt:a}}calcOutGivenInWithInvarient(e,t,a,n,s,i){t[a]=t[a]+s;const d=this._getTokenBalanceGivenInvariantAndAllOtherBalances(e,t,i,n);return t[a]=t[a]-s,t[n]-d-1n}_skipBptIndex(e){return e<this.bptIndex?e:e-1}_addBptIndex(e){return e>=this.bptIndex?e+1:e}complement(e){return e<this.ONE?this.ONE-e:0n}_calcTokenOutGivenExactBptIn(e,t,a,n,s,i){const d=this._calculateInvariant(e,t,!0),c=this.mulUp(this.divUpFixedPoint(s-n,s),d),r=this._getTokenBalanceGivenInvariantAndAllOtherBalances(e,t,c,a),o=t[a]-r;let f=0n;for(let e=0;e<t.length;e++)f+=t[e];const l=this.divDownFixedPoint(t[a],f),b=this.complement(l),h=this.mulUp(o,b);return o-h+this.mulDown(h,this.ONE-i)}_calcBptOutGivenExactTokensIn(e,t,a,n,s){let i=0n;for(let e=0;e<t.length;e++)i+=t[e];const d=Array.from({length:a.length},(()=>0n));let c=0n;for(let e=0;e<t.length;e++){const n=this.divDownFixedPoint(t[e],i);d[e]=this.divDownFixedPoint(t[e]+a[e],t[e]),c+=this.mulDown(d[e],n)}const r=Array.from({length:t.length},(()=>0n));for(let e=0;e<t.length;e++){let n=0n;if(d[e]>c){const i=this.mulDown(t[e],c-this.ONE),d=a[e]-i;n=i+this.mulDown(d,this.ONE-s)}else n=a[e];r[e]=t[e]+n}const o=this._calculateInvariant(e,t,!0),f=this._calculateInvariant(e,r,!1),l=this.divDownFixedPoint(f,o);return l>this.ONE?this.mulDown(n,l-this.ONE):0n}_onSwapTokenGivenBptIn(e,t,a,n){return this._calcTokenOutGivenExactBptIn(this.A,n,t,e,a,0n)}_onSwapBptGivenTokenIn(e,t,a,n){const s=Array.from({length:this.tokens.length-1},(()=>0n));return s[t]=e,this._calcBptOutGivenExactTokensIn(this.A,n,s,a,0n)}getAmountOutThisPool(e,t,a){const n=[...this.balances];this._upscaleArray(n,this.scalingFactors);const s=this._subtractSwapFeeAmount(a),i=this._upscale(s,this.scalingFactors[e]),{virtualSupply:d,amountsWithoutBpt:c}=this._dropBptItem(n);let r=0n;if(e===this.bptIndex)r=this._onSwapTokenGivenBptIn(i,this._skipBptIndex(t),d,c);else if(t===this.bptIndex)r=this._onSwapBptGivenTokenIn(i,this._skipBptIndex(e),d,c);else{const a=this._calculateInvariant(this.A,c,!0);r=this.calcOutGivenInWithInvarient(this.A,c,this._skipBptIndex(e),this._skipBptIndex(t),i,a)}return r=this._downscaleDown(r,this.scalingFactors[t]),r}getAmountOut(e,t,a){let n=this.tokenIndex[e],s=this.tokenIndex[t],i=this.baseTokenIndex[e],d=this.baseTokenIndex[t];if(void 0!==n&&void 0!==s)return{amount:this.getAmountOutThisPool(n,s,a),gas:this.gasConstant};if(void 0!==n&&void 0!==d){let e={amount:a,gas:0n};n!==this.bptIndex&&this._skipBptIndex(n)===d||(e={amount:this.getAmountOutThisPool(n,this._addBptIndex(d),a),gas:e.gas+this.gasConstant});const s=this.linearPools[d].getAmountOut(this.tokensWithoutBpt[d],t,e.amount);return{amount:s.amount,gas:e.gas+s.gas}}if(void 0!==i&&void 0!==s){let t=this.linearPools[i].getAmountOut(e,this.tokensWithoutBpt[i],a);return s!==this.bptIndex&&this._skipBptIndex(s)===i||(t={amount:this.getAmountOutThisPool(this._addBptIndex(i),s,t.amount),gas:t.gas+this.gasConstant}),t}if(void 0!==i&&void 0!==d){if(i===d)return this.linearPools[i].getAmountOut(e,t,a);let n=this.linearPools[i].getAmountOut(e,this.tokensWithoutBpt[i],a);n={amount:this.getAmountOutThisPool(this._addBptIndex(i),this._addBptIndex(d),n.amount),gas:n.gas+this.gasConstant};const s=this.linearPools[d].getAmountOut(this.tokensWithoutBpt[d],t,n.amount);return{amount:s.amount,gas:n.gas+s.gas}}return{amount:0n,gas:0n}}}class qe extends ue{static create(e,t,a){const{factory:n,fee:s,feePrecision:i,pairBytecodeHash:d,gas:c}=e;return new qe(d,n,s,i,t[0],t[1],a,c)}getfetchingCurrentStateCalls(){return[...super.getfetchingCurrentStateCalls(),{callData:"0x1df4ccfc",target:this.pairContract}]}applyCurrentStateFromCalls(e){if(0===e.length||!1===e[0].success||"0x"===e[0].returnData)return this.reserve0=0n,this.reserve1=0n,void(this.fee=0n);if(super.applyCurrentStateFromCalls(e),e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.fee=this.feePrecision-t.toBigInt()}}}const Xe=0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn,He=0xffffffffffffffffffffffffffffffffffffffffn;class Ge{static mulDiv(e,t,a){Ge.err.require(a>0n,"zero division");const n=e*t/a;return Ge.err.require(n<=Xe,"uint256 overflowed"),n}static mulDivRoundingUp(e,t,a){let n=this.mulDiv(e,t,a);return e*t%a>0&&(Ge.err.require(n<Xe,"mulDivRoundingUp Overflowed"),n++),Ge.err.require(n<=Xe,"mulDivRoundingUp Overflowed"),n}}Ge.err=new ge(Ge.name);const Ke=-887272n,ze=887272n,Qe=4295128739n,Ye=1461446703485210103287273052203988822378723970342n;class Ze{static getSqrtRatioAtTick(e){const t=e<0n?-e:e;this.err.require(t<=ze,"T");let a=0n!==(0x1n&t)?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return 0n!==(0x2n&t)&&(a=0xfff97272373d413259a46990580e213an*a>>128n),0n!==(0x4n&t)&&(a=0xfff2e50f5f656932ef12357cf3c7fdccn*a>>128n),0n!==(0x8n&t)&&(a=0xffe5caca7e10e4e61c3624eaa0941cd0n*a>>128n),0n!==(0x10n&t)&&(a=0xffcb9843d60f6159c9db58835c926644n*a>>128n),0n!==(0x20n&t)&&(a=0xff973b41fa98c081472e6896dfb254c0n*a>>128n),0n!==(0x40n&t)&&(a=0xff2ea16466c96a3843ec78b326b52861n*a>>128n),0n!==(0x80n&t)&&(a=0xfe5dee046a99a2a811c461f1969c3053n*a>>128n),0n!==(0x100n&t)&&(a=0xfcbe86c7900a88aedcffc83b479aa3a4n*a>>128n),0n!==(0x200n&t)&&(a=0xf987a7253ac413176f2b074cf7815e54n*a>>128n),0n!==(0x400n&t)&&(a=0xf3392b0822b70005940c7a398e4b70f3n*a>>128n),0n!==(0x800n&t)&&(a=0xe7159475a2c29b7443b29c7fa6e889d9n*a>>128n),0n!==(0x1000n&t)&&(a=0xd097f3bdfd2022b8845ad8f792aa5825n*a>>128n),0n!==(0x2000n&t)&&(a=0xa9f746462d870fdf8a65dc1f90e061e5n*a>>128n),0n!==(0x4000n&t)&&(a=0x70d869a156d2a1b890bb3df62baf32f7n*a>>128n),0n!==(0x8000n&t)&&(a=0x31be135f97d08fd981231505542fcfa6n*a>>128n),0n!==(0x10000n&t)&&(a=0x9aa508b5b7a84e1c677de54f3e99bc9n*a>>128n),0n!==(0x20000n&t)&&(a=0x5d6af8dedb81196699c329225ee604n*a>>128n),0n!==(0x40000n&t)&&(a=0x2216e584f5fa1ea926041bedfe98n*a>>128n),0n!==(0x80000n&t)&&(a=0x48a170391f7dc42444e8fa2n*a>>128n),e>0n&&(a=Xe/a),(a>>32n)+(a%(1n<<32n)===0n?0n:1n)}static getTickAtSqrtRatio(e){this.err.require(e>=Qe&&e<Ye,"R");const t=e<<32n;let a,n=t,s=0n;a=(n>0xffffffffffffffffffffffffffffffffn?1n:0n)<<7n,s|=a,n>>=a,a=(n>0xffffffffffffffffn?1n:0n)<<6n,s|=a,n>>=a,a=(n>0xffffffffn?1n:0n)<<5n,s|=a,n>>=a,a=(n>0xffffn?1n:0n)<<4n,s|=a,n>>=a,a=(n>0xffn?1n:0n)<<3n,s|=a,n>>=a,a=(n>0xfn?1n:0n)<<2n,s|=a,n>>=a,a=(n>0x3n?1n:0n)<<1n,s|=a,n>>=a,a=n>0x1n?1n:0n,s|=a,n=s>=128n?t>>s-127n:t<<127n-s;let i=s-128n<<64n;n=n*n>>127n,a=n>>128n,i|=a<<63n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<62n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<61n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<60n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<59n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<58n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<57n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<56n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<55n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<54n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<53n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<52n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<51n,n>>=a,n=n*n>>127n,a=n>>128n,i|=a<<50n;const d=255738958999603826347141n*i,c=d-3402992956809132418596140100660247210n>>128n,r=d+291339464771989622907027621153398088495n>>128n;return c===r?c:this.getSqrtRatioAtTick(r)<=e?r:c}}Ze.err=new ge(Ze.name);const $e=0xffffffffffffffffffffffffffffffffn;class je{static addDelta(e,t){let a;return t<0n?(a=e- -t,je.err.require(a<e&&a>=0n,"LS")):(a=e+t,je.err.require(a>=e&&a<=$e,"LA")),a}}je.err=new ge(je.name);const Je=0x1000000000000000000000000n;class et{static divRoundingUp(e,t){return e%t>0n?e/t+1n:e/t}}class tt{static getAmount0Delta(e,t,a,n){e>t&&([e,t]=[t,e]);const s=a<<96n,i=t-e;return tt.err.require(e>0n,"sqrtRatioAX96 > 0n"),n?et.divRoundingUp(Ge.mulDivRoundingUp(s,i,t),e):Ge.mulDiv(s,i,t)/e}static getAmount1Delta(e,t,a,n){return e>t&&([e,t]=[t,e]),n?Ge.mulDivRoundingUp(a,t-e,Je):Ge.mulDiv(a,t-e,Je)}static getNextSqrtPriceFromAmount0RoundingUp(e,t,a,n){if(0n===a)return e;const s=t<<96n;if(n){let t;if((t=a*e)/a==e){const a=s+t;if(a>=s)return Ge.mulDivRoundingUp(s,e,a)}return et.divRoundingUp(s,s/e+a)}{const t=a*e;tt.err.require(t/a===e&&s>t,"product / amount === sqrtPX96");const n=s-t;return Ge.mulDivRoundingUp(s,e,n)}}static getNextSqrtPriceFromAmount1RoundingDown(e,t,a,n){if(n){const n=a<=He?(a<<96n)/t:Ge.mulDiv(a,Je,t);return tt.err.require(e+n<=He,"result overflowed uint160"),e+n}{const n=a<=He?et.divRoundingUp(a<<96n,t):Ge.mulDivRoundingUp(a,Je,t);return tt.err.require(e>n,"sqrtPX96 > quotient"),tt.err.require(e-n<=He,"result overflowed uint160"),e-n}}static getNextSqrtPriceFromInput(e,t,a,n){return tt.err.require(e>0n,"sqrtPX96 > 0n"),tt.err.require(t>0n,"liquidity > 0n"),n?tt.getNextSqrtPriceFromAmount0RoundingUp(e,t,a,!0):tt.getNextSqrtPriceFromAmount1RoundingDown(e,t,a,!0)}}tt.err=new ge(tt.name);class at{static computeSwapStep(e,t,a,n,s){const i=e>=t,d={sqrtRatioNextX96:0n,amountIn:0n,amountOut:0n,feeAmount:0n},c=Ge.mulDiv(n,1000000n-s,1000000n);d.amountIn=i?tt.getAmount0Delta(t,e,a,!0):tt.getAmount1Delta(e,t,a,!0),c>=d.amountIn?d.sqrtRatioNextX96=t:d.sqrtRatioNextX96=tt.getNextSqrtPriceFromInput(e,a,c,i);const r=t===d.sqrtRatioNextX96;return i?(d.amountIn=r?d.amountIn:tt.getAmount0Delta(d.sqrtRatioNextX96,e,a,!0),d.amountOut=tt.getAmount1Delta(d.sqrtRatioNextX96,e,a,!1)):(d.amountIn=r?d.amountIn:tt.getAmount1Delta(e,d.sqrtRatioNextX96,a,!0),d.amountOut=tt.getAmount0Delta(e,d.sqrtRatioNextX96,a,!1)),d.sqrtRatioNextX96!==t?d.feeAmount=n-d.amountIn:d.feeAmount=Ge.mulDivRoundingUp(d.amountIn,s,1000000n-s),d}}class nt{constructor(){this.tickInfo={}}setTick(e,t){this.tickInfo[e]=t}setTicksAndLiquidity(e){e.forEach((e=>{this.tickInfo[e[0]]={feeGrowthOutside0X128:0n,feeGrowthOutside1X128:0n,initialized:e[1]>0n,liquidityGross:0n,liquidityNet:e[1],secondsOutside:0n,secondsPerLiquidityOutsideX128:0n,tickCumulativeOutside:0n}}))}ticks(e){return this.tickInfo[e]}cross(e,t,a,n,s,i){const d=this.tickInfo[e];return d.feeGrowthOutside0X128=t-d.feeGrowthOutside0X128,d.feeGrowthOutside1X128=a-d.feeGrowthOutside1X128,d.secondsPerLiquidityOutsideX128=n-d.secondsPerLiquidityOutsideX128,d.tickCumulativeOutside=s-d.tickCumulativeOutside,d.secondsOutside=i-d.secondsOutside,d.liquidityNet}}class st{constructor(e,t,a,n,s,i,d,c,r,o,f,l){this.PAIR_BYTECODE_HASH=e,this.factory=t,this.tickQuerier=a,this.fee=n,this.token0=s,this.token1=i,this.maxInitializedTicks=d,this.routeIndex=c,this.depositAddress=r,this.gasConstant=o,this.gasPerInitializedTick=f,this.gasPerTick=l,this.abiCoder=he,this.err=new ge(st.name),this.MAX_UINT160=0xffffffffffffffffffffffffffffffffffffffffn,this.Q128=0x100000000000000000000000000000000n,this.slot0={feeProtocol:0n,sqrtPriceX96:0n,tick:0n,unlocked:!0},this.liquidity=0n,this.tickNextList0=[],this.tickNextList1=[],this.tickNextList0Idx=0,this.tickNextList1Idx=0,this.ticks=new nt;const b=this.getSortedPair(this.token0,this.token1);this.token0=b[0],this.token1=b[1],this.poolContract=this.generatePairAddress(this.factory,this.token0,this.token1,this.fee),this.getSwapStateZeroForOneParam=this.abiCoder.encode(["address","uint256","bool"],[this.poolContract,this.maxInitializedTicks,!0]),this.getSwapStateOneForZeroParam=this.abiCoder.encode(["address","uint256","bool"],[this.poolContract,this.maxInitializedTicks,!1])}static create(e,t,a){const{factory:n,fee:s,pairBytecodeHash:i,maxInitializedTicks:d,tickQuerier:c,depositAddress:r,gas:o,gasPerInitializedTick:f,gasPerTick:l}=e;return new st(i,n,c,s,t[0],t[1],d,a,r,o,f,l)}generatePairAddress(t,a,n,s){return e.utils.hexDataSlice(e.utils.keccak256(e.utils.concat(["0xff",t,e.utils.keccak256(this.abiCoder.encode(["address","address","uint24"],[a,n,Number(s)])),this.PAIR_BYTECODE_HASH])),12)}getSortedPair(e,t){return e.localeCompare(t,"en",{sensitivity:"base"})<=0?[e,t]:[t,e]}getTradablePairs(){return[[this.token0,this.token1],[this.token1,this.token0]]}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[{callData:"0x3850c7bd",target:this.poolContract},{callData:"0x1a686502",target:this.poolContract},{callData:e.utils.hexConcat(["0xa6438a3a",this.getSwapStateZeroForOneParam]),target:this.tickQuerier},{callData:e.utils.hexConcat(["0xa6438a3a",this.getSwapStateOneForZeroParam]),target:this.tickQuerier}]}applyCurrentStateFromCalls(e){if(0!==e.length&&!1!==e[0].success&&"0x"!==e[0].returnData){if(e[0].success){const[t,a,,,,n,s]=this.abiCoder.decode(["uint160","int24","uint16","uint16","uint16","uint8","bool"],e[0].returnData);this.slot0={sqrtPriceX96:t.toBigInt(),tick:BigInt(a),feeProtocol:BigInt(n),unlocked:s}}if(e[1].success){const[t]=this.abiCoder.decode(["uint128"],e[1].returnData);this.liquidity=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[2].returnData);this.tickNextList0=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0]+1,e[1].toBigInt()])))}if(e[3].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[3].returnData);this.tickNextList1=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0],e[1].toBigInt()])))}}}getNextInitializedTick(e,t){if(t){if(e===this.tickNextList0[this.tickNextList0Idx].tick){if(this.tickNextList0Idx+1>=this.tickNextList0.length)return{tick:{tick:0n,initialized:!1},exist:!1};const{initialized:e,tick:t}=this.tickNextList0[++this.tickNextList0Idx];return{tick:{initialized:e,tick:t+1n},exist:!0}}{const{initialized:e,tick:t}=this.tickNextList0[this.tickNextList0Idx];return{tick:{initialized:e,tick:t+1n},exist:!0}}}return e===this.tickNextList1[this.tickNextList1Idx].tick?this.tickNextList1Idx+1>=this.tickNextList1.length?{tick:{tick:0n,initialized:!1},exist:!1}:{tick:this.tickNextList1[++this.tickNextList1Idx],exist:!0}:{tick:this.tickNextList1[this.tickNextList1Idx],exist:!0}}getAmountOut(e,t,a){this.err.require(0n!==a,"AS");const n=e===this.token0,s=n?4295128740n:Ye-1n,i={...this.slot0};this.err.require(n?s<i.sqrtPriceX96&&s>Qe:s>i.sqrtPriceX96&&s<Ye,"SPL");const d={liquidityStart:this.liquidity,feeProtocol:n?i.feeProtocol%16n:i.feeProtocol>>4n},c={amountSpecifiedRemaining:a,amountCalculated:0n,sqrtPriceX96:i.sqrtPriceX96,tick:i.tick,feeGrowthGlobalX128:0n,protocolFee:0n,liquidity:d.liquidityStart};this.tickNextList0Idx=0,this.tickNextList1Idx=0;let r=0n;for(;0n!==c.amountSpecifiedRemaining&&c.sqrtPriceX96!==s&&(n?this.tickNextList0Idx<this.tickNextList0.length:this.tickNextList1Idx<this.tickNextList1.length);){let e={amountIn:0n,amountOut:0n,feeAmount:0n,initialized:!1,sqrtPriceNextX96:0n,sqrtPriceStartX96:0n,tickNext:0n};e.sqrtPriceStartX96=c.sqrtPriceX96;const{tick:t,exist:a}=this.getNextInitializedTick(c.tick,n);if(!a)break;e.tickNext=t.tick,e.initialized=t.initialized,e.tickNext<Ke?e.tickNext=Ke:e.tickNext>ze&&(e.tickNext=ze),e.sqrtPriceNextX96=Ze.getSqrtRatioAtTick(e.tickNext);const i=at.computeSwapStep(c.sqrtPriceX96,(n?e.sqrtPriceNextX96<s:e.sqrtPriceNextX96>s)?s:e.sqrtPriceNextX96,c.liquidity,c.amountSpecifiedRemaining,this.fee);if(e.amountIn=i.amountIn,e.amountOut=i.amountOut,c.sqrtPriceX96=i.sqrtRatioNextX96,e.feeAmount=i.feeAmount,c.amountSpecifiedRemaining-=e.amountIn+e.feeAmount,c.amountCalculated=c.amountCalculated-e.amountOut,d.feeProtocol>0){const t=e.feeAmount/d.feeProtocol;e.feeAmount-=t,c.protocolFee+=t}if(c.sqrtPriceX96==e.sqrtPriceNextX96){if(e.initialized){let t=this.ticks.cross(Number(e.tickNext),0n,0n,0n,0n,0n);r+=this.gasPerInitializedTick,n&&(t=-t),c.liquidity=je.addDelta(c.liquidity,t)}c.tick=n?e.tickNext-1n:e.tickNext}else c.sqrtPriceX96!=e.sqrtPriceStartX96&&(c.tick=Ze.getTickAtSqrtRatio(c.sqrtPriceX96));r+=this.gasPerTick}return c.amountSpecifiedRemaining>0n?{amount:0n,gas:0n}:{amount:-c.amountCalculated,gas:r+this.gasConstant}}}class it extends Oe{static create(e,t){return new it(t,e.tokens,e.scalingFactors,e.weights,e.poolId,e.vaultContract,e.depositAddress,e.gas)}getfetchingCurrentStateCalls(){return[...super.getfetchingCurrentStateCalls(),{callData:"0xf89f27ed",target:this.poolContract}]}applyCurrentStateFromCalls(e){if(super.applyCurrentStateFromCalls(e),e[2].success){const[t]=this.abiCoder.decode(["uint256[]"],e[2].returnData);this.normalizedWeights=t.map((e=>e.toBigInt()))}}}class dt extends Te{static createMeta(e,t,a){return new dt(a,e.multicall,e.baseCacheExpires,e.isCacheExists,e.lpToken,e.poolContract,e.tokens,e.rates,e.precision,e.precisionMul,e.feeDenominator,t,e.address,e.gas,e.aPrecision)}getfetchingCurrentStateCalls(){return[{callData:"0x0ba81959",target:this.poolContract},{callData:"0x5fd65f0f",target:this.poolContract},{callData:"0x2d74d4e9",target:this.poolContract},{callData:"0x18160ddd",target:this.lpToken},{callData:"0x0f28c97d",target:this.multicall},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode(["uint8"],[a]);return{callData:e.utils.hexConcat(["0x91ceb3eb",n]),target:this.poolContract}}))]}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}else i.warn("unable to find A for Curve pool",this.poolContract),this.A=0n;if(e[1].success){const[,,,,t]=this.abiCoder.decode(["uint256","uint256","uint256","uint256","uint256","uint256","address"],e[1].returnData);this.fee=t.toBigInt()}else i.warn("unable to find fee for Curve pool",this.poolContract),this.fee=0n;if(e[2].success){const[,t,a]=this.abiCoder.decode(["address","uint256","uint256"],e[2].returnData);this.baseVirtualPrice=t.toBigInt(),this.baseCacheUpdated=a.toBigInt()}else i.warn("unable to find base virtual price/cache for pool",this.poolContract),this.baseVirtualPrice=0n,this.baseCacheUpdated=0n;if(e[3].success){const[t]=this.abiCoder.decode(["uint256"],e[3].returnData);this.lpTokenTotalSupply=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve pool",this.poolContract),this.lpTokenTotalSupply=0n;if(e[4].success){const[t]=this.abiCoder.decode(["uint256"],e[4].returnData);this.blockTimestamp=t.toBigInt()}else i.warn("unable to find block timestamp for the pool",this.poolContract),this.blockTimestamp=0n;for(let t=5,a=this.TOKENS.length+t;t<a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances.push(a.toBigInt())}else i.warn("unable to find balance at index",t-3,"for Curve pool",this.poolContract),this.balances.push(0n)}}}class ct{constructor(e,t,a,n,s,i,d){this.token0=e,this.token1=t,this.vaultContract=a,this.pricePrecision=n,this.debtTokenContract=s,this.tradingRouteIndex=i,this.gasConstant=d,this.errorFactory=new ge(ct.name),this.abiCoder=he,this.stableSwapFeeBasisPoints=0n,this.swapFeeBasisPoints=0n,this.stableTaxBasisPoints=0n,this.taxBasisPoints=0n,this.hasDynamicFees=!1,this.minPrices={},this.maxPrices={},this.decimals={},this.isTokenStable={},this.usdgAmounts={},this.tokenWeights={},this.isInWhiteList={},this.maxUsdgAmounts={},this.poolAmounts={},this.reservedAmounts={},this.bufferAmounts={},this.totalTokenWeights=0n,this.usdgTotalsupply=0n,this.USDG_DECIMALS=18n,this.BASIS_POINTS_DIVISOR=10000n;const c=this.getSortedPair(this.token0,this.token1);this.token0=c[0],this.token1=c[1]}static create(e,t,a){const{vaultContract:n,pricePrecision:s,debtTokenContract:i,gas:d}=e;return new ct(t[0],t[1],n,s,i,a,d)}getAmountOut(e,t,a){if(this.getMaxAmountIn(e,t)<a||!this.isInWhiteList[e]||!this.isInWhiteList[t])return{amount:0n,gas:0n};const n=this.minPrices[e],s=this.maxPrices[t],i=this.decimals[e],d=this.decimals[t];let c=a*n/this.pricePrecision;c=c*10n**this.USDG_DECIMALS/10n**i;const r=this.isTokenStable[e]&&this.isTokenStable[t],o=r?this.stableSwapFeeBasisPoints:this.swapFeeBasisPoints,f=r?this.stableTaxBasisPoints:this.taxBasisPoints,l=this.getFeeBasisPoints(e,c,o,f,!0),b=this.getFeeBasisPoints(t,c,o,f,!1),h=l>b?l:b;let u=a*n/s;u=u*10n**d/10n**i;return{amount:u*(this.BASIS_POINTS_DIVISOR-h)/this.BASIS_POINTS_DIVISOR,gas:this.gasConstant}}getFeeBasisPoints(e,t,a,n,s){if(!this.hasDynamicFees)return a;const i=this.usdgAmounts[e];let d=i+t;s||(d=t>i?0n:i-t);const c=this.getTargetUsdgAmount(e);if(0n===c)return a;const r=i>c?i-c:c-i,o=d>c?d-c:c-d;if(o<r){const e=n*r/c;return e>a?0n:a-e}let f=(r+o)/2n;f>c&&(f=c);return a+n*f/c}getTargetUsdgAmount(e){const t=this.usdgTotalsupply;if(0n===t)return 0n;return this.tokenWeights[e]*t/this.totalTokenWeights}getMaxAmountIn(e,t){const a=this.minPrices[e],n=this.maxPrices[t];if(void 0===a||void 0===n)return 0n;const s=this.decimals[e],i=this.decimals[t],d=this.poolAmounts[t],c=this.reservedAmounts[t],r=this.bufferAmounts[t],o=c>r?c:r;if(o>=d)return 0n;const f=(d-o)*n/a*10n**s/10n**i,l=this.maxUsdgAmounts[e];if(0n!==l){if(l<this.usdgAmounts[e])return 0n;let t=l-this.usdgAmounts[e];if(t=t*10n**s/10n**this.USDG_DECIMALS,t=t*this.pricePrecision/a,f>t)return t}return f}getfetchingCurrentStateCalls(){const t=[],a=[this.token0,this.token1],n=[this.abiCoder.encode(["address"],[this.token0]),this.abiCoder.encode(["address"],[this.token1])];for(let s=0,i=a.length;s<i;++s){const a=n[s];t.push({callData:e.utils.hexConcat(["0x81a612d6",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0xe124e6d2",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0x8ee573ac",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0x42b60b03",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0x1aa4ace5",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0xab2f3ad4",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0xad1e4f8d",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0x52f55eed",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0xc3c7b9e9",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0x4a993ee9",a]),target:this.vaultContract},{callData:e.utils.hexConcat(["0xdaf9c210",a]),target:this.vaultContract})}return t.push({callData:"0xdf73a267",target:this.vaultContract},{callData:"0xa22f2392",target:this.vaultContract},{callData:"0x10eb56c2",target:this.vaultContract},{callData:"0x7a210a2b",target:this.vaultContract},{callData:"0x9f392eb3",target:this.vaultContract},{callData:"0xdc8f5fac",target:this.vaultContract},{callData:"0x18160ddd",target:this.debtTokenContract}),t}applyCurrentStateFromCalls(e){if(0===e.length||!1===e[0].success||!1===e[1].success)return;const t=e.length,a=[this.token0,this.token1],n=11;for(let t=0,s=a.length;t<s;++t){const s=a[t];if(e[n*t].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t].returnData);this.minPrices[s]=a.toBigInt()}if(e[n*t+1].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+1].returnData);this.maxPrices[s]=a.toBigInt()}if(e[n*t+2].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+2].returnData);this.decimals[s]=a.toBigInt()}if(e[n*t+3].success){const[a]=this.abiCoder.decode(["bool"],e[n*t+3].returnData);this.isTokenStable[s]=a}if(e[n*t+4].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+4].returnData);this.usdgAmounts[s]=a.toBigInt()}if(e[n*t+5].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+5].returnData);this.tokenWeights[s]=a.toBigInt()}if(e[n*t+6].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+6].returnData);this.maxUsdgAmounts[s]=a.toBigInt()}if(e[n*t+7].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+7].returnData);this.poolAmounts[s]=a.toBigInt()}if(e[n*t+8].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+8].returnData);this.reservedAmounts[s]=a.toBigInt()}if(e[n*t+9].success){const[a]=this.abiCoder.decode(["uint256"],e[n*t+9].returnData);this.bufferAmounts[s]=a.toBigInt()}if(e[n*t+10].success){const[a]=this.abiCoder.decode(["bool"],e[n*t+10].returnData);this.isInWhiteList[s]=a}}if(e[t-1].success){const[a]=this.abiCoder.decode(["uint256"],e[t-1].returnData);this.usdgTotalsupply=a.toBigInt()}if(e[t-2].success){const[a]=this.abiCoder.decode(["uint256"],e[t-2].returnData);this.totalTokenWeights=a.toBigInt()}if(e[t-3].success){const[a]=this.abiCoder.decode(["bool"],e[t-3].returnData);this.hasDynamicFees=a}if(e[t-4].success){const[a]=this.abiCoder.decode(["uint256"],e[t-4].returnData);this.taxBasisPoints=a.toBigInt()}if(e[t-5].success){const[a]=this.abiCoder.decode(["uint256"],e[t-5].returnData);this.stableTaxBasisPoints=a.toBigInt()}if(e[t-6].success){const[a]=this.abiCoder.decode(["uint256"],e[t-6].returnData);this.swapFeeBasisPoints=a.toBigInt()}if(e[t-7].success){const[a]=this.abiCoder.decode(["uint256"],e[t-7].returnData);this.stableSwapFeeBasisPoints=a.toBigInt()}}getTradablePairs(){return[[this.token0,this.token1],[this.token1,this.token0]]}getTradingRouteIndex(){return this.tradingRouteIndex}getPoolAddress(){return this.vaultContract}getDepositAddress(){return this.vaultContract}getSortedPair(e,t){return e.localeCompare(t,"en",{sensitivity:"base"})<=0?[e,t]:[t,e]}}class rt{constructor(e,t,a,n,s,i,d){this.PAIR_BYTECODE_HASH=e,this.token0=t,this.token1=a,this.factoryContract=n,this.stable=s,this.tradingRouteIndex=i,this.gasConstant=d,this.abiCoder=he,this.err=new ge(rt.name),this.reserve0=0n,this.reserve1=0n,this.decimals0=0n,this.decimals1=0n,this.fee=0n;const c=this.getSortedPair(this.token0,this.token1);this.token0=c[0],this.token1=c[1],this.pairContract=this.generatePairAddress(this.factoryContract,this.token0,this.token1,this.stable)}static create(e,t,a){const{factoryContract:n,isStable:s,pairBytecodeHash:i,gas:d}=e;return new rt(i,t[0],t[1],n,s,a,d)}getTradablePairs(){return[[this.token0,this.token1],[this.token1,this.token0]]}getTradingRouteIndex(){return this.tradingRouteIndex}getDepositAddress(){return this.pairContract}getPoolAddress(){return this.pairContract}getfetchingCurrentStateCalls(){return[{callData:"0x0902f1ac",target:this.pairContract},{callData:e.utils.hexConcat(["0x512b45ea",this.abiCoder.encode(["bool"],[this.stable])]),target:this.factoryContract},{callData:"0x313ce567",target:this.token0},{callData:"0x313ce567",target:this.token1}]}applyCurrentStateFromCalls(e){if(0!==e.length&&!1!==e[0].success&&!1!==e[1].success&&"0x"!==e[0].returnData){if(e[0].success){const[t,a]=this.abiCoder.decode(["uint256","uint256","uint256"],e[0].returnData);this.reserve0=t.toBigInt(),this.reserve1=a.toBigInt()}if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.fee=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["uint8"],e[2].returnData);this.decimals0=BigInt(10**t)}if(e[3].success){const[t]=this.abiCoder.decode(["uint8"],e[3].returnData);this.decimals1=BigInt(10**t)}}}getAmountOut(e,t,a){if(0n===this.decimals0||0n===this.decimals1)return{amount:0n,gas:0n};a-=a*this.fee/10000n;const n=this._getAmountOut(a,e,this.reserve0,this.reserve1);let s,i;e.toLowerCase()===this.token0.toLowerCase()?(s=this.reserve0+a,i=this.reserve1-n):(i=this.reserve1+a,s=this.reserve0-n);const d=this._k(s,i),c=this._k(this.reserve0,this.reserve1);return this.err.require(d>=c,"K"),{amount:n,gas:this.gasConstant}}_getAmountOut(e,t,a,n){if(this.stable){const s=this._k(a,n);a=1000000000000000000n*a/this.decimals0,n=1000000000000000000n*n/this.decimals1;const{reserveA:i,reserveB:d}=t===this.token0?{reserveA:a,reserveB:n}:{reserveA:n,reserveB:a};e=t===this.token0?1000000000000000000n*e/this.decimals0:1000000000000000000n*e/this.decimals1;return(d-this._get_y(e+i,s,d))*(t===this.token0?this.decimals1:this.decimals0)/1000000000000000000n}{const{reserveA:s,reserveB:i}=t===this.token0?{reserveA:a,reserveB:n}:{reserveA:n,reserveB:a};return e*i/(s+e)}}_k(e,t){if(this.stable){const a=1000000000000000000n*e/this.decimals0,n=1000000000000000000n*t/this.decimals1;return a*n/1000000000000000000n*(a*a/1000000000000000000n+n*n/1000000000000000000n)/1000000000000000000n}return e*t}_get_y(e,t,a){for(let n=0;n<255;n++){const n=a,s=this._f(e,a),i=this._d(e,a);if(this.err.require(0n!==i,"D must not be zero"),s<t){a+=1000000000000000000n*(t-s)/i}else{a-=1000000000000000000n*(s-t)/i}if(a>n){if(a-n<=1)return a}else if(n-a<=1)return a}return a}_f(e,t){return e*(t*t/1000000000000000000n*t/1000000000000000000n)/1000000000000000000n+e*e/1000000000000000000n*e/1000000000000000000n*t/1000000000000000000n}_d(e,t){return 3n*e*(t*t/1000000000000000000n)/1000000000000000000n+e*e/1000000000000000000n*e/1000000000000000000n}generatePairAddress(t,a,n,s){return e.utils.hexDataSlice(e.utils.keccak256(e.utils.concat(["0xff",t,e.utils.solidityKeccak256(["address","address","bool"],[a,n,s]),this.PAIR_BYTECODE_HASH])),12)}getSortedPair(e,t){return e.localeCompare(t,"en",{sensitivity:"base"})<=0?[e,t]:[t,e]}}class ot{constructor(e,t,a,n,s,i,d,c,r,o){this.SYNTHS=e,this.exchangeRatesContract=t,this.sUSDContract=a,this.exchangerContract=n,this.synthetixContract=s,this.flexibleStorageContract=i,this.PRECISION_UNIT=d,this.depositAddress=c,this.gasConstant=r,this.routeIndex=o,this.MAX_UINT256=0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn,this.err=new ge(ot.name),this.abiCoder=he,this.rates={},this.fee={},this.maxFee=0n,this.SYSTEM_SETTING_CFG="0x53797374656d53657474696e6773000000000000000000000000000000000000",this.SETTING_EXCHANGE_MAX_DYNAMIC_FEE_CFG="0x65786368616e67654d617844796e616d69634665650000000000000000000000"}static create(e,t){return new ot(e.tokens,e.exchangeRatesContract,e.sUsdContract,e.exchangerContract,e.synthetixContract,e.flexibleStorageContract,e.PRECISION_UNIT,e.address,e.gas,t)}static isPairSupported(e,t){return void 0!==t[e[0]]&&void 0!==t[e[1]]}getTradablePairs(){const e=[],t=Object.keys(this.SYNTHS);for(let a=0,n=t.length;a<n;++a)for(let s=a+1;s<n;++s)e.push([t[a],t[s]]),e.push([t[s],t[a]]);return e}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.synthetixContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){const t=[],a=Object.keys(this.SYNTHS);for(let n=0;n<a.length;++n){const s=e.utils.formatBytes32String(this.SYNTHS[a[n]]);t.push({callData:e.utils.hexConcat(["0xac82f608",s]),target:this.exchangeRatesContract},{callData:e.utils.hexConcat(["0x1a5c6095",s,"0x0000000000000000000000000000000000000000000000000000000000000000"]),target:this.exchangerContract})}return t.push({callData:e.utils.hexConcat(["0x23257c2b",this.SYSTEM_SETTING_CFG,this.SETTING_EXCHANGE_MAX_DYNAMIC_FEE_CFG]),target:this.flexibleStorageContract}),t}applyCurrentStateFromCalls(e){if(0===e.length)return;const t=Object.keys(this.SYNTHS);for(let a=0,n=2*t.length;a<n;a+=2)if(!e[a].success)return;for(let a=0,n=2*t.length;a<n;a+=2){const[n]=this.abiCoder.decode(["uint"],e[a].returnData);if(this.rates[t[a/2]]=n.toBigInt(),e[a+1].success){const[n]=this.abiCoder.decode(["uint256"],e[a+1].returnData);this.fee[t[a/2]]={rate:n.toBigInt(),isVolatile:!1}}else this.fee[t[a/2]]={rate:0n,isVolatile:!0}}const[a]=this.abiCoder.decode(["uint256"],e[e.length-1].returnData);this.maxFee=a.toBigInt()}mul(e,t){const a=e*t;return this.err.require(a<=this.MAX_UINT256,"SafeMath: multiplication overflow"),a}div(e,t){return this.err.require(t>0,"SafeMath: division by zero"),e/t}multiplyDecimal(e,t){return this.mul(e,t)/this.PRECISION_UNIT}multiplyDecimalRound(e,t){let a=this.mul(e,t)/(this.PRECISION_UNIT/10n);return a%10n>=5n&&(a+=10n),a/10n}divideDecimalRound(e,t){let a=this.div(this.mul(e,10n*this.PRECISION_UNIT),t);return a%10n>=5n&&(a+=10n),a/10n}getAmountOut(e,t,a){if(void 0===this.rates[e]||void 0===this.rates[t])return{amount:0n,gas:0n};if(e===t)return{amount:a,gas:this.gasConstant};{const n=this.rates[e],s=this.rates[t];if(s>0){let i=this.divideDecimalRound(this.multiplyDecimalRound(a,n),s),d=this.fee[e].rate+this.fee[t].rate;return this.fee[e].isVolatile||this.fee[t].isVolatile||d>this.maxFee?{amount:0n,gas:0n}:(i=this.multiplyDecimal(i,this.PRECISION_UNIT-d),{amount:i,gas:this.gasConstant})}return{amount:0n,gas:0n}}}}class ft extends st{constructor(e,t,a,n,s,i,d,c,r,o,f,l){super(e,t,a,n,s,i,d,c,r,o,f,l),this.PAIR_BYTECODE_HASH=e,this.poolDeployer=t,this.err=new ge(ft.name),this.PROTOCOL_FEE_DENOMINATOR=10000n,this.PROTOCOL_FEE_SP=65536n,this.poolContract=this.generatePairAddress(this.poolDeployer,this.token0,this.token1,this.fee)}static createPancake(e,t,a){const{poolDeployer:n,fee:s,pairBytecodeHash:i,maxInitializedTicks:d,tickQuerier:c,depositAddress:r,gas:o,gasPerInitializedTick:f,gasPerTick:l}=e;return new ft(i,n,c,s,t[0],t[1],d,a,r,o,f,l)}applyCurrentStateFromCalls(e){if(0!==e.length&&!1!==e[0].success&&"0x"!==e[0].returnData){if(e[0].success){const[t,a,,,,n,s]=this.abiCoder.decode(["uint160","int24","uint16","uint16","uint16","uint32","bool"],e[0].returnData);this.slot0={sqrtPriceX96:t.toBigInt(),tick:BigInt(a),feeProtocol:BigInt(n),unlocked:s}}if(e[1].success){const[t]=this.abiCoder.decode(["uint128"],e[1].returnData);this.liquidity=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[2].returnData);this.tickNextList0=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0]+1,e[1].toBigInt()])))}if(e[3].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[3].returnData);this.tickNextList1=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0],e[1].toBigInt()])))}}}getAmountOut(e,t,a){this.err.require(0n!==a,"AS");const n=e===this.token0,s=n?4295128740n:Ye-1n,i={...this.slot0};this.err.require(n?s<i.sqrtPriceX96&&s>Qe:s>i.sqrtPriceX96&&s<Ye,"SPL");const d={liquidityStart:this.liquidity,feeProtocol:n?i.feeProtocol%this.PROTOCOL_FEE_SP:i.feeProtocol>>16n},c={amountSpecifiedRemaining:a,amountCalculated:0n,sqrtPriceX96:i.sqrtPriceX96,tick:i.tick,feeGrowthGlobalX128:0n,protocolFee:0n,liquidity:d.liquidityStart};this.tickNextList0Idx=0,this.tickNextList1Idx=0;let r=0n;for(;0n!==c.amountSpecifiedRemaining&&c.sqrtPriceX96!==s&&(n?this.tickNextList0Idx<this.tickNextList0.length:this.tickNextList1Idx<this.tickNextList1.length);){let e={amountIn:0n,amountOut:0n,feeAmount:0n,initialized:!1,sqrtPriceNextX96:0n,sqrtPriceStartX96:0n,tickNext:0n};e.sqrtPriceStartX96=c.sqrtPriceX96;const{tick:t,exist:a}=this.getNextInitializedTick(c.tick,n);if(!a)break;e.tickNext=t.tick,e.initialized=t.initialized,e.tickNext<Ke?e.tickNext=Ke:e.tickNext>ze&&(e.tickNext=ze),e.sqrtPriceNextX96=Ze.getSqrtRatioAtTick(e.tickNext);const i=at.computeSwapStep(c.sqrtPriceX96,(n?e.sqrtPriceNextX96<s:e.sqrtPriceNextX96>s)?s:e.sqrtPriceNextX96,c.liquidity,c.amountSpecifiedRemaining,this.fee);if(e.amountIn=i.amountIn,e.amountOut=i.amountOut,c.sqrtPriceX96=i.sqrtRatioNextX96,e.feeAmount=i.feeAmount,c.amountSpecifiedRemaining-=e.amountIn+e.feeAmount,c.amountCalculated=c.amountCalculated-e.amountOut,d.feeProtocol>0){const t=e.feeAmount*d.feeProtocol/this.PROTOCOL_FEE_DENOMINATOR;e.feeAmount-=t,c.protocolFee+=t}if(c.sqrtPriceX96==e.sqrtPriceNextX96){if(e.initialized){let t=this.ticks.cross(Number(e.tickNext),0n,0n,0n,0n,0n);r+=this.gasPerInitializedTick,n&&(t=-t),c.liquidity=je.addDelta(c.liquidity,t)}c.tick=n?e.tickNext-1n:e.tickNext}else c.sqrtPriceX96!=e.sqrtPriceStartX96&&(c.tick=Ze.getTickAtSqrtRatio(c.sqrtPriceX96));r+=this.gasPerTick}return c.amountSpecifiedRemaining>0n?{amount:0n,gas:0n}:{amount:-c.amountCalculated,gas:r+this.gasConstant}}}class lt extends st{constructor(e,t,a,n,s,i,d,c,r,o,f,l){super(e,t,a,0n,s,i,d,c,r,o,f,l),this.PAIR_BYTECODE_HASH=e,this.factory=t,this.tickQuerier=a,this.tickSpacing=n,this.token0=s,this.token1=i,this.maxInitializedTicks=d,this.routeIndex=c,this.depositAddress=r,this.gasConstant=o,this.gasPerInitializedTick=f,this.gasPerTick=l,this.err=new ge(lt.name),this.liquidity=0n,this.tickNextList0=[],this.tickNextList1=[],this.tickNextList0Idx=0,this.tickNextList1Idx=0,this.ticks=new nt;const b=this.getSortedPair(this.token0,this.token1);this.token0=b[0],this.token1=b[1],this.poolContract=this.generatePairAddress(this.factory,this.token0,this.token1,this.tickSpacing),this.getSwapStateZeroForOneParam=this.abiCoder.encode(["address","uint256","bool"],[this.poolContract,this.maxInitializedTicks,!0]),this.getSwapStateOneForZeroParam=this.abiCoder.encode(["address","uint256","bool"],[this.poolContract,this.maxInitializedTicks,!1])}static createVelodrome(e,t,a){const{factory:n,tickSpacing:s,pairBytecodeHash:i,maxInitializedTicks:d,tickQuerier:c,depositAddress:r,gas:o,gasPerInitializedTick:f,gasPerTick:l}=e;return new lt(i,n,c,s,t[0],t[1],d,a,r,o,f,l)}generatePairAddress(t,a,n,s){return e.utils.hexDataSlice(e.utils.keccak256(e.utils.concat(["0xff",t,e.utils.keccak256(this.abiCoder.encode(["address","address","int24"],[a,n,Number(s)])),this.PAIR_BYTECODE_HASH])),12)}getfetchingCurrentStateCalls(){const e=super.getfetchingCurrentStateCalls();return e.push({callData:"0xddca3f43",target:this.poolContract}),e}applyCurrentStateFromCalls(e){if(0!==e.length&&!1!==e[0].success&&"0x"!==e[0].returnData){if(e[0].success){const[t,a,,,,n]=this.abiCoder.decode(["uint160","int24","uint16","uint16","uint16","bool"],e[0].returnData);this.slot0={sqrtPriceX96:t.toBigInt(),tick:BigInt(a),feeProtocol:BigInt(0),unlocked:n}}if(e[1].success){const[t]=this.abiCoder.decode(["uint128"],e[1].returnData);this.liquidity=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[2].returnData);this.tickNextList0=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0]+1,e[1].toBigInt()])))}if(e[3].success){const[t]=this.abiCoder.decode(["(int24, int128)[]"],e[3].returnData);this.tickNextList1=t.map((e=>({tick:BigInt(e[0]),initialized:!e[1].eq(0)}))),this.ticks.setTicksAndLiquidity(t.map((e=>[e[0],e[1].toBigInt()])))}if(e[4].success){const[t]=this.abiCoder.decode(["uint24"],e[4].returnData);this.fee=BigInt(t)}}}getAmountOut(e,t,a){this.err.require(0n!==a,"AS");const n=e===this.token0,s=n?4295128740n:Ye-1n,i={...this.slot0};this.err.require(n?s<i.sqrtPriceX96&&s>Qe:s>i.sqrtPriceX96&&s<Ye,"SPL");const d={liquidityStart:this.liquidity,feeProtocol:n?i.feeProtocol%16n:i.feeProtocol>>4n},c={amountSpecifiedRemaining:a,amountCalculated:0n,sqrtPriceX96:i.sqrtPriceX96,tick:i.tick,feeGrowthGlobalX128:0n,protocolFee:0n,liquidity:d.liquidityStart};this.tickNextList0Idx=0,this.tickNextList1Idx=0;let r=0n;for(;0n!==c.amountSpecifiedRemaining&&c.sqrtPriceX96!==s&&(n?this.tickNextList0Idx<this.tickNextList0.length:this.tickNextList1Idx<this.tickNextList1.length);){let e={amountIn:0n,amountOut:0n,feeAmount:0n,initialized:!1,sqrtPriceNextX96:0n,sqrtPriceStartX96:0n,tickNext:0n};e.sqrtPriceStartX96=c.sqrtPriceX96;const{tick:t,exist:a}=this.getNextInitializedTick(c.tick,n);if(!a)break;e.tickNext=t.tick,e.initialized=t.initialized,e.tickNext<Ke?e.tickNext=Ke:e.tickNext>ze&&(e.tickNext=ze),e.sqrtPriceNextX96=Ze.getSqrtRatioAtTick(e.tickNext);const i=at.computeSwapStep(c.sqrtPriceX96,(n?e.sqrtPriceNextX96<s:e.sqrtPriceNextX96>s)?s:e.sqrtPriceNextX96,c.liquidity,c.amountSpecifiedRemaining,this.fee);if(e.amountIn=i.amountIn,e.amountOut=i.amountOut,c.sqrtPriceX96=i.sqrtRatioNextX96,e.feeAmount=i.feeAmount,c.amountSpecifiedRemaining-=e.amountIn+e.feeAmount,c.amountCalculated=c.amountCalculated-e.amountOut,d.feeProtocol>0){const t=e.feeAmount/d.feeProtocol;e.feeAmount-=t,c.protocolFee+=t}if(c.sqrtPriceX96==e.sqrtPriceNextX96){if(e.initialized){let t=this.ticks.cross(Number(e.tickNext),0n,0n,0n,0n,0n);r+=this.gasPerInitializedTick,n&&(t=-t),c.liquidity=je.addDelta(c.liquidity,t)}c.tick=n?e.tickNext-1n:e.tickNext}else c.sqrtPriceX96!=e.sqrtPriceStartX96&&(c.tick=Ze.getTickAtSqrtRatio(c.sqrtPriceX96));r+=this.gasPerTick}return c.amountSpecifiedRemaining>0n?{amount:0n,gas:0n}:{amount:-c.amountCalculated,gas:r+this.gasConstant}}}class bt extends rt{constructor(e,t,a,n,s,i,d){super(e,t,a,n,s,i,d),this.PAIR_BYTECODE_HASH=e,this.err=new ge(bt.name),this.isFactoryPaused=!0}static create(e,t,a){const{factoryContract:n,isStable:s,pairBytecodeHash:i,gas:d}=e;return new bt(i,t[0],t[1],n,s,a,d)}getfetchingCurrentStateCalls(){return[{callData:"0x392f37e9",target:this.pairContract},{callData:e.utils.hexConcat(["0xcc56b2c5",this.abiCoder.encode(["address","bool"],[this.pairContract,this.stable])]),target:this.factoryContract},{callData:"0xb187bd26",target:this.factoryContract}]}applyCurrentStateFromCalls(e){if(0!==e.length&&!1!==e[0].success&&!1!==e[1].success&&"0x"!==e[0].returnData){if(e[0].success){const[t,a,n,s,,,]=this.abiCoder.decode(["uint256","uint256","uint256","uint256","bool","address","address"],e[0].returnData);this.decimals0=t.toBigInt(),this.decimals1=a.toBigInt(),this.reserve0=n.toBigInt(),this.reserve1=s.toBigInt()}if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.fee=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["bool"],e[2].returnData);this.isFactoryPaused=t}}}getAmountOut(e,t,a){if(0n===this.decimals0||0n===this.decimals1||this.isFactoryPaused)return{amount:0n,gas:0n};a-=a*this.fee/10000n;const n=this._getAmountOut(a,e,this.reserve0,this.reserve1);let s,i;e.toLowerCase()===this.token0.toLowerCase()?this.err.require(n<this.reserve1,"InsufficientLiquidity1"):this.err.require(n<this.reserve0,"InsufficientLiquidity0"),e.toLowerCase()===this.token0.toLowerCase()?(s=this.reserve0+a,i=this.reserve1-n):(i=this.reserve1+a,s=this.reserve0-n);const d=this._k(s,i),c=this._k(this.reserve0,this.reserve1);return this.err.require(d>=c,"K"),{amount:n,gas:this.gasConstant}}_f(e,t){return e*t/1000000000000000000n*(e*e/1000000000000000000n+t*t/1000000000000000000n)/1000000000000000000n}_get_y(e,t,a){for(let n=0;n<255;n++){const n=this._f(e,a),s=this._d(e,a);if(this.err.require(0n!==s,"D must not be zero"),n<t){let i=1000000000000000000n*(t-n)/s;if(0n===i){if(n==t)return a;if(this._k(e,a+1n)>t)return a+1n;i=1n}a+=i}else{let i=1000000000000000000n*(n-t)/s;if(0n===i){if(n==t||this._f(e,a-1n)<t)return a;i=1n}a-=i}}throw this.err.createRequireViolated("!y")}}var ht;class ut{static sort(e){const t=[...e];let a=t[0];return t[0]<t[1]&&(t[0]=t[1],t[1]=a),t[0]<t[2]&&(a=t[0],t[0]=t[2],t[2]=a),t[1]<t[2]&&(a=t[1],t[1]=t[2],t[2]=a),t}static _geometric_mean(e){const t=e[0]*e[1]/10n**18n*e[2]/10n**18n;return 0n===t?0n:this._cbrt(t)}static max(e,t){return e>t?e:t}static abs(e){return e<0n?0n-e:e}static _snekmate_log_2(e,t){let a=e,n=0n;return e>>128n!==0n&&(a=e>>128n,n=128n),a>>64n!==0n&&(a>>=64n,n+=64n),a>>32n!==0n&&(a>>=32n,n+=32n),a>>16n!==0n&&(a>>=16n,n+=16n),a>>8n!==0n&&(a>>=8n,n+=8n),a>>4n!==0n&&(a>>=4n,n+=4n),a>>2n!==0n&&(a>>=2n,n+=2n),a>>1n!==0n&&(n+=1n),t&&1n<<n<e&&(n+=1n),n}static pow_mod256(e,t){return e**t%2n**256n}static _cbrt(e){let t=0n;t=e>=115792089237316195423570985008687907853269n*10n**18n?e:e>=115792089237316195423570985008687907853269n?e*10n**18n:e*10n**36n;const a=this._snekmate_log_2(t,!1),n=a%3n;let s=this.pow_mod256(2n,a/3n)*this.pow_mod256(1260n,n)/this.pow_mod256(1000n,n);return s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,s=(2n*s+t/(s*s))/3n,e>=115792089237316195423570985008687907853269n*10n**18n?s*=10n**12n:e>=11579208923731619e25&&(s*=10n**6n),s}static newton_D(e,t,a,n=0n){const s=this.sort(a);this.err.require(s[0]<this.MAX_UINT256/10n**18n*this.N_COINS**this.N_COINS,"dev: out of limits"),this.err.require(s[0]>0,"dev: empty pool");let i=s[0]+s[1]+s[2],d=0n;d=0n===n?this.N_COINS*this._geometric_mean(s):i>10n**36n?this._cbrt(s[0]*s[1]/10n**36n*s[2]/n*27n*10n**12n):i>10**24?this._cbrt(s[0]*s[1]/10n**24n*s[2]/n*27n*10n**6n):this._cbrt(s[0]*s[1]/10n**18n*s[2]/n*27n);let c=0n,r=0n;for(let a=0;a<255;a++){const a=d,n=10n**18n*s[0]*this.N_COINS/d*s[1]*this.N_COINS/d*s[2]*this.N_COINS/d;let o=t+10n**18n;o=o>n?o-n+1n:n-o+1n;const f=10n**18n*d/t*o/t*o*this.A_MULTIPLIER/e,l=2n*10n**18n*this.N_COINS*n/o,b=i+i*l/10n**18n+f*this.N_COINS/n-l*d/10n**18n;let h=d*(b+i)/b,u=d*d/b;if(10n**18n>n?u+=d*(f/b)/10n**18n*(10n**18n-n)/n:u-=d*(f/b)/10n**18n*(n-10n**18n)/n,d=h>u?h-u:(u-h)/2n,c=d>a?d-a:a-d,c*10n**14n<this.max(10n**16n,d)){for(let e=0,t=s.length;e<t;e++){r=s[e]*10n**18n/d,this.err.require(r>=10**16-1&&r<10**20+1,"Unsafe values x[i]")}return d}}throw this.err.createRequireViolated("Did not converge")}static sqrt(e){let t=e/2n+1n,a=e;for(;t<a;)a=t,t=(e/t+t)/2n;return a}static _newton_y(e,t,a,n,s){let i=0n;for(let e=0;e<3;e++)e!==s&&(i=a[e]*10n**18n/n,this.err.require(i>10n**16n-1n&&i<10n**20n+1n,"Unsafe values x[i]"));let d=n/this.N_COINS,c=10n**18n,r=0n,o=[...a];o[s]=0n,o=this.sort(o);const f=this.max(this.max(o[0]/10n**14n,n/10n**14n),100n);for(let e=2;e<Number(this.N_COINS)+1;e++){const t=o[Number(this.N_COINS)-e];d=d*n/(t*this.N_COINS),r+=t}for(let e=0;e<Number(this.N_COINS)-1;e++)c=c*o[e]*this.N_COINS/n;let l=0n,b=0n,h=0n,u=0n,p=0n,x=0n,g=0n,m=0n,C=0n,I=0n,T=0n,A=0n;for(let a=0;a<255;a++)if(b=d,h=c*d*this.N_COINS/n,u=r+d,p=t+10n**18n,p=p>h?p-h+1n:h-p+1n,x=10n**18n*n/t*p/t*p*this.A_MULTIPLIER/e,g=10n**18n+2n*10n**18n*h/p,m=10n**18n*d+u*g+x,C=n*g,m<C)d=b/2n;else if(m-=C,I=m/d,T=x/I,A=(m+10n**18n*n)/I+T*10n**18n/h,T+=10n**18n*u/I,d=A<T?b/2n:A-T,l=d>b?d-b:b-d,l<this.max(f,d/10n**14n))return i=d*10n**18n/n,this.err.require(i>10n**16n-1n&&i<10n**20n+1n,"Unsafe value for y"),d;throw this.err.createRequireViolated("Did not converge")}static get_y(e,t,a,n,s){this.err.require(e>this.MIN_A-1n&&e<this.MAX_A+1n,"dev: unsafe values A"),this.err.require(t>this.MIN_GAMMA-1n&&t<this.MAX_GAMMA+1n,"dev: unsafe values gamma"),this.err.require(n>10n**17n-1n&&n<10n**15n*10n**18n+1n,"dev: unsafe values D");let i=0n;for(let e=0;e<3;e++)e!==s&&(i=a[e]*10n**18n/n,this.err.require(i>10n**16n-1n&&i<10n**20n+1n,"Unsafe values x[i]"));let d=0,c=0;0===s?(d=1,c=2):1===s?(d=0,c=2):2===s&&(d=0,c=1);const r=e,o=t,f=n,l=a[d],b=a[c],h=o*o;let u=10n**36n/27n,p=10n**36n/9n+2n*10n**18n*o/27n-f*f/l*h*r/729n/this.A_MULTIPLIER/b,x=10n**36n/9n+o*(o+4n*10n**18n)/27n+h*(l+b-f)/f*r/27n/this.A_MULTIPLIER,g=(10n**18n+o)**2n/27n;const m=this.abs(3n*u*x/p-p);let C=0n;C=m>10n**48n?10n**30n:m>10n**44n?10n**26n:m>10n**40n?10n**22n:m>10n**36n?10n**18n:m>10n**32n?10n**14n:m>10n**28n?10n**10n:m>10n**24n?10n**6n:m>10n**20n?100n:1n;let I=0n;this.abs(u)>this.abs(p)?(I=this.abs(u/p),u=u*I/C,p=p*I/C,x=x*I/C,g=g*I/C):(I=this.abs(p/u),u=u/I/C,p=p/I/C,x=x/I/C,g=g/I/C);const T=3n*u*x,A=T/p-p,y=3n*T/p-2n*p-27n*u**2n/p*g/p,E=y**2n+4n*A**2n/p*A;let k=0n;if(!(E>0n))return[this._newton_y(e,t,a,n,s),0n];k=this.sqrt(E);let N=0n;N=p>=0n?this._cbrt(p):0n-this._cbrt(0n-p);let O=0n;O=y>0n?this._cbrt((y+k)/2n):0n-this._cbrt((0n-(y-k))/2n);const S=N*N/10n**18n*O/10n**18n,P=(p+p*A/S-S)/3n,D=[f*f/27n/b*f/l*P/u,10n**18n*P/u];return i=D[0]*10n**18n/n,this.err.require(i>=10n**16n-1n&&i<10n**20n+1n,"Unsafe value for y"),D}static reduction_coefficient(e,t){const a=e[0]+e[1]+e[2];let n=10n**18n*this.N_COINS*e[0]/a;return n=n*this.N_COINS*e[1]/a,n=n*this.N_COINS*e[2]/a,t>0n&&(n=t*10n**18n/(t+10n**18n-n)),n}}ht=ut,ut.N_COINS=3n,ut.A_MULTIPLIER=10000n,ut.MIN_GAMMA=10n**10n,ut.MAX_GAMMA=5n*10n**16n,ut.MIN_A=ht.N_COINS**ht.N_COINS*ht.A_MULTIPLIER/100n,ut.MAX_A=ht.N_COINS**ht.N_COINS*ht.A_MULTIPLIER*1000n,ut.MAX_UINT256=115792089237316195423570985008687907853269984665640564039457584007913129639935n,ut.err=new ge(ht.name);class pt{constructor(e,t,a,n,s,i,d,c,r,o,f,l,b,h){this.poolContract=e,this.multicallContract=t,this.TOKENS=a,this.PRECISION=n,this.PRECISIONS=s,this.NOISE_FEE=i,this.MIN_A=d,this.MAX_A=c,this.MIN_GAMMA=r,this.MAX_GAMMA=o,this.A_MULTIPLIER=f,this.routeIndex=l,this.depositAddress=b,this.gasConstant=h,this.err=new ge(pt.name),this.abiCoder=he,this.tokenIndex={},this.A=0n,this.gamma=0n,this.D=0n,this.feeGamma=0n,this.midFee=0n,this.outFee=0n,this.blockTimestamp=0n,this.futureAGammaTime=0n,this.tokenIndex=a.reduce(((e,t,a)=>(e[t]=a,e)),{}),this.balances=Array.from({length:this.TOKENS.length},(()=>0n)),this.priceScales=Array.from({length:this.TOKENS.length-1},(()=>0n))}static create(e,t){return new pt(e.poolContract,e.multicallContract,e.tokens,e.precision,e.precisions,e.noiseFee,e.minA,e.maxA,e.minGamma,e.maxGamma,e.aMultiplier,t,e.address,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.TOKENS.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.TOKENS[t],this.TOKENS[n]]),e.push([this.TOKENS[n],this.TOKENS[t]]);return e}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){const t=[{callData:"0xf446c1d0",target:this.poolContract},{callData:"0x0f529ba2",target:this.poolContract},{callData:"0xb1373929",target:this.poolContract},{callData:"0x72d4f0e2",target:this.poolContract},{callData:"0x92526c0c",target:this.poolContract},{callData:"0xee8de675",target:this.poolContract},{callData:"0x0f28c97d",target:this.multicallContract},{callData:"0xf9ed9597",target:this.poolContract},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode(["uint256"],[a]);return{callData:e.utils.hexConcat(["0x4903b0d1",n]),target:this.poolContract}}))];return t.push(...this.TOKENS.slice(0,this.TOKENS.length-1).map(((t,a)=>{const n=this.abiCoder.encode(["uint256"],[a]);return{callData:e.utils.hexConcat(["0xa3f7cdd5",n]),target:this.poolContract}}))),t}applyCurrentStateFromCalls(e){if(0===e.length)return;if(e[0].success){const[t]=this.abiCoder.decode(["uint256"],e[0].returnData);this.A=t.toBigInt()}if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.D=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.gamma=t.toBigInt()}if(e[3].success){const[t]=this.abiCoder.decode(["uint256"],e[3].returnData);this.feeGamma=t.toBigInt()}if(e[4].success){const[t]=this.abiCoder.decode(["uint256"],e[4].returnData);this.midFee=t.toBigInt()}if(e[5].success){const[t]=this.abiCoder.decode(["uint256"],e[5].returnData);this.outFee=t.toBigInt()}if(e[6].success){const[t]=this.abiCoder.decode(["uint256"],e[6].returnData);this.blockTimestamp=t.toBigInt()}if(e[7].success){const[t]=this.abiCoder.decode(["uint256"],e[7].returnData);this.futureAGammaTime=t.toBigInt()}let t=0;for(let a=8,n=a+this.TOKENS.length;a<n;++a)if(e[a].success){const[n]=this.abiCoder.decode(["uint256"],e[a].returnData);this.balances[t]=n.toBigInt(),t+=1}t=0;for(let a=this.TOKENS.length+8,n=a+this.TOKENS.length-1;a<n;++a)if(e[a].success){const[n]=this.abiCoder.decode(["uint256"],e[a].returnData);this.priceScales[t]=n.toBigInt(),t+=1}}_fee(e){const t=[this.midFee,this.outFee,this.feeGamma],a=ut.reduction_coefficient(e,t[2]);return(t[0]*a+t[1]*(10n**18n-a))/10n**18n}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t],i=this.TOKENS.length;this.err.require(void 0!==n&&void 0!==s,"untradable pair");const d=[this.A,this.gamma];let c=[...this.balances];c[n]+=a;let r=c[n]-a;c[0]*=this.PRECISIONS[0];for(let e=1;e<i;e++)c[e]=c[e]*this.priceScales[e-1]*this.PRECISIONS[e]/this.PRECISION;const o=this.PRECISIONS[n];if(this.futureAGammaTime>this.blockTimestamp){r*=o,n>0&&(r=r*this.priceScales[n-1]/this.PRECISION);const e=c[n];c[n]=r,this.D=ut.newton_D(d[0],d[1],c,0n),c[n]=e}const f=this.D,l=ut.get_y(d[0],d[1],c,f,s);let b=c[s]-l[0]-1n;c[s]=l[0],s>0&&(b=b*this.PRECISION/this.priceScales[s-1]),b/=this.PRECISIONS[s];return b-=this._fee(c)*b/10n**10n,{amount:b,gas:this.gasConstant}}}class xt{constructor(e,t,a,n,s,i,d,c){this.poolContract=e,this.TOKENS=t,this.PRECISION=a,this.FEE_DENOMINATOR=n,this.A_PRECISION=s,this.routeIndex=i,this.depositAddress=d,this.gasConstant=c,this.err=new ge(xt.name),this.abiCoder=he,this.TwoPower256=2n**256n,this.tokenIndex={},this.APrecise=0n,this.fee=0n,this.offpegFeeMultiplier=0n,this.tokenIndex=t.reduce(((e,t,a)=>(e[t]=a,e)),{}),this.balances=Array.from({length:this.TOKENS.length},(()=>0n)),this.storedRates=Array.from({length:this.TOKENS.length},(()=>0n))}static create(e,t){return new xt(e.poolContract,e.tokens,e.precision,e.feeDenominator,e.aPrecision,t,e.address,e.gas)}static isPairSupported(e,t){return t.includes(e[0])&&t.includes(e[1])}getTradablePairs(){const e=[];for(let t=0,a=this.TOKENS.length;t<a;++t)for(let n=t+1;n<a;++n)e.push([this.TOKENS[t],this.TOKENS[n]]),e.push([this.TOKENS[n],this.TOKENS[t]]);return e}getTradingRouteIndex(){return this.routeIndex}getPoolAddress(){return this.poolContract}getDepositAddress(){return this.depositAddress}getfetchingCurrentStateCalls(){return[{callData:"0xfd0684b1",target:this.poolContract},{callData:"0x76a2f0f0",target:this.poolContract},{callData:"0xddca3f43",target:this.poolContract},{callData:"0x8edfdd5f",target:this.poolContract},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode(["uint256"],[a]);return{callData:e.utils.hexConcat(["0x4903b0d1",n]),target:this.poolContract}}))]}applyCurrentStateFromCalls(e){if(0===e.length)return;if(e[0].success){const[t]=this.abiCoder.decode(["uint256[]"],e[0].returnData);this.storedRates=t.map((e=>e.toBigInt()))}if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.APrecise=t.toBigInt()}if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.fee=t.toBigInt()}if(e[3].success){const[t]=this.abiCoder.decode(["uint256"],e[3].returnData);this.offpegFeeMultiplier=t.toBigInt()}for(let t=4,a=t+this.TOKENS.length;t<a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances[t-4]=a.toBigInt()}}_xp_mem(e,t){const a=[];for(let n=0,s=this.TOKENS.length;n<s;n++)a.push(e[n]*t[n]/this.PRECISION);return a}get_D(e,t){const a=BigInt(this.TOKENS.length);let n=0n;for(let t=0,a=e.length;t<a;t++)n+=e[t];if(0n===n)return 0n;let s=n;const i=t*a;for(let t=0;t<255;t++){let t=s;for(let a=0,n=e.length;a<n;a++)t=t*s/e[a];t/=a**a%this.TwoPower256;let d=s;if(s=(i*n/this.A_PRECISION+t*a)*s/((i-this.A_PRECISION)*s/this.A_PRECISION+(a+1n)*t),s>d){if(s-d<=1n)return s}else if(d-s<=1n)return s}throw this.err.createRequireViolated("did not converge")}get_y(e,t,a,n,s,i){const d=this.TOKENS.length;this.err.require(e!==t,"dev: same coin"),this.err.require(t>=0n,"dev: j below zero"),this.err.require(t<d,"dev: j above N_COINS"),this.err.require(e>=0,"i is negative"),this.err.require(e<d,"i exceeds allowed token index");const c=i;let r=0n,o=0n,f=0n,l=c;const b=s*BigInt(d);for(let s=0;s<d&&s!==d;s++){if(s===e)o=a;else{if(s===t)continue;o=n[s]}r+=o,l=l*c/(o*BigInt(d))}l=l*c*this.A_PRECISION/(b*BigInt(d));const h=r+c*this.A_PRECISION/b;let u=c;for(let e=0;e<255;e++)if(f=u,u=(u*u+l)/(2n*u+h-c),u>f){if(u-f<=1n)return u}else if(f-u<=1n)return u;throw this.err.createRequireViolated("does not converge")}_dynamic_fee(e,t,a){const n=this.offpegFeeMultiplier;if(n<=this.FEE_DENOMINATOR)return a;const s=(e+t)**2n;return n*a/(4n*(n-this.FEE_DENOMINATOR)*e*t/s+this.FEE_DENOMINATOR)}__exchange(e,t,a,n,s){const i=this.APrecise,d=this.get_D(t,i),c=this.get_y(n,s,e,t,i,d);let r=t[s]-c-1n;return r=(r-r*this._dynamic_fee((t[n]+e)/2n,(t[s]+c)/2n,this.fee)/this.FEE_DENOMINATOR)*this.PRECISION/a[s],r}getAmountOut(e,t,a){const n=this.tokenIndex[e],s=this.tokenIndex[t];this.err.require(n!==s,"dev: coin index out of range"),this.err.require(a>0n,"dev: do not exchange 0 coins");const i=[...this.storedRates],d=[...this.balances],c=this._xp_mem(i,d),r=c[n]+a*i[n]/this.PRECISION;return{amount:this.__exchange(r,c,i,n,s),gas:this.gasConstant}}}class gt extends me{constructor(e,t,a,n,s,i,d,c,r,o,f,l,b,h,u=1n,p="uint256"){super(e,t,a,n,s,i,d,c,r,o,f,h,u,p),this.lpToken=t,this.TOKENS=a,this.oracleAddress=l,this.stETHCoinIdx=b}static createLido(e,t){return new gt(e.poolContract,e.lpToken,e.tokens,e.rates,e.lendingPrecision,e.precision,e.precisionMul,e.feeDenominator,e.isUnderlying,t,e.address,e.oracleAddress,e.stethCoinIdx,e.gas,e.aPrecision,e.balancesArgs)}getfetchingCurrentStateCalls(){return[{callData:1n===this.A_PRECISION?"0xf446c1d0":"0x76a2f0f0",target:this.poolContract},{callData:"0xddca3f43",target:this.poolContract},{callData:"0x18160ddd",target:this.lpToken},{callData:"0x50d25bcd",target:this.oracleAddress},...this.TOKENS.map(((t,a)=>{const n=this.abiCoder.encode([this.balancesArgs],[a]);let s="0x4903b0d1";return"int128"===this.balancesArgs&&(s="0x065a80d8"),{callData:e.utils.hexConcat([s,n]),target:this.poolContract}}))]}applyCurrentStateFromCalls(e){if(0!==e.length){if(e[0].success){const[t]=(this.A_PRECISION,this.abiCoder.decode(["uint256"],e[0].returnData));this.A=t.toBigInt()}else i.warn("unable to find A for Curve LIDO pool",this.poolContract),this.A=0n;if(e[1].success){const[t]=this.abiCoder.decode(["uint256"],e[1].returnData);this.fee=t.toBigInt()}else i.warn("unable to find fee for Curve LIDO pool",this.poolContract),this.fee=0n;if(e[2].success){const[t]=this.abiCoder.decode(["uint256"],e[2].returnData);this.lpTokenTotalSupply=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve LIDO pool",this.poolContract),this.lpTokenTotalSupply=0n;if(e[3].success){const[t]=this.abiCoder.decode(["uint256"],e[3].returnData);this.RATES[this.stETHCoinIdx]=t.toBigInt()}else i.warn("unable to find lp token total supply for Curve LIDO pool",this.poolContract);for(let t=4,a=this.TOKENS.length;t<4+a;++t)if(e[t].success){const[a]=this.abiCoder.decode(["uint256"],e[t].returnData);this.balances.push(a.toBigInt())}else i.warn("unable to find balance at index",t-4,"for Curve LIDO pool",this.poolContract),this.balances.push(0n)}}}class mt{constructor(e,t,a,n){this.DEX_ROUTES=e,this.CORRESPONDENT_TOKENS=t,this.multicall=a,this.opt=n,this.corrTokenDecimals={},this.models=[],this.indexedModels={},this.amountOutCache={},this.corrTokens=this.CORRESPONDENT_TOKENS.map((e=>e.address));for(let e=0,t=this.CORRESPONDENT_TOKENS.length;e<t;++e)this.corrTokenDecimals[this.CORRESPONDENT_TOKENS[e].address]=this.CORRESPONDENT_TOKENS[e].decimals;this.DEX_ROUTES_ID_IDX=this.DEX_ROUTES.reduce(((e,t,a)=>(e[t.id]=a,e)),{}),this.DEX_ROUTES_ADDRESS_IDX=this.DEX_ROUTES.reduce(((e,t,a)=>(e[t.address]=a,e)),{})}updateIndexedModel(e,t,a){void 0===this.indexedModels[e[0]]&&(this.indexedModels[e[0]]={}),void 0===this.indexedModels[e[0]][e[1]]&&(this.indexedModels[e[0]][e[1]]={tradableList:[],mapping:{}}),this.indexedModels[e[0]][e[1]].mapping[t]=a,this.isModelTradingAllowed(t)&&this.indexedModels[e[0]][e[1]].tradableList.push(a)}isModelIndexed(e,t,a){return void 0!==this.indexedModels[e]&&void 0!==this.indexedModels[e][t]&&void 0!==this.indexedModels[e][t].mapping[a]}isModelTradingAllowed(e){return this.DEX_ROUTES[e].isTradingAllowed}getModel(e,t,a){if(void 0!==this.indexedModels[e]&&void 0!==this.indexedModels[e][t]&&void 0!==this.indexedModels[e][t].mapping[a])return this.models[this.indexedModels[e][t].mapping[a]]}getTradableModels(e,t){return void 0===this.indexedModels[e]||void 0===this.indexedModels[e][t]?[]:this.indexedModels[e][t].tradableList}getDepositAddress(e,t,a){const n=this.DEX_ROUTES_ADDRESS_IDX[a];let s=this.getModel(e,t,n);return void 0===s&&(this.registerSingle([e,t],n),s=this.getModel(e,t,n),void 0===s)?"":s.getDepositAddress()}generateAllTokenPairs(e,t){const a=[];a.push([e,t]);for(let n=0,s=this.corrTokens.length;n<s;++n){const i=this.corrTokens[n];e!==i&&i!==t&&(a.push([e,i]),a.push([i,t]));for(let n=0;n<s;++n){const s=this.corrTokens[n];i!==s&&i!==e&&s!==t&&a.push([i,s])}}return a}unregisterAll(){this.models=[],this.indexedModels={},this.amountOutCache={}}registerSingle(e,t){const a=this.DEX_ROUTES[t];if(this.isModelIndexed(e[0],e[1],t))return;let n=null;switch(a.model){case ee.UniswapV2:n=ue.create(a,e,t);break;case ee.UniswapV3:n=st.create(a,e,t);break;case ee.PancakeV3:n=ft.createPancake(a,e,t);break;case ee.VelodromeSS:n=lt.createVelodrome(a,e,t);break;case ee.Mdex:n=Ee.create(a,e,t);break;case ee.Mars:n=Ue.create(a,e,t);break;case ee.Biswap:n=pe.create(a,e,t);break;case ee.Shibaswap:n=qe.create(a,e,t);break;case ee.CurvePlain:me.isPairSupported(e,a.tokens)&&(n=me.create(a,t));break;case ee.CurveStableNG:xt.isPairSupported(e,a.tokens)&&(n=xt.create(a,t));break;case ee.CurvePlainSol:Ae.isPairSupported(e,a.tokens)&&(n=Ae.create(a,t));break;case ee.Iron:Re.isPairSupported(e,a.tokens)&&(n=Re.create(a,t));break;case ee.Synapse:Fe.isPairSupported(e,a.tokens)&&(n=Fe.create(a,t));break;case ee.CurveLido:gt.isPairSupported(e,a.tokens)&&(n=gt.createLido(a,t));break;case ee.CurveMeta:{const s=this.DEX_ROUTES_ID_IDX[a.basePoolRouteId],i=this.DEX_ROUTES[s];if(i.model!==ee.CurvePlain&&i.model!==ee.CurveLendingA)throw new Error(`expected curve plain/lending pool for the meta pool, but receive model ID: ${i.model}`);if(Te.isPairSupportedMeta(e,a.tokens,i.tokens,i.lpToken)){this.registerSingle([i.tokens[0],i.tokens[1]],s);let e=this.getModel(i.tokens[0],i.tokens[1],s);n=Te.createMeta(a,t,e)}break}case ee.CurveMetaSol:{const s=this.DEX_ROUTES_ID_IDX[a.basePoolRouteId],i=this.DEX_ROUTES[s];if(i.model!==ee.CurvePlainSol&&i.model!==ee.Synapse&&i.model!==ee.Iron)throw new Error(`expected curve plain sol pool for the meta sol pool, but receive model ID: ${i.model}`);if(dt.isPairSupportedMeta(e,a.tokens,i.tokens,i.lpToken)){this.registerSingle([i.tokens[0],i.tokens[1]],s);let e=this.getModel(i.tokens[0],i.tokens[1],s);n=dt.createMeta(a,t,e)}break}case ee.CurveCrypto:Se.isPairSupported(e,a.tokens)&&(n=Se.create(a,t));break;case ee.CurveTriCryptoNG:pt.isPairSupported(e,a.tokens)&&(n=pt.create(a,t));break;case ee.DodoV2:ye.isPairSupported(e,a.pools)&&(n=ye.create(a,e,t));break;case ee.DodoV1:Ne.isPairSupported(e,a.pools)&&(n=Ne.create(a,e,t));break;case ee.Smoothy:ke.isPairSupported(e,a.expectedTokens)&&(n=ke.create(a,t));break;case ee.BalancerWeighted:Oe.isPairSupported(e,a.tokens)&&(n=Oe.create(a,t));break;case ee.BalancerStable:Be.isPairSupported(e,a.tokens)&&(n=Be.create(a,t));break;case ee.DMM:we.isPairSupported(e,a.pools)&&(n=we.create(a,e,t));break;case ee.PolyDex:n=_e.createPolyDex(a,e,t);break;case ee.FireBirdWeighted:n=ve.createPolyDex(a,e,t);break;case ee.CurveLendingA:Pe.isPairSupported(e,a.tokens)&&(n=Pe.createLendingA(a,t));break;case ee.CurveLendingCryptoZap:case ee.CurveLendingCryptoTwoZap:{const s=this.DEX_ROUTES_ID_IDX[a.basePoolId],i=this.DEX_ROUTES[s],d=this.DEX_ROUTES_ID_IDX[a.poolId],c=this.DEX_ROUTES[d];if(i.model!==ee.CurveLendingA)throw new Error(`expected curve lending pool for the zap's base pool, but receive model ID: ${i.model}`);if(c.model!==ee.CurveCrypto)throw new Error(`expected curve crypto pool for the zap's pool, but receive model ID: ${i.model}`);if(a.model===ee.CurveLendingCryptoZap&&De.isPairSupported(e,a.tokens)){this.registerSingle([i.tokens[0],i.tokens[1]],s),this.registerSingle([c.tokens[0],c.tokens[1]],d);const e=this.getModel(i.tokens[0],i.tokens[1],s),r=this.getModel(c.tokens[0],c.tokens[1],d);n=De.create(a,e,r,t)}else if(a.model===ee.CurveLendingCryptoTwoZap&&Me.isPairSupported(e,a.tokens)){this.registerSingle([i.tokens[0],i.tokens[1]],s),this.registerSingle([c.tokens[0],c.tokens[1]],d);const e=this.getModel(i.tokens[0],i.tokens[1],s),r=this.getModel(c.tokens[0],c.tokens[1],d);n=Me.create(a,e,r,t)}}break;case ee.BalancerMetaStable:Le.isPairSupported(e,a.tokens)&&Le.createMeta(a,t);break;case ee.BalancerLinear:Ve.isPairSupported(e,a.tokens)&&Ve.create(a,t);break;case ee.BalancerLiquidityBootstrapping:it.isPairSupported(e,a.tokens)&&it.create(a,t);break;case ee.BalancerBoostedStable:if(We.isPairSupported(e,a.tokens)){const e=a.linearPoolIds.map((e=>{const t=this.DEX_ROUTES_ID_IDX[e],a=this.DEX_ROUTES[t];if(a.model!==ee.BalancerLinear)throw new Error(`expected Balancer Linear pool for Balancer boosted pool, but receive model ID: ${a.model}`);return this.registerSingle([a.tokens[0],a.tokens[1]],t),this.getModel(a.tokens[0],a.tokens[1],t)}));We.createBoosted(a,e,t)}break;case ee.GmxDex:n=ct.create(a,e,t);break;case ee.Solidly:n=rt.create(a,e,t);break;case ee.VelodromeV2:n=bt.create(a,e,t);break;case ee.Synthetix:ot.isPairSupported(e,a.tokens)&&(n=ot.create(a,t));break;default:throw new Error(`Unknown DEX model: ${a.model}`)}if(null!==n){this.models.push(n);const e=n.getTradablePairs();for(let a=0,n=e.length;a<n;++a)this.updateIndexedModel(e[a],t,this.models.length-1)}}register(e,t){const a=this.generateAllTokenPairs(e,t);i.debug("[Model Manager]","Registering models");for(let e=0,t=a.length;e<t;++e)for(let t=0,n=this.DEX_ROUTES.length;t<n;++t)this.registerSingle(a[e],t);i.debug("[Model Manager]","Total model registered:",this.models.length)}getRouteInfo(e){const{id:t,name:a,address:n}=this.DEX_ROUTES[e];return{id:t,name:a,address:n}}async fetchAllReserves(){let t=[],a=[];i.log("[Model Manager]","Fetching...");for(let e=0,n=this.models.length;e<n;++e){const n=this.models[e].getfetchingCurrentStateCalls();a.push(t.length+n.length),t.push(...n)}t.push({callData:"0x42cbb15c",target:this.multicall.address});let n=await be(t,this.opt.multicall,this.multicall),s=0;for(let e=0,t=a.length;e<t;++e){try{this.models[e].applyCurrentStateFromCalls(n.slice(s,a[e]))}catch(e){throw i.error("unable to decode received data"),e}s=a[e]}const[d]=e.utils.defaultAbiCoder.decode(["uint256"],n[n.length-1].returnData);return d.toNumber()}tryGetAmountOut(e,t,a,n){let s={amount:0n,gas:0n};try{s=e.getAmountOut(t,a,n)}catch(e){if(e instanceof xe)return{amount:0n,gas:0n};throw e}return s}getMaxAmountOutWithCache(e,t,a,n,s){const i=this.getTradableModels(e,t);let d=[];const c=a.toString(),r=s?1:0,o=[e,t,c,r];if(function(e,t){const a=t.length;for(var n=0;n<a;++n){if("object"!=typeof e)return!1;const a=t[n];if(!(a in e))return!1;e=e[a]}return!0}(this.amountOutCache,o))d=this.amountOutCache[e][t][c][r];else{for(let n=0,c=i.length;n<c;++n){const c=this.models[i[n]],r=c.getTradingRouteIndex(),o=c.getPoolAddress(),f=this.tryGetAmountOut(c,e,t,a);let l=f.amount;void 0!==s&&(l-=f.gas*N(s[t].fee,k,s[t].decimals)),f.amount>0n&&d.push({amountOut:f,amountOutGasDeducted:l,poolAddress:o,routeIndex:r})}d.sort(((e,t)=>e.amountOutGasDeducted<t.amountOutGasDeducted?1:e.amountOutGasDeducted>t.amountOutGasDeducted?-1:0)),function(e,t,a){const n=t.length-1;for(var s=0;s<n&&"object"==typeof e;++s){const a=t[s];a in e||(e[a]={}),e=e[a]}if("object"!=typeof e)throw new Error(`Object at key ${t[s]} is not an object`);e[t[n]]=a}(this.amountOutCache,o,d)}for(let e=0,t=d.length;e<t;++e)if(void 0===n||!n.has(d[e].poolAddress))return{amountOut:d[e].amountOut,poolAddress:d[e].poolAddress,routeIndex:d[e].routeIndex};return{amountOut:{amount:0n,gas:0n},poolAddress:"",routeIndex:-1}}getAmountOutByPath(e,t,a,n,s){if(0===n.length)return{amount:0n,gas:0n};let i={amount:a,gas:0n};for(let a=0,d=n.length;a<d&&0n!==i.amount;++a){const c=0===a?e:s[a-1],r=a===d-1?t:s[a],o=this.getModel(c,r,n[a]),f=this.tryGetAmountOut(o,c,r,i.amount);i.amount=f.amount,i.gas+=f.gas}return i}getPathCombinationRecursively(e,t,a,n,s,i,d,c){const r=n[n.length-1];if(0!==e||r===a)if(r!==a)for(let o=0,f=t.length;o<f;++o)r!==t[o]&&(n.push(t[o]),this.getPathCombinationRecursively(e-1,t,a,n,s,i,d,c),n.pop());else{const e=new Set;for(let t=0;t<d;++t){let t=s;const a=[];for(let s=0,i=n.length-1;s<i;++s){const i=c(n[s],n[s+1],t,e);if(i.routeIndex<0)break;t=i.amountOut.amount,e.add(i.poolAddress),a.push(i)}if(a.length<n.length-1){for(let t=0,n=a.length;t<n;++t)e.delete(a[t].poolAddress);break}const d=a[a.length-1];i.push({amountOut:d.amountOut.amount,gas:a.reduce(((e,t)=>e+t.amountOut.gas),0n),pools:a.map((e=>e.poolAddress)),routeIndexes:a.map((e=>e.routeIndex)),tokens:n.filter(((e,t)=>t>0&&t<n.length-1))})}}}getAllRoutesSingle(e,t,a,n){const s=[...new Set([...this.corrTokens,t])],i=[];return this.getPathCombinationRecursively(3,s,t,[e],a,i,1,((e,t,a,s)=>this.getMaxAmountOutWithCache(e,t,a,s,n))),i}getTokenPriceRoutes(e,t,a){const n={},s=[...new Set([...a,...this.corrTokens])],d=100n*10n**BigInt(t);for(let t=0,a=s.length;t<a;++t)if(s[t]!==e&&(n[s[t]]=this.getAllRoutesSingle(e,s[t],d),0===n[s[t]].length))throw i.error(`Unable to find usd price for token ${s[t]}`),new Error("UNKNOWN_DEST_TOKEN_PRICE");return n}getCandidatePaths(e,t,a,n,s){const i=n/2n,d=[...new Set([...this.corrTokens,a])],c=[],r=[];this.getPathCombinationRecursively(3,d,a,[t],i,r,10,((e,t,a,n)=>this.getMaxAmountOutWithCache(e,t,a,n,s))),r.sort(((e,t)=>e.amountOut<t.amountOut?1:e.amountOut>t.amountOut?-1:0));const o=new Set;for(let e=0,t=r.length;e<t;++e){const t=r[e];let a=!1;for(let e=0,n=t.pools.length;e<n;++e)if(o.has(t.pools[e])){a=!0;break}if(!a){for(let e=0,a=t.pools.length;e<a;++e)o.add(t.pools[e]);c.push(t)}}return c.length>e?c.slice(0,e):c}getAllRoutesSplit(e,t,a,n){const s=this.getCandidatePaths(this.opt.maxCandidatePaths,e,t,a,n);i.debug("CANDIDATE POOLS LENGTH",s.length),i.table((()=>s));const d=Array.from({length:s.length},(()=>Array.from({length:B.length},(()=>null)))),c=Array.from({length:s.length},(()=>Array.from({length:B.length},(()=>null))));for(let n=0,i=s.length;n<i;++n){const i=s[n];for(let s=0,r=B.length;s<r;++s){const r=a*BigInt(B[s])/BigInt(100),o=this.getAmountOutByPath(e,t,r,i.routeIndexes,i.tokens);d[n][s]=o.amount,c[n][s]=o.gas}}return{paths:s,amountOuts:d,gas:c}}}const Ct={arbitrum:{maxCallsPerBatch:10},avalanche:{maxCallsPerBatch:500},bsc:{maxCallsPerBatch:500},ethereum:{maxCallsPerBatch:500},optimism:{maxCallsPerBatch:500},polygon:{maxCallsPerBatch:500}};class It{constructor(e,t,a){this.networkName=e,this.provider=t,this.multicallOptions=a,this.MAX_UINT24=16777215n,this.MAX_UINT32=4294967295n,this.MAX_UINT64=18446744073709551615n,this.MAX_UINT80=1208925819614629174706175n,this.MAX_UINT96=79228162514264337593543950335n,this.MAX_UINT112=5192296858534827628530496329220095n,this.multicall=V.connect(I[this.networkName],this.provider),this.addressTableContract=C[this.networkName],this.multicallOptions={...Ct[this.networkName],...this.multicallOptions}}async fetchAddressIndex(t){const a=Array.from({length:t.length},(()=>({callData:"0xd4b6b5da",target:this.addressTableContract})));for(let n=0,s=a.length;n<s;++n){const s=he.encode(["address"],[t[n]]);a[n].callData=e.utils.hexConcat([a[n].callData,s])}const n=await be(a,this.multicallOptions,this.multicall),s=[];for(let e=0,t=n.length;e<t;++e)if(n[e].success){const[t]=he.decode(["uint256"],n[e].returnData);if(t.isZero()){s.push(null);continue}s.push(t)}else s.push(null);return s}encodeAddress(t,a){if(t===e.constants.AddressZero)return{type:["uint8"],data:[3]};if(null===a)return{type:["uint8","address"],data:[0,t]};if(a.lte(this.MAX_UINT24))return{type:["uint8","uint24"],data:[2,a.toBigInt()]};if(a.lte(this.MAX_UINT32))return{type:["uint8","uint32"],data:[1,a.toBigInt()]};throw new Error(`Unable to encode address: ${t}, index: ${a}`)}encodeAmount(t){const a=e.BigNumber.from(t).toBigInt();if(0n===a)return{type:["uint8"],data:[4]};if(a<=this.MAX_UINT64)return{type:["uint8","uint64"],data:[0,a]};if(a<=this.MAX_UINT80)return{type:["uint8","uint80"],data:[1,a]};if(a<=this.MAX_UINT96)return{type:["uint8","uint96"],data:[2,a]};if(a<=this.MAX_UINT112)return{type:["uint8","uint112"],data:[3,a]};throw new Error(`unable to encode amount: ${a.toString()}`)}encodePathResult(e,t){const a=[],n=[];a.push("uint8"),n.push(e.routes.length);for(let s=0,i=e.routes.length;s<i;++s){const i=e.routes[s].address,d=this.encodeAddress(i,t[i]);a.push(...d.type),n.push(...d.data)}for(let s=0,i=e.tokens.length;s<i;++s){const i=e.tokens[s],d=this.encodeAddress(i,t[i]);a.push(...d.type),n.push(...d.data)}return{type:a,data:n}}addPathResultAddressesToArray(e,t){for(let a=0,n=t.length;a<n;++a)e.push(...t[a].routes.map((e=>e.address)));for(let a=0,n=t.length;a<n;++a)e.push(...t[a].tokens)}createAddressIndexMap(e,t){const a={};for(let n=0,s=e.length;n<s;++n)a[e[n]]=t[n];return a}async encodeSwapDataL2(t,a,n){let s=[],i=[];if(void 0===n){const e=[];Array.isArray(t)?this.addPathResultAddressesToArray(e,t):this.addPathResultAddressesToArray(e,[t]);const a=await this.fetchAddressIndex(e);n=this.createAddressIndexMap(e,a)}if(Array.isArray(t)){i.push("uint8"),s.push(t.length);for(let e=0,t=a.length;e<t-1;++e){const t=this.encodeAmount(a[e]);i.push(...t.type),s.push(...t.data)}for(let e=0,a=t.length;e<a;++e){const a=this.encodePathResult(t[e],n);s.push(...a.data),i.push(...a.type)}}else{const e=this.encodePathResult(t,n);s=e.data,i=e.type}return e.utils.solidityPack(i,s)}encodeSwapData(t){return Array.isArray(t)?e.utils.defaultAbiCoder.encode(["address[][]","address[][]"],[t.map((e=>e.routes.map((e=>e.address)))),t.map((e=>e.tokens))]):e.utils.defaultAbiCoder.encode(["address[]","address[]"],[t.routes.map((e=>e.address)),t.tokens])}async compress(t,a,n,s,i,d,c,r,o,f){const l=[c,t,a,r],b=[n,s,i,d];Array.isArray(o)?this.addPathResultAddressesToArray(l,o):this.addPathResultAddressesToArray(l,[o]);const h=await this.fetchAddressIndex(l),u=this.createAddressIndexMap(l,h),p=await this.encodeSwapDataL2(o,f,u),x=[],g=[];for(let e=0;e<4;++e){const t=this.encodeAddress(l[e],h[e]);x.push(...t.type),g.push(...t.data)}for(let e=0,t=b.length;e<t;++e){const t=this.encodeAmount(b[e]);x.push(...t.type),g.push(...t.data)}return x.push("bytes"),g.push(p),e.utils.solidityPack(x,g)}}const Tt={maxCallsPerFetch:500,maxCandidatePathsCount:50},At={maxCallsPerFetch:500,maxCandidatePathsCount:50},yt={maxCallsPerFetch:50,maxCandidatePathsCount:50},Et={maxCallsPerFetch:500,maxCandidatePathsCount:50},kt={maxCallsPerFetch:500,maxCandidatePathsCount:50},Nt={maxCallsPerFetch:500,maxCandidatePathsCount:50},Ot={enableSplit:!0};class St{constructor(e,t,a={}){switch(this.provider=e,t){case"bsc":this.network=u.bsc,this.options={...Tt,...a};break;case"arbitrum":this.network=u.arbitrum,this.options={...yt,...a};break;case"polygon":this.network=u.polygon,this.options={...At,...a};break;case"ethereum":this.network=u.ethereum,this.options={...Et,...a};break;case"avalanche":this.network=u.avalanche,this.options={...kt,...a};break;case"optimism":this.network=u.optimism,this.options={...Nt,...a};break;default:throw new Error("Unknown chain")}this.multicall2=function(e,t){const a=I[t];return V.connect(a,e)}(e,this.network)}getTradeType(e,t){const a=G(this.network);return e===K&&t===a?z.ETH2WETH:e===a&&t===K?z.WETH2ETH:z.BESTRATE}getDepositAddresses(t,a){return t=t.map((e=>({src:Q(e.src,this.network).toLowerCase(),dest:Q(e.dest,this.network).toLowerCase(),routeAddress:e.routeAddress.toLowerCase()}))),void 0===a&&(a=new mt(fe[this.network],le[this.network],this.multicall2,{maxCandidatePaths:this.options.maxCandidatePathsCount,multicall:{maxCallsPerBatch:this.options.maxCallsPerFetch}}),t.forEach((({src:e,dest:t})=>{a.register(e,t)}))),t.map((({src:t,dest:n,routeAddress:s})=>e.utils.getAddress(a.getDepositAddress(t,n,s))))}async _fetch(t,a,n,s,d,c){const r=Q(A[this.network].address,this.network),o=T[this.network],f=Q(t,this.network),l=Q(a,this.network);i.debug("[Best Rate Quote]","registering wrappedSrc/wrappedDest..."),d.register(f,l),i.debug("[Best Rate Quote]","registering gas tokens..."),d.register(o.address,l),d.register(o.address,r);const b=U.connect(l,this.provider);let[h,u]=await Promise.all([d.fetchAllReserves(),b.decimals()]);const p={address:l,decimals:u},x=J(d,s,A[this.network].decimals,y[this.network],p,o,void 0!==c.gasPriceL2?e.BigNumber.from(c.gasPriceL2).toBigInt():void 0),g=void 0!==c.gasPriceL2?x.l2:x.l1,m=d.getAllRoutesSingle(f,l,n,g);let C;if(c.enableSplit){const e=d.getAllRoutesSplit(f,l,n,g);C={paths:e.paths,amountOuts:e.amountOuts,gas:e.gas}}return{blockNumber:h,gasPriceTokens:S(x,p.address,o.address),singleRouteRates:m,splitRouteRates:C}}async _quoteETHWETH(e,t,a,n,s,i){const d=Q(A[this.network].address,this.network),c=T[this.network],f=Q(t,this.network);s.register(c.address,f),s.register(c.address,d),await Promise.all([s.fetchAllReserves()]);const l=S(J(s,a,A[this.network].decimals,y[this.network],y[this.network],c,i),f,c.address);if(e===z.ETH2WETH){const e=function(e){const t={execution:r[e]};return p(e)&&(t.l2Calldata=h[e].ethWeth),t}(this.network);let t=P(e.execution,l.l1);return void 0!==l.l2&&(t=P(e.l2Calldata,l.l1,P(e.execution,l.l2))),{type:"ethToWeth",amountOut:n.toString(),routerAddress:m[this.network],gasFees:w(t)}}if(e===z.WETH2ETH){const e=function(e){const t={execution:o[e]};return p(e)&&(t.l2Calldata=h[e].wethEth),t}(this.network);let t=P(e.execution,l.l1);return void 0!==l.l2&&(t=P(e.l2Calldata,l.l1,P(e.execution,l.l2))),{type:"wethToEth",amountOut:n.toString(),routerAddress:m[this.network],gasFees:w(t)}}}async sendTx(e,t,...a){const n=t,s=a[a.length-1];if(void 0===s.gasLimit){const t=await e.estimateGas[n](...a);i.log("[Send Tx]","Fetched Gas Limit:",t.toString()),s.gasLimit=t.mul(E[this.network]+100).div(100)}return i.log("[Send Tx]","Final Gas Limit:",a[a.length-1].gasLimit.toString()),e[n](...a)}async approve(t,a,n=e.constants.MaxUint256,s={}){if(a.toLowerCase()===K)return null;const i=U.connect(a,t);return await this.sendTx(i,"approve",m[this.network],n,s)}async swap(t,a,n,s,d,c,r=0,o=0,f=e.constants.AddressZero,l={}){if(a.toLowerCase()===K&&(l.value=s),"split"===c.type||"strategies"===c.type){if(p(this.network)){const e=H.connect(m[this.network],t),b=new It(this.network,t.provider,{maxCallsPerBatch:this.options.maxCallsPerFetch});i.log("Prepare Tx...");const h=await b.compress(a,n,s,d,r,o,g[this.network],f,"strategies"===c.type?c.path:c.paths,"strategies"===c.type?[]:c.volumns);let u;return i.log("Sending Tx..."),u="strategies"===c.type?await this.sendTx(e,"swapCompressed",h,l):await this.sendTx(e,"swapSplitCompressed",h,l),i.log("Tx Hash:",u.hash),u}{const e=q.connect(m[this.network],t),b=new It(this.network,t.provider,{maxCallsPerBatch:this.options.maxCallsPerFetch}).encodeSwapData("strategies"===c.type?c.path:c.paths);let h;return i.log("Sending Tx..."),h="strategies"===c.type?await this.sendTx(e,"swap",g[this.network],b,c.depositAddress,a,s,n,d,f,r,o,l):await this.sendTx(e,"swapSplit",g[this.network],b,c.depositAddresses,c.volumns,a,s,n,d,f,r,o,l),i.log("Tx Hash:",h.hash),h}}{const e=q.connect(m[this.network],t);let a;return i.log("Sending Tx..."),a="ethToWeth"===c.type?await this.sendTx(e,"tradeEthToWeth",f,l):await this.sendTx(e,"tradeWethToEth",s,f,l),i.log("Tx Hash:",a.hash),a}}async getQuote(t,a,n,s,r={}){if(r={...Ot,...r},t=e.utils.getAddress(t).toLowerCase(),a=e.utils.getAddress(a).toLowerCase(),p(this.network)&&void 0===r.gasPriceL2)throw new Error("L2 Gas Price option is required. Please specify `gasPriceL2` inside `opts` argument");const o=e.BigNumber.from(n).toBigInt(),u=e.BigNumber.from(s).toBigInt(),x=void 0!==r.gasPriceL2?e.BigNumber.from(r.gasPriceL2).toBigInt():void 0,C=new mt(fe[this.network],le[this.network],this.multicall2,{maxCandidatePaths:this.options.maxCandidatePathsCount,multicall:{maxCallsPerBatch:this.options.maxCallsPerFetch}}),I=this.getTradeType(t,a);if(I!==z.BESTRATE){return await this._quoteETHWETH(I,a,u,o,C,x)}i.log("[Best Rate Quote]","Fetching data");const{blockNumber:T,splitRouteRates:A,singleRouteRates:y,gasPriceTokens:E}=await this._fetch(t,a,o,u,C,r);i.log("[Best Rate Quote]","Compute best rate");const k=_(y,{gas:{price:E,execution:{initial:c[this.network],variable:l[this.network],pathVariable:0n},l2Calldata:h[this.network]}}),N=r.enableSplit?function(e,t,a,n){if(0===t.length)return{amountOut:0n,gasFee:{usd:0n,dest:0n,unit:0n},paths:[],volumns:[]};const s=Array.from({length:t.length},(()=>Array.from({length:t[0].length},(()=>null)))),d=Array.from({length:t.length},(()=>Array.from({length:t[0].length},(()=>null)))),c=t.length,r=t[0].length,o=void 0!==n.gas.price.l2?n.gas.price.l2:n.gas.price.l1,f=n.gas.execution,l=n.gas.l2Calldata,b=n.gas.price.l1;for(let i=0;i<c;++i){const{routeIndexes:c}=e[i];let h=f.variable.constant+f.variable.multiplier*BigInt(c.length)+f.pathVariable,u={dest:0n,unit:0n,usd:0n};void 0!==n.gas.price.l2&&(u=P(l.perPath+l.perRoute*BigInt(c.length),b));for(let e=0;e<r;e++){d[i][e]=P(h+a[i][e],o,u);const n=t[i][e];s[i][e]=n-d[i][e].dest}}i.log("[Best Rate Split]","Finding Best Rate");let h={amountOut:0n,paths:[],volumns:[],gasFee:{dest:0n,unit:0n,usd:0n}},u=Array.from({length:s.length},((e,t)=>t));const p=[];for(let e=0,t=u.length;e<t;++e){p.push([]);for(let t=0,a=B.length;t<a;++t)p[e].push([B[t],s[u[e]][t]])}const x=new R(p,100).compute();return i.debug("[Best Rate Split]","=== ChosenLearn ==="),i.table((()=>x)),i.debug("[Best Rate Split]","=== Amount outs ==="),i.table((()=>x.map((e=>({pathIndex:u[e[0]],amountOut:s[u[e[0]]][e[1]].toString()}))))),h.amountOut=x.reduce(((e,a)=>{const[n,s]=a;return e+t[u[n]][s]}),0n),h.paths=x.map((t=>{const[a,n]=t,{routeIndexes:s,tokens:i}=e[u[a]];return{routeIndexes:s,tokens:i}})),h.volumns=x.map((e=>{const[t,a]=e;return B[a]})),h.gasFee=x.reduce(((e,t)=>{const[a,n]=t,s=u[a];return{usd:e.usd+d[s][n].usd,dest:e.dest+d[s][n].dest,unit:e.unit+d[s][n].unit}}),h.gasFee),i.debug((()=>`[Best Rate Split] Gas fee before initial gas deduction ${JSON.stringify(w(h.gasFee),null,2)}`)),h.gasFee=P(f.initial,o,h.gasFee),void 0!==n.gas.price.l2&&(h.gasFee=P(l.initialSplit,b,h.gasFee)),i.debug((()=>`[Best Rate Split] FINAL RESULT: ${JSON.stringify(M(h),null,2)}`)),h}(A.paths,A.amountOuts,A.gas,{gas:{price:E,execution:{initial:d[this.network],variable:f[this.network],pathVariable:b[this.network]},l2Calldata:h[this.network]}}):{amountOut:0n,gasFee:{usd:0n,dest:0n,unit:0n},paths:[],volumns:[]},O=N.amountOut-N.gasFee.dest,S=k.amountOut-k.gasFee.dest;let D;if(i.log("[Best Rate Quote]","SINGLE",v(k,C)),i.log("[Best Rate Quote]","Block number:",T),i.log("[Best Rate Quote]","Best rate for single-route trading (without gas deduction):",k.amountOut),i.log("[Best Rate Quote]","Best rate for single-route trading (gas deducted):",S),i.log("[Best Rate Quote]","SPLIT",M(N,C)),i.log("[Best Rate Quote]","Best rate for split trading (without gas deduction):",N.amountOut),i.log("[Best Rate Quote]","Best rate for split trading (gas deducted):",O),O>S&&N.paths.length>1){const t=N.paths.map((t=>t.routeIndexes.map((e=>C.getRouteInfo(e))).map((({address:t,...a})=>({address:e.utils.getAddress(t),...a})))));D={type:"split",paths:N.paths.map((({tokens:a},n)=>({routes:t[n],tokens:a.map((t=>e.utils.getAddress(t)))}))),volumns:N.volumns,amountOut:N.amountOut.toString(),gasFees:w(N.gasFee),blockNumber:T,routerAddress:m[this.network],swapAddress:g[this.network],depositAddresses:[]}}else{D={type:"strategies",path:{routes:k.routeIndexes.map((e=>C.getRouteInfo(e))).map((({address:t,...a})=>({address:e.utils.getAddress(t),...a}))),tokens:k.tokens.map((t=>e.utils.getAddress(t)))},amountOut:k.amountOut.toString(),gasFees:w(k.gasFee),blockNumber:T,routerAddress:m[this.network],swapAddress:g[this.network],depositAddress:""}}if("split"===D.type)p(this.network)?D.depositAddresses=Array.from({length:D.paths.length},(()=>g[this.network])):D.depositAddresses=this.getDepositAddresses(D.paths.map((e=>({src:t,dest:0===e.tokens.length?a:e.tokens[0],routeAddress:e.routes[0].address}))),C);else if("strategies"===D.type&&D.path.routes.length>0)if(p(this.network))D.depositAddress=g[this.network];else{const e=this.getDepositAddresses([{src:t,dest:0===D.path.tokens.length?a:D.path.tokens[0],routeAddress:D.path.routes[0].address}],C);D.depositAddress=e[0]}return D}}function Pt(t,a,n){const s={url:t,user:a,password:n,allowGzip:!0};return new e.providers.JsonRpcProvider(s)}export{u as BESTRATE_NETWORK,k as GAS_TOKEN_DECIMALS,n as LogLevel,s as Logger,St as WardenBestRate,It as WardenPayloadCompressor,Pt as initProvider,i as log,D as zeroGasOptions};
|