"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var f,t,n,r,i,a,o,s,d,u,c,p,h,T,C,b,I,E,x,l,A,m,y,v,N,O,S,D,B,R,g,M=e(require("jsbi")),_=require("@ethersproject/bignumber"),F=e(require("tiny-invariant")),P=require("@ethersproject/address"),k=(e(require("tiny-warning")),e(require("big.js"))),w=e(require("decimal.js-light")),L=e(require("toformat")),q=require("@ethersproject/solidity"),H=require("@ethersproject/abi"),U=require("@ethersproject/signing-key"),K=require("eip-712"),V=require("@ethersproject/bytes"),X=require("@ethersproject/contracts"),W=e(require("isomorphic-unfetch"));(f=exports.ChainId||(exports.ChainId={}))[f.MAINNET=1]="MAINNET",f[f.ROPSTEN=3]="ROPSTEN",f[f.RINKEBY=4]="RINKEBY",f[f["GÖRLI"]=5]="GÖRLI",f[f.KOVAN=42]="KOVAN",f[f.MATIC=137]="MATIC",f[f.MATIC_TESTNET=80001]="MATIC_TESTNET",f[f.FANTOM=250]="FANTOM",f[f.FANTOM_TESTNET=4002]="FANTOM_TESTNET",f[f.XDAI=100]="XDAI",f[f.BSC=56]="BSC",f[f.BSC_TESTNET=97]="BSC_TESTNET",f[f.ARBITRUM=42161]="ARBITRUM",f[f.ARBITRUM_TESTNET=79377087078960]="ARBITRUM_TESTNET",f[f.MOONBEAM_TESTNET=1287]="MOONBEAM_TESTNET",f[f.AVALANCHE=43114]="AVALANCHE",f[f.AVALANCHE_TESTNET=43113]="AVALANCHE_TESTNET",f[f.HECO=128]="HECO",f[f.HECO_TESTNET=256]="HECO_TESTNET",f[f.HARMONY=16666e5]="HARMONY",f[f.HARMONY_TESTNET=16667e5]="HARMONY_TESTNET",f[f.OKEX=66]="OKEX",f[f.OKEX_TESTNET=65]="OKEX_TESTNET",f[f.CELO=42220]="CELO",f[f.PALM=11297108109]="PALM",f[f.PALM_TESTNET=11297108099]="PALM_TESTNET",f[f.MOONRIVER=1285]="MOONRIVER",(t=exports.Rounding||(exports.Rounding={}))[t.ROUND_DOWN=0]="ROUND_DOWN",t[t.ROUND_HALF_UP=1]="ROUND_HALF_UP",t[t.ROUND_UP=2]="ROUND_UP",(n=exports.TradeType||(exports.TradeType={}))[n.EXACT_INPUT=0]="EXACT_INPUT",n[n.EXACT_OUTPUT=1]="EXACT_OUTPUT",(r=exports.KashiAction||(exports.KashiAction={}))[r.ADD_ASSET=1]="ADD_ASSET",r[r.REPAY=2]="REPAY",r[r.REMOVE_ASSET=3]="REMOVE_ASSET",r[r.REMOVE_COLLATERAL=4]="REMOVE_COLLATERAL",r[r.BORROW=5]="BORROW",r[r.GET_REPAY_SHARE=6]="GET_REPAY_SHARE",r[r.GET_REPAY_PART=7]="GET_REPAY_PART",r[r.ACCRUE=8]="ACCRUE",r[r.ADD_COLLATERAL=10]="ADD_COLLATERAL",r[r.UPDATE_EXCHANGE_RATE=11]="UPDATE_EXCHANGE_RATE",r[r.BENTO_DEPOSIT=20]="BENTO_DEPOSIT",r[r.BENTO_WITHDRAW=21]="BENTO_WITHDRAW",r[r.BENTO_TRANSFER=22]="BENTO_TRANSFER",r[r.BENTO_TRANSFER_MULTIPLE=23]="BENTO_TRANSFER_MULTIPLE",r[r.BENTO_SETAPPROVAL=24]="BENTO_SETAPPROVAL",r[r.CALL=30]="CALL",(i=exports.Fee||(exports.Fee={}))[i.DEFAULT=30]="DEFAULT",(a=exports.OrderStatus||(exports.OrderStatus={})).FILLED="FILLED",a.CANCELLED="CANCELLED",a.EXPIRED="EXPIRED",a.PENDING="PENDING";var Y=((o={})[exports.ChainId.MAINNET]="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",o[exports.ChainId.ROPSTEN]="0x0D9C8723B343A8368BebE0B5E89273fF8D712e3C",o[exports.ChainId.KOVAN]="0xb7a4F3E9097C08dA09517b5aB877F7a917224ede",o[exports.ChainId.MATIC]="0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",o[exports.ChainId.FANTOM]="0x04068DA6C83AFCFA0e13ba15A6696662335D5B75",o[exports.ChainId.BSC]="0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",o[exports.ChainId.HARMONY]="0x985458E523dB3d53125813eD68c274899e9DfAb4",o[exports.ChainId.HECO]="0x9362Bbef4B8313A8Aa9f0c9808B80577Aa26B73B",o[exports.ChainId.OKEX]="0xc946DAf81b08146B1C7A8Da2A851Ddf2B3EAaf85",o[exports.ChainId.XDAI]="0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83",o[exports.ChainId.ARBITRUM]="0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",o),G=((s={})[exports.ChainId.MAINNET]="0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac",s[exports.ChainId.ROPSTEN]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.RINKEBY]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.GÖRLI]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.KOVAN]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.FANTOM]="0xCC738D2fDE18fe66773b84c8E6C869aB233766D1",s[exports.ChainId.FANTOM_TESTNET]="",s[exports.ChainId.MATIC]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.MATIC_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.XDAI]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.BSC]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.BSC_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.ARBITRUM]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.ARBITRUM_TESTNET]="",s[exports.ChainId.MOONBEAM_TESTNET]="0x2Ce3F07dD4c62b56a502E223A7cBE38b1d77A1b5",s[exports.ChainId.AVALANCHE]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.AVALANCHE_TESTNET]="0xd00ae08403B9bbb9124bB305C09058E32C39A48c",s[exports.ChainId.HECO]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.HECO_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.HARMONY]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.HARMONY_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.OKEX]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.OKEX_TESTNET]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.CELO]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.PALM]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s[exports.ChainId.PALM_TESTNET]="",s[exports.ChainId.MOONRIVER]="0xc35DADB65012eC5796536bD9864eD8773aBc74C4",s),j=((d={})[exports.ChainId.MAINNET]="0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F",d[exports.ChainId.RINKEBY]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.ROPSTEN]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.GÖRLI]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.KOVAN]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.FANTOM]="0x8C9E059a729C17fB294cd782eB66Df3871D29173",d[exports.ChainId.FANTOM_TESTNET]="",d[exports.ChainId.MATIC]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.MATIC_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.XDAI]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.BSC]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.BSC_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.ARBITRUM]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.ARBITRUM_TESTNET]="",d[exports.ChainId.MOONBEAM_TESTNET]="0xeB5c2BB5E83B51d83F3534Ae21E84336B8B376ef",d[exports.ChainId.AVALANCHE]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.AVALANCHE_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.HECO]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.HECO_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.HARMONY]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.HARMONY_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.OKEX]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.OKEX_TESTNET]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.CELO]="0x1421bDe4B10e8dd459b3BCb598810B1337D56842",d[exports.ChainId.PALM]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d[exports.ChainId.PALM_TESTNET]="",d[exports.ChainId.MOONRIVER]="0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",d),Z=((u={})[exports.ChainId.MAINNET]="0x6B3595068778DD592e39A122f4f5a5cF09C90fE2",u[exports.ChainId.ROPSTEN]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",u[exports.ChainId.RINKEBY]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",u[exports.ChainId.GÖRLI]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",u[exports.ChainId.KOVAN]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",u[exports.ChainId.FANTOM]="0x4cf098d3775bd78a4508a13e126798da5911b6cd",u[exports.ChainId.FANTOM_TESTNET]="",u[exports.ChainId.MATIC]="0x0b3F868E0BE5597D5DB7fEB59E1CADBb0fdDa50a",u[exports.ChainId.MATIC_TESTNET]="",u[exports.ChainId.XDAI]="0x2995D1317DcD4f0aB89f4AE60F3f020A4F17C7CE",u[exports.ChainId.BSC]="0x947950BcC74888a40Ffa2593C5798F11Fc9124C4",u[exports.ChainId.BSC_TESTNET]="",u[exports.ChainId.ARBITRUM]="0xd4d42F0b6DEF4CE0383636770eF773390d85c61A",u[exports.ChainId.ARBITRUM_TESTNET]="",u[exports.ChainId.MOONBEAM_TESTNET]="",u[exports.ChainId.AVALANCHE]="0x39cf1BD5f15fb22eC3D9Ff86b0727aFc203427cc",u[exports.ChainId.AVALANCHE_TESTNET]="",u[exports.ChainId.HECO]="0x52E00B2dA5Bd7940fFe26B609A42F957f31118D5",u[exports.ChainId.HECO_TESTNET]="",u[exports.ChainId.HARMONY]="0xBEC775Cb42AbFa4288dE81F387a9b1A3c4Bc552A",u[exports.ChainId.HARMONY_TESTNET]="",u[exports.ChainId.OKEX]="0x2218E0D5E0173769F5b4939a3aE423f7e5E4EAB7",u[exports.ChainId.OKEX_TESTNET]="",u[exports.ChainId.CELO]="",u[exports.ChainId.PALM]="",u[exports.ChainId.PALM_TESTNET]="",u),Q=((c={})[exports.ChainId.MAINNET]="0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd",c[exports.ChainId.ROPSTEN]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",c[exports.ChainId.RINKEBY]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",c[exports.ChainId.GÖRLI]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",c[exports.ChainId.KOVAN]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",c[exports.ChainId.FANTOM]="",c[exports.ChainId.FANTOM_TESTNET]="",c[exports.ChainId.MATIC]="",c[exports.ChainId.MATIC_TESTNET]="",c[exports.ChainId.XDAI]="",c[exports.ChainId.BSC]="",c[exports.ChainId.BSC_TESTNET]="",c[exports.ChainId.ARBITRUM]="",c[exports.ChainId.ARBITRUM_TESTNET]="",c[exports.ChainId.MOONBEAM_TESTNET]="",c[exports.ChainId.AVALANCHE]="",c[exports.ChainId.AVALANCHE_TESTNET]="",c[exports.ChainId.HECO]="",c[exports.ChainId.HECO_TESTNET]="",c[exports.ChainId.HARMONY]="",c[exports.ChainId.HARMONY_TESTNET]="",c[exports.ChainId.OKEX]="",c[exports.ChainId.OKEX_TESTNET]="",c[exports.ChainId.CELO]="",c[exports.ChainId.PALM]="",c[exports.ChainId.PALM_TESTNET]="",c),J=((p={})[exports.ChainId.MAINNET]="0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272",p[exports.ChainId.ROPSTEN]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",p[exports.ChainId.RINKEBY]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",p[exports.ChainId.GÖRLI]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",p[exports.ChainId.KOVAN]="0x1be211D8DA40BC0ae8719c6663307Bfc987b1d6c",p[exports.ChainId.FANTOM]="",p[exports.ChainId.FANTOM_TESTNET]="",p[exports.ChainId.MATIC]="",p[exports.ChainId.MATIC_TESTNET]="",p[exports.ChainId.XDAI]="",p[exports.ChainId.BSC]="",p[exports.ChainId.BSC_TESTNET]="",p[exports.ChainId.ARBITRUM]="",p[exports.ChainId.ARBITRUM_TESTNET]="",p[exports.ChainId.MOONBEAM_TESTNET]="",p[exports.ChainId.AVALANCHE]="",p[exports.ChainId.AVALANCHE_TESTNET]="",p[exports.ChainId.HECO]="",p[exports.ChainId.HECO_TESTNET]="",p[exports.ChainId.HARMONY]="",p[exports.ChainId.HARMONY_TESTNET]="",p[exports.ChainId.OKEX]="",p[exports.ChainId.OKEX_TESTNET]="",p[exports.ChainId.CELO]="",p[exports.ChainId.PALM]="",p[exports.ChainId.PALM_TESTNET]="",p),z=((h={})[exports.ChainId.MAINNET]="0xE11fc0B43ab98Eb91e9836129d1ee7c3Bc95df50",h[exports.ChainId.ROPSTEN]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",h[exports.ChainId.RINKEBY]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",h[exports.ChainId.GÖRLI]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",h[exports.ChainId.KOVAN]="0x1b9d177CcdeA3c79B6c8F40761fc8Dc9d0500EAa",h[exports.ChainId.FANTOM]="",h[exports.ChainId.FANTOM_TESTNET]="",h[exports.ChainId.MATIC]="",h[exports.ChainId.MATIC_TESTNET]="",h[exports.ChainId.XDAI]="",h[exports.ChainId.BSC]="",h[exports.ChainId.BSC_TESTNET]="",h[exports.ChainId.ARBITRUM]="",h[exports.ChainId.ARBITRUM_TESTNET]="",h[exports.ChainId.MOONBEAM_TESTNET]="",h[exports.ChainId.AVALANCHE]="",h[exports.ChainId.AVALANCHE_TESTNET]="",h[exports.ChainId.HECO]="",h[exports.ChainId.HECO_TESTNET]="",h[exports.ChainId.HARMONY]="",h[exports.ChainId.HARMONY_TESTNET]="",h[exports.ChainId.OKEX]="",h[exports.ChainId.OKEX_TESTNET]="",h[exports.ChainId.CELO]="",h[exports.ChainId.PALM]="",h[exports.ChainId.PALM_TESTNET]="",h),$=((T={})[exports.ChainId.MAINNET]="0x9a8541Ddf3a932a9A922B607e9CF7301f1d47bD1",T[exports.ChainId.ROPSTEN]="",T[exports.ChainId.RINKEBY]="",T[exports.ChainId.GÖRLI]="",T[exports.ChainId.KOVAN]="",T[exports.ChainId.FANTOM]="",T[exports.ChainId.FANTOM_TESTNET]="",T[exports.ChainId.MATIC]="",T[exports.ChainId.MATIC_TESTNET]="",T[exports.ChainId.XDAI]="",T[exports.ChainId.BSC]="",T[exports.ChainId.BSC_TESTNET]="",T[exports.ChainId.ARBITRUM]="",T[exports.ChainId.ARBITRUM_TESTNET]="",T[exports.ChainId.MOONBEAM_TESTNET]="",T[exports.ChainId.AVALANCHE]="",T[exports.ChainId.AVALANCHE_TESTNET]="",T[exports.ChainId.HECO]="",T[exports.ChainId.HECO_TESTNET]="",T[exports.ChainId.HARMONY]="",T[exports.ChainId.HARMONY_TESTNET]="",T[exports.ChainId.OKEX]="",T[exports.ChainId.OKEX_TESTNET]="",T[exports.ChainId.CELO]="",T[exports.ChainId.PALM]="",T[exports.ChainId.PALM_TESTNET]="",T),ee=((C={})[exports.ChainId.MAINNET]="0xF5BCE5077908a1b7370B9ae04AdC565EBd643966",C[exports.ChainId.ROPSTEN]="0x6BdD85290001C8Aef74f35A7606065FA15aD5ACF",C[exports.ChainId.RINKEBY]="0xF5BCE5077908a1b7370B9ae04AdC565EBd643966",C[exports.ChainId.GÖRLI]="0xF5BCE5077908a1b7370B9ae04AdC565EBd643966",C[exports.ChainId.KOVAN]="0x9A0D9920D92c178a58D99B455898Df2df22A2eE4",C[exports.ChainId.FANTOM]="0xF5BCE5077908a1b7370B9ae04AdC565EBd643966",C[exports.ChainId.FANTOM_TESTNET]="",C[exports.ChainId.MATIC]="0x0319000133d3AdA02600f0875d2cf03D442C3367",C[exports.ChainId.MATIC_TESTNET]="0xF5BCE5077908a1b7370B9ae04AdC565EBd643966",C[exports.ChainId.XDAI]="0xE2d7F5dd869Fc7c126D21b13a9080e75a4bDb324",C[exports.ChainId.BSC]="0xF5BCE5077908a1b7370B9ae04AdC565EBd643966",C[exports.ChainId.BSC_TESTNET]="0xF5BCE5077908a1b7370B9ae04AdC565EBd643966",C[exports.ChainId.ARBITRUM]="0x74c764D41B77DBbb4fe771daB1939B00b146894A",C[exports.ChainId.ARBITRUM_TESTNET]="",C[exports.ChainId.MOONBEAM_TESTNET]="",C[exports.ChainId.AVALANCHE]="",C[exports.ChainId.AVALANCHE_TESTNET]="",C[exports.ChainId.HECO]="0xF5BCE5077908a1b7370B9ae04AdC565EBd643966",C[exports.ChainId.HECO_TESTNET]="",C[exports.ChainId.HARMONY]="",C[exports.ChainId.HARMONY_TESTNET]="",C[exports.ChainId.OKEX]="",C[exports.ChainId.OKEX_TESTNET]="",C[exports.ChainId.CELO]="",C[exports.ChainId.PALM]="",C[exports.ChainId.PALM_TESTNET]="",C),fe=((b={})[exports.ChainId.MAINNET]="0x2cBA6Ab6574646Badc84F0544d05059e57a5dc42",b[exports.ChainId.ROPSTEN]="",b[exports.ChainId.RINKEBY]="",b[exports.ChainId.GÖRLI]="",b[exports.ChainId.KOVAN]="0x2cBA6Ab6574646Badc84F0544d05059e57a5dc42",b[exports.ChainId.FANTOM]="",b[exports.ChainId.FANTOM_TESTNET]="",b[exports.ChainId.MATIC]="0xB527C5295c4Bc348cBb3a2E96B2494fD292075a7",b[exports.ChainId.MATIC_TESTNET]="",b[exports.ChainId.XDAI]="0x7a6DA9903d0a481F40b8336c1463487BC8C0407e",b[exports.ChainId.BSC]="0x2cBA6Ab6574646Badc84F0544d05059e57a5dc42",b[exports.ChainId.BSC_TESTNET]="",b[exports.ChainId.ARBITRUM]="0xa010eE0226cd071BeBd8919A1F675cAE1f1f5D3e",b[exports.ChainId.ARBITRUM_TESTNET]="",b[exports.ChainId.MOONBEAM_TESTNET]="",b[exports.ChainId.AVALANCHE]="",b[exports.ChainId.AVALANCHE_TESTNET]="",b[exports.ChainId.HECO]="0x2cBA6Ab6574646Badc84F0544d05059e57a5dc42",b[exports.ChainId.HECO_TESTNET]="",b[exports.ChainId.HARMONY]="",b[exports.ChainId.HARMONY_TESTNET]="",b[exports.ChainId.OKEX]="",b[exports.ChainId.OKEX_TESTNET]="",b[exports.ChainId.CELO]="",b[exports.ChainId.PALM]="",b[exports.ChainId.PALM_TESTNET]="",b),te=((I={})[exports.ChainId.MAINNET]="0x1766733112408b95239aD1951925567CB1203084",I[exports.ChainId.ROPSTEN]="",I[exports.ChainId.RINKEBY]="",I[exports.ChainId.GÖRLI]="",I[exports.ChainId.KOVAN]="",I[exports.ChainId.FANTOM]="",I[exports.ChainId.FANTOM_TESTNET]="",I[exports.ChainId.MATIC]="0xe9589382130Ded5DF2397E2fD7A3E9b41DD2701D",I[exports.ChainId.MATIC_TESTNET]="",I[exports.ChainId.XDAI]="0xE02BDb31C353CE95A1D74F81C93eEa70Bf7371B9",I[exports.ChainId.BSC]="0x1766733112408b95239aD1951925567CB1203084",I[exports.ChainId.BSC_TESTNET]="",I[exports.ChainId.ARBITRUM]="0x0bFcD5dD76218bF9e3BE8A1055f9e6D27E5745eb",I[exports.ChainId.ARBITRUM_TESTNET]="",I[exports.ChainId.MOONBEAM_TESTNET]="",I[exports.ChainId.AVALANCHE]="",I[exports.ChainId.AVALANCHE_TESTNET]="",I[exports.ChainId.HECO]="0x1766733112408b95239aD1951925567CB1203084",I[exports.ChainId.HECO_TESTNET]="",I[exports.ChainId.HARMONY]="",I[exports.ChainId.HARMONY_TESTNET]="",I[exports.ChainId.OKEX]="",I[exports.ChainId.OKEX_TESTNET]="",I[exports.ChainId.CELO]="",I[exports.ChainId.PALM]="",I[exports.ChainId.PALM_TESTNET]="",I),ne=((E={})[exports.ChainId.MAINNET]="0x545820d5Cc05248da112419fEfb18522c63C8e12",E[exports.ChainId.ROPSTEN]="",E[exports.ChainId.RINKEBY]="",E[exports.ChainId.GÖRLI]="",E[exports.ChainId.KOVAN]="0xc0c1649b2c67f1a9f5ff1dd618188165e2555bcf",E[exports.ChainId.FANTOM]="",E[exports.ChainId.FANTOM_TESTNET]="",E[exports.ChainId.MATIC]="0x73BE093B84c773fe8eE0f76DDc0829E45c215415",E[exports.ChainId.MATIC_TESTNET]="",E[exports.ChainId.XDAI]="0x735f0FbEb3b6389986BcaAf073Af07D2F8be2b93",E[exports.ChainId.BSC]="0x86c655cAc122e9A2fd9Ae1f79Df27b30E357968c",E[exports.ChainId.BSC_TESTNET]="",E[exports.ChainId.ARBITRUM]="0xbe7D5968296843756109D42946D01195320922EF",E[exports.ChainId.ARBITRUM_TESTNET]="",E[exports.ChainId.MOONBEAM_TESTNET]="",E[exports.ChainId.AVALANCHE]="",E[exports.ChainId.AVALANCHE_TESTNET]="",E[exports.ChainId.HECO]="",E[exports.ChainId.HECO_TESTNET]="",E[exports.ChainId.HARMONY]="",E[exports.ChainId.HARMONY_TESTNET]="",E[exports.ChainId.OKEX]="",E[exports.ChainId.OKEX_TESTNET]="",E[exports.ChainId.CELO]="",E[exports.ChainId.PALM]="",E[exports.ChainId.PALM_TESTNET]="",E),re=((x={})[exports.ChainId.MAINNET]="0xB527C5295c4Bc348cBb3a2E96B2494fD292075a7",x[exports.ChainId.ROPSTEN]="",x[exports.ChainId.RINKEBY]="",x[exports.ChainId.GÖRLI]="",x[exports.ChainId.KOVAN]="0x75AE0Aa596D39b20addC921DeB5EE3c96279dABE",x[exports.ChainId.FANTOM]="",x[exports.ChainId.FANTOM_TESTNET]="",x[exports.ChainId.MATIC]="0xDB6C4EDd9545d3b815dA85E6429B699c418886f9",x[exports.ChainId.MATIC_TESTNET]="",x[exports.ChainId.XDAI]="0x07b6e34EeCF38B02e83b6B4702699717e298967E",x[exports.ChainId.BSC]="0x1B16149Edaf1EFa6ADE6aEEF33e63C6e08c9bB1B",x[exports.ChainId.BSC_TESTNET]="",x[exports.ChainId.ARBITRUM]="0x860D841bfD1cfEf72A14B2b734005799F07dC7ED",x[exports.ChainId.ARBITRUM_TESTNET]="",x[exports.ChainId.MOONBEAM_TESTNET]="",x[exports.ChainId.AVALANCHE]="",x[exports.ChainId.AVALANCHE_TESTNET]="",x[exports.ChainId.HECO]="",x[exports.ChainId.HECO_TESTNET]="",x[exports.ChainId.HARMONY]="",x[exports.ChainId.HARMONY_TESTNET]="",x[exports.ChainId.OKEX]="",x[exports.ChainId.OKEX_TESTNET]="",x[exports.ChainId.CELO]="",x[exports.ChainId.PALM]="",x[exports.ChainId.PALM_TESTNET]="",x),ie=((l={})[exports.ChainId.MAINNET]="0x00632CFe43d8F9f8E6cD0d39Ffa3D4fa7ec73CFB",l[exports.ChainId.MATIC]="0x00632CFe43d8F9f8E6cD0d39Ffa3D4fa7ec73CFB",l[exports.ChainId.XDAI]="0x00632CFe43d8F9f8E6cD0d39Ffa3D4fa7ec73CFB",l[exports.ChainId.BSC]="0x00632CFe43d8F9f8E6cD0d39Ffa3D4fa7ec73CFB",l[exports.ChainId.ARBITRUM]="0xB2B5C26B6868be10fF77e4E233fD231ceB90162a",l),ae=((A={})[exports.ChainId.MAINNET]="0x11Ca5375AdAfd6205E41131A4409f182677996E6",A[exports.ChainId.ROPSTEN]="",A[exports.ChainId.RINKEBY]="",A[exports.ChainId.GÖRLI]="",A[exports.ChainId.KOVAN]="0x11Ca5375AdAfd6205E41131A4409f182677996E6",A[exports.ChainId.FANTOM]="",A[exports.ChainId.FANTOM_TESTNET]="",A[exports.ChainId.MATIC]="0xA77a7fD5a16237B85E0FAd02C51f459D18AE93Cd",A[exports.ChainId.MATIC_TESTNET]="",A[exports.ChainId.XDAI]="0x97e4a0fb71243A83A6FbaEF7Cf73617594e4cF2F",A[exports.ChainId.BSC]="0x11Ca5375AdAfd6205E41131A4409f182677996E6",A[exports.ChainId.BSC_TESTNET]="",A[exports.ChainId.ARBITRUM]="0x37B3287292De241278fB5FCa514a756E0BE924f8",A[exports.ChainId.ARBITRUM_TESTNET]="",A[exports.ChainId.MOONBEAM_TESTNET]="",A[exports.ChainId.AVALANCHE]="",A[exports.ChainId.AVALANCHE_TESTNET]="",A[exports.ChainId.HECO]="0x11Ca5375AdAfd6205E41131A4409f182677996E6",A[exports.ChainId.HECO_TESTNET]="",A[exports.ChainId.HARMONY]="",A[exports.ChainId.HARMONY_TESTNET]="",A[exports.ChainId.OKEX]="",A[exports.ChainId.OKEX_TESTNET]="",A[exports.ChainId.CELO]="",A[exports.ChainId.PALM]="",A[exports.ChainId.PALM_TESTNET]="",A),oe=((m={})[exports.ChainId.MAINNET]="",m[exports.ChainId.ROPSTEN]="",m[exports.ChainId.RINKEBY]="",m[exports.ChainId.GÖRLI]="",m[exports.ChainId.KOVAN]="0xce9365dB1C99897f04B3923C03ba9a5f80E8DB87",m[exports.ChainId.FANTOM]="",m[exports.ChainId.FANTOM_TESTNET]="",m[exports.ChainId.MATIC]="0x1aDb3Bd86bb01797667eC382a0BC6A9854b4005f",m[exports.ChainId.MATIC_TESTNET]="",m[exports.ChainId.XDAI]="",m[exports.ChainId.BSC]="",m[exports.ChainId.BSC_TESTNET]="",m[exports.ChainId.ARBITRUM]="",m[exports.ChainId.ARBITRUM_TESTNET]="",m[exports.ChainId.MOONBEAM_TESTNET]="",m[exports.ChainId.AVALANCHE]="",m[exports.ChainId.AVALANCHE_TESTNET]="",m[exports.ChainId.HECO]="",m[exports.ChainId.HECO_TESTNET]="",m[exports.ChainId.HARMONY]="",m[exports.ChainId.HARMONY_TESTNET]="",m[exports.ChainId.OKEX]="",m[exports.ChainId.OKEX_TESTNET]="",m[exports.ChainId.CELO]="",m[exports.ChainId.PALM]="",m[exports.ChainId.PALM_TESTNET]="",m),se=((y={})[exports.ChainId.MAINNET]="0x9917C083FF9FbD29Df1367FBF7F2388A9a202431",y),de=((v={})[exports.ChainId.MATIC]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",v[exports.ChainId.XDAI]="0xdDCbf776dF3dE60163066A5ddDF2277cB445E0F3",v[exports.ChainId.HARMONY]="0x67dA5f2FfaDDfF067AB9d5F025F8810634d84287",v[exports.ChainId.ARBITRUM]="0xF4d73326C13a4Fc5FD7A064217e12780e9Bd62c3",v),ue=((N={})[exports.ChainId.MAINNET]="0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",N[exports.ChainId.ROPSTEN]="0xc778417E063141139Fce010982780140Aa0cD5Ab",N[exports.ChainId.RINKEBY]="0xc778417E063141139Fce010982780140Aa0cD5Ab",N[exports.ChainId.GÖRLI]="0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",N[exports.ChainId.KOVAN]="0xd0A1E359811322d97991E03f863a0C30C2cF029C",N[exports.ChainId.ARBITRUM]="0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",N[exports.ChainId.ARBITRUM_TESTNET]="0xf8456e5e6A225C2C1D74D8C9a4cB2B1d5dc1153b",N[exports.ChainId.BSC]="0x2170Ed0880ac9A755fd29B2688956BD959F933F8",N[exports.ChainId.FANTOM]="0x74b23882a30290451A17c44f4F05243b6b58C76d",N[exports.ChainId.MATIC]="0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",N[exports.ChainId.OKEX]="0x2170Ed0880ac9A755fd29B2688956BD959F933F8",N[exports.ChainId.HECO]="0x64FF637fB478863B7468bc97D30a5bF3A428a1fD",N[exports.ChainId.HARMONY]="0x6983D1E6DEf3690C4d616b13597A09e6193EA013",N[exports.ChainId.XDAI]="0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1",N[exports.ChainId.AVALANCHE]="0xf20d962a6c8f70c731bd838a3a388D7d48fA6e15",N),ce=((O={})[exports.ChainId.MAINNET]=ue[exports.ChainId.MAINNET],O[exports.ChainId.ROPSTEN]=ue[exports.ChainId.ROPSTEN],O[exports.ChainId.RINKEBY]=ue[exports.ChainId.RINKEBY],O[exports.ChainId.GÖRLI]=ue[exports.ChainId.GÖRLI],O[exports.ChainId.KOVAN]=ue[exports.ChainId.KOVAN],O[exports.ChainId.ARBITRUM]=ue[exports.ChainId.ARBITRUM],O[exports.ChainId.ARBITRUM_TESTNET]=ue[exports.ChainId.ARBITRUM_TESTNET],O[exports.ChainId.FANTOM]="0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",O[exports.ChainId.FANTOM_TESTNET]="0xf1277d1Ed8AD466beddF92ef448A132661956621",O[exports.ChainId.MATIC]="0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",O[exports.ChainId.MATIC_TESTNET]="0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",O[exports.ChainId.XDAI]="0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",O[exports.ChainId.BSC]="0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",O[exports.ChainId.BSC_TESTNET]="0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd",O[exports.ChainId.MOONBEAM_TESTNET]="0xe73763DB808ecCDC0E36bC8E32510ED126910394",O[exports.ChainId.AVALANCHE]="0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",O[exports.ChainId.AVALANCHE_TESTNET]="0xd00ae08403B9bbb9124bB305C09058E32C39A48c",O[exports.ChainId.HECO]="0x5545153CCFcA01fbd7Dd11C0b23ba694D9509A6F",O[exports.ChainId.HECO_TESTNET]="0x5B2DA6F42CA09C77D577a12BeaD0446148830687",O[exports.ChainId.HARMONY]="0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a",O[exports.ChainId.HARMONY_TESTNET]="0x7a2afac38517d512E55C0bCe3b6805c10a04D60F",O[exports.ChainId.OKEX]="0x8F8526dbfd6E38E3D8307702cA8469Bae6C56C15",O[exports.ChainId.OKEX_TESTNET]="0x2219845942d28716c0F7C605765fABDcA1a7d9E0",O[exports.ChainId.CELO]="0x471EcE3750Da237f93B8E339c536989b8978a438",O[exports.ChainId.PALM]="0xF98cABF0a963452C5536330408B2590567611a71",O[exports.ChainId.MOONRIVER]="0xf50225a84382c74CbdeA10b0c176f71fc3DE0C4d",O),pe=((S={})[exports.ChainId.MAINNET]="0xEF0881eC094552b2e128Cf945EF17a6752B4Ec5d",S),he=((D={})[exports.ChainId.MAINNET]="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",D[exports.ChainId.GÖRLI]="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",D[exports.ChainId.ROPSTEN]="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",D[exports.ChainId.RINKEBY]="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",D),Te=((B={})[exports.ChainId.MAINNET]="0xcff6eF0B9916682B37D80c19cFF8949bc1886bC2",B[exports.ChainId.ROPSTEN]="0xcff6eF0B9916682B37D80c19cFF8949bc1886bC2",B),Ce=((R={})[exports.ChainId.MAINNET]="0xcBE6B83e77cdc011Cc18F6f0Df8444E5783ed982",R[exports.ChainId.ROPSTEN]="0x84d1f7202e0e7dac211617017ca72a2cb5e2b955",R),be=((g={})[exports.ChainId.MAINNET]="0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696",g[exports.ChainId.ROPSTEN]="0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696",g[exports.ChainId.RINKEBY]="0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696",g[exports.ChainId.GÖRLI]="0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696",g[exports.ChainId.KOVAN]="0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696",g[exports.ChainId.ARBITRUM]="0x80C7DD17B01855a6D2347444a0FCC36136a314de",g[exports.ChainId.ARBITRUM_TESTNET]="0xa501c031958F579dB7676fF1CE78AD305794d579",g[exports.ChainId.CELO]="0x9aac9048fC8139667D6a2597B902865bfdc225d3",g[exports.ChainId.FANTOM]="0x22D4cF72C45F8198CfbF4B568dBdB5A85e8DC0B5",g[exports.ChainId.FANTOM_TESTNET]="",g[exports.ChainId.MATIC]="0x02817C1e3543c2d908a590F5dB6bc97f933dB4BD",g[exports.ChainId.MATIC_TESTNET]="",g[exports.ChainId.XDAI]="0x67dA5f2FfaDDfF067AB9d5F025F8810634d84287",g[exports.ChainId.BSC]="0xa9193376D09C7f31283C54e56D013fCF370Cd9D9",g[exports.ChainId.BSC_TESTNET]="",g[exports.ChainId.MOONBEAM_TESTNET]="",g[exports.ChainId.AVALANCHE]="0xdDCbf776dF3dE60163066A5ddDF2277cB445E0F3",g[exports.ChainId.AVALANCHE_TESTNET]="",g[exports.ChainId.HECO]="0xdDCbf776dF3dE60163066A5ddDF2277cB445E0F3",g[exports.ChainId.HECO_TESTNET]="",g[exports.ChainId.HARMONY]="0xdDCbf776dF3dE60163066A5ddDF2277cB445E0F3",g[exports.ChainId.HARMONY_TESTNET]="",g[exports.ChainId.OKEX]="0xF4d73326C13a4Fc5FD7A064217e12780e9Bd62c3",g[exports.ChainId.OKEX_TESTNET]="",g[exports.ChainId.PALM]="0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",g[exports.ChainId.MOONRIVER]="0x270f2F35bED92B7A59eA5F08F6B3fd34c8D9D9b5",g),Ie=_.BigNumber.from("700000000000000000"),Ee=_.BigNumber.from("800000000000000000"),xe=_.BigNumber.from("1000000000000000000"),le=_.BigNumber.from("1000000000000000000"),Ae=le.sub(Ee),me=_.BigNumber.from(317097920).mul(_.BigNumber.from(60)).mul(_.BigNumber.from(60)).mul(_.BigNumber.from(24)).mul(_.BigNumber.from(365)),ye=_.BigNumber.from(79274480).mul(_.BigNumber.from(60)).mul(_.BigNumber.from(60)).mul(_.BigNumber.from(24)).mul(_.BigNumber.from(365)),ve=_.BigNumber.from(31709792e4).mul(_.BigNumber.from(60)).mul(_.BigNumber.from(60)).mul(_.BigNumber.from(24)).mul(_.BigNumber.from(365)),Ne=_.BigNumber.from("28800000000000000000000000000000000000000"),Oe=_.BigNumber.from("1000000000000000000"),Se=_.BigNumber.from("10000"),De=_.BigNumber.from("100000");function Be(e,f,t,n,r,i,a){try{var o=e[i](a),s=o.value}catch(e){return void t(e)}o.done?f(s):Promise.resolve(s).then(n,r)}function Re(e){return function(){var f=this,t=arguments;return new Promise((function(n,r){var i=e.apply(f,t);function a(e){Be(i,n,r,a,o,"next",e)}function o(e){Be(i,n,r,a,o,"throw",e)}a(void 0)}))}}function ge(e,f){for(var t=0;t<f.length;t++){var n=f[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Me(e,f,t){return f&&ge(e.prototype,f),t&&ge(e,t),e}function _e(){return(_e=Object.assign||function(e){for(var f=1;f<arguments.length;f++){var t=arguments[f];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function Fe(e,f){e.prototype=Object.create(f.prototype),e.prototype.constructor=e,ke(e,f)}function Pe(e){return(Pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ke(e,f){return(ke=Object.setPrototypeOf||function(e,f){return e.__proto__=f,e})(e,f)}function we(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Le(e,f,t){return(Le=we()?Reflect.construct:function(e,f,t){var n=[null];n.push.apply(n,f);var r=new(Function.bind.apply(e,n));return t&&ke(r,t.prototype),r}).apply(null,arguments)}function qe(e){var f="function"==typeof Map?new Map:void 0;return(qe=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==f){if(f.has(e))return f.get(e);f.set(e,t)}function t(){return Le(e,arguments,Pe(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),ke(t,e)})(e)}function He(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ue(e,f){(null==f||f>e.length)&&(f=e.length);for(var t=0,n=new Array(f);t<f;t++)n[t]=e[t];return n}function Ke(e,f){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,f){if(e){if("string"==typeof e)return Ue(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ue(e,void 0):void 0}}(e))||f&&e&&"number"==typeof e.length){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Ve=function(e,f,t,n){Number.isSafeInteger(e)||F(!1),f>=0&&f<255&&Number.isInteger(f)||F(!1),this.chainId=e,this.decimals=f,this.symbol=t,this.name=n},Xe=function(e){function f(){var f;return(f=e.apply(this,arguments)||this).isNative=!0,f.isToken=!1,f}return Fe(f,e),f}(Ve);function We(e){try{return P.getAddress(e)}catch(e){F(!1)}}var Ye,Ge,je,Ze=function(e){function f(f,t,n,r,i){var a;return(a=e.call(this,f,n,r,i)||this).isNative=!1,a.isToken=!0,a.chainId=f,a.address=We(t),a}Fe(f,e);var t=f.prototype;return t.equals=function(e){return e.isToken&&this.chainId===e.chainId&&this.address===e.address},t.sortsBefore=function(e){return this.chainId!==e.chainId&&F(!1),this.address===e.address&&F(!1),this.address.toLowerCase()<e.address.toLowerCase()},Me(f,[{key:"wrapped",get:function(){return this}}]),f}(Ve),Qe=((Ye={})[exports.ChainId.MAINNET]=new Ze(exports.ChainId.MAINNET,Y[exports.ChainId.MAINNET],6,"USDC","USD Coin"),Ye[exports.ChainId.ROPSTEN]=new Ze(exports.ChainId.ROPSTEN,Y[exports.ChainId.ROPSTEN],6,"USDC","USD Coin"),Ye[exports.ChainId.KOVAN]=new Ze(exports.ChainId.KOVAN,Y[exports.ChainId.KOVAN],6,"USDC","USD Coin"),Ye[exports.ChainId.MATIC]=new Ze(exports.ChainId.MATIC,Y[exports.ChainId.MATIC],6,"USDC","USD Coin"),Ye[exports.ChainId.FANTOM]=new Ze(exports.ChainId.FANTOM,Y[exports.ChainId.FANTOM],6,"USDC","USD Coin"),Ye[exports.ChainId.BSC]=new Ze(exports.ChainId.BSC,Y[exports.ChainId.BSC],18,"USDC","USD Coin"),Ye[exports.ChainId.HARMONY]=new Ze(exports.ChainId.HARMONY,Y[exports.ChainId.HARMONY],6,"USDC","USD Coin"),Ye[exports.ChainId.HECO]=new Ze(exports.ChainId.HECO,Y[exports.ChainId.HECO],6,"USDC","USD Coin"),Ye[exports.ChainId.OKEX]=new Ze(exports.ChainId.OKEX,Y[exports.ChainId.OKEX],18,"USDC","USD Coin"),Ye[exports.ChainId.XDAI]=new Ze(exports.ChainId.XDAI,Y[exports.ChainId.XDAI],6,"USDC","USD Coin"),Ye[exports.ChainId.ARBITRUM]=new Ze(exports.ChainId.ARBITRUM,Y[exports.ChainId.ARBITRUM],6,"USDC","USD Coin"),Ye),Je=((Ge={})[exports.ChainId.MAINNET]=new Ze(exports.ChainId.MAINNET,ue[exports.ChainId.MAINNET],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.ROPSTEN]=new Ze(exports.ChainId.ROPSTEN,ue[exports.ChainId.ROPSTEN],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.RINKEBY]=new Ze(exports.ChainId.RINKEBY,ue[exports.ChainId.RINKEBY],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.GÖRLI]=new Ze(exports.ChainId.GÖRLI,ue[exports.ChainId.GÖRLI],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.KOVAN]=new Ze(exports.ChainId.KOVAN,ue[exports.ChainId.KOVAN],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.ARBITRUM]=new Ze(exports.ChainId.ARBITRUM,ue[exports.ChainId.ARBITRUM],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.ARBITRUM_TESTNET]=new Ze(exports.ChainId.ARBITRUM_TESTNET,ue[exports.ChainId.ARBITRUM_TESTNET],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.BSC]=new Ze(exports.ChainId.BSC,ue[exports.ChainId.BSC],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.FANTOM]=new Ze(exports.ChainId.FANTOM,ue[exports.ChainId.FANTOM],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.MATIC]=new Ze(exports.ChainId.MATIC,ue[exports.ChainId.MATIC],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.OKEX]=new Ze(exports.ChainId.OKEX,ue[exports.ChainId.OKEX],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.HECO]=new Ze(exports.ChainId.HECO,ue[exports.ChainId.HECO],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.HARMONY]=new Ze(exports.ChainId.HARMONY,ue[exports.ChainId.HARMONY],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.XDAI]=new Ze(exports.ChainId.XDAI,ue[exports.ChainId.XDAI],18,"WETH","Wrapped Ether"),Ge[exports.ChainId.AVALANCHE]=new Ze(exports.ChainId.AVALANCHE,ue[exports.ChainId.AVALANCHE],18,"WETH","Wrapped Ether"),Ge),ze=((je={})[exports.ChainId.MAINNET]=Je[exports.ChainId.MAINNET],je[exports.ChainId.ROPSTEN]=Je[exports.ChainId.ROPSTEN],je[exports.ChainId.RINKEBY]=Je[exports.ChainId.RINKEBY],je[exports.ChainId.GÖRLI]=Je[exports.ChainId.GÖRLI],je[exports.ChainId.KOVAN]=Je[exports.ChainId.KOVAN],je[exports.ChainId.FANTOM]=new Ze(exports.ChainId.FANTOM,ce[exports.ChainId.FANTOM],18,"WFTM","Wrapped FTM"),je[exports.ChainId.FANTOM_TESTNET]=new Ze(exports.ChainId.FANTOM_TESTNET,ce[exports.ChainId.FANTOM_TESTNET],18,"FTM","Wrapped FTM"),je[exports.ChainId.MATIC]=new Ze(exports.ChainId.MATIC,ce[exports.ChainId.MATIC],18,"WMATIC","Wrapped Matic"),je[exports.ChainId.MATIC_TESTNET]=new Ze(exports.ChainId.MATIC_TESTNET,ce[exports.ChainId.MATIC_TESTNET],18,"WMATIC","Wrapped Matic"),je[exports.ChainId.XDAI]=new Ze(exports.ChainId.XDAI,ce[exports.ChainId.XDAI],18,"WXDAI","Wrapped xDai"),je[exports.ChainId.BSC]=new Ze(exports.ChainId.BSC,ce[exports.ChainId.BSC],18,"WBNB","Wrapped BNB"),je[exports.ChainId.BSC_TESTNET]=new Ze(exports.ChainId.BSC_TESTNET,ce[exports.ChainId.BSC_TESTNET],18,"WBNB","Wrapped BNB"),je[exports.ChainId.ARBITRUM]=Je[exports.ChainId.ARBITRUM],je[exports.ChainId.ARBITRUM_TESTNET]=Je[exports.ChainId.ARBITRUM_TESTNET],je[exports.ChainId.MOONBEAM_TESTNET]=new Ze(exports.ChainId.MOONBEAM_TESTNET,ce[exports.ChainId.MOONBEAM_TESTNET],18,"WETH","Wrapped Ether"),je[exports.ChainId.AVALANCHE]=new Ze(exports.ChainId.AVALANCHE,ce[exports.ChainId.AVALANCHE],18,"WAVAX","Wrapped AVAX"),je[exports.ChainId.AVALANCHE_TESTNET]=new Ze(exports.ChainId.AVALANCHE_TESTNET,ce[exports.ChainId.AVALANCHE_TESTNET],18,"WAVAX","Wrapped AVAX"),je[exports.ChainId.HECO]=new Ze(exports.ChainId.HECO,ce[exports.ChainId.HECO],18,"WHT","Wrapped HT"),je[exports.ChainId.HECO_TESTNET]=new Ze(exports.ChainId.HECO_TESTNET,ce[exports.ChainId.HECO_TESTNET],18,"WHT","Wrapped HT"),je[exports.ChainId.HARMONY]=new Ze(exports.ChainId.HARMONY,ce[exports.ChainId.HARMONY],18,"WONE","Wrapped ONE"),je[exports.ChainId.HARMONY_TESTNET]=new Ze(exports.ChainId.HARMONY_TESTNET,ce[exports.ChainId.HARMONY_TESTNET],18,"WONE","Wrapped ONE"),je[exports.ChainId.OKEX]=new Ze(exports.ChainId.OKEX,ce[exports.ChainId.OKEX],18,"WOKT","Wrapped OKExChain"),je[exports.ChainId.OKEX_TESTNET]=new Ze(exports.ChainId.OKEX_TESTNET,ce[exports.ChainId.OKEX_TESTNET],18,"WOKT","Wrapped OKExChain"),je[exports.ChainId.CELO]=new Ze(exports.ChainId.CELO,ce[exports.ChainId.CELO],18,"CELO","Celo"),je[exports.ChainId.PALM]=new Ze(exports.ChainId.PALM,ce[exports.ChainId.PALM],18,"WPALM","Wrapped Palm"),je[exports.ChainId.MOONRIVER]=new Ze(exports.ChainId.MOONRIVER,ce[exports.ChainId.MOONRIVER],18,"WMOVR","Wrapped Moonriver"),je),$e=function(e){function f(f){return e.call(this,f,18,"AVAX","Avalanche")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._cache[e])?t:this._cache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=ze[this.chainId];return e||F(!1),e}}]),f}(Xe);$e._cache={};var ef=function(e){function f(f){return e.call(this,f,18,"BNB","Binance Coin")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._cache[e])?t:this._cache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=ze[this.chainId];return e||F(!1),e}}]),f}(Xe);ef._cache={};var ff=function(e){function f(f){return e.call(this,f,18,"CELO","Celo")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._cache[e])?t:this._cache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=ze[this.chainId];return e||F(!1),e}}]),f}(Xe);ff._cache={};var tf=function(e){function f(f){return e.call(this,f,18,"ETH","Ether")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._etherCache[e])?t:this._etherCache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=Je[this.chainId];return e||F(!1),e}}]),f}(Xe);tf._etherCache={};var nf=function(e){function f(f){return e.call(this,f,18,"FTM","Fantom")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._cache[e])?t:this._cache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=ze[this.chainId];return e||F(!1),e}}]),f}(Xe);nf._cache={};var rf=function(e){function f(f){return e.call(this,f,18,"ONE","Harmony")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._cache[e])?t:this._cache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=ze[this.chainId];return e||F(!1),e}}]),f}(Xe);rf._cache={};var af=function(e){function f(f){return e.call(this,f,18,"HT","Huobi Token")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._cache[e])?t:this._cache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=ze[this.chainId];return e||F(!1),e}}]),f}(Xe);af._cache={};var of=function(e){function f(f){return e.call(this,f,18,"MATIC","Matic")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._cache[e])?t:this._cache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=ze[this.chainId];return e||F(!1),e}}]),f}(Xe);of._cache={};var sf=function(e){function f(f){return e.call(this,f,18,"MOVR","Moonriver")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._cache[e])?t:this._cache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=ze[this.chainId];return e||F(!1),e}}]),f}(Xe);sf._cache={};var df=function(e){function f(f){return e.call(this,f,18,"OKT","OKExChain")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._cache[e])?t:this._cache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=ze[this.chainId];return e||F(!1),e}}]),f}(Xe);df._cache={};var uf=function(e){function f(f){return e.call(this,f,18,"XDAI","xDai")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._cache[e])?t:this._cache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=ze[this.chainId];return e||F(!1),e}}]),f}(Xe);uf._cache={};var cf,pf=function(e){function f(f){return e.call(this,f,18,"PALM","Palm")||this}return Fe(f,e),f.onChain=function(e){var t;return null!=(t=this._cache[e])?t:this._cache[e]=new f(e)},f.prototype.equals=function(e){return e.isNative&&e.chainId===this.chainId},Me(f,[{key:"wrapped",get:function(){var e=ze[this.chainId];return e||F(!1),e}}]),f}(Xe);pf._cache={};var hf,Tf,Cf=((cf={})[exports.ChainId.MAINNET]=tf.onChain(exports.ChainId.MAINNET),cf[exports.ChainId.ROPSTEN]=tf.onChain(exports.ChainId.ROPSTEN),cf[exports.ChainId.RINKEBY]=tf.onChain(exports.ChainId.RINKEBY),cf[exports.ChainId.GÖRLI]=tf.onChain(exports.ChainId.GÖRLI),cf[exports.ChainId.KOVAN]=tf.onChain(exports.ChainId.KOVAN),cf[exports.ChainId.FANTOM]=nf.onChain(exports.ChainId.FANTOM),cf[exports.ChainId.FANTOM_TESTNET]=nf.onChain(exports.ChainId.FANTOM_TESTNET),cf[exports.ChainId.MATIC]=of.onChain(exports.ChainId.MATIC),cf[exports.ChainId.MATIC_TESTNET]=of.onChain(exports.ChainId.MATIC_TESTNET),cf[exports.ChainId.XDAI]=uf.onChain(exports.ChainId.XDAI),cf[exports.ChainId.BSC]=ef.onChain(exports.ChainId.BSC),cf[exports.ChainId.BSC_TESTNET]=ef.onChain(exports.ChainId.BSC_TESTNET),cf[exports.ChainId.ARBITRUM]=tf.onChain(exports.ChainId.ARBITRUM),cf[exports.ChainId.AVALANCHE]=$e.onChain(exports.ChainId.AVALANCHE),cf[exports.ChainId.AVALANCHE_TESTNET]=$e.onChain(exports.ChainId.AVALANCHE_TESTNET),cf[exports.ChainId.HECO]=af.onChain(exports.ChainId.HECO),cf[exports.ChainId.HECO_TESTNET]=af.onChain(exports.ChainId.HECO_TESTNET),cf[exports.ChainId.HARMONY]=rf.onChain(exports.ChainId.HARMONY),cf[exports.ChainId.HARMONY_TESTNET]=rf.onChain(exports.ChainId.HARMONY_TESTNET),cf[exports.ChainId.OKEX]=df.onChain(exports.ChainId.OKEX),cf[exports.ChainId.OKEX_TESTNET]=df.onChain(exports.ChainId.OKEX_TESTNET),cf[exports.ChainId.CELO]=ff.onChain(exports.ChainId.CELO),cf[exports.ChainId.PALM]=pf.onChain(exports.ChainId.PALM),cf[exports.ChainId.MOONRIVER]=sf.onChain(exports.ChainId.MOONRIVER),cf),bf=M.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),If=M.BigInt(0),Ef=M.BigInt(1),xf=M.BigInt(2),lf=M.BigInt(3),Af=M.BigInt(5),mf=M.BigInt(10),yf=M.BigInt(100),vf=M.BigInt(997),Nf=M.BigInt(1e3),Of="0x8f0e7bd0f6fa7c615890ae2cd01935a8f7a878199761c93b3cd0ffca4486d84d",Sf=M.BigInt(1e3);(Tf=exports.SolidityType||(exports.SolidityType={})).uint8="uint8",Tf.uint256="uint256";var Df,Bf,Rf=((hf={})[exports.SolidityType.uint8]=M.BigInt("0xff"),hf[exports.SolidityType.uint256]=M.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),hf),gf="https://9epjsvomc4.execute-api.us-east-1.amazonaws.com/dev",Mf="setPrototypeOf"in Object,_f=function(e){function f(){var t;return(t=e.call(this)||this).isInsufficientReservesError=!0,t.name=t.constructor.name,Mf&&Object.setPrototypeOf(He(t),(this instanceof f?this.constructor:void 0).prototype),t}return Fe(f,e),f}(qe(Error)),Ff=function(e){function f(){var t;return(t=e.call(this)||this).isInsufficientInputAmountError=!0,t.name=t.constructor.name,Mf&&Object.setPrototypeOf(He(t),(this instanceof f?this.constructor:void 0).prototype),t}return Fe(f,e),f}(qe(Error)),Pf=L(w),kf=L(k);kf.strict=!0;var wf=((Df={})[exports.Rounding.ROUND_DOWN]=Pf.ROUND_DOWN,Df[exports.Rounding.ROUND_HALF_UP]=Pf.ROUND_HALF_UP,Df[exports.Rounding.ROUND_UP]=Pf.ROUND_UP,Df),Lf=((Bf={})[exports.Rounding.ROUND_DOWN]=0,Bf[exports.Rounding.ROUND_HALF_UP]=1,Bf[exports.Rounding.ROUND_UP]=3,Bf),qf=function(){function e(e,f){void 0===f&&(f=M.BigInt(1)),this.numerator=M.BigInt(e),this.denominator=M.BigInt(f)}e.tryParseFraction=function(f){if(f instanceof M||"number"==typeof f||"string"==typeof f)return new e(f);if("numerator"in f&&"denominator"in f)return f;throw new Error("Could not parse fraction")};var f=e.prototype;return f.invert=function(){return new e(this.denominator,this.numerator)},f.add=function(f){var t=e.tryParseFraction(f);return M.equal(this.denominator,t.denominator)?new e(M.add(this.numerator,t.numerator),this.denominator):new e(M.add(M.multiply(this.numerator,t.denominator),M.multiply(t.numerator,this.denominator)),M.multiply(this.denominator,t.denominator))},f.subtract=function(f){var t=e.tryParseFraction(f);return M.equal(this.denominator,t.denominator)?new e(M.subtract(this.numerator,t.numerator),this.denominator):new e(M.subtract(M.multiply(this.numerator,t.denominator),M.multiply(t.numerator,this.denominator)),M.multiply(this.denominator,t.denominator))},f.lessThan=function(f){var t=e.tryParseFraction(f);return M.lessThan(M.multiply(this.numerator,t.denominator),M.multiply(t.numerator,this.denominator))},f.equalTo=function(f){var t=e.tryParseFraction(f);return M.equal(M.multiply(this.numerator,t.denominator),M.multiply(t.numerator,this.denominator))},f.greaterThan=function(f){var t=e.tryParseFraction(f);return M.greaterThan(M.multiply(this.numerator,t.denominator),M.multiply(t.numerator,this.denominator))},f.multiply=function(f){var t=e.tryParseFraction(f);return new e(M.multiply(this.numerator,t.numerator),M.multiply(this.denominator,t.denominator))},f.divide=function(f){var t=e.tryParseFraction(f);return new e(M.multiply(this.numerator,t.denominator),M.multiply(this.denominator,t.numerator))},f.toSignificant=function(e,f,t){void 0===f&&(f={groupSeparator:""}),void 0===t&&(t=exports.Rounding.ROUND_HALF_UP),Number.isInteger(e)||F(!1),e>0||F(!1),Pf.set({precision:e+1,rounding:wf[t]});var n=new Pf(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e);return n.toFormat(n.decimalPlaces(),f)},f.toFixed=function(e,f,t){return void 0===f&&(f={groupSeparator:""}),void 0===t&&(t=exports.Rounding.ROUND_HALF_UP),Number.isInteger(e)||F(!1),e>=0||F(!1),kf.DP=e,kf.RM=Lf[t],new kf(this.numerator.toString()).div(this.denominator.toString()).toFormat(e,f)},Me(e,[{key:"quotient",get:function(){return M.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new e(M.remainder(this.numerator,this.denominator),this.denominator)}},{key:"asFraction",get:function(){return new e(this.numerator,this.denominator)}}]),e}(),Hf=L(k);Hf.strict=!0;var Uf=function(e){function f(f,t,n){var r;return r=e.call(this,t,n)||this,M.lessThanOrEqual(r.quotient,bf)||F(!1),r.currency=f,r.decimalScale=M.exponentiate(M.BigInt(10),M.BigInt(f.decimals)),r}Fe(f,e),f.fromRawAmount=function(e,t){return new f(e,t)},f.fromFractionalAmount=function(e,t,n){return new f(e,t,n)};var t=f.prototype;return t.add=function(t){this.currency.equals(t.currency)||F(!1);var n=e.prototype.add.call(this,t);return f.fromFractionalAmount(this.currency,n.numerator,n.denominator)},t.subtract=function(t){this.currency.equals(t.currency)||F(!1);var n=e.prototype.subtract.call(this,t);return f.fromFractionalAmount(this.currency,n.numerator,n.denominator)},t.multiply=function(t){var n=e.prototype.multiply.call(this,t);return f.fromFractionalAmount(this.currency,n.numerator,n.denominator)},t.divide=function(t){var n=e.prototype.divide.call(this,t);return f.fromFractionalAmount(this.currency,n.numerator,n.denominator)},t.toSignificant=function(f,t,n){return void 0===f&&(f=6),void 0===n&&(n=exports.Rounding.ROUND_DOWN),e.prototype.divide.call(this,this.decimalScale).toSignificant(f,t,n)},t.toFixed=function(f,t,n){return void 0===f&&(f=this.currency.decimals),void 0===n&&(n=exports.Rounding.ROUND_DOWN),f<=this.currency.decimals||F(!1),e.prototype.divide.call(this,this.decimalScale).toFixed(f,t,n)},t.toExact=function(e){return void 0===e&&(e={groupSeparator:""}),Hf.DP=this.currency.decimals,new Hf(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(e)},Me(f,[{key:"wrapped",get:function(){return this.currency.isToken?this:f.fromFractionalAmount(this.currency.wrapped,this.numerator,this.denominator)}}]),f}(qf),Kf=function(e){function f(){for(var f,t,n,r,i,a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];if(4===o.length)t=o[0],n=o[1],r=o[2],i=o[3];else{var d=o[0].quoteAmount.divide(o[0].baseAmount),u=[o[0].baseAmount.currency,o[0].quoteAmount.currency,d.denominator,d.numerator];t=u[0],n=u[1],r=u[2],i=u[3]}return(f=e.call(this,i,r)||this).baseCurrency=t,f.quoteCurrency=n,f.scalar=new qf(M.exponentiate(M.BigInt(10),M.BigInt(t.decimals)),M.exponentiate(M.BigInt(10),M.BigInt(n.decimals))),f}Fe(f,e);var t=f.prototype;return t.invert=function(){return new f(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},t.multiply=function(t){this.quoteCurrency.equals(t.baseCurrency)||F(!1);var n=e.prototype.multiply.call(this,t);return new f(this.baseCurrency,t.quoteCurrency,n.denominator,n.numerator)},t.quote=function(f){f.currency.equals(this.baseCurrency)||F(!1);var t=e.prototype.multiply.call(this,f);return Uf.fromFractionalAmount(this.quoteCurrency,t.numerator,t.denominator)},t.toSignificant=function(e,f,t){return void 0===e&&(e=6),this.adjustedForDecimals.toSignificant(e,f,t)},t.toFixed=function(e,f,t){return void 0===e&&(e=4),this.adjustedForDecimals.toFixed(e,f,t)},Me(f,[{key:"adjustedForDecimals",get:function(){return e.prototype.multiply.call(this,this.scalar)}}]),f}(qf),Vf=function(e){return q.keccak256(["bytes"],[q.pack(["bytes","bytes"],[e.creationCode,H.defaultAbiCoder.encode(["bytes","address"],[e.deployData,e.masterDeployerAddress])])])},Xf=function(e){var f=e.factoryAddress,t=e.tokenA,n=e.tokenB,r=e.fee,i=e.twap,a=t.sortsBefore(n)?[t,n]:[n,t],o=H.defaultAbiCoder.encode(["address","address","uint256","bool"],[].concat([a[0].address,a[1].address].sort(),[r,i])),s=Vf({creationCode:"0x6101806040523480156200001257600080fd5b5060405162004195380380620041958339810160408190526200003591620005d2565b604080518082018252600e81526d29bab9b434902628102a37b5b2b760911b6020918201528151808301835260018152603160f81b9082015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f918101919091527fc2bf45081e840722410522aa366600d7fe4da5bfb5a5b417f4d5125b4ed180a4918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015246608082018190523060a08301529060c0016040516020818303038152906040528051906020012060808181525050506000806000808580602001905181019062000132919062000572565b929650909450925090506001600160a01b038416620001875760405162461bcd60e51b815260206004820152600c60248201526b5a45524f5f4144445245535360a01b60448201526064015b60405180910390fd5b826001600160a01b0316846001600160a01b03161415620001eb5760405162461bcd60e51b815260206004820152601360248201527f4944454e544943414c5f4144445245535345530000000000000000000000000060448201526064016200017e565b6001600160a01b038416301415620002365760405162461bcd60e51b815260206004820152600d60248201526c24a72b20a624a22faa27a5a2a760991b60448201526064016200017e565b6001600160a01b038316301415620002815760405162461bcd60e51b815260206004820152600d60248201526c24a72b20a624a22faa27a5a2a760991b60448201526064016200017e565b612710821115620002c85760405162461bcd60e51b815260206004820152601060248201526f494e56414c49445f535741505f46454560801b60448201526064016200017e565b60408051600481526024810182526020810180516001600160e01b03166360a56c0160e11b17905290516000916001600160a01b038816916200030c9190620006b9565b600060405180830381855afa9150503d806000811462000349576040519150601f19603f3d011682016040523d82523d6000602084013e6200034e565b606091505b5060408051600481526024810182526020810180516001600160e01b0316630605066960e11b1790529051919350600092506001600160a01b03891691620003979190620006b9565b600060405180830381855afa9150503d8060008114620003d4576040519150601f19603f3d011682016040523d82523d6000602084013e620003d9565b606091505b5060408051600481526024810182526020810180516001600160e01b0316634da3182760e01b1790529051919350600092506001600160a01b038a1691620004229190620006b9565b600060405180830381855afa9150503d80600081146200045f576040519150601f19603f3d011682016040523d82523d6000602084013e62000464565b606091505b506001600160601b031960608a811b82166101405289901b166101605260a087905261271087900360c0528451909250620004aa9150840160209081019085016200069f565b6004558151620004c490830160209081019084016200054b565b60601b6001600160601b03191660e0528051620004eb90602090830181019083016200054b565b6001600160601b0319606091821b8116610100529089901b1661012052600160095583156200052a57600880546001600160e01b0316600160e01b1790555b50505050505050505062000739565b8051620005468162000720565b919050565b6000602082840312156200055e57600080fd5b81516200056b8162000720565b9392505050565b600080600080608085870312156200058957600080fd5b8451620005968162000720565b6020860151909450620005a98162000720565b6040860151606087015191945092508015158114620005c757600080fd5b939692955090935050565b60008060408385031215620005e657600080fd5b82516001600160401b0380821115620005fe57600080fd5b818501915085601f8301126200061357600080fd5b8151818111156200062857620006286200070a565b604051601f8201601f19908116603f011681019083821181831017156200065357620006536200070a565b816040528281528860208487010111156200066d57600080fd5b62000680836020830160208801620006d7565b8096505050505050620006966020840162000539565b90509250929050565b600060208284031215620006b257600080fd5b5051919050565b60008251620006cd818460208701620006d7565b9190910192915050565b60005b83811015620006f4578181015183820152602001620006da565b8381111562000704576000848401525b50505050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200073657600080fd5b50565b60805160a05160c05160e05160601c6101005160601c6101205160601c6101405160601c6101605160601c61390062000895600039600081816105b301528181610791015281816108c00152818161096e01528181610ff6015281816110fe01528181611336015281816113a5015281816115e701528181611fc30152818161204a01526129e701526000818161032e0152818161070d01528181610a5301528181610b8201528181610fca01528181611095015281816112e2015281816114860152818161157901528181611d24015281816120830152818161216e01526128e801526000818161058c015281816118070152611c240152600081816103f901528181612650015281816127c6015281816128ac0152612a900152600081816102e20152612eb3015260006125520152600081816104200152818161315501526131c00152600081816103d2015261233901526139006000f3fe608060405234801561001057600080fd5b506004361061020b5760003560e01c8063627dd56a1161012a578063a69840a8116100bd578063c14ad8021161008c578063d21220a711610071578063d21220a7146105ae578063d505accf146105d5578063dd62ed3e146105e857600080fd5b8063c14ad8021461057e578063cf58879a1461058757600080fd5b8063a69840a81461051e578063a8f1f52e14610545578063a9059cbb14610558578063af8c09bf1461056b57600080fd5b80637ba0e2e7116100f95780637ba0e2e7146104a55780637ecebe00146104b857806392bc3219146104d857806395d89b41146104e257600080fd5b8063627dd56a1461045457806367e4ac2c1461046757806370a082311461047c5780637464fc3d1461049c57600080fd5b80632a07b6c7116101a25780634da31827116101715780634da31827146103f457806354cf2aeb1461041b5780635909c0d5146104425780635a3d54931461044b57600080fd5b80632a07b6c71461036c57806330adf81f1461038c578063313ce567146103b35780633644e515146103cd57600080fd5b80630c0a0cd2116101de5780630c0a0cd2146102dd5780630dfe16811461032957806318160ddd1461035057806323b872dd1461035957600080fd5b8063053da1c81461021057806306fdde03146102365780630902f1ac1461027f578063095ea7b3146102ba575b600080fd5b61022361021e366004613566565b610613565b6040519081526020015b60405180910390f35b6102726040518060400160405280600e81526020017f5375736869204c5020546f6b656e00000000000000000000000000000000000081525081565b60405161022d9190613716565b610287610c3e565b604080516dffffffffffffffffffffffffffff948516815293909216602084015263ffffffff169082015260600161022d565b6102cd6102c8366004613449565b610ca7565b604051901515815260200161022d565b6103047f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161022d565b6103047f000000000000000000000000000000000000000000000000000000000000000081565b61022360005481565b6102cd6103673660046134ae565b610d20565b61037f61037a366004613566565b610e6c565b60405161022d91906136b1565b6102237f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6103bb601281565b60405160ff909116815260200161022d565b6102237f000000000000000000000000000000000000000000000000000000000000000081565b6103047f000000000000000000000000000000000000000000000000000000000000000081565b6102237f000000000000000000000000000000000000000000000000000000000000000081565b61022360055481565b61022360065481565b610223610462366004613566565b6111e1565b61046f611557565b60405161022d9190613657565b61022361048a36600461327d565b60016020526000908152604090205481565b61022360075481565b6102236104b3366004613566565b611656565b6102236104c636600461327d565b60036020526000908152604090205481565b6104e0611bb2565b005b6102726040518060400160405280600381526020017f534c50000000000000000000000000000000000000000000000000000000000081525081565b6102237f54726964656e743a436f6e7374616e7450726f6475637400000000000000000081565b610223610553366004613566565b611cad565b6102cd610566366004613449565b611de0565b610223610579366004613566565b611e65565b61022360045481565b6103047f000000000000000000000000000000000000000000000000000000000000000081565b6103047f000000000000000000000000000000000000000000000000000000000000000081565b6104e06105e33660046134ef565b61220e565b6102236105f6366004613475565b600260209081526000928352604080842090915290825290205481565b6000600954600114610686576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f4c4f434b4544000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600260095560008080808061069d87890189613305565b9450945094509450945060008060006107056008546dffffffffffffffffffffffffffff808216926e01000000000000000000000000000083049091169163ffffffff7c01000000000000000000000000000000000000000000000000000000009091041690565b9250925092507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16141561096c5761078a85846dffffffffffffffffffffffffffff16846dffffffffffffffffffffffffffff1661254a565b98506107b87f00000000000000000000000000000000000000000000000000000000000000008a89896125ad565b6040517fbd50c7b1000000000000000000000000000000000000000000000000000000008152339063bd50c7b1906107f4908790600401613716565b600060405180830381600087803b15801561080e57600080fd5b505af1158015610822573d6000803e3d6000fd5b505050506000806108316128a5565b9150915086856dffffffffffffffffffffffffffff16830310156108b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f494e53554646494349454e545f414d4f554e545f494e00000000000000000000604482015260640161067d565b6108be8282878787612b1d565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e460628a8f60405161095d929190918252602082015260400190565b60405180910390a45050610c2a565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614610a21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e56414c49445f494e5055545f544f4b454e00000000000000000000000000604482015260640161067d565b610a4c85836dffffffffffffffffffffffffffff16856dffffffffffffffffffffffffffff1661254a565b9850610a7a7f00000000000000000000000000000000000000000000000000000000000000008a89896125ad565b6040517fbd50c7b1000000000000000000000000000000000000000000000000000000008152339063bd50c7b190610ab6908790600401613716565b600060405180830381600087803b158015610ad057600080fd5b505af1158015610ae4573d6000803e3d6000fd5b50505050600080610af36128a5565b9150915086846dffffffffffffffffffffffffffff1682031015610b73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f494e53554646494349454e545f414d4f554e545f494e00000000000000000000604482015260640161067d565b610b808282878787612b1d565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e460628a8f604051610c1f929190918252602082015260400190565b60405180910390a450505b505060016009555094979650505050505050565b6000806000610c9c6008546dffffffffffffffffffffffffffff808216926e01000000000000000000000000000083049091169163ffffffff7c01000000000000000000000000000000000000000000000000000000009091041690565b925092509250909192565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610d0f9086815260200190565b60405180910390a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610dbd5773ffffffffffffffffffffffffffffffffffffffff8416600090815260026020908152604080832033845290915281208054849290610db7908490613792565b90915550505b73ffffffffffffffffffffffffffffffffffffffff841660009081526001602052604081208054849290610df2908490613792565b909155505073ffffffffffffffffffffffffffffffffffffffff808416600081815260016020526040908190208054860190555190918616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610e5a9086815260200190565b60405180910390a35060019392505050565b6060600954600114610eda576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f4c4f434b45440000000000000000000000000000000000000000000000000000604482015260640161067d565b6002600955600080610eee84860186613414565b915091506000806000610f506008546dffffffffffffffffffffffffffff808216926e01000000000000000000000000000083049091169163ffffffff7c01000000000000000000000000000000000000000000000000000000009091041690565b925092509250600080610f616128a5565b60008054308252600160205260409091205492945090925090610f85878784612e33565b90910190600082610f968684613755565b610fa09190613741565b9050600083610faf8685613755565b610fb99190613741565b9050610fc53084612ee2565b610ff17f0000000000000000000000000000000000000000000000000000000000000000838d8d6125ad565b61101d7f0000000000000000000000000000000000000000000000000000000000000000828d8d6125ad565b8186039550808503945061103486868b8b8b612b1d565b6110466110418688613755565b612f75565b6007556040805160028082526060820190925290816020015b604080518082019091526000808252602082015281526020019060019003908161105f579050509b5060405180604001604052807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168152602001838152508c6000815181106110e6576110e6613847565b602002602001018190525060405180604001604052807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168152602001828152508c60018151811061114f5761114f613847565b60200260200101819052508a73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d8193649684846040516111c2929190918252602082015260400190565b60405180910390a35050600160095550979a9950505050505050505050565b600060095460011461124f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f4c4f434b45440000000000000000000000000000000000000000000000000000604482015260640161067d565b600260095560008080611264858701876132be565b92509250925060008060006112c86008546dffffffffffffffffffffffffffff808216926e01000000000000000000000000000083049091169163ffffffff7c01000000000000000000000000000000000000000000000000000000009091041690565b9250925092506000806112d96128a5565b915091506000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1614156113a3577f00000000000000000000000000000000000000000000000000000000000000009050866dffffffffffffffffffffffffffff168403915061139782886dffffffffffffffffffffffffffff16886dffffffffffffffffffffffffffff1661254a565b9a508a830392506114bf565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1614611458576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e56414c49445f494e5055545f544f4b454e00000000000000000000000000604482015260640161067d565b50506008546dffffffffffffffffffffffffffff6e01000000000000000000000000000090910481168203907f0000000000000000000000000000000000000000000000000000000000000000906114b7908390888116908a1661254a565b9a508a840393505b6114cb818c8b8b6125ad565b6114d88484898989612b1d565b8073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e46062858f604051610c1f929190918252602082015260400190565b60408051600280825260608083018452926020830190803683370190505090507f0000000000000000000000000000000000000000000000000000000000000000816000815181106115ab576115ab613847565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250507f00000000000000000000000000000000000000000000000000000000000000008160018151811061161957611619613847565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505090565b60006009546001146116c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f4c4f434b45440000000000000000000000000000000000000000000000000000604482015260640161067d565b600260095560006116d78385018561327d565b905060008060006117376008546dffffffffffffffffffffffffffff808216926e01000000000000000000000000000083049091169163ffffffff7c01000000000000000000000000000000000000000000000000000000009091041690565b9250925092506000806117486128a5565b600054919350915061175b868683612e33565b0160006117786dffffffffffffffffffffffffffff881685613792565b905060006117966dffffffffffffffffffffffffffff881685613792565b90506000806117c784848c6dffffffffffffffffffffffffffff168c6dffffffffffffffffffffffffffff166130fa565b909250905060006117ef6117db8389613792565b6117e5858b613792565b6110419190613755565b905085611a705761180360006103e86131fd565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16637cd07e476040518163ffffffff1660e01b815260040160206040518083038186803b15801561186b57600080fd5b505afa15801561187f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a391906132a1565b90503373ffffffffffffffffffffffffffffffffffffffff821614156119dd578073ffffffffffffffffffffffffffffffffffffffff166340dc0e376040518163ffffffff1660e01b815260040160206040518083038186803b15801561190957600080fd5b505afa15801561191d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194191906135d8565b9d508d1580159061197257507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8e14155b6119d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4241445f444553495245445f4c49515549444954590000000000000000000000604482015260640161067d565b611a6a565b73ffffffffffffffffffffffffffffffffffffffff811615611a5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4f4e4c595f4d49475241544f5200000000000000000000000000000000000000604482015260640161067d565b611a676103e883613792565b9d505b50611ab8565b6000611a926110416dffffffffffffffffffffffffffff808e16908f16613755565b90508087611aa08285613792565b611aaa9190613755565b611ab49190613741565b9d50505b8c611b1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f494e53554646494349454e545f4c49515549444954595f4d494e544544000000604482015260640161067d565b611b298c8e6131fd565b611b3688888d8d8d612b1d565b611b43611041888a613755565b600755604080518681526020810186905273ffffffffffffffffffffffffffffffffffffffff8e169133917fdbba30eb0402b389513e87f51f4db2db80bed454384ec6925a24097c3548a02a91015b60405180910390a35050600160095550989b9a5050505050505050505050565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fc14ad80200000000000000000000000000000000000000000000000000000000179052905160009173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691611c4f919061363b565b600060405180830381855afa9150503d8060008114611c8a576040519150601f19603f3d011682016040523d82523d6000602084013e611c8f565b606091505b5091505080806020019051810190611ca791906135d8565b60045550565b60008080611cbd84860186613449565b91509150600080611d1d6008546dffffffffffffffffffffffffffff808216926e01000000000000000000000000000083049091169163ffffffff7c01000000000000000000000000000000000000000000000000000000009091041690565b50915091507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611da857611da183836dffffffffffffffffffffffffffff16836dffffffffffffffffffffffffffff1661254a565b9450611dd6565b611dd383826dffffffffffffffffffffffffffff16846dffffffffffffffffffffffffffff1661254a565b94505b5050505092915050565b33600090815260016020526040812080548391908390611e01908490613792565b909155505073ffffffffffffffffffffffffffffffffffffffff8316600081815260016020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610d0f9086815260200190565b6000600954600114611ed3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f4c4f434b45440000000000000000000000000000000000000000000000000000604482015260640161067d565b600260095560008080611ee8858701876132be565b9250925092506000806000611f4c6008546dffffffffffffffffffffffffffff808216926e01000000000000000000000000000083049091169163ffffffff7c01000000000000000000000000000000000000000000000000000000009091041690565b925092509250600080611f5d6128a5565b60008054308252600160205260409091205492945090925090611f81878784612e33565b90910190600082611f928684613755565b611f9c9190613741565b9050600083611fab8685613755565b611fb59190613741565b9050611fc13084612ee2565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff1614156120815761204482838b6dffffffffffffffffffffffffffff1603838b6dffffffffffffffffffffffffffff160361254a565b016120717f0000000000000000000000000000000000000000000000000000000000000000828d8d6125ad565b9b5050918a90039160008b6121a1565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff1614612136576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f494e56414c49445f4f55545055545f544f4b454e000000000000000000000000604482015260640161067d565b61216581828a6dffffffffffffffffffffffffffff1603848c6dffffffffffffffffffffffffffff160361254a565b820191506121957f0000000000000000000000000000000000000000000000000000000000000000838d8d6125ad565b509a50928a9003928a60005b6121ae86868b8b8b612b1d565b6121bb6110418688613755565b600755604080518381526020810183905273ffffffffffffffffffffffffffffffffffffffff8d169133917fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d819364969101611b92565b42841015612278576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f45585049524544000000000000000000604482015260640161067d565b73ffffffffffffffffffffffffffffffffffffffff878116600081815260036020908152604080832080546001810190915581517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98185015280830195909552948b166060850152608084018a905260a084019490945260c08084018990528451808503909101815260e0840190945283519301929092207f19010000000000000000000000000000000000000000000000000000000000006101008301527f000000000000000000000000000000000000000000000000000000000000000061010283015261012282015261014201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156123f1573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81161580159061246c57508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b6124d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f494e56414c49445f5045524d49545f5349474e41545552450000000000000000604482015260640161067d565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526002602090815260408083208b8516808552908352928190208a905551898152919350918a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6000806125777f000000000000000000000000000000000000000000000000000000000000000086613755565b90508061258661271086613755565b6125909190613729565b61259a8483613755565b6125a49190613741565b95945050505050565b801561272f576040805173ffffffffffffffffffffffffffffffffffffffff8681166024830152306044830152848116606483015260006084830181905260a48084018890528451808503909101815260c490930184526020830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f97da6d300000000000000000000000000000000000000000000000000000000017905292517f00000000000000000000000000000000000000000000000000000000000000009091169161267c9161363b565b6000604051808303816000865af19150503d80600081146126b9576040519150601f19603f3d011682016040523d82523d6000602084013e6126be565b606091505b5050905080612729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f57495448445241575f4641494c45440000000000000000000000000000000000604482015260640161067d565b5061289f565b6040805173ffffffffffffffffffffffffffffffffffffffff8681166024830152306044830152848116606483015260848083018790528351808403909101815260a490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167ff18d03cc0000000000000000000000000000000000000000000000000000000017905291516000927f000000000000000000000000000000000000000000000000000000000000000016916127f09161363b565b6000604051808303816000865af19150503d806000811461282d576040519150601f19603f3d011682016040523d82523d6000602084013e612832565b606091505b505090508061289d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c45440000000000000000000000000000000000604482015260640161067d565b505b50505050565b60008060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f7888aec7f00000000000000000000000000000000000000000000000000000000000000003060405160240161293b92919073ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051612989919061363b565b600060405180830381855afa9150503d80600081146129c4576040519150601f19603f3d011682016040523d82523d6000602084013e6129c9565b606091505b50915050808060200190518101906129e191906135d8565b604080517f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff90811660248301523060448084019190915283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167ff7888aec0000000000000000000000000000000000000000000000000000000017905291519295506000927f000000000000000000000000000000000000000000000000000000000000000090921691612abd919061363b565b600060405180830381855afa9150503d8060008114612af8576040519150601f19603f3d011682016040523d82523d6000602084013e612afd565b606091505b5091505080806020019051810190612b1591906135d8565b925050509091565b6dffffffffffffffffffffffffffff8511801590612b4957506dffffffffffffffffffffffffffff8411155b612baf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600860248201527f4f564552464c4f57000000000000000000000000000000000000000000000000604482015260640161067d565b6008547c0100000000000000000000000000000000000000000000000000000000900463ffffffff16612c3357600880546dffffffffffffffffffffffffffff8681166e010000000000000000000000000000027fffffffff0000000000000000000000000000000000000000000000000000000090921690881617179055612df3565b6000612c44640100000000426137d5565b90508163ffffffff168163ffffffff1614158015612c7157506dffffffffffffffffffffffffffff841615155b8015612c8c57506dffffffffffffffffffffffffffff831615155b15612d515781810360006dffffffffffffffffffffffffffff86167bffffffffffffffffffffffffffff0000000000000000000000000000607087901b1681612cd757612cd7613818565b600580549290910463ffffffff851681029092019055905060006dffffffffffffffffffffffffffff8616607088901b7bffffffffffffffffffffffffffff00000000000000000000000000001681612d3257612d32613818565b0490508263ffffffff1681026006600082825401925050819055505050505b6008805463ffffffff9092167c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff6dffffffffffffffffffffffffffff8881166e010000000000000000000000000000027fffffffff00000000000000000000000000000000000000000000000000000000909516908a161793909317929092169190911790555b60408051868152602081018690527fcf2aa50876cdfbb541206f89af0ee78d44a2abf8d328e37fa4917f982149848a910160405180910390a15050505050565b6007546000908015612eda576000612e616110416dffffffffffffffffffffffffffff808816908916613755565b905081811115612ed857612710816004548484612e7e9190613792565b612e889088613755565b612e929190613755565b612e9c9190613741565b612ea69190613741565b92508215612ed857612ed87f0000000000000000000000000000000000000000000000000000000000000000846131fd565b505b509392505050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604081208054839290612f17908490613792565b909155505060008054829003815560405182815273ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b600081612f8457506000919050565b8160017001000000000000000000000000000000008210612faa5760809190911c9060401b5b680100000000000000008210612fc55760409190911c9060201b5b6401000000008210612fdc5760209190911c9060101b5b620100008210612ff15760109190911c9060081b5b61010082106130055760089190911c9060041b5b601082106130185760049190911c9060021b5b600882106130245760011b5b600181858161303557613035613818565b048201901c9050600181858161304d5761304d613818565b048201901c9050600181858161306557613065613818565b048201901c9050600181858161307d5761307d613818565b048201901c9050600181858161309557613095613818565b048201901c905060018185816130ad576130ad613818565b048201901c905060018185816130c5576130c5613818565b048201901c905060008185816130dd576130dd613818565b0490508082106130ed57806130ef565b815b93505050505b919050565b600080831580613108575082155b15613118575060009050806131f4565b6000846131258589613755565b61312f9190613741565b905085811161318a576131456127106002613755565b61314f8288613792565b613179907f0000000000000000000000000000000000000000000000000000000000000000613755565b6131839190613741565b91506131f2565b6000846131978789613755565b6131a19190613741565b90506131b06127106002613755565b6131ba828a613792565b6131e4907f0000000000000000000000000000000000000000000000000000000000000000613755565b6131ee9190613741565b9350505b505b94509492505050565b8060008082825461320e9190613729565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000818152600160209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101612f69565b803580151581146130f557600080fd5b60006020828403121561328f57600080fd5b813561329a816138a5565b9392505050565b6000602082840312156132b357600080fd5b815161329a816138a5565b6000806000606084860312156132d357600080fd5b83356132de816138a5565b925060208401356132ee816138a5565b91506132fc6040850161326d565b90509250925092565b600080600080600060a0868803121561331d57600080fd5b8535613328816138a5565b94506020860135613338816138a5565b93506133466040870161326d565b925060608601359150608086013567ffffffffffffffff8082111561336a57600080fd5b818801915088601f83011261337e57600080fd5b81358181111561339057613390613876565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156133d6576133d6613876565b816040528281528b60208487010111156133ef57600080fd5b8260208601602083013760006020848301015280955050505050509295509295909350565b6000806040838503121561342757600080fd5b8235613432816138a5565b91506134406020840161326d565b90509250929050565b6000806040838503121561345c57600080fd5b8235613467816138a5565b946020939093013593505050565b6000806040838503121561348857600080fd5b8235613493816138a5565b915060208301356134a3816138a5565b809150509250929050565b6000806000606084860312156134c357600080fd5b83356134ce816138a5565b925060208401356134de816138a5565b929592945050506040919091013590565b600080600080600080600060e0888a03121561350a57600080fd5b8735613515816138a5565b96506020880135613525816138a5565b95506040880135945060608801359350608088013560ff8116811461354957600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806020838503121561357957600080fd5b823567ffffffffffffffff8082111561359157600080fd5b818501915085601f8301126135a557600080fd5b8135818111156135b457600080fd5b8660208285010111156135c657600080fd5b60209290920196919550909350505050565b6000602082840312156135ea57600080fd5b5051919050565b600081518084526136098160208601602086016137a9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000825161364d8184602087016137a9565b9190910192915050565b6020808252825182820181905260009190848201906040850190845b818110156136a557835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101613673565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b82811015613709578151805173ffffffffffffffffffffffffffffffffffffffff1685528601518685015292840192908501906001016136ce565b5091979650505050505050565b60208152600061329a60208301846135f1565b6000821982111561373c5761373c6137e9565b500190565b60008261375057613750613818565b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561378d5761378d6137e9565b500290565b6000828210156137a4576137a46137e9565b500390565b60005b838110156137c45781810151838201526020016137ac565b8381111561289f5750506000910152565b6000826137e4576137e4613818565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146138c757600080fd5b5056fea264697066735822122004f193ad403a2048e6ef0c1fc9da9b9f522fe2ad030c99737c73f0f04901cf7464736f6c63430008070033",deployData:o,masterDeployerAddress:"0xa2A7Aa74cb94f37221FD49F5BA6F3fF876092700"});return P.getCreate2Address(f,q.keccak256(["bytes"],[o]),s)},Wf=M.BigInt(Number.MAX_SAFE_INTEGER),Yf=M.BigInt(0),Gf=M.BigInt(1),jf=M.BigInt(2);function Zf(e){if(M.greaterThanOrEqual(e,Yf)||F(!1),M.lessThan(e,Wf))return M.BigInt(Math.floor(Math.sqrt(M.toNumber(e))));var f,t;for(f=e,t=M.add(M.divide(e,jf),Gf);M.lessThan(t,f);)f=t,t=M.divide(M.add(M.divide(e,t),t),jf);return f}var Qf=function(){function e(f,t,n,r){void 0===n&&(n=25),void 0===r&&(r=!0);var i=f.currency.sortsBefore(t.currency)?[f,t]:[t,f];this.liquidityToken=new Ze(i[0].currency.chainId,e.getAddress(i[0].currency,i[1].currency,n,r),18,"SLP","Sushi LP Token"),this.fee=n,this.tokenAmounts=i}e.getAddress=function(e,f,t,n){return void 0===t&&(t=25),void 0===n&&(n=!0),Xf({factoryAddress:G[e.chainId],tokenA:e,tokenB:f,fee:t,twap:n})};var f=e.prototype;return f.involvesToken=function(e){return e.equals(this.token0)||e.equals(this.token1)},f.priceOf=function(e){return this.involvesToken(e)||F(!1),e.equals(this.token0)?this.token0Price:this.token1Price},f.reserveOf=function(e){return this.involvesToken(e)||F(!1),e.equals(this.token0)?this.reserve0:this.reserve1},f.getOutputAmount=function(f){if(this.involvesToken(f.currency)||F(!1),M.equal(this.reserve0.quotient,If)||M.equal(this.reserve1.quotient,If))throw new _f;var t=this.reserveOf(f.currency),n=this.reserveOf(f.currency.equals(this.token0)?this.token1:this.token0),r=M.multiply(f.quotient,vf),i=M.multiply(r,n.quotient),a=M.add(M.multiply(t.quotient,Nf),r),o=Uf.fromRawAmount(f.currency.equals(this.token0)?this.token1:this.token0,M.divide(i,a));if(M.equal(o.quotient,If))throw new Ff;return[o,new e(t.add(f),n.subtract(o))]},f.getInputAmount=function(f){if(this.involvesToken(f.currency)||F(!1),M.equal(this.reserve0.quotient,If)||M.equal(this.reserve1.quotient,If)||M.greaterThanOrEqual(f.quotient,this.reserveOf(f.currency).quotient))throw new _f;var t=this.reserveOf(f.currency),n=this.reserveOf(f.currency.equals(this.token0)?this.token1:this.token0),r=M.multiply(M.multiply(n.quotient,f.quotient),Nf),i=M.multiply(M.subtract(t.quotient,f.quotient),vf),a=Uf.fromRawAmount(f.currency.equals(this.token0)?this.token1:this.token0,M.add(M.divide(r,i),Ef));return[a,new e(n.add(a),t.subtract(f))]},f.getLiquidityMinted=function(e,f,t){e.currency.equals(this.liquidityToken)||F(!1);var n,r=f.currency.sortsBefore(t.currency)?[f,t]:[t,f];if(r[0].currency.equals(this.token0)&&r[1].currency.equals(this.token1)||F(!1),M.equal(e.quotient,If))n=M.subtract(Zf(M.multiply(r[0].quotient,r[1].quotient)),Sf);else{var i=M.divide(M.multiply(r[0].quotient,e.quotient),this.reserve0.quotient),a=M.divide(M.multiply(r[1].quotient,e.quotient),this.reserve1.quotient);n=M.lessThanOrEqual(i,a)?i:a}if(!M.greaterThan(n,If))throw new Ff;return Uf.fromRawAmount(this.liquidityToken,n)},f.getLiquidityValue=function(e,f,t,n,r){var i;if(void 0===n&&(n=!1),this.involvesToken(e)||F(!1),f.currency.equals(this.liquidityToken)||F(!1),t.currency.equals(this.liquidityToken)||F(!1),M.lessThanOrEqual(t.quotient,f.quotient)||F(!1),n){r||F(!1);var a=M.BigInt(r);if(M.equal(a,If))i=f;else{var o=Zf(M.multiply(this.reserve0.quotient,this.reserve1.quotient)),s=Zf(a);if(M.greaterThan(o,s)){var d=M.multiply(f.quotient,M.subtract(o,s)),u=M.add(M.multiply(o,Af),s),c=M.divide(d,u);i=f.add(Uf.fromRawAmount(this.liquidityToken,c))}else i=f}}else i=f;return Uf.fromRawAmount(e,M.divide(M.multiply(t.quotient,this.reserveOf(e).quotient),i.quotient))},Me(e,[{key:"token0Price",get:function(){var e=this.tokenAmounts[1].divide(this.tokenAmounts[0]);return new Kf(this.token0,this.token1,e.denominator,e.numerator)}},{key:"token1Price",get:function(){var e=this.tokenAmounts[0].divide(this.tokenAmounts[1]);return new Kf(this.token1,this.token0,e.denominator,e.numerator)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"token0",get:function(){return this.tokenAmounts[0].currency}},{key:"token1",get:function(){return this.tokenAmounts[1].currency}},{key:"reserve0",get:function(){return this.tokenAmounts[0]}},{key:"reserve1",get:function(){return this.tokenAmounts[1]}}]),e}(),Jf=function(e){var f=e.factoryAddress,t=e.tokenA,n=e.tokenB,r=t.sortsBefore(n)?[t,n]:[n,t];return P.getCreate2Address(f,q.keccak256(["bytes"],[q.pack(["address","address"],[r[0].address,r[1].address])]),Of)},zf=function(){function e(f,t){var n=f.currency.sortsBefore(t.currency)?[f,t]:[t,f];this.liquidityToken=new Ze(n[0].currency.chainId,e.getAddress(n[0].currency,n[1].currency),18,"UNI-V2","Uniswap V2"),this.tokenAmounts=n}e.getAddress=function(e,f){return Jf({factoryAddress:G[e.chainId],tokenA:e,tokenB:f})};var f=e.prototype;return f.involvesToken=function(e){return e.equals(this.token0)||e.equals(this.token1)},f.priceOf=function(e){return this.involvesToken(e)||F(!1),e.equals(this.token0)?this.token0Price:this.token1Price},f.reserveOf=function(e){return this.involvesToken(e)||F(!1),e.equals(this.token0)?this.reserve0:this.reserve1},f.getOutputAmount=function(f){if(this.involvesToken(f.currency)||F(!1),M.equal(this.reserve0.quotient,If)||M.equal(this.reserve1.quotient,If))throw new _f;var t=this.reserveOf(f.currency),n=this.reserveOf(f.currency.equals(this.token0)?this.token1:this.token0),r=M.multiply(f.quotient,vf),i=M.multiply(r,n.quotient),a=M.add(M.multiply(t.quotient,Nf),r),o=Uf.fromRawAmount(f.currency.equals(this.token0)?this.token1:this.token0,M.divide(i,a));if(M.equal(o.quotient,If))throw new Ff;return[o,new e(t.add(f),n.subtract(o))]},f.getInputAmount=function(f){if(this.involvesToken(f.currency)||F(!1),M.equal(this.reserve0.quotient,If)||M.equal(this.reserve1.quotient,If)||M.greaterThanOrEqual(f.quotient,this.reserveOf(f.currency).quotient))throw new _f;var t=this.reserveOf(f.currency),n=this.reserveOf(f.currency.equals(this.token0)?this.token1:this.token0),r=M.multiply(M.multiply(n.quotient,f.quotient),Nf),i=M.multiply(M.subtract(t.quotient,f.quotient),vf),a=Uf.fromRawAmount(f.currency.equals(this.token0)?this.token1:this.token0,M.add(M.divide(r,i),Ef));return[a,new e(n.add(a),t.subtract(f))]},f.getLiquidityMinted=function(e,f,t){e.currency.equals(this.liquidityToken)||F(!1);var n,r=f.currency.sortsBefore(t.currency)?[f,t]:[t,f];if(r[0].currency.equals(this.token0)&&r[1].currency.equals(this.token1)||F(!1),M.equal(e.quotient,If))n=M.subtract(Zf(M.multiply(r[0].quotient,r[1].quotient)),Sf);else{var i=M.divide(M.multiply(r[0].quotient,e.quotient),this.reserve0.quotient),a=M.divide(M.multiply(r[1].quotient,e.quotient),this.reserve1.quotient);n=M.lessThanOrEqual(i,a)?i:a}if(!M.greaterThan(n,If))throw new Ff;return Uf.fromRawAmount(this.liquidityToken,n)},f.getLiquidityValue=function(e,f,t,n,r){var i;if(void 0===n&&(n=!1),this.involvesToken(e)||F(!1),f.currency.equals(this.liquidityToken)||F(!1),t.currency.equals(this.liquidityToken)||F(!1),M.lessThanOrEqual(t.quotient,f.quotient)||F(!1),n){r||F(!1);var a=M.BigInt(r);if(M.equal(a,If))i=f;else{var o=Zf(M.multiply(this.reserve0.quotient,this.reserve1.quotient)),s=Zf(a);if(M.greaterThan(o,s)){var d=M.multiply(f.quotient,M.subtract(o,s)),u=M.add(M.multiply(o,Af),s),c=M.divide(d,u);i=f.add(Uf.fromRawAmount(this.liquidityToken,c))}else i=f}}else i=f;return Uf.fromRawAmount(e,M.divide(M.multiply(t.quotient,this.reserveOf(e).quotient),i.quotient))},Me(e,[{key:"token0Price",get:function(){var e=this.tokenAmounts[1].divide(this.tokenAmounts[0]);return new Kf(this.token0,this.token1,e.denominator,e.numerator)}},{key:"token1Price",get:function(){var e=this.tokenAmounts[0].divide(this.tokenAmounts[1]);return new Kf(this.token1,this.token0,e.denominator,e.numerator)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"token0",get:function(){return this.tokenAmounts[0].currency}},{key:"token1",get:function(){return this.tokenAmounts[1].currency}},{key:"reserve0",get:function(){return this.tokenAmounts[0]}},{key:"reserve1",get:function(){return this.tokenAmounts[1]}}]),e}(),$f=new qf(M.BigInt(100));function et(e){return new ft(e.numerator,e.denominator)}var ft=function(e){function f(){var f;return(f=e.apply(this,arguments)||this).isPercent=!0,f}Fe(f,e);var t=f.prototype;return t.add=function(f){return et(e.prototype.add.call(this,f))},t.subtract=function(f){return et(e.prototype.subtract.call(this,f))},t.multiply=function(f){return et(e.prototype.multiply.call(this,f))},t.divide=function(f){return et(e.prototype.divide.call(this,f))},t.toSignificant=function(f,t,n){return void 0===f&&(f=5),e.prototype.multiply.call(this,$f).toSignificant(f,t,n)},t.toFixed=function(f,t,n){return void 0===f&&(f=2),e.prototype.multiply.call(this,$f).toFixed(f,t,n)},f}(qf),tt=function(){function e(e,f,t){this._midPrice=null,e.length>0||F(!1);var n=e[0].chainId;e.every((function(e){return e.chainId===n}))||F(!1);var r=f.wrapped;e[0].involvesToken(r)||F(!1),void 0===t||e[e.length-1].involvesToken(t.wrapped)||F(!1);for(var i,a=[r],o=Ke(e.entries());!(i=o()).done;){var s=i.value,d=s[1],u=a[s[0]];u.equals(d.token0)||u.equals(d.token1)||F(!1);var c=u.equals(d.token0)?d.token1:d.token0;a.push(c)}this.pairs=e,this.path=a,this.input=f,this.output=t}return Me(e,[{key:"midPrice",get:function(){if(null!==this._midPrice)return this._midPrice;for(var e,f=[],t=Ke(this.pairs.entries());!(e=t()).done;){var n=e.value,r=n[1];f.push(this.path[n[0]].equals(r.token0)?new Kf(r.reserve0.currency,r.reserve1.currency,r.reserve0.quotient,r.reserve1.quotient):new Kf(r.reserve1.currency,r.reserve0.currency,r.reserve1.quotient,r.reserve0.quotient))}var i=f.slice(1).reduce((function(e,f){return e.multiply(f)}),f[0]);return this._midPrice=new Kf(this.input,this.output,i.denominator,i.numerator)}},{key:"chainId",get:function(){return this.pairs[0].chainId}}]),e}();function nt(e,f,t){var n=e.quote(f),r=n.subtract(t).divide(n);return new ft(r.numerator,r.denominator)}function rt(e,f,t,n){if(t>0||F(!1),e.length<=t||F(!1),0===e.length)return e.push(f),null;var r=e.length===t;if(r&&n(e[e.length-1],f)<=0)return f;for(var i=0,a=e.length;i<a;){var o=i+a>>>1;n(e[o],f)<=0?i=o+1:a=o}return e.splice(i,0,f),r?e.pop():null}function it(e,f){return e.inputAmount.currency.equals(f.inputAmount.currency)||F(!1),e.outputAmount.currency.equals(f.outputAmount.currency)||F(!1),e.outputAmount.equalTo(f.outputAmount)?e.inputAmount.equalTo(f.inputAmount)?0:e.inputAmount.lessThan(f.inputAmount)?-1:1:e.outputAmount.lessThan(f.outputAmount)?1:-1}function at(e,f){var t=it(e,f);return 0!==t?t:e.priceImpact.lessThan(f.priceImpact)?-1:e.priceImpact.greaterThan(f.priceImpact)?1:e.route.path.length-f.route.path.length}var ot,st,dt=function(){function e(e,f,t){this.route=e,this.tradeType=t;var n=new Array(e.path.length);if(t===exports.TradeType.EXACT_INPUT){f.currency.equals(e.input)||F(!1),n[0]=f.wrapped;for(var r=0;r<e.path.length-1;r++){var i=e.pairs[r].getOutputAmount(n[r]);n[r+1]=i[0]}this.inputAmount=Uf.fromFractionalAmount(e.input,f.numerator,f.denominator),this.outputAmount=Uf.fromFractionalAmount(e.output,n[n.length-1].numerator,n[n.length-1].denominator)}else{f.currency.equals(e.output)||F(!1),n[n.length-1]=f.wrapped;for(var a=e.path.length-1;a>0;a--){var o=e.pairs[a-1].getInputAmount(n[a]);n[a-1]=o[0]}this.inputAmount=Uf.fromFractionalAmount(e.input,n[0].numerator,n[0].denominator),this.outputAmount=Uf.fromFractionalAmount(e.output,f.numerator,f.denominator)}this.executionPrice=new Kf(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.quotient,this.outputAmount.quotient),this.priceImpact=nt(e.midPrice,this.inputAmount,this.outputAmount)}e.exactIn=function(f,t){return new e(f,t,exports.TradeType.EXACT_INPUT)},e.exactOut=function(f,t){return new e(f,t,exports.TradeType.EXACT_OUTPUT)};var f=e.prototype;return f.minimumAmountOut=function(e){if(e.lessThan(If)&&F(!1),this.tradeType===exports.TradeType.EXACT_OUTPUT)return this.outputAmount;var f=new qf(Ef).add(e).invert().multiply(this.outputAmount.quotient).quotient;return Uf.fromRawAmount(this.outputAmount.currency,f)},f.maximumAmountIn=function(e){if(e.lessThan(If)&&F(!1),this.tradeType===exports.TradeType.EXACT_INPUT)return this.inputAmount;var f=new qf(Ef).add(e).multiply(this.inputAmount.quotient).quotient;return Uf.fromRawAmount(this.inputAmount.currency,f)},e.bestTradeExactIn=function(f,t,n,r,i,a,o){var s=void 0===r?{}:r,d=s.maxNumResults,u=void 0===d?3:d,c=s.maxHops,p=void 0===c?3:c;void 0===i&&(i=[]),void 0===a&&(a=t),void 0===o&&(o=[]),f.length>0||F(!1),p>0||F(!1),t===a||i.length>0||F(!1);for(var h=a.wrapped,T=n.wrapped,C=0;C<f.length;C++){var b=f[C];if((b.token0.equals(h.currency)||b.token1.equals(h.currency))&&!b.reserve0.equalTo(If)&&!b.reserve1.equalTo(If)){var I=void 0;try{I=b.getOutputAmount(h)[0]}catch(e){if(e.isInsufficientInputAmountError)continue;throw e}if(I.currency.equals(T))rt(o,new e(new tt([].concat(i,[b]),t.currency,n),t,exports.TradeType.EXACT_INPUT),u,at);else if(p>1&&f.length>1){var E=f.slice(0,C).concat(f.slice(C+1,f.length));e.bestTradeExactIn(E,t,n,{maxNumResults:u,maxHops:p-1},[].concat(i,[b]),I,o)}}}return o},f.worstExecutionPrice=function(e){return new Kf(this.inputAmount.currency,this.outputAmount.currency,this.maximumAmountIn(e).quotient,this.minimumAmountOut(e).quotient)},e.bestTradeExactOut=function(f,t,n,r,i,a,o){var s=void 0===r?{}:r,d=s.maxNumResults,u=void 0===d?3:d,c=s.maxHops,p=void 0===c?3:c;void 0===i&&(i=[]),void 0===a&&(a=n),void 0===o&&(o=[]),f.length>0||F(!1),p>0||F(!1),n===a||i.length>0||F(!1);for(var h=a.wrapped,T=t.wrapped,C=0;C<f.length;C++){var b=f[C];if((b.token0.equals(h.currency)||b.token1.equals(h.currency))&&!b.reserve0.equalTo(If)&&!b.reserve1.equalTo(If)){var I=void 0;try{I=b.getInputAmount(h)[0]}catch(e){if(e.isInsufficientReservesError)continue;throw e}if(I.currency.equals(T))rt(o,new e(new tt([b].concat(i),t,n.currency),n,exports.TradeType.EXACT_OUTPUT),u,at);else if(p>1&&f.length>1){var E=f.slice(0,C).concat(f.slice(C+1,f.length));e.bestTradeExactOut(E,t,n,{maxNumResults:u,maxHops:p-1},[b].concat(i),I,o)}}}return o},e}(),ut=(function(e){var f=function(e){var f=Object.prototype,t=f.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function o(e,f,t){return Object.defineProperty(e,f,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[f]}try{o({},"")}catch(e){o=function(e,f,t){return e[f]=t}}function s(e,f,t,n){var r=Object.create((f&&f.prototype instanceof c?f:c).prototype),i=new y(n||[]);return r._invoke=function(e,f,t){var n="suspendedStart";return function(r,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===r)throw i;return{value:void 0,done:!0}}for(t.method=r,t.arg=i;;){var a=t.delegate;if(a){var o=l(a,t);if(o){if(o===u)continue;return o}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var s=d(e,f,t);if("normal"===s.type){if(n=t.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:t.done}}"throw"===s.type&&(n="completed",t.method="throw",t.arg=s.arg)}}}(e,t,i),r}function d(e,f,t){try{return{type:"normal",arg:e.call(f,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function c(){}function p(){}function h(){}var T={};o(T,r,(function(){return this}));var C=Object.getPrototypeOf,b=C&&C(C(v([])));b&&b!==f&&t.call(b,r)&&(T=b);var I=h.prototype=c.prototype=Object.create(T);function E(e){["next","throw","return"].forEach((function(f){o(e,f,(function(e){return this._invoke(f,e)}))}))}function x(e,f){var n;this._invoke=function(r,i){function a(){return new f((function(n,a){!function n(r,i,a,o){var s=d(e[r],e,i);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&t.call(c,"__await")?f.resolve(c.__await).then((function(e){n("next",e,a,o)}),(function(e){n("throw",e,a,o)})):f.resolve(c).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,o)}))}o(s.arg)}(r,i,n,a)}))}return n=n?n.then(a,a):a()}}function l(e,f){var t=e.iterator[f.method];if(void 0===t){if(f.delegate=null,"throw"===f.method){if(e.iterator.return&&(f.method="return",f.arg=void 0,l(e,f),"throw"===f.method))return u;f.method="throw",f.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=d(t,e.iterator,f.arg);if("throw"===n.type)return f.method="throw",f.arg=n.arg,f.delegate=null,u;var r=n.arg;return r?r.done?(f[e.resultName]=r.value,f.next=e.nextLoc,"return"!==f.method&&(f.method="next",f.arg=void 0),f.delegate=null,u):r:(f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,u)}function A(e){var f={tryLoc:e[0]};1 in e&&(f.catchLoc=e[1]),2 in e&&(f.finallyLoc=e[2],f.afterLoc=e[3]),this.tryEntries.push(f)}function m(e){var f=e.completion||{};f.type="normal",delete f.arg,e.completion=f}function y(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function v(e){if(e){var f=e[r];if(f)return f.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function f(){for(;++n<e.length;)if(t.call(e,n))return f.value=e[n],f.done=!1,f;return f.value=void 0,f.done=!0,f};return i.next=i}}return{next:N}}function N(){return{value:void 0,done:!0}}return p.prototype=h,o(I,"constructor",h),o(h,"constructor",p),p.displayName=o(h,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var f="function"==typeof e&&e.constructor;return!!f&&(f===p||"GeneratorFunction"===(f.displayName||f.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,o(e,a,"GeneratorFunction")),e.prototype=Object.create(I),e},e.awrap=function(e){return{__await:e}},E(x.prototype),o(x.prototype,i,(function(){return this})),e.AsyncIterator=x,e.async=function(f,t,n,r,i){void 0===i&&(i=Promise);var a=new x(s(f,t,n,r),i);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(I),o(I,a,"Generator"),o(I,r,(function(){return this})),o(I,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var f=[];for(var t in e)f.push(t);return f.reverse(),function t(){for(;f.length;){var n=f.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=v,y.prototype={constructor:y,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(m),!e)for(var f in this)"t"===f.charAt(0)&&t.call(this,f)&&!isNaN(+f.slice(1))&&(this[f]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var f=this;function n(t,n){return a.type="throw",a.arg=e,f.next=t,n&&(f.method="next",f.arg=void 0),!!n}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=t.call(i,"catchLoc"),s=t.call(i,"finallyLoc");if(o&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,f){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&t.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=f&&f<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=f,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},complete:function(e,f){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&f&&(this.next=f),u},finish:function(e){for(var f=this.tryEntries.length-1;f>=0;--f){var t=this.tryEntries[f];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),m(t),u}},catch:function(e){for(var f=this.tryEntries.length-1;f>=0;--f){var t=this.tryEntries[f];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var r=n.arg;m(t)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,f,t){return this.delegate={iterator:v(e),resultName:f,nextLoc:t},"next"===this.method&&(this.arg=void 0),u}},e}(e.exports);try{regeneratorRuntime=f}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=f:Function("r","regeneratorRuntime = r")(f)}}(st={exports:{}}),st.exports);(ot=exports.PoolType||(exports.PoolType={})).ConstantProduct="ConstantProduct",ot.Weighted="Weighted",ot.Hybrid="Hybrid",ot.ConcentratedLiquidity="ConcentratedLiquidity";var ct,pt=function(e){var f=_e({minLiquidity:1e3,swapGasCost:4e4},e);this.address=f.address,this.token0=f.token0,this.token1=f.token1,this.type=f.type,this.reserve0=f.reserve0,this.reserve1=f.reserve1,this.fee=f.fee,this.minLiquidity=f.minLiquidity,this.swapGasCost=f.swapGasCost},ht=function(e){function f(f){return e.call(this,_e({type:exports.PoolType.ConstantProduct},f))||this}return Fe(f,e),f}(pt),Tt=function(e){function f(f){var t;return(t=e.call(this,_e({type:exports.PoolType.Hybrid},f))||this).A=f.A,t}return Fe(f,e),f}(pt),Ct=function(e){function f(f){var t;return(t=e.call(this,_e({type:exports.PoolType.Weighted},f))||this).weight0=f.weight0,t.weight1=f.weight1,t}return Fe(f,e),f}(pt),bt=function(e){function f(f){var t;return(t=e.call(this,_e({type:exports.PoolType.ConcentratedLiquidity,reserve0:_.BigNumber.from(0),reserve1:_.BigNumber.from(0)},f))||this).liquidity=f.liquidity,t.sqrtPrice=f.sqrtPrice,t.nearestTick=f.nearestTick,t.ticks=f.ticks,t}return Fe(f,e),f}(pt);(ct=exports.RouteStatus||(exports.RouteStatus={})).Success="Success",ct.NoWay="NoWay",ct.Partial="Partial";var It={EIP712Domain:[{name:"name",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],LimitOrder:[{name:"maker",type:"address"},{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"amountIn",type:"uint256"},{name:"amountOut",type:"uint256"},{name:"recipient",type:"address"},{name:"startTime",type:"uint256"},{name:"endTime",type:"uint256"},{name:"stopPrice",type:"uint256"},{name:"oracleAddress",type:"address"},{name:"oracleData",type:"bytes32"}]},Et={EIP712Domain:[{name:"name",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],SetMasterContractApproval:[{name:"warning",type:"string"},{name:"user",type:"address"},{name:"masterContract",type:"address"},{name:"approved",type:"bool"},{name:"nonce",type:"uint256"}]},xt="LimitOrder",lt=function(e,f,t){return vt({types:It,primaryType:"LimitOrder",domain:{name:xt,chainId:f,verifyingContract:oe[f]},message:e},t)},At=function(e,f){return{types:It,primaryType:"LimitOrder",domain:{name:xt,chainId:f,verifyingContract:oe[f]},message:e}},mt=function(e,f){return{types:Et,primaryType:"SetMasterContractApproval",domain:{name:"BentoBox V1",chainId:f,verifyingContract:ee[f]},message:e}},yt=function(e){return"0x"+K.getMessage(e,!0).toString("hex")},vt=function(e,f){var t=K.getMessage(e,!0),n=new U.SigningKey(f).signDigest(t);return{v:n.v,r:n.r,s:n.s}},Nt=function(){var e=Re(ut.mark((function e(f,t,n){var r,i;return ut.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=At(f,t),e.next=3,n.send("eth_signTypedData_v4",[f.maker,JSON.stringify(r)]);case 3:return i=V.splitSignature(e.sent),e.abrupt("return",{v:i.v,r:i.r,s:i.s});case 6:case"end":return e.stop()}}),e)})));return function(f,t,n){return e.apply(this,arguments)}}(),Ot=function(){var e=Re(ut.mark((function e(f,t,n){var r,i;return ut.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=mt(f,t),e.next=3,n.send("eth_signTypedData_v4",[f.user,JSON.stringify(r)]);case 3:return i=V.splitSignature(e.sent),e.abrupt("return",{v:i.v,r:i.r,s:i.s});case 6:case"end":return e.stop()}}),e)})));return function(f,t,n){return e.apply(this,arguments)}}(),St=function(){var e=Re(ut.mark((function e(f,t,n){return ut.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",vt({types:Et,primaryType:"SetMasterContractApproval",domain:{name:"BentoBox V1",chainId:t,verifyingContract:ee[t]},message:f},n));case 2:case"end":return e.stop()}}),e)})));return function(f,t,n){return e.apply(this,arguments)}}(),Dt=new Map;function Bt(e){var f=Dt.get(e);if(void 0!==f)return f;var t=e.reserve0,n=e.reserve1;if(t.isZero()&&n.isZero())return Dt.set(e,_.BigNumber.from(0)),_.BigNumber.from(0);for(var r,i=t.add(n),a=_.BigNumber.from(2*e.A),o=i,s=0;s<256;s++){var d=o.mul(o).div(t).mul(o).div(n).div(4);if(r=o,(o=a.mul(i).div(100).add(d.mul(2)).mul(o).div(a.div(100).sub(1).mul(o).add(d.mul(3)))).sub(r).abs().lte(1))break}return Dt.set(e,o),o}function Rt(e,f){for(var t,n=Bt(e),r=2*e.A,i=n.mul(n).div(f.mul(2)).mul(n).div(2*r/100),a=n.mul(100).div(r).add(f),o=n,s=0;s<256&&(t=o,!(o=o.mul(o).add(i).div(o.mul(2).add(a).sub(n))).sub(t).abs().lte(1));s++);return o}function gt(e,f,t){void 0===t&&(t=!0);var n=t?e.reserve0:e.reserve1,r=t?e.reserve1:e.reserve0;switch(e.type){case exports.PoolType.ConstantProduct:var i=parseInt(n.toString());return parseInt(r.toString())*f/(i/(1-e.fee)+f);case exports.PoolType.Weighted:var a=parseInt(n.toString());return parseInt(r.toString())*(1-Math.pow(a/(a+f*(1-e.fee)),t?e.weight0/e.weight1:e.weight1/e.weight0));case exports.PoolType.Hybrid:var o=Rt(e,n.add(Lt(void 0,f*(1-e.fee))));return parseInt(r.sub(o).toString());case exports.PoolType.ConcentratedLiquidity:return function(e,f,t){if(0===e.ticks.length)return 0;e.ticks[0].index>-887272&&e.ticks.unshift({index:-887272,DLiquidity:0}),e.ticks[e.ticks.length-1].index<887271&&e.ticks.push({index:887271,DLiquidity:0});for(var n=t?e.nearestTick:e.nearestTick+1,r=e.sqrtPrice,i=e.liquidity,a=0,o=f;o>0;){if(n<0||n>=e.ticks.length)throw new Mt;var s=Math.sqrt(Math.pow(1.0001,e.ticks[n].index)),d=0;if(t){var u=i*(r-s)/r/s;o<=u?(d=i*r*o/(o+i/r),o=0):(d=i*(r-s),r=s,o-=u,e.ticks[n].index%2==0?i-=e.ticks[n].DLiquidity:i+=e.ticks[n].DLiquidity,n--)}else{var c=i*(s-r);o<=c?(d=o/r/(r+o/i),o=0):(d=i*(s-r)/r/s,r=s,o-=c,e.ticks[n].index%2==0?i+=e.ticks[n].DLiquidity:i-=e.ticks[n].DLiquidity,n++)}a+=d*(1-e.fee)}return a}(e,f,t)}}var Mt=function(e){function f(){return e.apply(this,arguments)||this}return Fe(f,e),f}(qe(Error));function _t(e,f,t){var n=0,r=t?e.reserve0:e.reserve1,i=t?e.reserve1:e.reserve0;switch(e.type){case exports.PoolType.ConstantProduct:var a=parseInt(r.toString()),o=parseInt(i.toString());n=a*f/(1-e.fee)/(o-f);break;case exports.PoolType.Weighted:var s=parseInt(r.toString()),d=parseInt(i.toString());n=s*(1-e.fee)*(Math.pow(1-f/d,-(t?e.weight0/e.weight1:e.weight1/e.weight0))-1);break;case exports.PoolType.Hybrid:var u=i.sub(Lt(void 0,f));u.lt(1)&&(u=_.BigNumber.from(1));var c=Rt(e,u);n=Math.round(parseInt(c.sub(r).toString())/(1-e.fee));break;default:console.error("Unknown pool type")}return n<1&&(n=1),n}function Ft(e,f,t){void 0===t&&(t=!0);var n=parseInt(e.reserve0.toString()),r=parseInt(e.reserve1.toString()),i=t?1-e.fee:1;switch(e.type){case exports.PoolType.ConstantProduct:var a=n/i;return r*a/(a+f)/(a+f);case exports.PoolType.Weighted:var o=e.weight0/e.weight1,s=n+f*i;return r*o*i*Math.pow(n/s,o)/s;case exports.PoolType.Hybrid:var d=e,u=parseInt(Bt(d).toString()),c=d.A/100,p=n+f,h=4*c*p+u-4*c*u,T=u*u*u/p;return(.5-(2*h-T/p)/Math.sqrt(h*h+4*c*T)/4)*i}return 0}function Pt(e,f){!e()&&f&&console.error(f)}function kt(e,f,t){return 0===t?e===f:e<1/t?Math.abs(e-f)<=10:Math.abs(e/f-1)<t}function wt(e,f,t){void 0===t&&(t=1);try{if(f<=e(0))return 0;var n,r;if(e(t)>f){for(n=t/2;e(n)>f;)n/=2;r=2*n}else{for(r=2*t;e(r)<f;)r*=2;n=r/2}for(;r/n-1>1e-4;){var i=(n+r)/2,a=e(i);if(f===a)return i;f<a?r=i:n=i}return(n+r)/2}catch(e){return 0}}function Lt(e,f){if(void 0!==e)return e;if(f<Number.MAX_SAFE_INTEGER)return _.BigNumber.from(Math.round(f));var t=Math.floor(Math.log(f)/Math.LN2);console.assert(t>=51,"Internal Error 314");var n=t-51,r=Math.round(f/Math.pow(2,n));return _.BigNumber.from(r).mul(_.BigNumber.from(2).pow(n))}var qt=function(){function e(e,f,t){this.GasConsumption=4e4,this.MINIMUM_LIQUIDITY=1e3,this.pool=e,this.vert0=f,this.vert1=t,this.amountInPrevious=0,this.amountOutPrevious=0,this.canBeUsed=!0,this.direction=!0,this.bestEdgeIncome=0}var f=e.prototype;return f.reserve=function(e){return e===this.vert0?this.pool.reserve0:this.pool.reserve1},f.calcOutput=function(e,f){var t,n=this.pool,r=this.amountInPrevious?0:this.GasConsumption;return e===this.vert1?this.direction?(t=f<this.amountOutPrevious?this.amountInPrevious-_t(n,this.amountOutPrevious-f,!0):gt(n,f-this.amountOutPrevious,!1)+this.amountInPrevious,f===this.amountOutPrevious&&(r=-this.GasConsumption)):t=gt(n,this.amountOutPrevious+f,!1)-this.amountInPrevious:this.direction?t=gt(n,this.amountInPrevious+f,!0)-this.amountOutPrevious:(f===this.amountInPrevious&&(r=-this.GasConsumption),t=f<this.amountInPrevious?this.amountOutPrevious-_t(n,this.amountInPrevious-f,!1):gt(n,f-this.amountInPrevious,!0)+this.amountOutPrevious),[t,r]},f.checkMinimalLiquidityExceededAfterSwap=function(e,f){if(e===this.vert0){var t=parseInt(this.pool.reserve1.toString());return this.direction?t-f-this.amountOutPrevious<this.MINIMUM_LIQUIDITY:t-f+this.amountOutPrevious<this.MINIMUM_LIQUIDITY}var n=parseInt(this.pool.reserve0.toString());return this.direction?n-f+this.amountInPrevious<this.MINIMUM_LIQUIDITY:n-f-this.amountInPrevious<this.MINIMUM_LIQUIDITY},f.testApply=function(e,f,t){console.assert(this.amountInPrevious*this.amountOutPrevious>=0);var n,r=this.direction?this.amountInPrevious:-this.amountInPrevious,i=this.direction?this.amountOutPrevious:-this.amountOutPrevious,a=0,o=0;if(e.getNeibour(this)){var s=r+(e===this.vert0?f:-t),d=i+(e===this.vert0?t:-f);s*d<0&&console.log("333"),console.assert(s*d>=0),s>=0?(n=!0,a=s,o=d):(n=!1,a=-s,o=-d)}else console.error("Error 221");if(n){var u=gt(this.pool,a,n),c=kt(o,u,1e-6);return c||console.log("Err 225-1 !!",o,u,Math.abs(u/o-1)),c}var p=gt(this.pool,o,n),h=kt(a,p,1e-6);return h||console.log("Err 225-2!!",a,p,Math.abs(p/a-1)),h},f.applySwap=function(e){var f=this;console.assert(this.amountInPrevious*this.amountOutPrevious>=0);var t=this.direction?this.amountInPrevious:-this.amountInPrevious,n=this.direction?this.amountOutPrevious:-this.amountOutPrevious,r=e.getNeibour(this);if(r){var i=t+(e===this.vert0?e.bestIncome:-r.bestIncome),a=n+(e===this.vert0?r.bestIncome:-e.bestIncome);console.assert(i*a>=0),i>=0?(this.direction=!0,this.amountInPrevious=i,this.amountOutPrevious=a):(this.direction=!1,this.amountInPrevious=-i,this.amountOutPrevious=-a)}else console.error("Error 221");Pt((function(){return f.direction?kt(f.amountOutPrevious,gt(f.pool,f.amountInPrevious,f.direction),1e-6):kt(f.amountInPrevious,gt(f.pool,f.amountOutPrevious,f.direction),1e-6)}),"Error 225")},e}(),Ht=function(){function e(e){this.token=e,this.edges=[],this.price=0,this.gasPrice=0,this.bestIncome=0,this.gasSpent=0,this.bestTotal=0,this.bestSource=void 0,this.checkLine=-1}return e.prototype.getNeibour=function(e){if(e)return e.vert0===this?e.vert1:e.vert0},e}(),Ut=function(){function e(e,f,t){var n=this;this.vertices=[],this.edges=[],this.tokens=new Map,e.forEach((function(e){var f=n.getOrCreateVertice(e.token0),t=n.getOrCreateVertice(e.token1),r=new qt(e,f,t);f.edges.push(r),t.edges.push(r),n.edges.push(r)}));var r=this.tokens.get(f);r&&this.setPrices(r,1,t)}var f=e.prototype;return f.setPrices=function(e,f,t){var n=this;0===e.price&&(e.price=f,e.gasPrice=t,e.edges.map((function(f){return[f,parseInt(f.reserve(e).toString())]})).sort((function(e,f){return f[1]-e[1]})).forEach((function(r){var i=r[0],a=i.vert0===e?i.vert1:i.vert0;if(0===a.price){var o=Ft(i.pool,0,!1);e===i.vert0&&(o=1/o),n.setPrices(a,f*o,t/o)}})))},f.getOrCreateVertice=function(e){var f=this.tokens.get(e);return f||(f=new Ht(e),this.vertices.push(f),this.tokens.set(e,f),f)},f.exportPath=function(e,f){for(var t=this.tokens.get(e),n=this.tokens.get(f),r=t.bestIncome*t.price/n.price,i=new Set,a=n;a!==t;a=a.getNeibour(a.bestSource))a.bestSource&&i.add(a.bestSource);function o(e,f){var t;if(0===e)t="0";else{var n=e>0?e:-e,r=f-Math.ceil(Math.log(n)/Math.LN10);if(r<=0)t=""+Math.round(n);else{var i=Math.pow(10,r);t=""+Math.round(n*i)/i}e<0&&(t=-t)}return t}var s="var nodes = new vis.DataSet([\n      "+this.vertices.map((function(e){return"{ id: "+e.token.name+', label: "'+function(e){var f=""+o(e.bestIncome*e.price/n.price,3),t=""+o(e.bestTotal,3);return[-1===e.checkLine?void 0:""+e.checkLine,f,t].filter((function(e){return void 0!==e})).join(":")}(e)+'"}'})).join(",\n\t\t")+"\n    ]);\n",d="var edges = new vis.DataSet([\n      "+this.edges.map((function(e){return"{ from: "+e.vert0.token.name+", to: "+e.vert1.token.name+(a=(f=e).vert1.bestSource===f,s=f.vert0.bestSource===f,-1===f.bestEdgeIncome&&(t='label: "low_liq"'),0!==f.bestEdgeIncome&&(t='label: "'+o(100*(f.bestEdgeIncome/r-1),3)+'%"'),a&&s&&(n='arrows: "from,to"'),a&&(n='arrows: "to"'),s&&(n='arrows: "from"'),["",t,i.has(f)?"value: 2":void 0,n].filter((function(e){return void 0!==e})).join(", ")+"}");var f,t,n,a,s})).join(",\n\t\t")+"\n    ]);\n";require("fs").writeFileSync("D:/Info/Notes/GraphVisualization/data.js",s+d+"var data = {\n        nodes: nodes,\n        edges: edges,\n    };\n")},f.findBestPath=function(e,f,t){var n=this.tokens.get(e),r=this.tokens.get(f);if(n&&r){this.edges.forEach((function(e){return e.bestEdgeIncome=0})),this.vertices.forEach((function(e){e.bestIncome=0,e.gasSpent=0,e.bestTotal=0,e.bestSource=void 0,e.checkLine=-1})),n.bestIncome=t,n.bestTotal=t;for(var i=new Set,a=[n],o=0,s=function(){var e=void 0,f=-1,t=0;if(a.forEach((function(n,r){n.bestTotal>f&&(f=n.bestTotal,e=n,t=r)})),!e)return{v:void 0};if(e.checkLine=o++,e===r){for(var n=[],s=r;null!=(d=s)&&d.bestSource;s=s.getNeibour(s.bestSource)){var d;n.unshift(s.bestSource)}return{v:{path:n,output:r.bestIncome,gasSpent:r.gasSpent,totalOutput:r.bestTotal}}}a.splice(t,1),e.edges.forEach((function(f){var t=e===f.vert0?f.vert1:f.vert0;if(!i.has(t)){var n,o;try{var s=f.calcOutput(e,e.bestIncome);n=s[0],o=s[1]}catch(f){return}if(f.checkMinimalLiquidityExceededAfterSwap(e,n))f.bestEdgeIncome=-1;else{var d=e.gasSpent+o,u=t.price/r.price,c=n*u-d*r.gasPrice;console.assert(0===f.bestEdgeIncome,"Error 373"),f.bestEdgeIncome=n*u,t.bestSource||a.push(t),(!t.bestSource||c>t.bestTotal)&&(t.bestIncome=n,t.gasSpent=d,t.bestTotal=c,t.bestSource=f)}}})),i.add(e)};;){var d=s();if("object"==typeof d)return d.v}}},f.addPath=function(e,f,t){var n=this,r=e;t.forEach((function(e){r?(e.applySwap(r),r=r.getNeibour(e)):console.error("Unexpected 315")})),Pt((function(){return n.vertices.every((function(t){var n=0,r=0;return t.edges.forEach((function(e){e.vert0===t?(e.direction?n-=e.amountInPrevious:n+=e.amountInPrevious,r+=e.amountInPrevious):(e.direction?n+=e.amountOutPrevious:n-=e.amountOutPrevious,r+=e.amountOutPrevious)})),t===e?n<=0:t===f?n>=0:0===r?0===n:Math.abs(n/r)<1e10}))}),"Error 290")},f.findBestRoute=function(e,f,t,n){var r=[];if(Array.isArray(n)){var i=n.reduce((function(e,f){return e+f}),0);r=n.map((function(e){return e/i}))}else for(var a=0;a<n;++a)r.push(1/n);this.edges.forEach((function(e){e.amountInPrevious=0,e.amountOutPrevious=0,e.direction=!0}));var o,s,d=0,u=0,c=0;for(o=0;o<r.length;++o){var p=this.findBestPath(e,f,t*r[o]);if(!p)break;d+=p.output,u+=p.gasSpent,this.addPath(this.tokens.get(e),this.tokens.get(f),p.path),c+=r[o]}if(0==o)return{status:exports.RouteStatus.NoWay,amountIn:0,amountOut:0,legs:[],gasSpent:0,totalAmountOut:0};s=o<r.length?exports.RouteStatus.Partial:exports.RouteStatus.Success;var h=this.tokens.get(e),T=this.tokens.get(f),C=this.getRouteLegs(h,T),b=C[0],I=C[1],E=C[2];return console.assert(I<=u,"Internal Error 491"),E&&(d=this.calcLegsAmountOut(b,t,f)),{status:s,amountIn:t*c,amountOut:d,legs:b,gasSpent:I,totalAmountOut:d-I*T.gasPrice}},f.getRouteLegs=function(e,f){var t=this,n=this.cleanTopology(e,f),r=n[1],i=[],a=0;return n[0].forEach((function(e){var f=t.getOutputEdges(e).map((function(e){var f=t.edgeFrom(e);return f?[e,f[0],f[1]]:[e]})),n=f.reduce((function(e,f){return e+f[2]}),0);if(!(n<=0)){var r=n;f.forEach((function(t,o){var s=t[2];i.push({address:t[0].pool.address,token:e.token,swapPortion:o+1===f.length?1:s/n,absolutePortion:s/r}),a+=t[0].pool.swapGasCost,n-=s})),console.assert(n/r<1e-12,"Error 281")}})),[i,a,r]},f.edgeFrom=function(e){if(0!==e.amountInPrevious)return e.direction?[e.vert0,e.amountInPrevious]:[e.vert1,e.amountOutPrevious]},f.getOutputEdges=function(e){return e.edges.filter((function(f){return!!f.canBeUsed&&0!==f.amountInPrevious&&f.direction===(f.vert0===e)}))},f.getInputEdges=function(e){return e.edges.filter((function(f){return!!f.canBeUsed&&0!==f.amountInPrevious&&f.direction!==(f.vert0===e)}))},f.calcLegsAmountOut=function(e,f,t){var n=this,r=new Map;return r.set(e[0].token,f),e.forEach((function(e){var f=n.tokens.get(e.token);console.assert(void 0!==f,"Internal Error 570");var t=f.edges.find((function(f){return f.pool.address===e.address}));console.assert(void 0!==t,"Internel Error 569");var i=t.pool,a=f===t.vert0,o=r.get(e.token);console.assert(void 0!==o,"Internal Error 564");var s=o*e.swapPortion;r.set(e.token,o-s);var d=gt(i,s,a),u=f.getNeibour(t),c=r.get(u.token);r.set(u.token,(c||0)+d)})),r.get(t)||0},f.cleanTopology=function(e,f){var t=!1,n=this.topologySort(e,f);if(2!==n[0]){for(t=!0,console.assert(0===n[0],"Internal Error 554");0===n[0];)this.removeWeakestEdge(n[1]),n=this.topologySort(e,f);if(3===n[0]&&(this.removeDeadEnds(n[1]),n=this.topologySort(e,f)),console.assert(2===n[0],"Internal Error 563"),2!==n[0])return[[],t]}return[n[1],t]},f.removeDeadEnds=function(e){var f=this;e.forEach((function(e){f.getInputEdges(e).forEach((function(e){e.canBeUsed=!1}))}))},f.removeWeakestEdge=function(e){var f,t,n=this,r=Number.MAX_VALUE;e.forEach((function(i,a){var o=0===a?e[e.length-1]:e[a-1],s=0;n.getOutputEdges(i).forEach((function(e){i.getNeibour(e)===o&&(s+=e.direction?e.amountOutPrevious:e.amountInPrevious)})),s<r&&(f=i,t=o,r=s)})),this.getOutputEdges(f).forEach((function(e){f.getNeibour(e)===t&&(e.canBeUsed=!1)}))},f.topologySort=function(e,f){var t=new Map,n=[],r=[],i=[],a=this,o=function e(o){var s=t.get(o);if(2===s||3===s)return s;if(1===s)return console.assert(0==r.length,"Internal Error 566"),r.push(o),1;t.set(o,1);for(var d=!1,u=a.getOutputEdges(o),c=0;c<u.length;++c){var p=e(o.getNeibour(u[c]));if(0===p)return 0;if(1===p)return r[0]===o?0:(r.push(o),1);2===p&&(d=!0)}return d?(console.assert(o!==f,"Internal Error 589"),n.push(o),t.set(o,2),2):o!==f?(i.push(o),t.set(o,3),3):(n.push(o),t.set(o,2),2)}(e);return 0===o?[0,r]:i.length?[3,i]:(Pt((function(){return n[0]===f&&n[n.length-1]===e}),"Internal Error 614"),2===o?[2,n.reverse()]:(console.assert(!0,"Internal Error 612"),[1,[]]))},e}();function Kt(e){return"0x"+e.quotient.toString(16)}var Vt=function(){function e(){}return e.swapCallParameters=function(e,f){var t=e.inputAmount.currency.isNative,n=e.outputAmount.currency.isNative;t&&n&&F(!1),!("ttl"in f)||f.ttl>0||F(!1);var r,i,a,o=We(f.recipient),s=Kt(e.maximumAmountIn(f.allowedSlippage)),d=Kt(e.minimumAmountOut(f.allowedSlippage)),u=e.route.path.map((function(e){return e.address})),c="ttl"in f?"0x"+(Math.floor((new Date).getTime()/1e3)+f.ttl).toString(16):"0x"+f.deadline.toString(16),p=Boolean(f.feeOnTransfer);switch(e.tradeType){case exports.TradeType.EXACT_INPUT:t?(r=p?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",i=[d,u,o,c],a=s):n?(r=p?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",i=[s,d,u,o,c],a="0x0"):(r=p?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",i=[s,d,u,o,c],a="0x0");break;case exports.TradeType.EXACT_OUTPUT:p&&F(!1),t?(r="swapETHForExactTokens",i=[d,u,o,c],a=s):n?(r="swapTokensForExactETH",i=[d,s,u,o,c],a="0x0"):(r="swapTokensForExactTokens",i=[d,s,u,o,c],a="0x0")}return{methodName:r,args:i,value:a}},e}(),Xt=[{inputs:[{internalType:"uint256",name:"_externalOrderFee",type:"uint256"},{internalType:"contract IBentoBoxV1",name:"_bentoBox",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract IERC20",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"feeTo",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"LogFeesCollected",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"maker",type:"address"},{indexed:!0,internalType:"bytes32",name:"digest",type:"bytes32"},{indexed:!1,internalType:"contract ILimitOrderReceiver",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"fillAmount",type:"uint256"}],name:"LogFillOrder",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"bytes32",name:"digest",type:"bytes32"}],name:"LogOrderCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"feeTo",type:"address"},{indexed:!1,internalType:"uint256",name:"externalOrderFee",type:"uint256"}],name:"LogSetFees",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract ILimitOrderReceiver",name:"receiver",type:"address"}],name:"LogWhiteListReceiver",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[],name:"FEE_DIVISOR",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"calls",type:"bytes[]"},{internalType:"bool",name:"revertOnFail",type:"bool"}],name:"batch",outputs:[{internalType:"bool[]",name:"successes",type:"bool[]"},{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"maker",type:"address"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"stopPrice",type:"uint256"},{internalType:"contract IOracle",name:"oracleAddress",type:"address"},{internalType:"bytes",name:"oracleData",type:"bytes"},{internalType:"uint256",name:"amountToFill",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],internalType:"struct StopLimitOrder.OrderArgs[]",name:"order",type:"tuple[]"},{internalType:"contract IERC20",name:"tokenIn",type:"address"},{internalType:"contract IERC20",name:"tokenOut",type:"address"},{internalType:"contract ILimitOrderReceiver",name:"receiver",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"batchFillOrder",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"maker",type:"address"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"stopPrice",type:"uint256"},{internalType:"contract IOracle",name:"oracleAddress",type:"address"},{internalType:"bytes",name:"oracleData",type:"bytes"},{internalType:"uint256",name:"amountToFill",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],internalType:"struct StopLimitOrder.OrderArgs[]",name:"order",type:"tuple[]"},{internalType:"contract IERC20",name:"tokenIn",type:"address"},{internalType:"contract IERC20",name:"tokenOut",type:"address"},{internalType:"contract ILimitOrderReceiver",name:"receiver",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"batchFillOrderOpen",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"hash",type:"bytes32"}],name:"cancelOrder",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"bytes32",name:"",type:"bytes32"}],name:"cancelledOrder",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"claimOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deploymentChainId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"externalOrderFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"feeTo",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"",type:"address"}],name:"feesCollected",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"maker",type:"address"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"stopPrice",type:"uint256"},{internalType:"contract IOracle",name:"oracleAddress",type:"address"},{internalType:"bytes",name:"oracleData",type:"bytes"},{internalType:"uint256",name:"amountToFill",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],internalType:"struct StopLimitOrder.OrderArgs",name:"order",type:"tuple"},{internalType:"contract IERC20",name:"tokenIn",type:"address"},{internalType:"contract IERC20",name:"tokenOut",type:"address"},{internalType:"contract ILimitOrderReceiver",name:"receiver",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"fillOrder",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"maker",type:"address"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"amountOut",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"startTime",type:"uint256"},{internalType:"uint256",name:"endTime",type:"uint256"},{internalType:"uint256",name:"stopPrice",type:"uint256"},{internalType:"contract IOracle",name:"oracleAddress",type:"address"},{internalType:"bytes",name:"oracleData",type:"bytes"},{internalType:"uint256",name:"amountToFill",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],internalType:"struct StopLimitOrder.OrderArgs",name:"order",type:"tuple"},{internalType:"contract IERC20",name:"tokenIn",type:"address"},{internalType:"contract IERC20",name:"tokenOut",type:"address"},{internalType:"contract ILimitOrderReceiver",name:"receiver",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"fillOrderOpen",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"orderStatus",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pendingOwner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token",type:"address"},{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permitToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_feeTo",type:"address"},{internalType:"uint256",name:"_externalOrderFee",type:"uint256"}],name:"setFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token",type:"address"}],name:"swipe",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token",type:"address"}],name:"swipeFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"},{internalType:"bool",name:"direct",type:"bool"},{internalType:"bool",name:"renounce",type:"bool"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract ILimitOrderReceiver",name:"receiver",type:"address"}],name:"whiteListReceiver",outputs:[],stateMutability:"nonpayable",type:"function"}],Wt=function(){function e(e,f,t,n,r,i,a,o,s,d,u,c){void 0===a&&(a="0"),void 0===o&&(o="0x0000000000000000000000000000000000000000"),void 0===s&&(s="0x00000000000000000000000000000000000000000000000000000000000000"),void 0===d&&(d=0),void 0===u&&(u=""),void 0===c&&(c=""),this.maker=We(e),this.amountIn=f,this.amountOut=t,this.recipient=We(n),this.startTime=r.toString(),this.endTime=i.toString(),this.stopPrice=a,this.oracleAddress=We(o),this.oracleData=s,this.v=d,this.r=u,this.s=c}e.getLimitOrder=function(f){return new e(f.maker,Uf.fromRawAmount(new Ze(f.chainId,f.tokenIn,f.tokenInDecimals,f.tokenInSymbol),f.amountIn),Uf.fromRawAmount(new Ze(f.chainId,f.tokenOut,f.tokenOutDecimals,f.tokenOutSymbol),f.amountOut),f.recipient,f.startTime,f.endTime,f.stopPrice,f.oracleAddress,f.oracleData,f.v,f.r,f.s)};var f=e.prototype;return f.usePrice=function(f){return new e(this.maker,this.amountIn,Uf.fromRawAmount(this.amountOut.currency,f.quote(this.amountIn).quotient.toString()),this.recipient,this.startTime,this.endTime,this.stopPrice,this.oracleAddress,this.oracleData)},f.signdOrderWithPrivatekey=function(e,f){var t={maker:this.maker,tokenIn:this.tokenInAddress,tokenOut:this.tokenOutAddress,amountIn:this.amountInRaw,amountOut:this.amountOutRaw,recipient:this.recipient,startTime:this.startTime,endTime:this.endTime,stopPrice:this.stopPrice,oracleAddress:this.oracleAddress,oracleData:q.keccak256(["bytes"],[this.oracleData])},n=lt(t,e,f),r=n.v,i=n.r,a=n.s;return this.v=r,this.r=i,this.s=a,{v:r,r:i,s:a}},f.signOrderWithProvider=function(){var e=Re(ut.mark((function e(f,t){var n,r,i,a,o;return ut.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={maker:this.maker,tokenIn:this.tokenInAddress,tokenOut:this.tokenOutAddress,amountIn:this.amountInRaw,amountOut:this.amountOutRaw,recipient:this.recipient,startTime:this.startTime,endTime:this.endTime,stopPrice:this.stopPrice,oracleAddress:this.oracleAddress,oracleData:q.keccak256(["bytes"],[this.oracleData])},e.next=3,Nt(n,f,t);case 3:return a=(r=e.sent).r,o=r.s,this.v=i=r.v,this.r=a,this.s=o,e.abrupt("return",{v:i,r:a,s:o});case 11:case"end":return e.stop()}}),e,this)})));return function(f,t){return e.apply(this,arguments)}}(),f.getTypedData=function(){var e={maker:this.maker,tokenIn:this.tokenInAddress,tokenOut:this.tokenOutAddress,amountIn:this.amountInRaw,amountOut:this.amountOutRaw,recipient:this.recipient,startTime:this.startTime,endTime:this.endTime,stopPrice:this.stopPrice,oracleAddress:this.oracleAddress,oracleData:q.keccak256(["bytes"],[this.oracleData])};return At(e,this.chainId)},f.getTypeHash=function(){var e=this.getTypedData();return yt(e)},f.send=function(){var e=Re(ut.mark((function e(){return ut.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,W(gf+"/orders/create",{method:"POST",body:JSON.stringify({maker:this.maker,tokenIn:this.tokenInAddress,tokenOut:this.tokenOutAddress,tokenInDecimals:this.tokenInDecimals,tokenOutDecimals:this.tokenOutDecimals,tokenInSymbol:this.tokenInSymbol,tokenOutSymbol:this.tokenOutSymbol,amountIn:this.amountInRaw,amountOut:this.amountOutRaw,recipient:this.recipient,startTime:this.startTime,endTime:this.endTime,stopPrice:this.stopPrice,oracleAddress:this.oracleAddress,oracleData:this.oracleData,v:this.v,r:this.r,s:this.s,chainId:this.amountIn.currency.chainId})});case 2:return e.abrupt("return",e.sent.json());case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),Me(e,[{key:"amountInRaw",get:function(){return this.amountIn.quotient.toString()}},{key:"amountOutRaw",get:function(){return this.amountOut.quotient.toString()}},{key:"tokenInAddress",get:function(){return this.amountIn.currency.address}},{key:"tokenOutAddress",get:function(){return this.amountOut.currency.address}},{key:"tokenInDecimals",get:function(){return this.amountIn.currency.decimals}},{key:"tokenOutDecimals",get:function(){return this.amountOut.currency.decimals}},{key:"tokenInSymbol",get:function(){return this.amountIn.currency.symbol||""}},{key:"tokenOutSymbol",get:function(){return this.amountOut.currency.symbol||""}},{key:"chainId",get:function(){return this.amountIn.currency.chainId}}]),e}(),Yt=function(){function e(e,f,t,n,r,i,a){void 0===a&&(a=!1),this.order=e,this.path=f.map(We),this.amountExternal=t,this.amountToFill=n,this.limitOrderReceiver=We(r),this.to=We(i),this.tokenIn=e.amountIn.currency.address,this.tokenOut=e.amountOut.currency.address,this.limitOrderReceiverData=H.defaultAbiCoder.encode(["address[]","uint256","address","bool"],[this.path,this.amountExternal.toString(),this.to,a])}var f=e.prototype;return f.fillOrderOpen=function(e,f){return f.open=!0,this.fillOrder(e,f)},f.fillOrder=function(){var e=Re(ut.mark((function e(f,t){var n,r,i,a,o,s,d,u,c,p;return ut.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.gasPrice,r=t.nonce,a=void 0!==(i=t.forceExecution)&&i,s=void 0!==(o=t.open)&&o?"fillOrderOpen":"fillOrder",d=[this.order.maker,this.order.amountInRaw,this.order.amountOutRaw,this.order.recipient,this.order.startTime,this.order.endTime,this.order.stopPrice,this.order.oracleAddress,this.order.oracleData,this.amountToFill.toString(),this.order.v,this.order.r,this.order.s],u=new X.Contract(oe[this.order.chainId],Xt,f),p=!0,t.debug&&console.log(d,this.path,this.limitOrderReceiver,this.limitOrderReceiverData),e.prev=6,e.next=9,u.estimateGas[s](d,this.path[0],this.path[this.path.length-1],this.limitOrderReceiver,this.limitOrderReceiverData);case 9:c=(c=e.sent).mul(11).div(10),e.next=22;break;case 13:if(e.prev=13,e.t0=e.catch(6),!a){e.next=21;break}console.log("Failed to estimate gas, forcing execution"),c=_.BigNumber.from("400000"),p=!0,e.next=22;break;case 21:return e.abrupt("return",{executed:!1});case 22:return e.next=24,u.fillOrder(d,this.path[0],this.path[this.path.length-1],this.limitOrderReceiver,this.limitOrderReceiverData,{gasLimit:c,gasPrice:n,nonce:r});case 24:return e.abrupt("return",{executed:p,transaction:e.sent});case 26:case"end":return e.stop()}}),e,this,[[6,13]])})));return function(f,t){return e.apply(this,arguments)}}(),e}();exports.JSBI=M,exports.ACTION_ACCRUE=8,exports.ACTION_ADD_ASSET=1,exports.ACTION_ADD_COLLATERAL=10,exports.ACTION_BENTO_DEPOSIT=20,exports.ACTION_BENTO_SETAPPROVAL=24,exports.ACTION_BENTO_TRANSFER=22,exports.ACTION_BENTO_TRANSFER_MULTIPLE=23,exports.ACTION_BENTO_WITHDRAW=21,exports.ACTION_BORROW=5,exports.ACTION_CALL=30,exports.ACTION_GET_REPAY_PART=7,exports.ACTION_GET_REPAY_SHARE=6,exports.ACTION_REMOVE_ASSET=3,exports.ACTION_REMOVE_COLLATERAL=4,exports.ACTION_REPAY=2,exports.ACTION_UPDATE_EXCHANGE_RATE=11,exports.ARCHER_ROUTER_ADDRESS=se,exports.ASSERT=Pt,exports.AbstractCurrency=Ve,exports.Avalanche=$e,exports.BAR_ADDRESS=J,exports.BENTOBOX_ADDRESS=ee,exports.BORING_HELPER_ADDRESS=ae,exports.Binance=ef,exports.CHAINLINK_ORACLE_ADDRESS=ie,exports.CL_MAX_TICK=887271,exports.CL_MIN_TICK=-887272,exports.Celo=ff,exports.ConstantProductPool=Qf,exports.CurrencyAmount=Uf,exports.ENS_REGISTRAR_ADDRESS=he,exports.Edge=qt,exports.Ether=tf,exports.FACTORY_ADDRESS=G,exports.FACTOR_PRECISION=Oe,exports.FIVE=Af,exports.FULL_UTILIZATION=le,exports.FULL_UTILIZATION_MINUS_MAX=Ae,exports.Fantom=nf,exports.FillLimitOrder=Yt,exports.Fraction=qf,exports.Graph=Ut,exports.Harmony=rf,exports.Heco=af,exports.HybridComputeLiquidity=Bt,exports.HybridgetY=Rt,exports.INIT_CODE_HASH=Of,exports.INTEREST_ELASTICITY=Ne,exports.InsufficientInputAmountError=Ff,exports.InsufficientReservesError=_f,exports.KASHI_ADDRESS=fe,exports.LAMBDA_URL=gf,exports.LimitOrder=Wt,exports.MAKER_ADDRESS=z,exports.MASTERCHEF_ADDRESS=Q,exports.MASTERCHEF_V2_ADDRESS=pe,exports.MAXIMUM_INTEREST_PER_YEAR=ve,exports.MAXIMUM_TARGET_UTILIZATION=Ee,exports.MERKLE_DISTRIBUTOR_ADDRESS=Ce,exports.MINICHEF_ADDRESS=de,exports.MINIMUM_INTEREST_PER_YEAR=ye,exports.MINIMUM_LIQUIDITY=Sf,exports.MINIMUM_TARGET_UTILIZATION=Ie,exports.MULTICALL2_ADDRESS=be,exports.Matic=of,exports.MaxUint256=bf,exports.Movr=sf,exports.NATIVE=Cf,exports.NativeCurrency=Xe,exports.ONE=Ef,exports.Okex=df,exports.OutOfLiquidity=Mt,exports.PEGGED_ORACLE_ADDRESS="0x6cbfbB38498Df0E1e7A4506593cDB02db9001564",exports.PROTOCOL_FEE=Se,exports.PROTOCOL_FEE_DIVISOR=De,exports.Pair=zf,exports.Palm=pf,exports.Percent=ft,exports.Pool=pt,exports.Price=Kf,exports.RConcentratedLiquidityPool=bt,exports.RConstantProductPool=ht,exports.RHybridPool=Tt,exports.ROUTER_ADDRESS=j,exports.RWeightedPool=Ct,exports.Route=tt,exports.Router=Vt,exports.SOCKET_URL="wss://hfimt374ge.execute-api.us-east-1.amazonaws.com/dev",exports.SOLIDITY_TYPE_MAXIMA=Rf,exports.STARTING_INTEREST_PER_YEAR=me,exports.STOP_LIMIT_ORDER_ADDRESS=oe,exports.SUSHISWAP_MULTISWAPPER_ADDRESS=ne,exports.SUSHISWAP_MULTI_EXACT_SWAPPER_ADDRESS=re,exports.SUSHISWAP_SWAPPER_ADDRESS=te,exports.SUSHISWAP_TWAP_0_ORACLE_ADDRESS="0x66F03B0d30838A3fee971928627ea6F59B236065",exports.SUSHISWAP_TWAP_1_ORACLE_ADDRESS="0x0D51b575591F8f74a2763Ade75D3CDCf6789266f",exports.SUSHI_ADDRESS=Z,exports.TEN=mf,exports.THREE=lf,exports.TIMELOCK_ADDRESS=$,exports.TWO=xf,exports.Token=Ze,exports.Trade=dt,exports.USDC=Qe,exports.USDC_ADDRESS=Y,exports.UTILIZATION_PRECISION=xe,exports.Vertice=Ht,exports.WETH9=Je,exports.WETH9_ADDRESS=ue,exports.WNATIVE=ze,exports.WNATIVE_ADDRESS=ce,exports.ZAPPER_ADDRESS=Te,exports.ZERO=If,exports._100=yf,exports._1000=Nf,exports._997=vf,exports.bentoTypes=Et,exports.calcInByOut=_t,exports.calcInputByPrice=function(e,f,t){switch(void 0===t&&(t=1),e.type){case exports.PoolType.ConstantProduct:var n=parseInt(e.reserve0.toString()),r=parseInt(e.reserve1.toString()),i=n/(1-e.fee);return Math.sqrt(r*i*f)-i;case exports.PoolType.Weighted:return function(e,f){var t=parseInt(e.reserve0.toString()),n=parseInt(e.reserve1.toString()),r=e.weight0/e.weight1,i=n*f*r*(1-e.fee)*Math.pow(t,r);return(Math.pow(i,1/(r+1))-t)/(1-e.fee)}(e,f);case exports.PoolType.Hybrid:return wt((function(f){return 1/Ft(e,f)}),f,t)}return 0},exports.calcOutByIn=gt,exports.calcPrice=Ft,exports.calcSquareEquation=function(e,f,t){var n=f*f-4*e*t;console.assert(n>=0,"Discriminant is negative! "+e+" "+f+" "+t);var r=Math.sqrt(n);return[(-f-r)/2/e,(-f+r)/2/e]},exports.closeValues=kt,exports.computeConstantProductPoolAddress=Xf,exports.computePairAddress=Jf,exports.computePoolInitCodeHash=Vf,exports.computePriceImpact=nt,exports.currencyEquals=function(e,f){return e instanceof Ze&&f instanceof Ze?e.equals(f):!(e instanceof Ze||f instanceof Ze||e!==f)},exports.findMultiRouting=function(e,f,t,n,r,i,a){void 0===a&&(a=12);var o=new Ut(n,r,i),s=o.tokens.get(e);return 0===(null==s?void 0:s.price)&&o.setPrices(s,1,0),o.findBestRoute(e,f,t,a)},exports.getBigNumber=Lt,exports.getSignature=lt,exports.getSignatureBento=St,exports.getSignatureWithProvider=Nt,exports.getSignatureWithProviderBentobox=Ot,exports.getTypeHash=yt,exports.getTypedData=At,exports.getTypedDataBento=mt,exports.inputOutputComparator=it,exports.name=xt,exports.revertPositive=wt,exports.sortedInsert=rt,exports.sqrt=Zf,exports.toHex=Kt,exports.tradeComparator=at,exports.types=It,exports.validateAndParseAddress=We,exports.validateSolidityTypeInstance=function(e,f){M.greaterThanOrEqual(e,If)||F(!1),M.lessThanOrEqual(e,Rf[f])||F(!1)},exports.xDai=uf;
//# sourceMappingURL=sdk.cjs.production.min.js.map
