@myx-trade/sdk 1.0.24-beta.2 → 1.0.24-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-2B5OMCNB.mjs → chunk-NQDL2KZT.mjs} +1 -1
- package/dist/{chunk-LRVDCA42.js → chunk-R4SRLBVI.js} +1 -1
- package/dist/{index-BDOPfmoC.d.mts → index-BSocxma1.d.mts} +9 -1
- package/dist/{index-BDOPfmoC.d.ts → index-BSocxma1.d.ts} +9 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/lp.d.mts +1 -1
- package/dist/lp.d.ts +1 -1
- package/dist/lp.js +1 -1
- package/dist/lp.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {http,fallback,createPublicClient,getContract,parseUnits,getAddress,formatUnits,encodeFunctionData,getAbiItem,toFunctionSelector,maxUint256}from'viem';export{parseUnits as Aa,formatUnits as za}from'viem';import Zn from'wretch';import {WordArray}from'crypto-es';import Ma from'dayjs';import {isNil}from'lodash-es';var On=Object.defineProperty;var dt=t=>{throw TypeError(t)};var pe=(t,e)=>{for(var n in e)On(t,n,{get:e[n],enumerable:true});};var lt=(t,e,n)=>e.has(t)||dt("Cannot "+n);var yt=(t,e,n)=>(lt(t,e,"read from private field"),n?n.call(t):e.get(t)),ct=(t,e,n)=>e.has(t)?dt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),ft=(t,e,n,a)=>(lt(t,e,"write to private field"),e.set(t,n),n);var bn={};pe(bn,{claimBasePoolRebate:()=>tn,claimBasePoolRebates:()=>nn,deposit:()=>mn,getLpPrice:()=>fn,getRewards:()=>cn,previewUserWithdrawData:()=>on,withdraw:()=>yn,withdrawableLpAmount:()=>ln});var _=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"DifferentMarket",inputs:[{type:"bytes32",name:"fromPoolId"},{type:"bytes32",name:"toPoolId"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"ForwardedRecipientMustBeMasterAccount",inputs:[{type:"address",name:"recipient"},{type:"address",name:"master"}]},{type:"error",name:"InsufficientQuoteIn",inputs:[{type:"uint256",name:"orderId"},{type:"uint256",name:"quoteIn"},{type:"uint256",name:"exchangeDelta"}]},{type:"error",name:"InvalidAmount",inputs:[{type:"uint256",name:"amount"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidLiquidityAmount",inputs:[]},{type:"error",name:"InvalidTpsl",inputs:[{type:"uint256",name:"orderId"}]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"NotReachedPrice",inputs:[{type:"uint256",name:"orderId"},{type:"uint256",name:"price"},{type:"uint256",name:"triggerPrice"},{type:"uint8",name:"triggerType"}]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"SamePoolMigration",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"SlippageExceeded",inputs:[{type:"uint256",name:"expected"},{type:"uint256",name:"actual"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"__ERC2771ContextUpgradeable_init",constant:false,payable:false,inputs:[{type:"address",name:"trustedForwarder_"}],outputs:[]},{type:"function",name:"addTpsl",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"poolType"},{type:"tuple[]",name:"tpslParams",components:[{type:"uint256",name:"amount"},{type:"uint256",name:"triggerPrice"},{type:"uint8",name:"triggerType"},{type:"uint256",name:"minQuoteOut"}]}]}],outputs:[]},{type:"function",name:"cancelTpsl",constant:false,payable:false,inputs:[{type:"uint256",name:"orderId"}],outputs:[]},{type:"function",name:"claimBasePoolRebate",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"recipient"}],outputs:[]},{type:"function",name:"claimBasePoolRebates",constant:false,payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"address",name:"recipient"}],outputs:[]},{type:"function",name:"claimQuotePoolRebate",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"recipient"}],outputs:[]},{type:"function",name:"claimQuotePoolRebates",constant:false,payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"address",name:"recipient"}],outputs:[]},{type:"function",name:"currentOrderId",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"depositBase",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"},{type:"tuple[]",name:"tpslParams",components:[{type:"uint256",name:"amount"},{type:"uint256",name:"triggerPrice"},{type:"uint8",name:"triggerType"},{type:"uint256",name:"minQuoteOut"}]}]}],outputs:[]},{type:"function",name:"depositQuote",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"},{type:"tuple[]",name:"tpslParams",components:[{type:"uint256",name:"amount"},{type:"uint256",name:"triggerPrice"},{type:"uint8",name:"triggerType"},{type:"uint256",name:"minQuoteOut"}]}]}],outputs:[]},{type:"function",name:"executeTpsl",constant:false,payable:false,inputs:[{type:"uint256",name:"orderId"},{type:"uint256",name:"quoteInIfNecessary"},{type:"uint256",name:"minOut"}],outputs:[{type:"uint256",name:"baseOut"},{type:"uint256",name:"quoteOut"}]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getTpslData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint256",name:"orderId"}],outputs:[{type:"tuple",components:[{type:"address",name:"user"},{type:"bytes32",name:"poolId"},{type:"uint8",name:"poolType"},{type:"uint256",name:"amount"},{type:"uint256",name:"triggerPrice"},{type:"uint8",name:"triggerType"},{type:"uint256",name:"minQuoteOut"}]}]},{type:"function",name:"getUserTpslOrderIds",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"}],outputs:[{type:"uint256[]"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isTrustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"forwarder"}],outputs:[{type:"bool"}]},{type:"function",name:"migrateLiquidity",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"fromPoolId"},{type:"bytes32",name:"toPoolId"},{type:"uint256",name:"amount"},{type:"uint256",name:"minLpOut"}]}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"trustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"withdrawBase",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"}]}],outputs:[]},{type:"function",name:"withdrawQuote",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"}]}],outputs:[]}];var bt=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"BoostFeeClaimFailed",inputs:[]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ExceedMaxExchangeableAmount",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InsufficientReturnAmount",inputs:[{type:"uint256",name:"expected"},{type:"uint256",name:"received"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"PoolBoostReserveInsufficient",inputs:[]},{type:"error",name:"PoolOracleFeeCharged",inputs:[]},{type:"error",name:"PoolOracleFeeNotCharged",inputs:[]},{type:"error",name:"PoolOracleFeeNotExisted",inputs:[]},{type:"error",name:"PoolOracleFeeNotSoldOut",inputs:[]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"OracleFeeExchanged",inputs:[{type:"bytes32",name:"poolId",indexed:true},{type:"uint256",name:"quoteAmount",indexed:false},{type:"uint256",name:"baseAmount",indexed:false},{type:"address",name:"recipient",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"chargeBoostFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"proposer"},{type:"uint256",name:"quoteAmount"}],outputs:[]},{type:"function",name:"chargeOracleFeeFromPoolVault",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"poolVault"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"}],outputs:[]},{type:"function",name:"chargeOracleFeeFromPrimer",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"primer"},{type:"uint256",name:"quoteAmount"}],outputs:[]},{type:"function",name:"claimBoostFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[]},{type:"function",name:"confirmBoostFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"bool",name:"isAllow"}],outputs:[]},{type:"function",name:"exchangeBaseFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"recipient"},{type:"bytes",name:"data"}],outputs:[{type:"uint256",name:"baseOut"}]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getExchangeableBaseFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256",name:"quoteIn"},{type:"uint256",name:"baseOut"}]},{type:"function",name:"getPoolBoostFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"tuple",components:[{type:"address",name:"proposer"},{type:"uint256",name:"amount"},{type:"bool",name:"isClaimable"}]}]},{type:"function",name:"getPoolOracleFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"tuple",components:[{type:"address",name:"primer"},{type:"uint8",name:"state"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"}]}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isBaseFeeSoldOut",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"bool"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"refreshOracleFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"withdrawOracleFee",constant:false,payable:false,inputs:[{type:"address",name:"token"},{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[]}];var _n=(o=>(o[o.LINEA_SEPOLIA=59141]="LINEA_SEPOLIA",o[o.LINEA_MAINNET=59144]="LINEA_MAINNET",o[o.ARB_TESTNET=421614]="ARB_TESTNET",o[o.ARB_MAINNET=42161]="ARB_MAINNET",o[o.BSC_TESTNET=97]="BSC_TESTNET",o[o.BSC_MAINNET=56]="BSC_MAINNET",o))(_n||{});var kn=[421614,59141,97,42161,59144,56];function gt(t){return !!t&&kn.includes(t)}var V=10;var Za={42161:130n,421614:130n,59144:130n,59141:130n,56:150n,97:150n},It=1500000n;var xt={chainInfo:{explorer:"https://sepolia.lineascan.build/",explorerOfTX:"https://sepolia.lineascan.build/tx/",publicJsonRPCUrl:["https://rpc.sepolia.linea.build","https://linea-sepolia.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"],label:"Linea Sepolia",logoUrl:"",faucetUrl:"",chainSymbol:"Linea",gasPriceRatio:1.3,gasLimitRatio:1.2,gasAmountRatio:2,gasFeeReservedForCollateral:(.525+1)*V,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},gasPrice:0n}};var At={chainInfo:{privateJsonRPCUrl:"",publicJsonRPCUrl:["https://sepolia-rollup.arbitrum.io/rpc"],label:" Arbitrum Sepolia",chainSymbol:"Arb Sepolia",explorer:"https://sepolia.arbiscan.io/",explorerOfTX:"https://sepolia.arbiscan.io/tx/",faucetUrl:"https://bwarelabs.com/faucets/arbitrum-sepolia",logoUrl:"",gasPriceRatio:1.5,gasLimitRatio:1.3,gasAmountRatio:2,gasFeeReservedForCollateral:(.055+1)*V,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},gasPrice:0n}};var Ct={chainInfo:{privateJsonRPCUrl:"",publicJsonRPCUrl:["https://bsc-testnet-dataseed.bnbchain.org"],label:"BNB Chain Testnet",chainSymbol:"BNB Chain Testnet",explorer:"https://testnet.bscscan.com/",explorerOfTX:"https://testnet.bscscan.com/tx/",faucetUrl:"https://docs.bnbchain.org/bnb-smart-chain/developers/faucet/",logoUrl:"",gasPriceRatio:1.5,gasLimitRatio:1.3,gasAmountRatio:2,gasFeeReservedForCollateral:(5e-4+1)*V,nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},gasPrice:0n}};var Et={chainInfo:{label:"Linea Mainnet",explorer:"https://lineascan.build/",logoUrl:"",explorerOfTX:"https://lineascan.build/tx/",publicJsonRPCUrl:["https://rpc.linea.build/","https://linea.blockpi.network/v1/rpc/public","https://1rpc.io/linea","https://rpc.linea.build"],chainSymbol:"Linea",gasPriceRatio:1.3,gasLimitRatio:1.2,gasAmountRatio:2,gasFeeReservedForCollateral:(.525+.35)*V,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},gasPrice:0n}};var Pt={chainInfo:{privateJsonRPCUrl:"",publicJsonRPCUrl:["https://arb1.arbitrum.io/rpc"],label:" Arbitrum One",chainSymbol:"Arbitrum One",explorer:"https://arbiscan.io/",explorerOfTX:"https://arbiscan.io/tx/",logoUrl:"",gasPriceRatio:1.5,gasLimitRatio:1.3,gasAmountRatio:2,gasFeeReservedForCollateral:(.055+.175)*V,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},gasPrice:0n}};var Rt={chainInfo:{privateJsonRPCUrl:"",publicJsonRPCUrl:["https://bsc-dataseed.bnbchain.org"],label:"BNB Chain",chainSymbol:"BNB Chain",explorer:"https://bscscan.com/",explorerOfTX:"https://bscscan.com/tx/",faucetUrl:"https://docs.bnbchain.org/bnb-smart-chain/developers/faucet/",logoUrl:"",gasPriceRatio:1.5,gasLimitRatio:2,gasAmountRatio:2,gasFeeReservedForCollateral:(5e-4+1)*V,nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},gasPrice:100000000n}};var C={59141:xt.chainInfo,421614:At.chainInfo,97:Ct.chainInfo,59144:Et.chainInfo,42161:Pt.chainInfo,56:Rt.chainInfo};function he(t){let e=C[t];if(!e)throw new Error(`Could not find information with chain id ${t}`);return e}var Me={};function Un(t){if(!Me[t]){let e=he(t),n=[...e.privateJsonRPCUrl?[e.privateJsonRPCUrl]:[],...Array.isArray(e.publicJsonRPCUrl)?[...e.publicJsonRPCUrl]:[]].filter(Boolean);if(n.length===0)throw new Error(`${t} has no jsonRPCUrl configured`);Me[t]={id:t,name:e.label||`Chain ${t}`,nativeCurrency:e.nativeCurrency,rpcUrls:{default:{http:n}}};}return Me[t]}var De={};function f(t){if(!De[t]){let e=he(t),n=[...e.privateJsonRPCUrl?[e.privateJsonRPCUrl]:[],...Array.isArray(e.publicJsonRPCUrl)?[...e.publicJsonRPCUrl]:[]].filter(Boolean);if(n.length===0)throw new Error(`${t} has no jsonRPCUrl configured`);let a=n.length===1?http(n[0]):fallback(n.map(s=>http(s)));De[t]=createPublicClient({chain:Un(t),transport:a});}return De[t]}var Oe=null;function Ln(t){Oe=t;}function qn(){return Oe}async function A(t){let e=Oe;if(!e?.hasSigner())throw new Error("No signer: call auth({ signer }) or auth({ walletClient })");return e.getViemWalletClient(t)}var Fe=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"BaseFeeNotSoldOut",inputs:[]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidBaseToken",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"LPNotFullyMinted",inputs:[]},{type:"error",name:"MarketNotExist",inputs:[{type:"bytes32",name:"marketId"}]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"PoolDebtNotCleared",inputs:[]},{type:"error",name:"PoolExists",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"PoolNotExist",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"PositionNotEmpty",inputs:[]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"error",name:"UnauthorizedUnboost",inputs:[]},{type:"error",name:"UnexpectedPoolState",inputs:[]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"benchPool",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple[]",name:"prices",components:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"oracleType"},{type:"uint64",name:"publishTime"},{type:"bytes",name:"oracleUpdateData"}]},{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"string",name:"remark"}]}],outputs:[]},{type:"function",name:"boostPool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"}]}],outputs:[]},{type:"function",name:"checkPoolExists",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"bool"}]},{type:"function",name:"deployPool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"marketId"},{type:"address",name:"baseToken"}]}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getMarketPool",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"address",name:"asset"}],outputs:[{type:"tuple",components:[{type:"bytes32",name:"marketId"},{type:"bytes32",name:"poolId"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"state"},{type:"bool",name:"compoundEnabled"},{type:"address",name:"basePoolToken"},{type:"address",name:"quotePoolToken"},{type:"address",name:"poolVault"},{type:"address",name:"tradingVault"}]}]},{type:"function",name:"getPairToken",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"}]},{type:"function",name:"getPool",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"tuple",components:[{type:"bytes32",name:"marketId"},{type:"bytes32",name:"poolId"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"state"},{type:"bool",name:"compoundEnabled"},{type:"address",name:"basePoolToken"},{type:"address",name:"quotePoolToken"},{type:"address",name:"poolVault"},{type:"address",name:"tradingVault"}]}]},{type:"function",name:"getPoolMarket",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"bytes32",name:"marketId"},{type:"tuple",components:[{type:"address",name:"quoteToken"},{type:"uint32",name:"baseReserveRatio"},{type:"uint32",name:"quoteReserveRatio"},{type:"uint64",name:"oracleFeeUsd"},{type:"uint64",name:"boostFeeUsd"},{type:"uint64",name:"boostRefundFeeUsd"},{type:"uint128",name:"poolPrimeThreshold"},{type:"uint128",name:"executionFee"},{type:"uint128",name:"maxExecutionFee"},{type:"uint128",name:"forwardFee"},{type:"uint128",name:"maxForwardFee"}]}]},{type:"function",name:"getPoolMarketExecutionFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256",name:"executionFee"}]},{type:"function",name:"getPoolMarketForwardFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256",name:"forwardFee"}]},{type:"function",name:"getPoolMarketId",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"bytes32",name:"marketId"}]},{type:"function",name:"getPoolRiskTier",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint8"}]},{type:"function",name:"getPoolVault",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"address"}]},{type:"function",name:"getPools",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32[]",name:"pools"}]},{type:"function",name:"getTradingVault",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"address"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isPoolAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"addr"}],outputs:[{type:"bool"}]},{type:"function",name:"perBenchPool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"string",name:"remark"}]}],outputs:[]},{type:"function",name:"primePool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"referencePrice"}]}],outputs:[]},{type:"function",name:"primePoolFromBoost",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"}]}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"reprimePool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"}]}],outputs:[]},{type:"function",name:"trenchPool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"bytes32",name:"oracleFeedId"},{type:"uint32",name:"oracleDecimals"},{type:"uint8",name:"oracleType"},{type:"uint8",name:"riskTier"}]}],outputs:[]},{type:"function",name:"unboostPool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"}]}],outputs:[]},{type:"function",name:"updatePoolCompoundEnabled",constant:false,payable:false,inputs:[{type:"tuple[]",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"bool",name:"enabled"}]}],outputs:[]},{type:"function",name:"updatePoolRiskTiers",constant:false,payable:false,inputs:[{type:"tuple[]",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"riskTier"}]}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var G=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"uint8",name:"decimals_",type:"uint8"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"InvalidShortString",type:"error"},{inputs:[{internalType:"string",name:"str",type:"string"}],name:"StringTooLong",type:"error"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"owner",type:"address"},{indexed:true,internalType:"address",name:"spender",type:"address"},{indexed:false,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:false,inputs:[],name:"EIP712DomainChanged",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"previousOwner",type:"address"},{indexed:true,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"from",type:"address"},{indexed:true,internalType:"address",name:"to",type:"address"},{indexed:false,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];var Se=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InsufficientOutputAmount",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"PoolNotActive",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"PoolNotExist",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeCastOverflowedUintToInt",inputs:[{type:"uint256",name:"value"}]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"QuotePoolProfitDistributed",inputs:[{type:"bytes32",name:"poolId",indexed:false},{type:"uint256",name:"amount",indexed:false},{type:"uint256",name:"genesisAmount",indexed:false},{type:"uint256",name:"price",indexed:false},{type:"uint256",name:"exchangeRate",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"EXCHANGE_RATE_PRECISION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"POOL_TOKEN_DECIMALS",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"REBATE_INDEX_PRECISION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"claimUserRebate",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"rebateOut"}]},{type:"function",name:"claimUserRebates",constant:false,payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256[]",name:"rebateOut"}]},{type:"function",name:"deposit",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"amountOut"}]},{type:"function",name:"distribute",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amount"},{type:"uint256",name:"genesisAmount"},{type:"uint256",name:"price"}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getExchangeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getExchangeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getPoolData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"tuple",components:[{type:"uint256",name:"genesisRebateIndex"}]}]},{type:"function",name:"getPoolTokenPrice",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"getUserData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"}],outputs:[{type:"tuple",components:[{type:"uint256",name:"index"},{type:"uint256",name:"accrued"}]}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"pendingUserRebates",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewLpAmountOut",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"quoteAmountIn"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewPoolTokenPrice",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewQuoteAmountOut",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"lpAmountIn"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewUserWithdrawData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"lpAmountIn"},{type:"address",name:"user"},{type:"uint256",name:"price"}],outputs:[{type:"uint256",name:"quoteAmountOut"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"updatePool",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"oraclePrice"}],outputs:[]},{type:"function",name:"upgradeTo",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"withdraw",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"amountOut"},{type:"uint256",name:"rebateOut"}]},{type:"function",name:"withdrawableLpAmount",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]}];var _e=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ExceedMaxProfit",inputs:[]},{type:"error",name:"ExceedMinOutputAmount",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InsufficientOutputAmount",inputs:[]},{type:"error",name:"InsufficientReturnAmount",inputs:[{type:"uint256",name:"expected"},{type:"uint256",name:"received"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"PoolNotActive",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"PoolNotCompoundable",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"PoolNotExist",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeCastOverflowedUintToInt",inputs:[{type:"uint256",name:"value"}]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"BasePoolProfitDistributed",inputs:[{type:"bytes32",name:"poolId",indexed:true},{type:"uint256",name:"baseAmount",indexed:false},{type:"uint256",name:"quoteAmount",indexed:false},{type:"uint256",name:"price",indexed:false},{type:"uint256",name:"exchangeRate",indexed:false},{type:"uint256",name:"rebateIndex",indexed:false},{type:"uint256",name:"genesisRebateIndex",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"PoolProfitExchanged",inputs:[{type:"bytes32",name:"poolId",indexed:true},{type:"uint256",name:"baseIn",indexed:false},{type:"uint256",name:"quoteOut",indexed:false},{type:"uint256",name:"price",indexed:false},{type:"address",name:"recipient",indexed:false}]},{type:"event",anonymous:false,name:"PoolRebateIndexUpdated",inputs:[{type:"bytes32",name:"poolId",indexed:true},{type:"uint256",name:"unexchangedProfits",indexed:false},{type:"uint256",name:"oldIndex",indexed:false},{type:"uint256",name:"newIndex",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"EXCHANGE_RATE_PRECISION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"POOL_TOKEN_DECIMALS",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"REBATE_INDEX_PRECISION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"claimUserRebate",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"rebateOut"}]},{type:"function",name:"claimUserRebates",constant:false,payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256[]",name:"rebateOut"}]},{type:"function",name:"deposit",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"amountOut"}]},{type:"function",name:"distribute",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"},{type:"uint256",name:"genesisAmount"},{type:"uint256",name:"price"}],outputs:[]},{type:"function",name:"exchangeProfit",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"baseIn"},{type:"uint256",name:"minQuoteOut"},{type:"address",name:"recipient"},{type:"bytes",name:"data"}],outputs:[{type:"uint256",name:"quoteOut"}]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getExchangeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getExchangeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"getExchangeableProfit",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256",name:"baseIn"},{type:"uint256",name:"quoteOut"}]},{type:"function",name:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getPoolData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"tuple",components:[{type:"uint256",name:"rebateIndex"},{type:"uint256",name:"genesisRebateIndex"},{type:"uint256",name:"exchangeableProfits"}]}]},{type:"function",name:"getPoolTokenPrice",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"getUserData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"}],outputs:[{type:"tuple",components:[{type:"uint256",name:"index"},{type:"uint256",name:"genesisIndex"},{type:"uint256",name:"accrued"},{type:"uint256",name:"genesisAccrued"}]}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"pendingUserRebates",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"},{type:"uint256",name:"price"}],outputs:[{type:"uint256",name:"rebates"},{type:"uint256",name:"genesisRebates"}]},{type:"function",name:"previewBaseAmountOut",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"lpAmountIn"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewExchangeableProfit",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256",name:"baseIn"},{type:"uint256",name:"quoteOut"}]},{type:"function",name:"previewLpAmountOut",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"baseAmountIn"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewPoolTokenPrice",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewUserWithdrawData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"lpAmountIn"},{type:"address",name:"user"},{type:"uint256",name:"price"}],outputs:[{type:"uint256",name:"baseAmountOut"},{type:"uint256",name:"rebateAmount"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"updatePool",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"oraclePrice"}],outputs:[]},{type:"function",name:"upgradeTo",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"withdraw",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"amountOut"},{type:"uint256",name:"rebateOut"}]},{type:"function",name:"withdrawableLpAmount",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]}];var ke=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ECDSAInvalidSignature",inputs:[]},{type:"error",name:"ECDSAInvalidSignatureLength",inputs:[{type:"uint256",name:"length"}]},{type:"error",name:"ECDSAInvalidSignatureS",inputs:[{type:"bytes32",name:"s"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ExpiredFeeData",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InsufficientBalance",inputs:[]},{type:"error",name:"InvalidFeeRate",inputs:[]},{type:"error",name:"InvalidFeeTier",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"NoRebateToClaim",inputs:[]},{type:"error",name:"NotBrokerSigner",inputs:[{type:"address",name:"signer"}]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{type:"address",name:"owner"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{type:"address",name:"account"}]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"error",name:"UnsupportedAssetClass",inputs:[{type:"uint8",name:"assetClass"}]},{type:"error",name:"UnsupportedFeeTier",inputs:[{type:"uint8",name:"tier"}]},{type:"event",anonymous:false,name:"BrokerFeesWithdrawn",inputs:[{type:"address",name:"broker",indexed:true},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false},{type:"address",name:"recipient",indexed:false}]},{type:"event",anonymous:false,name:"BrokerStatusUpdated",inputs:[{type:"address",name:"broker",indexed:false},{type:"bool",name:"isActive",indexed:false}]},{type:"event",anonymous:false,name:"EIP712DomainChanged",inputs:[]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"OwnershipTransferStarted",inputs:[{type:"address",name:"previousOwner",indexed:true},{type:"address",name:"newOwner",indexed:true}]},{type:"event",anonymous:false,name:"OwnershipTransferred",inputs:[{type:"address",name:"previousOwner",indexed:true},{type:"address",name:"newOwner",indexed:true}]},{type:"event",anonymous:false,name:"RebateClaimed",inputs:[{type:"address",name:"user",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"SignerUpdated",inputs:[{type:"address",name:"signer",indexed:false},{type:"bool",name:"isSigner",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"FEE_TYPEHASH",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"__ERC2771ContextUpgradeable_init",constant:false,payable:false,inputs:[{type:"address",name:"trustedForwarder_"}],outputs:[]},{type:"function",name:"acceptOwnership",constant:false,payable:false,inputs:[],outputs:[]},{type:"function",name:"activeFeeTiers",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"}],outputs:[{type:"uint256[]"}]},{type:"function",name:"activeSpecialFeeTierList",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"}],outputs:[{type:"uint256[]"}]},{type:"function",name:"addressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"batchSetSpecialFeeTiers",constant:false,payable:false,inputs:[{type:"tuple[]",name:"params",components:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"},{type:"int32",name:"makerFeeRate"},{type:"uint32",name:"takerFeeRate"}]}],outputs:[]},{type:"function",name:"batchUpdateFeeTiers",constant:false,payable:false,inputs:[{type:"tuple[]",name:"params",components:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"},{type:"tuple",name:"addOnFeeRate",components:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]}]}],outputs:[]},{type:"function",name:"checkAndResetExpiredTier",constant:false,payable:false,inputs:[{type:"address",name:"user"}],outputs:[]},{type:"function",name:"claimRebate",constant:false,payable:false,inputs:[{type:"address",name:"token"}],outputs:[]},{type:"function",name:"claimRebates",constant:false,payable:false,inputs:[{type:"address[]",name:"tokens"}],outputs:[]},{type:"function",name:"domainSeparatorV4",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"eip712Domain",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes1",name:"fields"},{type:"string",name:"name"},{type:"string",name:"version"},{type:"uint256",name:"chainId"},{type:"address",name:"verifyingContract"},{type:"bytes32",name:"salt"},{type:"uint256[]",name:"extensions"}]},{type:"function",name:"getAddOnFeeTier",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"}],outputs:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]},{type:"function",name:"getBaseFeeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"assetClass"}],outputs:[{type:"tuple",name:"baseFeeRate",components:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]}]},{type:"function",name:"getSpecialFeeTier",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"}],outputs:[{type:"int32",name:"makerFeeRate"},{type:"uint32",name:"takerFeeRate"}]},{type:"function",name:"getUserFeeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"},{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"}],outputs:[{type:"uint32",name:"takerFeeRate"},{type:"int32",name:"makerFeeRate"},{type:"uint32",name:"baseTakerFeeRate"},{type:"uint32",name:"baseMakerFeeRate"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"_addressManager"},{type:"address",name:"owner"},{type:"string",name:"_brokerName"},{type:"address[]",name:"brokerSigners"},{type:"uint8[]",name:"assetClasses"},{type:"tuple[]",name:"baseFeeRates",components:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]}],outputs:[]},{type:"function",name:"isActive",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bool"}]},{type:"function",name:"isTrustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"forwarder"}],outputs:[{type:"bool"}]},{type:"function",name:"name",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"onBrokerFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"},{type:"address",name:"token"},{type:"uint256",name:"feeAmount"}],outputs:[{type:"uint256",name:"totalReferralRebate"},{type:"uint256",name:"referrerRebate"},{type:"address",name:"referrer"}]},{type:"function",name:"owner",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"pendingOwner",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"renounceOwnership",constant:false,payable:false,inputs:[],outputs:[]},{type:"function",name:"setSigner",constant:false,payable:false,inputs:[{type:"address",name:"signer"},{type:"bool",name:"isSigner"}],outputs:[]},{type:"function",name:"setSpecialFeeTier",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"},{type:"int32",name:"makerFeeRate"},{type:"uint32",name:"takerFeeRate"}]}],outputs:[]},{type:"function",name:"setUserFeeData",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"address",name:"user"},{type:"uint64",name:"nonce"},{type:"uint64",name:"deadline"},{type:"tuple",name:"feeData",components:[{type:"uint8",name:"tier"},{type:"address",name:"referrer"},{type:"uint32",name:"totalReferralRebatePct"},{type:"uint32",name:"referrerRebatePct"},{type:"uint64",name:"expiry"}]},{type:"bytes",name:"signature"}]}],outputs:[]},{type:"function",name:"setUserSpecialFeeTier",constant:false,payable:false,inputs:[{type:"address",name:"user"},{type:"uint8",name:"feeTier"}],outputs:[]},{type:"function",name:"supportedAssetClasses",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256[]"}]},{type:"function",name:"syncAssetClass",constant:false,payable:false,inputs:[{type:"uint8",name:"assetClass"}],outputs:[]},{type:"function",name:"transferOwnership",constant:false,payable:false,inputs:[{type:"address",name:"newOwner"}],outputs:[]},{type:"function",name:"trustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"updateBaseFeeRates",constant:false,payable:false,inputs:[{type:"tuple[]",name:"params",components:[{type:"uint8",name:"assetClass"},{type:"bool",name:"isEnable"},{type:"tuple",name:"baseFeeRate",components:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]}]}],outputs:[]},{type:"function",name:"updateBrokerStatus",constant:false,payable:false,inputs:[{type:"bool",name:"active"}],outputs:[]},{type:"function",name:"updateFeeTier",constant:false,payable:false,inputs:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"},{type:"tuple",name:"feeRate",components:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]}],outputs:[]},{type:"function",name:"updateUserFeeData",constant:false,payable:false,inputs:[{type:"address",name:"user"},{type:"tuple",name:"feeData",components:[{type:"uint8",name:"tier"},{type:"address",name:"referrer"},{type:"uint32",name:"totalReferralRebatePct"},{type:"uint32",name:"referrerRebatePct"},{type:"uint64",name:"expiry"}]}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"userFeeData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"}],outputs:[{type:"uint8",name:"tier"},{type:"address",name:"referrer"},{type:"uint32",name:"totalReferralRebatePct"},{type:"uint32",name:"referrerRebatePct"},{type:"uint64",name:"expiry"}]},{type:"function",name:"userNonces",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"}],outputs:[{type:"uint64",name:"nonce"}]},{type:"function",name:"userRebates",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"},{type:"address",name:"token"}],outputs:[{type:"uint256",name:"rebateAmount"}]},{type:"function",name:"withdrawBrokerFees",constant:false,payable:false,inputs:[{type:"address",name:"token"},{type:"uint256",name:"amount"},{type:"address",name:"recipient"}],outputs:[]}];var Ne=[{type:"constructor",payable:false,inputs:[]},{type:"error",name:"ERC20InsufficientAllowance",inputs:[{type:"address",name:"spender"},{type:"uint256",name:"allowance"},{type:"uint256",name:"needed"}]},{type:"error",name:"ERC20InsufficientBalance",inputs:[{type:"address",name:"sender"},{type:"uint256",name:"balance"},{type:"uint256",name:"needed"}]},{type:"error",name:"ERC20InvalidApprover",inputs:[{type:"address",name:"approver"}]},{type:"error",name:"ERC20InvalidReceiver",inputs:[{type:"address",name:"receiver"}]},{type:"error",name:"ERC20InvalidSender",inputs:[{type:"address",name:"sender"}]},{type:"error",name:"ERC20InvalidSpender",inputs:[{type:"address",name:"spender"}]},{type:"error",name:"InsufficientBalance",inputs:[{type:"address",name:"account"},{type:"uint256",name:"balance"},{type:"uint256",name:"needed"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"event",anonymous:false,name:"Approval",inputs:[{type:"address",name:"owner",indexed:true},{type:"address",name:"spender",indexed:true},{type:"uint256",name:"value",indexed:false}]},{type:"event",anonymous:false,name:"GenesisShareBurned",inputs:[{type:"address",name:"account",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"GenesisShareMinted",inputs:[{type:"address",name:"account",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"Transfer",inputs:[{type:"address",name:"from",indexed:true},{type:"address",name:"to",indexed:true},{type:"uint256",name:"value",indexed:false}]},{type:"function",name:"addressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"allowance",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"owner"},{type:"address",name:"spender"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",constant:false,payable:false,inputs:[{type:"address",name:"spender"},{type:"uint256",name:"value"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"}],outputs:[{type:"uint256"}]},{type:"function",name:"burnFrom",constant:false,payable:false,inputs:[{type:"address",name:"from"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"decimals",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"_addressManager"},{type:"bytes32",name:"_poolId"},{type:"address",name:"_underlyingToken"},{type:"string",name:"name"},{type:"string",name:"symbol"}],outputs:[]},{type:"function",name:"mint",constant:false,payable:false,inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"name",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"poolId",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"symbol",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalGenesisShare",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"totalSupply",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",constant:false,payable:false,inputs:[{type:"address",name:"to"},{type:"uint256",name:"value"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",constant:false,payable:false,inputs:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"}],outputs:[{type:"bool"}]},{type:"function",name:"underlyingToken",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"userGenesisShare",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"}],outputs:[{type:"uint256"}]}];var Be=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"InvalidQuoteTokenAddress",inputs:[]},{type:"error",name:"InvalidRatioParams",inputs:[]},{type:"error",name:"MarketAlreadyExisted",inputs:[]},{type:"error",name:"MarketNotExisted",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"ExecutionFeeUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint256",name:"oldExecutionFee",indexed:false},{type:"uint256",name:"newExecutionFee",indexed:false}]},{type:"event",anonymous:false,name:"ForwardFeeUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint256",name:"oldForwardFee",indexed:false},{type:"uint256",name:"newForwardFee",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"MaxExecutionFeeUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint256",name:"oldMaxExecutionFee",indexed:false},{type:"uint256",name:"newMaxExecutionFee",indexed:false}]},{type:"event",anonymous:false,name:"MaxForwardFeeUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint256",name:"oldMaxForwardFee",indexed:false},{type:"uint256",name:"newMaxForwardFee",indexed:false}]},{type:"event",anonymous:false,name:"OracleFeeUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint64",name:"newOracleFeeUsd",indexed:false}]},{type:"event",anonymous:false,name:"PoolPrimeThresholdUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint128",name:"newPoolPrimeThreshold",indexed:false}]},{type:"event",anonymous:false,name:"ReserveRatioUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint32",name:"newBaseReserveRatio",indexed:false},{type:"uint32",name:"newQuoteReserveRatio",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"createMarket",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"uint64",name:"chainId"},{type:"address",name:"quoteToken"},{type:"uint32",name:"baseReserveRatio"},{type:"uint32",name:"quoteReserveRatio"},{type:"uint64",name:"oracleFeeUsd"},{type:"uint64",name:"boostFeeUsd"},{type:"uint64",name:"boostRefundFeeUsd"},{type:"uint128",name:"poolPrimeThreshold"},{type:"uint128",name:"executionFee"},{type:"uint128",name:"maxExecutionFee"},{type:"uint128",name:"forwardFee"},{type:"uint128",name:"maxForwardFee"}]},{type:"tuple",name:"quoteParams",components:[{type:"address",name:"priceContract"},{type:"bool",name:"applyExchangeRate"},{type:"uint16",name:"minDeviationRatio"}]}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getBoostFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getBoostRefundFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getExecutionFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getExecutionFeeByToken",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"quoteToken"}],outputs:[{type:"uint256"}]},{type:"function",name:"getForwardFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getForwardFeeByToken",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"quoteToken"}],outputs:[{type:"uint256"}]},{type:"function",name:"getMarket",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"tuple",components:[{type:"address",name:"quoteToken"},{type:"uint32",name:"baseReserveRatio"},{type:"uint32",name:"quoteReserveRatio"},{type:"uint64",name:"oracleFeeUsd"},{type:"uint64",name:"boostFeeUsd"},{type:"uint64",name:"boostRefundFeeUsd"},{type:"uint128",name:"poolPrimeThreshold"},{type:"uint128",name:"executionFee"},{type:"uint128",name:"maxExecutionFee"},{type:"uint128",name:"forwardFee"},{type:"uint128",name:"maxForwardFee"}]}]},{type:"function",name:"getMarketIds",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32[]"}]},{type:"function",name:"getOracleFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"uint256"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"marketExists",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"bool"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"updateExecutionFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint128",name:"_executionFee"}],outputs:[]},{type:"function",name:"updateForwardFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint128",name:"_forwardFee"}],outputs:[]},{type:"function",name:"updateMarketQuoteConfiguration",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"tuple",name:"quoteParams",components:[{type:"address",name:"priceContract"},{type:"bool",name:"applyExchangeRate"},{type:"uint16",name:"minDeviationRatio"}]}],outputs:[]},{type:"function",name:"updateMaxExecutionFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint128",name:"_maxExecutionFee"}],outputs:[]},{type:"function",name:"updateMaxForwardFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint128",name:"_maxForwardFee"}],outputs:[]},{type:"function",name:"updateOracleFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint64",name:"_oracleFeeUsd"}],outputs:[]},{type:"function",name:"updatePoolPrimeThreshold",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint128",name:"_poolPrimeThreshold"}],outputs:[]},{type:"function",name:"updateReserveRatio",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint32",name:"_baseReserveRatio"},{type:"uint32",name:"_quoteReserveRatio"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var Ue=[{type:"error",name:"PositionNotHealthy",inputs:[{type:"bytes32",name:"positionId"},{type:"uint256",name:"marginRatio"}]},{type:"error",name:"SafeCastOverflowedUintToInt",inputs:[{type:"uint256",name:"value"}]},{type:"function",name:"ADDRESS_MANAGER",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getAccountInfo",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"}],outputs:[{type:"tuple",name:"accountInfo",components:[{type:"uint256",name:"freeMargin"},{type:"uint256",name:"walletBalance"},{type:"uint256",name:"freeBaseAmount"},{type:"uint256",name:"baseProfit"},{type:"uint256",name:"quoteProfit"},{type:"uint256",name:"reservedAmount"},{type:"uint64",name:"releaseTime"}]}]},{type:"function",name:"getAvailableLiquiditySize",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint256",name:"executePrice"}],outputs:[{type:"uint256"}]},{type:"function",name:"getBrokerFeeTiers",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"brokerAddress"},{type:"uint8[]",name:"assetClasses"},{type:"uint8[]",name:"riskTiers"},{type:"bool",name:"isMYXBroker"}],outputs:[{type:"tuple[]",name:"brokerFees",components:[{type:"uint8",name:"asset"},{type:"tuple[]",name:"riskTieredBrokerFees",components:[{type:"uint8",name:"riskTier"},{type:"tuple[]",name:"addOnFeeTiers",components:[{type:"uint8",name:"tier"},{type:"uint32",name:"takerFeeRate"},{type:"int32",name:"makerFeeRate"}]},{type:"tuple[]",name:"baseFeeRate",components:[{type:"uint8",name:"assetClass"},{type:"uint32",name:"makerFeeRate"},{type:"uint32",name:"takerFeeRate"}]},{type:"tuple[]",name:"specialFeeTiers",components:[{type:"uint8",name:"tier"},{type:"uint32",name:"takerFeeRate"},{type:"int32",name:"makerFeeRate"}]}]}]}]},{type:"function",name:"getExchangeables",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"uint256[]",name:"marketPrices"}],outputs:[{type:"tuple[]",name:"exchangeables",components:[{type:"uint256",name:"maxBaseIn"},{type:"uint256",name:"maxQuoteIn"},{type:"uint256",name:"maxBaseOut"},{type:"uint256",name:"maxQuoteOut"}]}]},{type:"function",name:"getLiquidationPrice",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"positionId"},{type:"uint256",name:"marketPrice"}],outputs:[{type:"uint256"}]},{type:"function",name:"getPoolInfo",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"marketPrice"}],outputs:[{type:"tuple",components:[{type:"tuple",name:"basePool",components:[{type:"address",name:"poolToken"},{type:"uint256",name:"exchangeRate"},{type:"uint256",name:"poolTokenPrice"},{type:"uint256",name:"poolTokenSupply"},{type:"uint256",name:"totalDebt"},{type:"uint256",name:"baseCollateral"}]},{type:"tuple",name:"quotePool",components:[{type:"address",name:"poolToken"},{type:"uint256",name:"exchangeRate"},{type:"uint256",name:"poolTokenPrice"},{type:"uint256",name:"poolTokenSupply"},{type:"uint256",name:"totalDebt"},{type:"uint256",name:"baseCollateral"}]},{type:"tuple",name:"reserveInfo",components:[{type:"uint256",name:"baseTotalAmount"},{type:"uint256",name:"baseReservedAmount"},{type:"uint256",name:"quoteTotalAmount"},{type:"uint256",name:"quoteReservedAmount"}]},{type:"tuple",name:"fundingInfo",components:[{type:"int256",name:"nextFundingRate"},{type:"int256",name:"lastFundingFeeTracker"},{type:"uint256",name:"nextEpochTime"}]},{type:"tuple",name:"oi",components:[{type:"int256",name:"tracker"},{type:"uint256",name:"longSize"},{type:"uint256",name:"shortSize"},{type:"uint256",name:"poolEntryPrice"}]},{type:"tuple",name:"liquidityInfo",components:[{type:"uint256",name:"windowCaps"},{type:"int256",name:"openInterest"}]}]}]},{type:"function",name:"getPoolInfos",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"uint256[]",name:"marketPrices"}],outputs:[{type:"tuple[]",components:[{type:"tuple",name:"basePool",components:[{type:"address",name:"poolToken"},{type:"uint256",name:"exchangeRate"},{type:"uint256",name:"poolTokenPrice"},{type:"uint256",name:"poolTokenSupply"},{type:"uint256",name:"totalDebt"},{type:"uint256",name:"baseCollateral"}]},{type:"tuple",name:"quotePool",components:[{type:"address",name:"poolToken"},{type:"uint256",name:"exchangeRate"},{type:"uint256",name:"poolTokenPrice"},{type:"uint256",name:"poolTokenSupply"},{type:"uint256",name:"totalDebt"},{type:"uint256",name:"baseCollateral"}]},{type:"tuple",name:"reserveInfo",components:[{type:"uint256",name:"baseTotalAmount"},{type:"uint256",name:"baseReservedAmount"},{type:"uint256",name:"quoteTotalAmount"},{type:"uint256",name:"quoteReservedAmount"}]},{type:"tuple",name:"fundingInfo",components:[{type:"int256",name:"nextFundingRate"},{type:"int256",name:"lastFundingFeeTracker"},{type:"uint256",name:"nextEpochTime"}]},{type:"tuple",name:"oi",components:[{type:"int256",name:"tracker"},{type:"uint256",name:"longSize"},{type:"uint256",name:"shortSize"},{type:"uint256",name:"poolEntryPrice"}]},{type:"tuple",name:"liquidityInfo",components:[{type:"uint256",name:"windowCaps"},{type:"int256",name:"openInterest"}]}]}]},{type:"function",name:"getPoolTokenPrices",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"uint256[]",name:"marketPrices"}],outputs:[{type:"tuple[]",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"basePoolTokenPrice"},{type:"uint256",name:"quotePoolTokenPrice"}]}]},{type:"function",name:"getPositionFees",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"positionId"},{type:"address",name:"broker"},{type:"uint256",name:"price"}],outputs:[{type:"int256",name:"netCollateral"},{type:"uint256",name:"collateralAmount"},{type:"int256",name:"tradingFee"},{type:"int256",name:"fundingFee"},{type:"int256",name:"unrealizedPnl"}]},{type:"function",name:"getRiskParameters",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"maxRiskTier"}],outputs:[{type:"tuple[]",name:"params",components:[{type:"tuple",name:"tradeLimitParams",components:[{type:"uint64",name:"minTradeUsd"},{type:"uint16",name:"maxPriceDeviation"}]},{type:"tuple",name:"riskLockParams",components:[{type:"uint64",name:"windowCapUsd"},{type:"uint64",name:"liquidityWindowSize"},{type:"uint64",name:"profitWindowSize"},{type:"uint16",name:"priceRangePct"},{type:"uint32",name:"baseSlippage"}]},{type:"tuple",name:"poolConfigParams",components:[{type:"uint16",name:"leverage"},{type:"uint16",name:"maintainMarginRate"},{type:"uint16",name:"baseTokenCollateralRatio"},{type:"uint16",name:"exchangeIncentiveRate"},{type:"uint16",name:"genesisRebateRatio"},{type:"uint8",name:"assetClass"}]},{type:"tuple",name:"fundingRateParams",components:[{type:"int32",name:"maxRate"},{type:"uint32",name:"equilibriumRange"},{type:"int32",name:"lowGrowthRate"},{type:"int32",name:"highGrowthRate"},{type:"uint32",name:"epochDuration"}]}]}]},{type:"function",name:"getSumProfitLock",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address[]",name:"respondents"}],outputs:[{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"},{type:"tuple[]",name:"infos",components:[{type:"address",name:"account"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"}]}]},{type:"function",name:"getUserPositionInfos",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"},{type:"bytes32[]",name:"poolIds"}],outputs:[{type:"tuple[]",name:"positions",components:[{type:"bytes32",name:"positionId"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"size"},{type:"uint256",name:"entryPrice"},{type:"int256",name:"fundingRateIndex"},{type:"uint256",name:"earlyClosePrice"},{type:"uint8",name:"direction"},{type:"uint8",name:"riskTier"},{type:"uint64",name:"lastUpdateTime"},{type:"uint256",name:"collateralAmount"}]}]}];var Le=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC2771ForwarderExpiredRequest",inputs:[{type:"uint48",name:"deadline"}]},{type:"error",name:"ERC2771ForwarderInvalidSigner",inputs:[{type:"address",name:"signer"},{type:"address",name:"from"}]},{type:"error",name:"ERC2771ForwarderMismatchedValue",inputs:[{type:"uint256",name:"requestedValue"},{type:"uint256",name:"msgValue"}]},{type:"error",name:"ERC2771UntrustfulTarget",inputs:[{type:"address",name:"target"},{type:"address",name:"forwarder"}]},{type:"error",name:"ExceedsMaximumRelayFee",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InconsistentParamsLength",inputs:[]},{type:"error",name:"InsufficientBalance",inputs:[{type:"uint256",name:"balance"},{type:"uint256",name:"needed"}]},{type:"error",name:"InsufficientFeeAllowance",inputs:[{type:"address",name:"user"},{type:"uint256",name:"allowance"},{type:"uint256",name:"required"}]},{type:"error",name:"InsufficientFeeBalance",inputs:[{type:"address",name:"user"},{type:"uint256",name:"balance"},{type:"uint256",name:"required"}]},{type:"error",name:"InvalidAccountNonce",inputs:[{type:"address",name:"account"},{type:"uint256",name:"currentNonce"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"MismatchExecuteFee",inputs:[{type:"uint256",name:"balanceBefore"},{type:"uint256",name:"balanceAfter"},{type:"uint256",name:"expected"}]},{type:"error",name:"MismatchedSender",inputs:[{type:"address",name:"sender"}]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotAllowedTarget",inputs:[{type:"address",name:"target"}]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"OnlyRelayer",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"RelayerRegistered",inputs:[{type:"address",name:"relayer"}]},{type:"error",name:"RemoveRelayerFailed",inputs:[]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"AddAllowedTarget",inputs:[{type:"address",name:"target",indexed:false}]},{type:"event",anonymous:false,name:"ChargeForwardFee",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"feeToken",indexed:false},{type:"uint256",name:"relayFee",indexed:false}]},{type:"event",anonymous:false,name:"EIP712DomainChanged",inputs:[]},{type:"event",anonymous:false,name:"ERC20PermitFailed",inputs:[{type:"address",name:"token",indexed:false},{type:"string",name:"reason",indexed:false}]},{type:"event",anonymous:false,name:"ERC20PermitLowLevelFailed",inputs:[{type:"bytes",name:"data",indexed:false}]},{type:"event",anonymous:false,name:"ExecutedForwardRequest",inputs:[{type:"address",name:"signer",indexed:true},{type:"uint256",name:"nonce",indexed:false},{type:"bool",name:"success",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"RemoveAllowedTarget",inputs:[{type:"address",name:"target",indexed:false}]},{type:"event",anonymous:false,name:"SetUserRelayer",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"relayer",indexed:false},{type:"bool",name:"enable",indexed:false}]},{type:"event",anonymous:false,name:"UpdateAcquiescentFeeToken",inputs:[{type:"address",name:"sender",indexed:false},{type:"address",name:"oldRelayGas",indexed:false},{type:"address",name:"newRelayGas",indexed:false}]},{type:"event",anonymous:false,name:"UpdateEquilibriumGas",inputs:[{type:"address",name:"sender",indexed:false},{type:"uint256",name:"oldRelayGas",indexed:false},{type:"uint256",name:"newRelayGas",indexed:false}]},{type:"event",anonymous:false,name:"UpdateMaxRelayFee",inputs:[{type:"address",name:"sender",indexed:false},{type:"uint256",name:"oldMaxRelayFee",indexed:false},{type:"uint256",name:"newMaxRelayFee",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"__ERC2771ContextUpgradeable_init",constant:false,payable:false,inputs:[{type:"address",name:"trustedForwarder_"}],outputs:[]},{type:"function",name:"addAllowedTarget",constant:false,payable:false,inputs:[{type:"address",name:"target"}],outputs:[]},{type:"function",name:"batchExecuteForwarder",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"forwardFeeToken"},{type:"tuple[]",name:"bundleParams",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]}],outputs:[]},{type:"function",name:"eip712Domain",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes1",name:"fields"},{type:"string",name:"name"},{type:"string",name:"version"},{type:"uint256",name:"chainId"},{type:"address",name:"verifyingContract"},{type:"bytes32",name:"salt"},{type:"uint256[]",name:"extensions"}]},{type:"function",name:"equilibriumGas",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"execute",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]},{type:"address"}],outputs:[]},{type:"function",name:"executeBatch",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple[]",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]},{type:"address"},{type:"address"}],outputs:[]},{type:"function",name:"executeForwarder",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"forwardFeeToken"},{type:"tuple",name:"params",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]}],outputs:[]},{type:"function",name:"exitForwardMode",constant:false,payable:false,inputs:[],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getAllowedTargets",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address[]"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getDesignatedToken",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getEquilibriumGas",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getUserRelayers",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"}],outputs:[{type:"address[]"}]},{type:"function",name:"inForwardMode",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bool"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"},{type:"uint256",name:"_equilibriumGas"}],outputs:[]},{type:"function",name:"isAllowedTargets",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"contractAddr"}],outputs:[{type:"bool"}]},{type:"function",name:"isTrustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"forwarder"}],outputs:[{type:"bool"}]},{type:"function",name:"isUserRelayerEnabled",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"},{type:"address",name:"relayer"}],outputs:[{type:"bool"}]},{type:"function",name:"nonces",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{type:"function",name:"originAccount",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"relayer"}],outputs:[{type:"address",name:"account"}]},{type:"function",name:"permitAndApproveForwarder",constant:false,payable:false,inputs:[{type:"address",name:"relayer"},{type:"bool",name:"enable"},{type:"tuple[]",name:"permitParams",components:[{type:"address",name:"token"},{type:"address",name:"owner"},{type:"address",name:"spender"},{type:"uint256",name:"value"},{type:"uint256",name:"deadline"},{type:"uint8",name:"v"},{type:"bytes32",name:"r"},{type:"bytes32",name:"s"}]}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"removeAllowedTarget",constant:false,payable:false,inputs:[{type:"address",name:"target"}],outputs:[]},{type:"function",name:"trustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"updateEquilibriumGas",constant:false,payable:false,inputs:[{type:"uint256",name:"_equilibriumGas"}],outputs:[]},{type:"function",name:"upgradeTo",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"verify",constant:true,stateMutability:"view",payable:false,inputs:[{type:"tuple",name:"request",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]}],outputs:[{type:"bool"}]}];var qe=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"AlreadyClaimed",inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"user"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidAmount",inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"user"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"MerkleTreeVerificationFailed",inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"user"}]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"ReimbursementValidity",inputs:[{type:"uint256",name:"caseId"}]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"TreeAlreadySet",inputs:[]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementClaimExpired",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"user",indexed:false},{type:"address",name:"baseToken",indexed:false},{type:"address",name:"quoteToken",indexed:false},{type:"uint256",name:"baseAmount",indexed:false},{type:"uint256",name:"quoteAmount",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementClaimed",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"user",indexed:false},{type:"address",name:"baseToken",indexed:false},{type:"address",name:"quoteToken",indexed:false},{type:"uint256",name:"baseAmount",indexed:false},{type:"uint256",name:"quoteAmount",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementInfoSet",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"bytes32",name:"merkleRoot",indexed:false},{type:"address",name:"baseToken",indexed:false},{type:"address",name:"quoteToken",indexed:false},{type:"uint256",name:"totalBaseAmount",indexed:false},{type:"uint256",name:"totalQuoteAmount",indexed:false},{type:"uint256",name:"claimedBaseAmount",indexed:false},{type:"uint256",name:"claimedQuoteAmount",indexed:false},{type:"uint256",name:"expireTime",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"claimExpiredCases",constant:false,payable:false,inputs:[{type:"uint256[]",name:"caseIds"},{type:"address",name:"receiver"}],outputs:[]},{type:"function",name:"claimReimbursement",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"},{type:"bytes32[]",name:"merkleProof"}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getReimbursementInfo",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[{type:"tuple",components:[{type:"bytes32",name:"merkleRoot"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint256",name:"totalBaseAmount"},{type:"uint256",name:"totalQuoteAmount"},{type:"uint256",name:"claimedBaseAmount"},{type:"uint256",name:"claimedQuoteAmount"},{type:"uint256",name:"expireTime"}]}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"setReimbursementInfo",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"tuple",name:"reimbursementInfo",components:[{type:"bytes32",name:"merkleRoot"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint256",name:"totalBaseAmount"},{type:"uint256",name:"totalQuoteAmount"},{type:"uint256",name:"claimedBaseAmount"},{type:"uint256",name:"claimedQuoteAmount"},{type:"uint256",name:"expireTime"}]},{type:"bytes32[]",name:"zeroMerkleProof"}],outputs:[]},{type:"function",name:"upgradeTo",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var Ge=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"BondNotReleased",inputs:[]},{type:"error",name:"BondZeroAmount",inputs:[]},{type:"error",name:"CaseAppealNotFinished",inputs:[]},{type:"error",name:"CaseDeadlineNotReached",inputs:[]},{type:"error",name:"CaseDeadlineReached",inputs:[]},{type:"error",name:"CaseNotAccepted",inputs:[]},{type:"error",name:"CaseNotExist",inputs:[{type:"uint256",name:"caseId"}]},{type:"error",name:"CaseRespondentAppealed",inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"respondent"}]},{type:"error",name:"DisputeNotAllowed",inputs:[]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"InvalidPoolToken",inputs:[]},{type:"error",name:"InvalidProfitAmount",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotCaseRespondent",inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"respondent"}]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"OnlyRelayer",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"RiskCloseNotCompleted",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"error",name:"UnexpectedCaseState",inputs:[]},{type:"error",name:"UnexpectedCaseType",inputs:[]},{type:"event",anonymous:false,name:"AppealCanceled",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint256",name:"appealCaseId",indexed:false},{type:"address",name:"complainant",indexed:false},{type:"bool",name:"isMalicious",indexed:false}]},{type:"event",anonymous:false,name:"AppealFiled",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint256",name:"appealCaseId",indexed:false},{type:"address",name:"respondent",indexed:false},{type:"address",name:"appealToken",indexed:false},{type:"uint256",name:"appealBond",indexed:false},{type:"uint64",name:"appealDeadline",indexed:false}]},{type:"event",anonymous:false,name:"AppealResolved",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint256",name:"appealCaseId",indexed:false},{type:"uint8",name:"resolution",indexed:false},{type:"address",name:"complainant",indexed:false}]},{type:"event",anonymous:false,name:"BondClaimed",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"user",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"CaseAppealsResolved",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint256",name:"remaining",indexed:false}]},{type:"event",anonymous:false,name:"CaseRiskClosed",inputs:[{type:"uint256",name:"caseId",indexed:false}]},{type:"event",anonymous:false,name:"DisputeCanceled",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"complainant",indexed:false},{type:"bool",name:"isMalicious",indexed:false}]},{type:"event",anonymous:false,name:"DisputeConfigurationUpdated",inputs:[{type:"tuple",name:"newDisputeConfigration",indexed:false,components:[{type:"address",name:"appealToken"},{type:"uint64",name:"disputeBondUsd"},{type:"uint64",name:"appealBondUsd"},{type:"uint64",name:"disputeThresholdUsd"},{type:"uint64",name:"caseDuration"},{type:"uint64",name:"voteDuration"},{type:"uint64",name:"resolveDuration"}]}]},{type:"event",anonymous:false,name:"DisputeFiled",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"bytes32",name:"poolId",indexed:false},{type:"address",name:"complainant",indexed:false},{type:"address",name:"poolToken",indexed:false},{type:"uint256",name:"disputeBond",indexed:false},{type:"uint64",name:"caseDeadline",indexed:false}]},{type:"event",anonymous:false,name:"DisputeResolved",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint8",name:"resolution",indexed:false},{type:"uint64",name:"appealDeadline",indexed:false}]},{type:"event",anonymous:false,name:"ForfeitBondsClaimed",inputs:[{type:"address",name:"receiver",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementProcessed",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"tuple",name:"reimbursementInfo",indexed:false,components:[{type:"bytes32",name:"merkleRoot"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint256",name:"totalBaseAmount"},{type:"uint256",name:"totalQuoteAmount"},{type:"uint256",name:"claimedBaseAmount"},{type:"uint256",name:"claimedQuoteAmount"},{type:"uint256",name:"expireTime"}]}]},{type:"event",anonymous:false,name:"ReimbursementVoteOpened",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"bytes32",name:"merkleRoot",indexed:false},{type:"uint256",name:"totalBaseAmount",indexed:false},{type:"uint256",name:"totalQuoteAmount",indexed:false},{type:"uint64",name:"voteDeadline",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementVoteRejected",inputs:[{type:"uint256",name:"caseId",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementVoteSubmitted",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"validator",indexed:false},{type:"uint8",name:"voteOption",indexed:false}]},{type:"event",anonymous:false,name:"RelayerAdded",inputs:[{type:"address",name:"relayer",indexed:false}]},{type:"event",anonymous:false,name:"RelayerRemoved",inputs:[{type:"address",name:"relayer",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"event",anonymous:false,name:"Voted",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"voter",indexed:false},{type:"uint8",name:"voteOption",indexed:false}]},{type:"event",anonymous:false,name:"VotingOpened",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint256",name:"evidenceId",indexed:false},{type:"uint64",name:"voteDeadline",indexed:false},{type:"address[]",name:"respondents",indexed:false}]},{type:"event",anonymous:false,name:"WormholeConfigurationUpdated",inputs:[{type:"tuple",name:"newWormholeConfiguration",indexed:false,components:[{type:"address",name:"wormhole"},{type:"address",name:"validatorView"},{type:"uint32",name:"maxAge"},{type:"bytes4",name:"selector"}]}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"addRelayers",constant:false,payable:false,inputs:[{type:"address[]",name:"relayers"}],outputs:[]},{type:"function",name:"appeal",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[]},{type:"function",name:"canRiskControlClose",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[{type:"bool"}]},{type:"function",name:"cancelAppeal",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"uint256",name:"appealCaseId"},{type:"bool",name:"isMalicious"}],outputs:[]},{type:"function",name:"cancelDispute",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"bool",name:"isMalicious"}],outputs:[]},{type:"function",name:"caseIdSequencer",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"checkRiskControlCloseCompleted",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[]},{type:"function",name:"claimBond",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[]},{type:"function",name:"claimForfeitBonds",constant:false,payable:false,inputs:[{type:"address",name:"receiver"}],outputs:[]},{type:"function",name:"fileDispute",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple[]",name:"prices",components:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"oracleType"},{type:"uint64",name:"publishTime"},{type:"bytes",name:"oracleUpdateData"}]},{type:"bytes32",name:"poolId"},{type:"address",name:"poolToken"}],outputs:[]},{type:"function",name:"fileDisputeFromStaker",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getDisputeConfiguration",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"tuple",components:[{type:"address",name:"appealToken"},{type:"uint64",name:"disputeBondUsd"},{type:"uint64",name:"appealBondUsd"},{type:"uint64",name:"disputeThresholdUsd"},{type:"uint64",name:"caseDuration"},{type:"uint64",name:"voteDuration"},{type:"uint64",name:"resolveDuration"}]},{type:"uint32"},{type:"uint32"}]},{type:"function",name:"getRelayers",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address[]"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isCaseRespondents",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"account"}],outputs:[{type:"bool"}]},{type:"function",name:"openReimbursementVote",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"bytes32",name:"merkleRoot"},{type:"uint256",name:"totalBaseAmount"},{type:"uint256",name:"totalQuoteAmount"}],outputs:[]},{type:"function",name:"openVoting",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"uint256",name:"evidenceId"},{type:"address[]",name:"respondents"}],outputs:[]},{type:"function",name:"processReimbursement",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"tuple",name:"reimbursementInfo",components:[{type:"bytes32",name:"merkleRoot"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint256",name:"totalBaseAmount"},{type:"uint256",name:"totalQuoteAmount"},{type:"uint256",name:"claimedBaseAmount"},{type:"uint256",name:"claimedQuoteAmount"},{type:"uint256",name:"expireTime"}]},{type:"bytes32[]",name:"zeroMerkleProof"}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"removeRelayers",constant:false,payable:false,inputs:[{type:"address[]",name:"relayers"}],outputs:[]},{type:"function",name:"resolveCaseAppeals",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"uint256",name:"limit"}],outputs:[]},{type:"function",name:"resolveDispute",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[]},{type:"function",name:"updateDisputeConfiguration",constant:false,payable:false,inputs:[{type:"tuple",name:"disputeConfiguration",components:[{type:"address",name:"appealToken"},{type:"uint64",name:"disputeBondUsd"},{type:"uint64",name:"appealBondUsd"},{type:"uint64",name:"disputeThresholdUsd"},{type:"uint64",name:"caseDuration"},{type:"uint64",name:"voteDuration"},{type:"uint64",name:"resolveDuration"}]},{type:"uint32",name:"voteCountRate"},{type:"uint32",name:"effectiveVoteRate"}],outputs:[]},{type:"function",name:"updateWormholeConfiguration",constant:false,payable:false,inputs:[{type:"tuple",name:"wormholeConfiguration",components:[{type:"address",name:"wormhole"},{type:"address",name:"validatorView"},{type:"uint32",name:"maxAge"},{type:"bytes4",name:"selector"}]}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"vote",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"validator"},{type:"uint8",name:"voteOption"},{type:"uint256",name:"deadline"},{type:"uint8",name:"v"},{type:"bytes32",name:"r"},{type:"bytes32",name:"s"}],outputs:[]},{type:"function",name:"voteReimbursement",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"validator"},{type:"uint8",name:"voteOption"},{type:"uint256",name:"deadline"},{type:"uint8",name:"v"},{type:"bytes32",name:"r"},{type:"bytes32",name:"s"}],outputs:[]}];var Tt=[{type:"error",name:"AccountInsufficientFreeAmount",inputs:[]},{type:"error",name:"AccountInsufficientReservedAmount",inputs:[]},{type:"error",name:"AccountInsufficientTradableAmount",inputs:[{type:"uint256",name:"accountTradableAmount"},{type:"uint256",name:"requiredTradableAmount"}]},{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"DepositToAccount",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"ExecuteCompensation",inputs:[{type:"bytes32",name:"poolId",indexed:false},{type:"uint256",name:"baseAmount",indexed:false},{type:"uint256",name:"quoteAmount",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"PayWithPrincipal",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"receiver",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"PayWithProfitFirst",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"receiver",indexed:false},{type:"bytes32",name:"poolId",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"usedFreeAmount",indexed:false},{type:"uint256",name:"usedRestrictedAmount",indexed:false}]},{type:"event",anonymous:false,name:"ReleaseForOrder",inputs:[{type:"bytes32",name:"poolId",indexed:false},{type:"uint256",name:"orderId",indexed:false},{type:"address",name:"account",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"ReleaseProfit",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"ReserveForOrder",inputs:[{type:"bytes32",name:"poolId",indexed:false},{type:"uint256",name:"orderId",indexed:false},{type:"address",name:"account",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"SettleToAccount",inputs:[{type:"address",name:"account",indexed:false},{type:"bytes32",name:"positionId",indexed:false},{type:"address",name:"baseToken",indexed:false},{type:"address",name:"quoteToken",indexed:false},{type:"uint256",name:"freeBase",indexed:false},{type:"uint256",name:"profitBase",indexed:false},{type:"uint256",name:"freeAmount",indexed:false},{type:"uint256",name:"profitAmount",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"event",anonymous:false,name:"WithdrawFromAccount",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"__ERC2771ContextUpgradeable_init",constant:false,payable:false,inputs:[{type:"address",name:"trustedForwarder_"}],outputs:[]},{type:"function",name:"deposit",constant:false,payable:false,inputs:[{type:"address",name:"account"},{type:"address",name:"token"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"executeCompensation",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"reimbursement"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getPoolWithdrawableBaseToken",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"},{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256",name:"baseAmount"}]},{type:"function",name:"getTradableAmount",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"},{type:"bytes32",name:"poolId"}],outputs:[{type:"bool"},{type:"uint256"},{type:"uint256"},{type:"uint256"}]},{type:"function",name:"getUserAsset",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"},{type:"address",name:"token"}],outputs:[{type:"uint256",name:"amount"}]},{type:"function",name:"getUserAssets",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"}],outputs:[{type:"tuple[]",components:[{type:"address",name:"asset"},{type:"uint256",name:"amount"}]}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isTrustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"forwarder"}],outputs:[{type:"bool"}]},{type:"function",name:"payWithPrincipal",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"account"},{type:"address",name:"token"},{type:"uint256",name:"amount"},{type:"address",name:"receiver"}],outputs:[]},{type:"function",name:"payWithProfitFirst",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"orderId"},{type:"address",name:"account"},{type:"address",name:"token"},{type:"uint256",name:"amount"}],outputs:[{type:"uint256",name:"usedFreeAmount"},{type:"uint256",name:"usedRestrictedAmount"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"releaseForCancelOrder",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"orderId"},{type:"address",name:"account"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"releaseFromProfitUnlock",constant:false,payable:false,inputs:[{type:"address",name:"account"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"}],outputs:[]},{type:"function",name:"reserveForOrder",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"orderId"},{type:"address",name:"account"},{type:"address",name:"token"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"settlementDeposit",constant:false,payable:false,inputs:[{type:"bytes32",name:"positionId"},{type:"address",name:"account"},{type:"tuple",name:"pool",components:[{type:"bytes32",name:"marketId"},{type:"bytes32",name:"poolId"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"state"},{type:"address",name:"basePoolToken"},{type:"address",name:"quotePoolToken"},{type:"uint16",name:"maxPriceDeviation"},{type:"bool",name:"compoundEnabled"},{type:"uint64",name:"windowCapUsd"},{type:"address",name:"poolVault"},{type:"address",name:"tradingVault"}]},{type:"uint256",name:"freeBaseAmount"},{type:"uint256",name:"freeQuoteAmount"},{type:"uint256",name:"receivedBaseAmount"},{type:"uint256",name:"receivedQuoteAmount"}],outputs:[]},{type:"function",name:"trustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"updateAndWithdraw",constant:false,payable:false,inputs:[{type:"address",name:"receiver"},{type:"bytes32",name:"poolId"},{type:"bool",name:"isQuoteToken"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"upgradeTo",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var vt={USDC:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",POOL_MANAGER:"0xb394948BC6c5d13189440Bd44E481f7833d29694",Account:"0x3edb8F5838603f70896d37233AD7F618D024c351",POSITION_MANAGER:"0xb8fAf2037788594e1BD27F1905A6eF090A5857ad",ORDER_MANAGER:"0xC016fD1b62A22991aa7085D4F7851C35e45d1B1b",PYTH:"0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF",ERC20:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",LIQUIDITY_ROUTER:"0xD375b2096602D613725E465c9a83e2C078B0273E",BASE_POOL:"0x2e217CB7e52cFca09132aDf4b12a04F4a9aB79E7",QUOTE_POOL:"0xBD8559b42aCd1c86b5Bf32e9858b559d3b71D94f",ORACLE:"0xEFCA7bB69e09125953C274715BE560b4a1603BE2",EIP7702Delegation:"0x7823b642DA17419717A8362B035E8a951110152E",MARKET_MANAGER:"0xf7810B57cb9A54fa751A4d82C4AeC4e2518CEb23",DATA_PROVIDER:"0x5B23C37A89f7F631D1cbA333545ad6Dce7B0da9E",ORACLE_RESERVE:"0x4Ffaf942B6d678Ca65001Fe87A30A0019393a2eE",FORWARDER:"0x5793932070EDeb981128650Aed7178F9B2F05690",TRADING_ROUTER:"0xA2cF15a8c3788802060F7d68cf888B28dA962b08",REIMBURSEMENT:"0xB26B967964498a1db1a77d3Aa62080D0B2dBff9e",DISPUTE_COURT:"0x62b6a26ae299cF31d01A77DAde7E5b39CC4A1eB0",EXECUTION_POOL:"0x83cA2bd1959F77eb07C3238e0Eb5b87427F66c89"};var ht={USDC:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",POOL_MANAGER:"0x05314a21Fc97B74f168730153b2B63A870D25dE5",Account:"0xAC0ca67fd6C7Ff9c80DE58420B840115b6d51c6e",POSITION_MANAGER:"0x1a8cC8391Ee19c3817de64a52904D0557f519bA5",ORDER_MANAGER:"0x3138f425f11f14fE33a180e9Bbf0661C8dc6d8AD",PYTH:"0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF",ERC20:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",LIQUIDITY_ROUTER:"0xfb790ECE13Cd9e296b4a06ABF38D10431360c236",BASE_POOL:"0x1F767BEa83EDe5E0C18904f439C579f52c2c0F1b",QUOTE_POOL:"0x50ad7da312c58c6689bEF028954a366cb5b8ee13",ORACLE:"0x3e437094C5687Ed6eDb1883b0bd445Efa9103a55",EIP7702Delegation:"0xc68fdf81ca68B26fdB296645F42a734c12E63751",MARKET_MANAGER:"0x71b57CcB7539aB761fd5C5767362A207a295e337",DATA_PROVIDER:"0xd4FdE3cc72D29b71507823cA43Dd6fD520644E92",ORACLE_RESERVE:"0x4fC26Cf34e5d486BFF211315bf17D77d34130971",FORWARDER:"0x58fb1a663b08871A755734231C387E1d10ac2B10",TRADING_ROUTER:"0x89ba8EDBD63f577cAA1095F25Df0A44A226f28bc",REIMBURSEMENT:"0xDbCe02B080C68671EF6EcEc1a01A789441A3a564",DISPUTE_COURT:"0x47648D171925a69b3A334898AaaE6e7cc41B1735",EXECUTION_POOL:"0x0000000000000000000000000000000000000000"};var Mt={USDC:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",POOL_MANAGER:"0x79412588c9dC5022f04b989595bd8e96Fd58A5fa",Account:"0x37C7B6ED8129312Ed51c9ee2CBd162F2096816c0",POSITION_MANAGER:"0x7d56F5ac970873741Ec29b95e48b8216574338Aa",ORDER_MANAGER:"0xc31d5b922eE6A6B829D2ad214bA5edC225401942",PYTH:"0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",ERC20:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",LIQUIDITY_ROUTER:"0x248F77f2E55Dd14715c5f35F4327Bb5feDB39B2B",BASE_POOL:"0x2c04502Fc87D55cBF91FD8aC32D5197c0FD54c13",QUOTE_POOL:"0x4bdB9C8B96e4cf8c7C1CcC05c2607ba781f49eeF",ORACLE:"0xac8F09568b048a259a6De474E1f51893D1fc3951",EIP7702Delegation:"0x7e3d707599aee82C06435F8338A9548f57fAa28e",MARKET_MANAGER:"0x9D0e83123AB97E93b3810913462746c7A4815b5E",DATA_PROVIDER:"0xf80999c3bB3C67c06bb0Bc917B430f9f79c51A7B",ORACLE_RESERVE:"0x666A9CD9920e0D751198b17c02B6eA0b620A3de0",FORWARDER:"0x45cc7768bb3D9242E5E9C63D7eb41Db3B4B32066",TRADING_ROUTER:"0x5dAea62F75fB4192Ec96Ec721895Bdbe12b47Cbe",REIMBURSEMENT:"0xd1a496A628a48bd56d465b99f8600F3FAcc40a35",DISPUTE_COURT:"0x7f17EF3779BbE5671Ad9b4Bb73C0849CbaC34e11",EXECUTION_POOL:"0x65C31A1f684adA8b6Db5f1Fc7F042B1B3f23A45c"};var Dt={POOL_MANAGER:"0xcf51a6895864c6D8E507fC31EF16b9011287c5f4",Account:"0x35054EfE58Bbdae792aeCaD7bC2e4939c169560f",POSITION_MANAGER:"0x689A0C7E46785584FF7636700ceF5d5e7c141F8D",ORDER_MANAGER:"0xa0B5E5AE9D3E214096C90DDeC04D39B27ED9B272",PYTH:"0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",ERC20:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",LIQUIDITY_ROUTER:"0x0AE31989318565620c03d35889a0B2536b8fba5C",BASE_POOL:"0xc9e3826c42183207B418116A16827C1605132c51",QUOTE_POOL:"0x9A9934D3b22103dE822d94A22A3177d728FE0e5a",ORACLE:"0x0dD8293765358cF7f2646D0B91bA59804E197FC6",EIP7702Delegation:"0x4686F8a0d44b056037b2A51c4342EE7FA8e0A48F",MARKET_MANAGER:"0xe99dAB65c5546D7C87850Bbc40C6a7BEd7328Efa",DATA_PROVIDER:"0x5b6Be9839552a49302d552aB3C223b60Adb8BF1D",ORACLE_RESERVE:"0xB3D5a67223905FE73a0749e7A03525838063C54C",USDC:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",FORWARDER:"0x6C40462A4d45BA4119af59Fb9e41b8eaC9293962",TRADING_ROUTER:"0x0000000000000000000000000000000000000000",REIMBURSEMENT:"0x0000000000000000000000000000000000000000",DISPUTE_COURT:"0x0000000000000000000000000000000000000000",EXECUTION_POOL:"0x0000000000000000000000000000000000000000"};var Ot={USDC:"0x9C452Ef0e7b158F81A0e00a81aaea8ae04132cBc",POOL_MANAGER:"0x48855b7c2168D38F029E3fdb3Bc96C8f35Bab955",Account:"0xB6BFE4cC301718AA5d3C2a3ccac52Ff9C5b7E20E",POSITION_MANAGER:"0xb5fa0Bde66D892f1451CD298A6f9a7a7e39409b0",ORDER_MANAGER:"0xdbC710cD74737d4Dd08E637177c475665273a798",PYTH:"0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb",ERC20:"0x9C452Ef0e7b158F81A0e00a81aaea8ae04132cBc",LIQUIDITY_ROUTER:"0x42E93f7dC6eA3e35b87529d2e0fc2deda7D4De85",BASE_POOL:"0x7553AA06c47E94F43128dC99e4FF83FB05304B8c",QUOTE_POOL:"0x573933e9e3299Ef4DB0f8207037BB4010C8728DD",ORACLE:"0xC3246f4c5c1463940993917467B8B5287D5F8233",EIP7702Delegation:"0x415f1bFf28023888B54E757eF9Ff0292ae309c6A",MARKET_MANAGER:"0xdA9D9Bf96466c1F4e4CF3D5667CF160834b46da8",DATA_PROVIDER:"0xe6C8e5F948BB33B78c157A995F48008c0bF7CcF1",ORACLE_RESERVE:"0xE7147190274E1175610D8e0e3CC5E8bb8670d148",FORWARDER:"0xDeA7223732f9Aa1740A94409633A65D45AA3571A",TRADING_ROUTER:"0xe3d6eEAF463ece18a57b2D5BbE7Bd7fF2836C4c4",REIMBURSEMENT:"0x53656983Bb07987729e1DA65bad53bCc9E618589",DISPUTE_COURT:"0xF4f535b61600735C6786e04A2a307B515C66f05B",EXECUTION_POOL:"0x9ca3Fc47abFD609b9b07d9Ecba7a4452AE61f926"};var Ft={USDC:"0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",POOL_MANAGER:"0x9E84a999e15CCdb2F64a5AF10939c25769dF6b07",Account:"0x42A1BC012CeC51Ebf3bbf79142bf2a912396FB0e",POSITION_MANAGER:"0x011a25Fe39b2f9033E49d1587CF24780242e40dA",ORDER_MANAGER:"0xfc30D3C858B72a9EDfE6679Fc3355039D276f811",PYTH:"0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb",ERC20:"0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",LIQUIDITY_ROUTER:"0x0F4C6f18Fb136DD1eBd6Da3C5d86a86597CF79a3",BASE_POOL:"0x51B62554a76197d5DF2D5dC4D57FF54d40775938",QUOTE_POOL:"0x783Ed065a12e1C1D33c2a8d6408385C1843D3084",ORACLE:"0xaF26d69BC0A6f1DEf8AeB00B6DAD28398ba67a53",EIP7702Delegation:"0xc8558cD3905F273ff45B1dd6D10894445bFa622f",MARKET_MANAGER:"0x3b809daB550f9DD0DbE82567f6EA6137C174532c",DATA_PROVIDER:"0x4B5888025570934cC9D31807feBAAEDaC823Cb8e",ORACLE_RESERVE:"0x3011dA5822c1ECA7fcda64716779769D0089945D",FORWARDER:"0x2943a063ae2A772f4314FaA28E00De827A491Dd3",TRADING_ROUTER:"0xaA16801F36e49cDD4f87938032487C7E6cfbb389",REIMBURSEMENT:"0xBF72B69bA547D0bB7D1255B43Ff5D7f2615326dF",DISPUTE_COURT:"0xeD8B129a5919c45c7391AA73632eA691A471C672",EXECUTION_POOL:"0x0000000000000000000000000000000000000000"};var Ee=Zn(),ea=(t,e)=>e?(e=JSON.parse(JSON.stringify(e)),t.includes("?")?t+"&"+new URLSearchParams(e).toString():t+"?"+new URLSearchParams(e).toString()):t,X={get:(t,e,n={})=>{let a=ea(t,e);return Ee.url(a).options(n).get().json()},post:(t,e,n={})=>Ee.url(t).options(n).post(e).json(),put:(t,e,n={})=>Ee.url(t).options(n).put(e).json(),delete:(t,e={})=>Ee.url(t).options(e).delete().json()};var ta=(p=>(p[p.SUCCESS=9200]="SUCCESS",p[p.SUCCESS_ORIGIN=0]="SUCCESS_ORIGIN",p[p.IDENTITY_VERIFICATION_FAILED=9401]="IDENTITY_VERIFICATION_FAILED",p[p.PERMISSION_DENIED=9403]="PERMISSION_DENIED",p[p.NOT_EXIST=9404]="NOT_EXIST",p[p.REQUEST_LIMIT=9429]="REQUEST_LIMIT",p[p.SERVICE_ERROR=9500]="SERVICE_ERROR",p[p.MISS_REQUESTED_PARAMETER=9900]="MISS_REQUESTED_PARAMETER",p[p.INVALID_PARAMETER=9901]="INVALID_PARAMETER",p.NETWORK_ERROR="ERR_NETWORK",p))(ta||{}),na=(o=>(o[o.Cook=0]="Cook",o[o.Boosted=1]="Boosted",o[o.Primed=2]="Primed",o[o.Trench=3]="Trench",o[o.PreBench=4]="PreBench",o[o.Bench=5]="Bench",o))(na||{}),St=(n=>(n[n.Chainlink=1]="Chainlink",n[n.Pyth=2]="Pyth",n))(St||{}),aa=(r=>(r[r.Minute1=1]="Minute1",r[r.Minute5=5]="Minute5",r[r.Minute15=15]="Minute15",r[r.Minute30=30]="Minute30",r[r.Hour1=60]="Hour1",r[r.Hour4=240]="Hour4",r[r.Day1=1440]="Day1",r[r.Week1=10080]="Week1",r[r.Month1=40320]="Month1",r))(aa||{}),sa=(s=>(s[s.Contract=1]="Contract",s[s.Cook=2]="Cook",s[s.Earn=3]="Earn",s[s.Cooking=4]="Cooking",s))(sa||{}),oa=(i=>(i[i.All=0]="All",i[i.Contract=1]="Contract",i[i.Cook=2]="Cook",i[i.Earn=3]="Earn",i[i.Cooking=4]="Cooking",i))(oa||{}),ia=(n=>(n[n.BlueChips=1]="BlueChips",n[n.Alpha=2]="Alpha",n))(ia||{}),ra=(a=>(a[a.BlueChips=1]="BlueChips",a[a.Alpha=2]="Alpha",a[a.Favorite=3]="Favorite",a))(ra||{});var pa=(s=>(s[s.Market=0]="Market",s[s.Limit=1]="Limit",s[s.Stop=2]="Stop",s[s.Conditional=3]="Conditional",s))(pa||{}),ua=(n=>(n[n.Increase=0]="Increase",n[n.Decrease=1]="Decrease",n))(ua||{}),ma=(d=>(d[d.Increase=0]="Increase",d[d.Decrease=1]="Decrease",d[d.AddMargin=2]="AddMargin",d[d.RemoveMargin=3]="RemoveMargin",d[d.CancelOrder=4]="CancelOrder",d[d.ADL=5]="ADL",d[d.Liquidation=6]="Liquidation",d[d.MarketClose=7]="MarketClose",d[d.EarlyClose=8]="EarlyClose",d[d.AddTPSL=9]="AddTPSL",d[d.SecurityDeposit=10]="SecurityDeposit",d[d.TransferToWallet=11]="TransferToWallet",d[d.MarginAccountDeposit=12]="MarginAccountDeposit",d[d.ReferralReward=13]="ReferralReward",d[d.ReferralRewardClaim=14]="ReferralRewardClaim",d))(ma||{}),da=(a=>(a[a.Unknown=0]="Unknown",a[a.GTE=1]="GTE",a[a.LTE=2]="LTE",a))(da||{}),la=(n=>(n[n.Long=0]="Long",n[n.Short=1]="Short",n))(la||{}),ya=(s=>(s[s.Cancelled=1]="Cancelled",s[s.Expired=2]="Expired",s[s.Successful=9]="Successful",s[s.PartialFilled=8]="PartialFilled",s))(ya||{}),ca=(r=>(r[r.Market=1]="Market",r[r.Limit=2]="Limit",r[r.TP=3]="TP",r[r.SL=4]="SL",r[r.ADL=5]="ADL",r[r.ADLTrigger=6]="ADLTrigger",r[r.Liquidation=7]="Liquidation",r[r.EarlyClose=8]="EarlyClose",r[r.MarketClose=9]="MarketClose",r))(ca||{}),fa=(p=>(p[p.Open=0]="Open",p[p.PartialClose=1]="PartialClose",p[p.FullClose=2]="FullClose",p[p.Liquidation=3]="Liquidation",p[p.EarlyClose=4]="EarlyClose",p[p.MarketClose=5]="MarketClose",p[p.ADL=6]="ADL",p[p.TP=7]="TP",p[p.SL=8]="SL",p[p.Increase=9]="Increase",p))(fa||{}),ba=(a=>(a[a.MarginAccount=1]="MarginAccount",a[a.WalletAccount=2]="WalletAccount",a[a.ReferralReward=3]="ReferralReward",a))(ba||{});var ga=(s=>(s[s.EXECUTING=1]="EXECUTING",s[s.BROADCAST_FAILED=2]="BROADCAST_FAILED",s[s.TIMEOUT_CANCEL=3]="TIMEOUT_CANCEL",s[s.EXECUTED=9]="EXECUTED",s))(ga||{});var Xs=async()=>X.get(`${Z()}/openapi/gateway/scan/market/list`);var Z=()=>{let{isTestnet:t,isBetaMode:e}=W?.getConfigManager()?.getConfig()||{};return e?"https://api-beta.myx.finance":t?"https://api-test.myx.cash":"https://api.myx.finance"},ee=async(t,e=[])=>e.length?X.get(`${Z()}/openapi/gateway/quote/price/oracles`,{chainId:t,poolIds:e.join(",")}):Promise.reject(new Error("Invalid pool id")),_t=async(t,e)=>await X.get(`${Z()}/openapi/gateway/scan/market/info?chainId=${t}&poolId=${e}`),kt=async(t,e,n)=>await X.get(`${Z()}/openapi/gateway/scan/market/pool-order/open?chainId=${n}`,void 0,{headers:{myx_openapi_access_token:t,myx_openapi_account:e}}),Zs=async({chainId:t,poolIds:e},n)=>X.get(`${Z()}/openapi/gateway/quote/candle/tickers`,{chainId:t,poolIds:e.join(",")}),eo=async({...t})=>X.get(`${Z()}/openapi/gateway/scan/market/base-details`,t),to=async({...t})=>X.get(`${Z()}/openapi/gateway/scan/market/detail`,t),Nt=async()=>X.get(`${Z()}/openapi/gateway/scan/market`);var be,ze=class ze{constructor(){this.version="1.0.24-beta.2";ct(this,be);}setConfigManager(e){ft(this,be,e);}getConfigManager(){return yt(this,be)}setProvider(e){this.provider=e;}getProvider(){return this.provider}static getInstance(){return this._instance||(this._instance=new ze),this._instance}async getMarkets(){try{let n=(await Nt())?.data||[];return this.Markets=n,n}catch(e){throw e}}};be=new WeakMap;var fe=ze,Bt=fe.getInstance(),W=Bt,uo=async t=>{let e=Bt.getConfigManager();if(!e?.hasSigner())throw new Error("No signer: call auth({ signer }) or auth({ walletClient })");return e.getViemWalletClient(t)};var Ut={USDC:"0x55d398326f99059fF775485246999027B3197955",POOL_MANAGER:"0x0dec8f3c72bcd5ef1377F74Db4Bb63672560eC1B",Account:"0x800Bc56D4970E4795203a7185c8c1E3a5fA93890",POSITION_MANAGER:"0x4A9a02F2E9aC66045861086EBEf611caAeB65A22",ORDER_MANAGER:"0xa0caD9E70078092b8E19E72dA069D1ef3be881e7",PYTH:"0x4D7E825f80bDf85e913E0DD2A2D54927e9dE1594",ERC20:"0x55d398326f99059fF775485246999027B3197955",LIQUIDITY_ROUTER:"0x9Fb871Ed8D6f20a3EB245250836F515D7aE89D4D",BASE_POOL:"0x6F8349A752b22b5e73f06A6980d2E3a33F385b6F",QUOTE_POOL:"0x677E05eD7f304734974A6b8a187e79f848aB7C87",ORACLE:"0x8E249E13538B76AaA1babd5eA2f0D8635E9860F0",EIP7702Delegation:"0x82B3bbd260FF451fa3877a67Ef23888f94E67104",MARKET_MANAGER:"0x4b1c6687c6E7E9900a9bF2A065540A3Ba83F98C3",DATA_PROVIDER:"0x14D209ff2C48aBD560bCF8317B2b560E254fb888",ORACLE_RESERVE:"0x586481B378895a889F26cA9E49D26211AC51D209",FORWARDER:"0x42dD6b225d8721314fe116Dfcd11C0D5275E301E",TRADING_ROUTER:"0xe1aB79710640FF72Ab9fc10D951cb939DA9766B1",REIMBURSEMENT:"0xFd3ee16Fe39CF75e49CDb46bEf76c67039680222",DISPUTE_COURT:"0x6B3a09E75306C054F18361D9Cc18AA411D299757",EXECUTION_POOL:"0x0000000000000000000000000000000000000000"};var x=t=>{let{isBetaMode:e}=W?.getConfigManager()?.getConfig()||{};switch(t){case 421614:return e?ht:vt;case 59141:return e?Dt:Mt;case 97:return e?Ft:Ot;case 56:return Ut;default:return {}}};var Lt=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"DesignatedTokenMismatch",inputs:[{type:"address",name:"collectToken"},{type:"address",name:"designatedToken"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"ForwardedRecipientMustBeMasterAccount",inputs:[{type:"address",name:"recipient"},{type:"address",name:"master"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotActiveBroker",inputs:[{type:"address",name:"broker"}]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotForwardAllowedTarget",inputs:[{type:"address",name:"from"}]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotOrderOwner",inputs:[]},{type:"error",name:"NotPositionOwner",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"CollectExecutionFee",inputs:[{type:"uint8",name:"source",indexed:false},{type:"bytes32",name:"positionId",indexed:false},{type:"address",name:"account",indexed:false},{type:"uint256",name:"executionFee",indexed:false},{type:"address",name:"token",indexed:false}]},{type:"event",anonymous:false,name:"CollectForwardFee",inputs:[{type:"uint8",name:"source",indexed:false},{type:"bytes32",name:"positionId",indexed:false},{type:"address",name:"account",indexed:false},{type:"uint256",name:"forwardFee",indexed:false},{type:"address",name:"token",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"__ERC2771ContextUpgradeable_init",constant:false,payable:false,inputs:[{type:"address",name:"trustedForwarder_"}],outputs:[]},{type:"function",name:"adjustCollateral",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"bytes32",name:"positionId"},{type:"int256",name:"adjustAmount"}],outputs:[]},{type:"function",name:"cancelOrder",constant:false,payable:false,inputs:[{type:"uint256",name:"orderId"}],outputs:[]},{type:"function",name:"cancelOrders",constant:false,payable:false,inputs:[{type:"uint256[]",name:"orderIds"}],outputs:[]},{type:"function",name:"collectExecutionFee",constant:false,payable:false,inputs:[{type:"uint8",name:"source"},{type:"bytes",name:"data"},{type:"address",name:"feeRecipient"}],outputs:[]},{type:"function",name:"collectForwardFeeIfNecessary",constant:false,payable:false,inputs:[{type:"uint8",name:"source"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"depositToAccount",constant:false,payable:false,inputs:[{type:"address",name:"recipient"},{type:"address",name:"token"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isTrustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"forwarder"}],outputs:[{type:"bool"}]},{type:"function",name:"placeOrderWithPosition",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"bytes32",name:"positionId"},{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"tuple",name:"orderParams",components:[{type:"address",name:"user"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{type:"address",name:"broker"},{type:"uint256",name:"tpSize"},{type:"uint256",name:"tpPrice"},{type:"uint256",name:"slSize"},{type:"uint256",name:"slPrice"}]}],outputs:[]},{type:"function",name:"placeOrderWithSalt",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"uint64",name:"userPositionSalt"},{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"tuple",name:"orderParams",components:[{type:"address",name:"user"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{type:"address",name:"broker"},{type:"uint256",name:"tpSize"},{type:"uint256",name:"tpPrice"},{type:"uint256",name:"slSize"},{type:"uint256",name:"slPrice"}]}],outputs:[]},{type:"function",name:"placeOrdersWithPosition",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"bytes32[]",name:"positionIds"},{type:"tuple[]",name:"orderParams",components:[{type:"address",name:"user"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{type:"address",name:"broker"},{type:"uint256",name:"tpSize"},{type:"uint256",name:"tpPrice"},{type:"uint256",name:"slSize"},{type:"uint256",name:"slPrice"}]}],outputs:[]},{type:"function",name:"placeOrdersWithSalt",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"uint64[]",name:"userPositionSalts"},{type:"tuple[]",name:"orderParams",components:[{type:"address",name:"user"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{type:"address",name:"broker"},{type:"uint256",name:"tpSize"},{type:"uint256",name:"tpPrice"},{type:"uint256",name:"slSize"},{type:"uint256",name:"slPrice"}]}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"trustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"updateOrder",constant:false,payable:false,inputs:[{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"tuple",name:"params",components:[{type:"uint256",name:"orderId"},{type:"address",name:"broker"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"tuple",name:"tpsl",components:[{type:"uint256",name:"tpSize"},{type:"uint256",name:"tpPrice"},{type:"uint256",name:"slSize"},{type:"uint256",name:"slPrice"}]}]}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var Ve=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"CollectFailed",inputs:[]},{type:"error",name:"DeadlineInPast",inputs:[]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ExecutionExpired",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"ExecutionNotExpired",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"ExecutionsNotExist",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"GracePeriodNotExpired",inputs:[]},{type:"error",name:"InsufficientGasEscrow",inputs:[]},{type:"error",name:"InvalidDataLength",inputs:[]},{type:"error",name:"InvalidGasEscrow",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidRequest",inputs:[]},{type:"error",name:"MaxPendingExceeded",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotExecutionOwner",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"PoolNotExists",inputs:[{type:"bytes32"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"RefundExceedsEscrow",inputs:[{type:"uint256",name:"refund"},{type:"uint256",name:"escrow"}]},{type:"error",name:"RefundFailed",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"SelectorNotRegistered",inputs:[{type:"bytes4",name:"selector"}]},{type:"error",name:"TxIdAlreadyExists",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"ExecutionCancelled",inputs:[{type:"bytes32",name:"txId",indexed:false},{type:"string",name:"remark",indexed:false}]},{type:"event",anonymous:false,name:"ExecutionExecuted",inputs:[{type:"bytes32[]",name:"txIds",indexed:false}]},{type:"event",anonymous:false,name:"ExecutionSubmitted",inputs:[{type:"bytes32",name:"txId",indexed:false},{type:"bytes32[]",name:"poolId",indexed:false},{type:"address",name:"from",indexed:false},{type:"uint64",name:"deadline",indexed:false}]},{type:"event",anonymous:false,name:"GasCollected",inputs:[{type:"bytes32[]",name:"txIds",indexed:false},{type:"uint256",name:"gasAmount",indexed:false}]},{type:"event",anonymous:false,name:"GasEscrowSelectorRemoved",inputs:[{type:"bytes4",name:"selector",indexed:false}]},{type:"event",anonymous:false,name:"GasEscrowSelectorUpdated",inputs:[{type:"bytes4",name:"selector",indexed:false},{type:"uint256",name:"gasEscrow",indexed:false}]},{type:"event",anonymous:false,name:"GracePeriodUpdated",inputs:[{type:"uint64",name:"gracePeriod",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"MaxPendingUpdated",inputs:[{type:"uint256",name:"maxPendingPerUser",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"cancel",constant:false,payable:false,inputs:[{type:"bytes32",name:"txId"}],outputs:[]},{type:"function",name:"cancelExpired",constant:false,payable:false,inputs:[{type:"bytes32",name:"txId"}],outputs:[]},{type:"function",name:"consumeExecutions",constant:false,payable:false,inputs:[{type:"bytes32[]",name:"txIds"}],outputs:[]},{type:"function",name:"executePublic",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"bytes32",name:"txId"},{type:"tuple[]",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"oracleType"},{type:"uint64",name:"publishTime"},{type:"bytes",name:"oracleUpdateData"}]}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getAllGasEscrowSelectors",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32[]",name:"selectors"},{type:"uint256[]",name:"escrows"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getExecutionRequest",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"txId"}],outputs:[{type:"bool",name:"isExpired"},{type:"tuple",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]}]},{type:"function",name:"getGasEscrowForSelector",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes4",name:"selector"}],outputs:[{type:"uint256"}]},{type:"function",name:"gracePeriod",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint64"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"maxPendingCount",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"pendingCount",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"}],outputs:[{type:"uint256",name:"count"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"removeGasEscrowForSelector",constant:false,payable:false,inputs:[{type:"bytes4",name:"selector"}],outputs:[]},{type:"function",name:"setGasEscrowForSelector",constant:false,payable:false,inputs:[{type:"bytes4",name:"selector"},{type:"uint256",name:"escrow"}],outputs:[]},{type:"function",name:"setGracePeriod",constant:false,payable:false,inputs:[{type:"uint64",name:"_gracePeriod"}],outputs:[]},{type:"function",name:"setMaxPendingCount",constant:false,payable:false,inputs:[{type:"uint256",name:"_maxPendingCount"}],outputs:[]},{type:"function",name:"submit",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"bytes32",name:"txId"},{type:"tuple",name:"execution",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"createdAt"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]},{type:"bytes32[]",name:"updatePricePoolIds"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var Qo=(t,e)=>{let n=f(t);return getContract({address:e,abi:G,client:n})},Ho=async t=>{let e=x(t),n=await A(t);return getContract({address:e.TRADING_ROUTER,abi:Lt,client:n})},qt=async(t,e)=>{let n=await A(t);return getContract({address:e,abi:G,client:n})},v=async t=>{let e=await A(t),[n]=await e.getAddresses();return n??void 0},ue=async t=>{let e=x(t),n=await A(t);return getContract({address:e.LIQUIDITY_ROUTER,abi:_,client:n})},Gt=async t=>{let e=x(t),n=await A(t);return getContract({address:e.ORACLE_RESERVE,abi:bt,client:n})},H=(t,e=1)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.POOL_MANAGER,abi:Fe,client:a})):A(t).then(s=>getContract({address:n.POOL_MANAGER,abi:Fe,client:s}))};var te=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.QUOTE_POOL,abi:Se,client:a})):A(t).then(s=>getContract({address:n.QUOTE_POOL,abi:Se,client:s}))},$=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.BASE_POOL,abi:_e,client:a})):A(t).then(s=>getContract({address:n.BASE_POOL,abi:_e,client:s}))},Jo=async(t,e)=>{let n=await A(t);return getContract({address:e,abi:ke,client:n})},B=async t=>{let e=await A(t),n=x(t);return getContract({address:n.EXECUTION_POOL,abi:Ve,client:e})},zt=async t=>{let e=await f(t),n=x(t);return getContract({address:n.EXECUTION_POOL,abi:Ve,client:e})};var Yo=(t,e)=>{let n=f(t);return getContract({address:e,abi:ke,client:n})};var Vt=(t,e,n=0)=>{let a=n===0?f(t):null;return a?Promise.resolve(getContract({address:e,abi:Ne,client:a})):A(t).then(s=>getContract({address:e,abi:Ne,client:s}))},Pe=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.MARKET_MANAGER,abi:Be,client:a})):A(t).then(s=>getContract({address:n.MARKET_MANAGER,abi:Be,client:s}))},Wt=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.DATA_PROVIDER,abi:Ue,client:a})):A(t).then(s=>getContract({address:n.DATA_PROVIDER,abi:Ue,client:s}))},Xo=async t=>{let e=x(t),n=await A(t);return getContract({address:e.Account,abi:Tt,client:n})},Qt=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.FORWARDER,abi:Le,client:a})):A(t).then(s=>getContract({address:n.FORWARDER,abi:Le,client:s}))},$o=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.REIMBURSEMENT,abi:qe,client:a})):A(t).then(s=>getContract({address:n.REIMBURSEMENT,abi:qe,client:s}))},jo=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.DISPUTE_COURT,abi:Ge,client:a})):A(t).then(s=>getContract({address:n.DISPUTE_COURT,abi:Ge,client:s}))};var me=null;function Aa(t){me=t;}function We(){return me??{}}function Qe(){}function Ca(...t){(me?.log??me?.info??Qe)(...t);}function Ea(...t){(me?.warn??Qe)(...t);}function y(...t){(me?.error??Qe)(...t);}var Ht=class{constructor(e){this.options={...e,logLevel:e?.logLevel??"info"};}get out(){return this.options.sink??We()}debug(e,...n){this.options.logLevel!=="none"&&this.options.logLevel==="debug"&&(this.out.log??this.out.info)?.(`[MYX-SDK-DEBUG] ${e}`,...n);}info(e,...n){this.options.logLevel!=="none"&&(this.options.logLevel==="debug"||this.options.logLevel==="info")&&(this.out.log??this.out.info)?.(`[MYX-SDK-INFO] ${e}`,...n);}error(e,...n){this.options.logLevel!=="none"&&(this.options.logLevel==="debug"||this.options.logLevel==="info"||this.options.logLevel==="error")&&this.out.error?.(`[MYX-SDK-ERROR] ${e}`,...n);}warn(e,...n){this.options.logLevel!=="none"&&this.out.warn?.(`[MYX-SDK-WARN] ${e}`,...n);}};var He={"0xfa52dfc0":"AccountInsufficientFreeAmount()","0xe2a1a260":"AccountInsufficientReservedAmount()","0xffd10028":"AccountInsufficientTradableAmount(uint256,uint256)","0x9996b315":"AddressEmptyCode(address)","0x4c9c8ce3":"ERC1967InvalidImplementation(address)","0xb398979f":"ERC1967NonPayable()","0xd6bda275":"FailedCall()","0xf92ee8a9":"InvalidInitialization()","0x44d3438f":"NotAddressManager()","0x3fc81f20":"NotDependencyManager()","0xd7e6bcf8":"NotInitializing()","0x507f487a":"NotProxyAdmin()","0xe03f6024":"PermissionDenied(address,address)","0x5274afe7":"SafeERC20FailedOperation(address)","0xe07c8dba":"UUPSUnauthorizedCallContext()","0xaa1d49a4":"UUPSUnsupportedProxiableUUID(bytes32)","0x24775e06":"SafeCastOverflowedUintToInt(uint256)","0xba767932":"ConvertAmountMismatch(uint256,uint256)","0xd93c0665":"EnforcedPause()","0x8dfc202b":"ExpectedPause()","0x059e2f49":"InRewindMode()","0x42301c23":"InsufficientOutputAmount()","0xcaa99aac":"MismatchExecuteFee(uint256,uint256,uint256)","0x8637dfc0":"NotInRewindMode()","0x4578ddb8":"OnlyRelayer()","0x1e4fbdf7":"OwnableInvalidOwner(address)","0x118cdaa7":"OwnableUnauthorizedAccount(address)","0x3ee5aeb5":"ReentrancyGuardReentrantCall()","0x90b8ec18":"TransferFailed()","0xbe1af266":"InternalOnly()","0x3385aa1f":"ExceedOrderSize(uint256)","0xb07e3bc4":"InsufficientCollateral(uint256,uint256)","0x613970e0":"InvalidParameter()","0x27d08510":"NotActiveBroker(address)","0xf6412b5a":"NotOrderOwner()","0x70d645e3":"NotPositionOwner()","0xe75316c6":"OrderNotExist(OrderId)","0xba01b06f":"PoolNotActive(PoolId)","0xddefae28":"AlreadyMinted()","0x64283d7b":"ERC721IncorrectOwner(address,uint256,address)","0x177e802f":"ERC721InsufficientApproval(address,uint256)","0xa9fbf51f":"ERC721InvalidApprover(address)","0x5b08ba18":"ERC721InvalidOperator(address)","0x89c62b64":"ERC721InvalidOwner(address)","0x64a0ae92":"ERC721InvalidReceiver(address)","0x73c6ac6e":"ERC721InvalidSender(address)","0x7e273289":"ERC721NonexistentToken(uint256)","0xb4762117":"ExceedMaxLeverage(PositionId)","0x29143a42":"ExceedPositionSize()","0x8ea9158f":"InvalidPosition(PositionId)","0xa5afd143":"PositionNotHealthy(PositionId,uint256)","0xba0d3752":"PositionNotInitialized(PositionId)","0xc20f35b7":"UnderflowOI()","0xf4d678b8":"InsufficientBalance()","0x6aee3c1a":"InsufficientRiskReserves()","0x2c5211c6":"InvalidAmount()","0x82cb17ef":"InvalidSplitConfig()","0xe921c36b":"AlreadyMigrated(PositionId,PositionId)","0xd34e366f":"ExceedBaseCollateral(uint256,uint256)","0xc7544914":"ExceedDebt(uint256,uint256)","0xe7aa687a":"ExceedExchangeable()","0x4b3c8f33":"ExceedMaxBaseProfit()","0xdc82bd68":"ExceedMinOutputAmount()","0xdb42144d":"InsufficientBalance(address,uint256,uint256)","0x5646203f":"InsufficientCollateral(PositionId,uint256)","0x9ac13039":"InsufficientPoolProfit()","0x14be833f":"InsufficientReturnAmount(uint256,uint256)","0x419ecd12":"MatchNotSupported()","0x4ec4fd74":"PoolFundingFeeNotPositive(int256,uint256,Direction)","0xba8f5df5":"PoolNotCompoundable(PoolId)","0xf645eedf":"ECDSAInvalidSignature()","0xfce698f7":"ECDSAInvalidSignatureLength(uint256)","0xd78bce0c":"ECDSAInvalidSignatureS(bytes32)","0x48834bee":"ExpiredFeeData()","0x56d69198":"InvalidFeeRate()","0x80577032":"NoRebateToClaim()","0x6e6b79b0":"NotBrokerSigner(address)","0xff70343d":"UnsupportedAssetClass(AssetClass)","0x185676be":"UnsupportedFeeTier(uint8)","0x60b25fe4":"BrokerAlreadyExists()","0x7eb4a674":"BrokerNotFound()","0x8c3b5bf0":"NotBrokerAdmin()","0x3733548a":"InvalidFeeTier()","0x192105d7":"InitializationFunctionReverted(address,bytes)","0x97c7f537":"ExcessiveSlippage()","0x700deaad":"InvalidADLPosition(OrderId,PositionId)","0xf64fa6a8":"InvalidOrder(OrderId)","0xd4944235":"NoADLNeeded(OrderId)","0xe079169e":"NotReachedPrice(OrderId,uint256,uint256,TriggerType)","0xc60eb335":"OnlyKeeper()","0xa8ce4432":"SafeCastOverflowedIntToUint(int256)","0x17229ec4":"NotMeetEarlyCloseCriteria(PositionId)","0x0dc149f0":"AlreadyInitialized()","0x7a5c919f":"InvalidRewindPrice()","0xc53f84e7":"PositionRemainsHealthy(PositionId)","0x1dab59cf":"InvalidOrderPair(OrderId,OrderId)","0x230e8e43":"PoolNotInPreBenchState(PoolId)","0x107dec14":"RiskCloseNotAllowed()","0x664431a8":"NotAllowedTarget(address)","0x03357c6c":"ExceedsMaximumRelayFee()","0x0d10f63b":"InconsistentParamsLength()","0x38802743":"InsufficientFeeAllowance(address,uint256,uint256)","0xd95b4ad5":"InsufficientFeeBalance(address,uint256,uint256)","0xa3972305":"MismatchedSender(address)","0xc3b80e86":"RelayerRegistered(address)","0xee0844a3":"RemoveRelayerFailed()","0xc583a8da":"IncorrectFee(uint256)","0x00bfc921":"InvalidPrice()","0x148cd0dd":"VerifyPriceFailed()","0xb12d13eb":"ETHTransferFailed()","0xa83325d4":"PoolOracleFeeCharged()","0x6b75f90d":"PoolOracleFeeNotCharged()","0x42a0e2a7":"PoolOracleFeeNotExisted()","0x8ee01e1c":"PoolOracleFeeNotSoldOut()","0x5e0a829b":"ETHTransferFailed(address,uint256)","0x4ba6536f":"GasLimitExceeded(address,uint256,uint256)","0xca1aae4b":"GasLimitNotSet(address)","0x3728b83d":"InvalidAmount(uint256)","0x3484727e":"BaseFeeNotSoldOut()","0x0251bde4":"LPNotFullyMinted()","0x1acb203e":"PositionNotEmpty()","0x2be7b24b":"UnexpectedPoolState()","0x759b3876":"UnhealthyAfterRiskTierApplied(PositionId)","0x7bd42a2e":"NotEmptyAddress()","0x6697b232":"AccessControlBadConfirmation()","0xe2517d3f":"AccessControlUnauthorizedAccount(address,bytes32)","0x7c9a1cf9":"AlreadyVoted()","0x796ea3a6":"BondNotReleased()","0x6511c20d":"BondZeroAmount()","0xf38e5973":"CaseAppealNotFinished()","0x1eaa4a59":"CaseDeadlineNotReached()","0xe6c67e3a":"CaseDeadlineReached()","0x0fc957b1":"CaseNotAccepted()","0x3ddb819d":"CaseNotExist(CaseId)","0x79eab18d":"CaseRespondentAppealed(CaseId,address)","0xa179f8c9":"ChainIdMismatch()","0x311c16d3":"DisputeNotAllowed()","0x752d88c0":"InvalidAccountNonce(address,uint256)","0xa710429d":"InvalidContractAddress()","0x8076dd8a":"InvalidFunctionSignature()","0xc37906a0":"InvalidPayloadLength(uint256,uint256)","0xdcdedda9":"InvalidPoolToken()","0x3471a3c2":"InvalidProfitAmount()","0x1d9617a0":"InvalidResponseVersion()","0x9284b197":"InvalidSourceChain()","0xb9021668":"NoChainResponse()","0xc546bca4":"NotCaseRespondent(CaseId,address)","0x84ae4a30":"NumberOfResponsesMismatch()","0x02164961":"RequestTypeMismatch()","0x4cf72652":"RiskCloseNotCompleted()","0x0819bdcd":"SignatureExpired()","0xc00ca938":"UnexpectedCaseState()","0x7935e939":"UnexpectedCaseType()","0x5e7bd6ec":"UnexpectedNumberOfResults()","0x51ee5853":"UnsupportedQueryType(uint8)","0x29ca666b":"UntrustfulVoting()","0x439cc0cd":"VerificationFailed()","0x714f5513":"VersionMismatch()","0x96b8e05b":"WrongQueryType(uint8,uint8)","0xbb6b170d":"ZeroQueries()","0xa9214540":"AlreadyClaimed(CaseId,address)","0xd4ac59c1":"InvalidAmount(CaseId,address)","0x7a6f5328":"MerkleTreeVerificationFailed(CaseId,address)","0x094a5cfe":"ReimbursementValidity(CaseId)","0x8b922563":"TreeAlreadySet()","0x7b27120a":"InDisputeMode()","0xb04111ef":"InsufficientFreeCollateral(PositionId,uint256)","0x12f1b11a":"InsufficientLockedCollateral(PositionId,uint256)","0x6dfcc650":"SafeCastOverflowedUintDowncast(uint8,uint256)","0xd24b47fb":"UserProfitFrozen()","0x1c151780":"ExceedMinOutput(uint256,uint256)","0xe1f0493d":"NotAllowedCaller(address)","0xfb8f41b2":"ERC20InsufficientAllowance(address,uint256,uint256)","0xe450d38c":"ERC20InsufficientBalance(address,uint256,uint256)","0xe602df05":"ERC20InvalidApprover(address)","0xec442f05":"ERC20InvalidReceiver(address)","0x96c6fd1e":"ERC20InvalidSender(address)","0x94280d62":"ERC20InvalidSpender(address)","0x62791302":"ERC2612ExpiredSignature(uint256)","0x4b800e46":"ERC2612InvalidSigner(address,address)","0xb3512b0c":"InvalidShortString()","0x305a27a9":"StringTooLong(string)","0xfd0f789d":"ExceedMaxPriceDeviation()","0x407b87e5":"ExchangeRateAlreadyApplied()","0x5c6c5686":"ExchangeRateAlreadyDisabled()","0x1ae17fcd":"InvalidDeviationRatio()","0x18b88897":"InvalidUpdateFee()","0xf76740e3":"PriceDeviationBelowMinimum()","0x49386283":"PriceDeviationThresholdReached()","0x19abf40e":"StalePrice()","0xe351cd13":"ExceedMaxExchangeableAmount()","0x15912a6f":"NotSupportVersion()","0xf1364a74":"ArrayEmpty()","0x15ed381d":"ExceedMaxProfit()","0x51aeee6c":"PoolNotExist(PoolId)","0x70f6c197":"InvalidQuoteTokenAddress()","0x0b8457f4":"InvalidRatioParams()","0x29dae146":"MarketAlreadyExisted()","0xf040b67a":"MarketNotExisted()","0x0e442a4a":"InvalidBaseToken()","0x24e219c7":"MarketNotExist(MarketId)","0xcc36f935":"PoolExists(PoolId)","0xe84c308d":"ExceedBaseReserved(uint256,uint256)","0x3e241751":"ExceedQuoteReserved(uint256,uint256)","0xde656889":"ExceedReservable(uint256,uint256,uint256)","0xd54d0fc4":"InsufficientLiquidity(uint256,uint256,uint256)","0x7e562a65":"InvalidDistributionAmount()","0x83c7580d":"ReservableNotEnough(uint256,uint256)","0x94eef58a":"ERC2771ForwarderExpiredRequest(uint48)","0xc845a056":"ERC2771ForwarderInvalidSigner(address,address)","0x70647f79":"ERC2771ForwarderMismatchedValue(uint256,uint256)","0xd2650cd1":"ERC2771UntrustfulTarget(address,address)","0xcf479181":"InsufficientBalance(uint256,uint256)","0x4c150d8f":"DifferentMarket(PoolId,PoolId)","0xaa98b06a":"InsufficientQuoteIn(uint256,uint256,uint256)","0x3e589bee":"InvalidLiquidityAmount()","0xaebd3617":"InvalidTpsl(uint256)","0x7fe81129":"SamePoolMigration(PoolId)","0x71c4efed":"SlippageExceeded(uint256,uint256)","0x62b9bc7b":"DesignatedTokenMismatch(address,address)","0x49465eb0":"NotForwardAllowedTarget(address)","0x301b6707":"ExecutionFeeNotCollected()","0xc6e8248a":"InsufficientSize()","0xd15b4fe2":"InvalidQuoteToken()","0xd8daec7c":"MarketNotInitialized()","0xcd4891b6":"NotInDisputeMode()","0x1ad308dc":"OrderExpired(OrderId)","0x486aa307":"PoolNotInitialized()"};var R={1:"Invalid Chain",2:"Invalid Token Address",4001:"User Rejected",3:"Insufficient Balance",4:"Insufficient Amount Of Approved",4002:"Invalid Base Token Address",4003:"Invalid Slippage",4004:"Invalid Amount",4005:"Invalid Pool State",4006:"Invalid Params",4007:"Invalid Amount Withdrawable LP Amount"};function Pa(t){let e=t;for(;e;){if(e.name==="UserRejectedRequestError"||e.code===4001)return true;let n=(e.message||"").toLowerCase();if(n.includes("user rejected")||n.includes("user denied")||n.includes("rejected the request"))return true;e=e.cause;}return false}function Je(t){if(!t||typeof t!="string")return null;let e=t.match(/(0x[0-9a-fA-F]{8,})/);if(!e)return null;let n=e[1].slice(0,10).toLowerCase(),a=Object.keys(He).find(s=>s.toLowerCase()===n);return a?{selector:n,message:He[a]}:null}function Jt(t){let e=t;for(;e;){if(typeof e.data=="string"){let n=Je(e.data);if(n)return n}if(typeof e.details=="string"){let n=Je(e.details);if(n)return n}for(let n of ["message","shortMessage"])if(typeof e[n]=="string"){let a=Je(e[n]);if(a)return a}e=e.cause;}return null}function Yt(t){if(!t)return "Unknown error";if(t?.data?.errorName)return `${t.data.errorName}()`;if(Array.isArray(t?.metaMessages)){let n=t.metaMessages.find(a=>a.includes("Error:"));if(n)return n.replace("Error: ","").trim()}let e=Jt(t);return e?e.message:t?.cause?Yt(t.cause):t?.reason?t.reason:t?.shortMessage?t.shortMessage:t?.message?t.message:String(t)}async function l(t){if(typeof t=="string")return {error:t};if(Pa(t))return {error:R[4001]};let e=Jt(t);if(e)return {error:{code:e.selector,message:e.message}};let n=Yt(t);return {error:{code:t?.code||t?.name||"Unknown Error",message:n}}}var Xt=async(t,e,n)=>{try{return await f(t).readContract({address:n,abi:G,functionName:"balanceOf",args:[e]})}catch(a){throw y(a),a}};var $t=async(t,e,n,a,s)=>{try{return await f(t).readContract({address:n,abi:G,functionName:"allowance",args:[e,a]})>=s}catch(i){throw i}};var U=30,ne=18;var h=(t,e)=>BigInt(t)*parseUnits(e.toString(),8)/BigInt(10**8),F=async t=>{try{let e=C[t],n=e?.gasPrice||0n,s=await f(t).getGasPrice();if(s==null)throw new Error("Network Error");let i=h(s,e.gasPriceRatio);return {gasPrice:i>n?i:n}}catch(e){throw e}},L=async(t,e)=>{let n=C[t],a=h(e,n.gasLimitRatio),{gasPrice:s}=await F(t);return {gasLimit:a,gasPrice:s}},se=(t,e=.01)=>{let n=parseUnits("1",8)-parseUnits(e.toString(),8);return t*n/BigInt(10**8)};var jt=async(t,e,n,a,s)=>{try{let i=C[t],o=await qt(t,n);if(!o.write)throw new Error("Wallet client required for write");let u=await o.estimateGas.approve([a,s]),m=h(u,i.gasLimitRatio),{gasPrice:r}=await F(t),p=await o.write.approve([a,s],{gasLimit:m,gasPrice:r});await f(t).waitForTransactionReceipt({hash:p});}catch(i){throw i}};var g=async t=>{if("chainId"in t&&!gt(t.chainId))throw new Error(R[1]);if("slippage"in t&&!(Number(t?.slippage)<=1&&Number(t?.slippage)>0))throw new Error(R[4003]);if("amount"in t&&(Number(t.amount)===Number.NaN||Number(t.amount)<0))throw new Error(R[4004]);let{tokenAddress:e,contractAddress:n,chainId:a,amount:s,decimals:i,account:o}=t;if(s&&a&&Number(i)>=0&&o){let u=parseUnits(s.toString(),Number(i));if(e){let m=await Xt(a,o,e);if(!m||m<u)throw new Error(R[3])}n&&e&&(await $t(a,o,e,n,u)||await jt(a,o,e,n,maxUint256));}};async function va(t){try{return (await fetch(t,{method:"HEAD"})).ok}catch{return false}}var ki=async(t,e,n)=>{try{let a=f(t),s=e,[i,o,u,m]=await Promise.all([a.readContract({address:s,abi:G,functionName:"name"}),a.readContract({address:s,abi:G,functionName:"symbol"}),a.readContract({address:s,abi:G,functionName:"decimals"}),a.readContract({address:s,abi:G,functionName:"totalSupply"})]),r=getAddress(s),p=`https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/${t}/assets/${r}/logo.png`,b=await va(p)?p:"",E;if(n){let I=await a.readContract({address:s,abi:G,functionName:"balanceOf",args:[n]});E=Number(formatUnits(I,Number(u)));}return {address:e,name:i,symbol:o,decimals:Number(u),icon:b,totalSupply:Number(formatUnits(m,Number(u))),...n?{balance:E}:{}}}catch(a){throw y(a),a}};var w={};pe(w,{buildHexDataAndExecutionGasFee:()=>_a,buildSignData:()=>Sa,generateTxId:()=>Zt,getExecutionTimestamp:()=>en});var Zt=()=>`0x${WordArray.random(32).toString()}`,en=()=>{let t=Ma(),e=t.unix(),n=t.add(1,"minute").unix();return {createAt:e,deadline:n}},Sa=async({chainId:t,data:e,from:n,to:a})=>{let s=await ge.getForwardEip712Domain(t),{createAt:i,deadline:o}=en(),u=Zt(),{types:m,primaryType:r}=ge.getForwardRequestTypes();return {domain:s,createAt:i,deadline:o,txId:u,types:m,primaryType:r,signData:{from:n,to:a,deadline:o,data:e,value:0n,gas:It}}},_a=async({chainId:t,abi:e,method:n,args:a})=>{let s=encodeFunctionData({abi:e,functionName:n,args:a}),i=getAbiItem({abi:e,name:n}),o=toFunctionSelector(i),m=await(await zt(t)).read.getGasEscrowForSelector([o]);return {hexData:s,executionGasFee:m}};var ge={};pe(ge,{getForwardEip712Domain:()=>ka,getForwardRequestTypes:()=>Na});var ka=async t=>{let n=await(await Qt(t)).read.eip712Domain();return {name:n[1],version:n[2],chainId:n[3],verifyingContract:n[4]}},Na=()=>({types:{ForwardRequest:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"gas",type:"uint256"},{name:"deadline",type:"uint48"},{name:"data",type:"bytes"}]},primaryType:"ForwardRequest"});var k={};pe(k,{waitForTransactionReceipt:()=>Ba});var Ba=async(t,e)=>f(t).waitForTransactionReceipt({hash:e});var tn=async t=>{try{let{chainId:e,poolId:n}=t,a=await v(e);await g({account:a,chainId:e});let{hexData:s,executionGasFee:i}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"claimBasePoolRebate",args:[n,a],chainId:e}),o=await A(e),m=x(e).LIQUIDITY_ROUTER,{domain:r,createAt:p,txId:c,types:b,primaryType:E,signData:I}=await w.buildSignData({chainId:e,data:s,from:a,to:m}),d=await o.signTypedData({account:a,domain:r,types:b,primaryType:E,message:I}),T=await B(e),S=await T.estimateGas.submit([c,{...I,createdAt:BigInt(p),signature:d},[n]],{value:i}),{gasLimit:N,gasPrice:D}=await L(e,S),O=await T.write.submit([c,{...I,createdAt:BigInt(p),signature:d},[n]],{value:i,gasLimit:N,gasPrice:D}),z=await k.waitForTransactionReceipt(e,O);return {hash:O,txId:c,receipt:z}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}},nn=async t=>{try{let{chainId:e,poolIds:n}=t;if(n.length===0)return;let a=await v(e);await g({account:a,chainId:e});let{hexData:s,executionGasFee:i}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"claimBasePoolRebates",args:[n,a],chainId:e}),o=x(e),u=await A(e),m=o.LIQUIDITY_ROUTER,{domain:r,createAt:p,txId:c,types:b,primaryType:E,signData:I}=await w.buildSignData({chainId:e,data:s,from:a,to:m}),d=await u.signTypedData({account:a,domain:r,types:b,primaryType:E,message:I}),T=await B(e),S=await T.estimateGas.submit([c,{...I,createdAt:BigInt(p),signature:d},n],{value:i}),{gasLimit:N,gasPrice:D}=await L(e,S),O=await T.write.submit([c,{...I,createdAt:BigInt(p),signature:d},n],{value:i,gasLimit:N,gasPrice:D}),z=await k.waitForTransactionReceipt(e,O);return {hash:O,txId:c,receipt:z}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var Xe=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{let s=C[t];return await(await $(t)).read.previewLpAmountOut([n,e,a])}catch(s){throw y(s),typeof s=="string"?s:await l(s)}},sn=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{let s=C[t];return await(await $(t)).read.previewBaseAmountOut([n,e,a])}catch(s){throw y(s),typeof s=="string"?s:await l(s)}},on=async({chainId:t,account:e,poolId:n,amount:a=0})=>{try{if(!t||!e||!n)return;if(!a)return {baseAmountOut:0n,rebateAmount:0n};let s=C[t],i=18;await g({decimals:i,account:e,chainId:t,amount:a});let o=parseUnits(a.toString(),i),m=(await ee(t,[n])).data?.[0]?.price||"0",r=parseUnits(m,30),c=await(await $(t)).read.previewUserWithdrawData([n,o,e,r]),[b,E]=c;return {baseAmountOut:b,rebateAmount:E}}catch(s){throw typeof s=="string"?s:await l(s)}};var M=async(t,e)=>{try{return !t||!e?void 0:(await _t(t,e)).data}catch(n){throw typeof n=="string"?n:await l(n)}};var rn=async(t,e)=>await Promise.all(e.map(async a=>{let{publishTime:s,vaa:i,oracleType:o,nativeFee:u,price:m,poolId:r}=a,p=isNil(u)?1n:BigInt(u);return {poolId:r,price:m,value:p,publishTime:s,oracleType:o??2,vaa:i}})),Tr=async(t,e)=>{if(!e||!e.length)return;let n=await ee(t,e);return await rn(t,n.data)},q=async(t,e)=>{if(!e)return;let a=(await ee(t,[e]))?.data?.[0];if(!a)throw new Error(`Unable to get price for ${e}`);return (await rn(t,[a]))?.[0]};function pn(t){return t.includes(".")?t.split(".")[1].length:0}var de=(t=.01,e=[],n=18,a)=>{if(e.length===0)return [];if(e.filter(i=>i.amount&&i.triggerPrice&&i.triggerType).length===0)throw new Error(R[4006]);return e.map(i=>{let o=parseUnits(i.amount.toString(),n),u=parseUnits(i.triggerPrice.toString(),30),m=pn(i.triggerPrice.toString()),r=parseUnits(i.triggerPrice.toString(),m),p=se(o*r*BigInt(10**a)/BigInt(10**(m+n)),t);return {amount:o,triggerPrice:u,triggerType:BigInt(i.triggerType),minQuoteOut:p}})};var le=t=>!(t===0||t===1||t===2||t===5);var mn=async t=>{try{let{poolId:e,chainId:n,amount:a,slippage:s=.01,tpsl:i=[]}=t;await g(t);let o=await M(n,e);if(!o)throw new Error(R[4006]);let u=o?.baseDecimals,m=o?.quoteDecimals,r=o?.baseToken,p=await v(n),c=x(n),b=c.BASE_POOL;await g({tokenAddress:r,contractAddress:b,decimals:u,account:p,chainId:n,amount:a});let E=le(o?.state),I=parseUnits(a.toString(),u),d;if(E){let re=await q(n,e);if(!re)return;let Dn=parseUnits(re.price,30);d=await Xe({chainId:n,poolId:e,amountIn:I,price:Dn});}else d=await Xe({chainId:n,poolId:e,amountIn:I});let T=i.map(re=>({amount:a,triggerPrice:re.triggerPrice,triggerType:re.triggerType})),S=de(s,T,18,m),N=se(d,s),D={poolId:e,amountIn:I,minAmountOut:N,recipient:p,tpslParams:S},{hexData:O,executionGasFee:z}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"depositBase",args:[D],chainId:n}),{domain:J,createAt:Q,txId:j,types:oe,primaryType:Y,signData:K}=await w.buildSignData({from:p,chainId:n,to:c.LIQUIDITY_ROUTER,data:O}),ce=await(await A(n)).signTypedData({account:p,domain:J,types:oe,primaryType:Y,message:K}),xe=await B(n),Te=await xe.estimateGas.submit([j,{...K,createdAt:BigInt(Q),signature:ce},[e]],{value:z}),{gasLimit:ve,gasPrice:Ae}=await L(n,Te),Ce=await xe.write.submit([j,{...K,createdAt:BigInt(Q),signature:ce},[e]],{value:z,gasLimit:ve,gasPrice:Ae}),ie=await k.waitForTransactionReceipt(n,Ce);return {hash:Ce,txId:j,receipt:ie}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var Ie=async({chainId:t,baseToken:e,marketId:n})=>{try{if(!e)throw new Error(R[2]);let a=x(t),s=await H(t,0),i=[n,e],o=await s.read.getMarketPool(i);return o.poolId==="0x0000000000000000000000000000000000000000000000000000000000000000"||!o.poolId?void 0:o.poolId}catch(a){throw y(a),typeof a=="string"?a:await l(a)}},je=async t=>{try{return await(await H(t)).read.getPools()||[]}catch(e){throw y(e),typeof e=="string"?e:await l(e)}},Ke=async(t,e,n=0n)=>{try{let s=await(await Wt(t)).read.getPoolInfo([e,n]);return {quotePool:{poolToken:s.quotePool.poolToken,exchangeRate:s.quotePool.exchangeRate,poolTokenPrice:s.quotePool.poolTokenPrice,poolTokenSupply:s.quotePool.poolTokenSupply,totalDebt:s.quotePool.totalDebt,baseCollateral:s.quotePool.baseCollateral},basePool:{poolToken:s.basePool.poolToken,exchangeRate:s.basePool.exchangeRate,poolTokenPrice:s.basePool.poolTokenPrice,poolTokenSupply:s.basePool.poolTokenSupply,totalDebt:s.basePool.totalDebt,baseCollateral:s.basePool.baseCollateral},reserveInfo:{baseTotalAmount:s.reserveInfo.baseTotalAmount,baseReservedAmount:s.reserveInfo.baseReservedAmount,quoteTotalAmount:s.reserveInfo.quoteTotalAmount,quoteReservedAmount:s.reserveInfo.quoteReservedAmount},fundingInfo:{nextFundingRate:s.fundingInfo.nextFundingRate,lastFundingFeeTracker:s.fundingInfo.lastFundingFeeTracker,nextEpochTime:s.fundingInfo.nextEpochTime},ioTracker:{tracker:s.oi.tracker,longSize:s.oi.longSize,shortSize:s.oi.shortSize,poolEntryPrice:s.oi.poolEntryPrice},liquidityInfo:{windowCaps:s.liquidityInfo.windowCaps,openInterest:s.liquidityInfo.openInterest}}}catch(a){throw y(a),typeof a=="string"?a:await l(a)}};var Ze=async({chainId:t,baseToken:e,marketId:n})=>{try{if(!e)throw new Error(R[2]);let a=C[t],s=await H(t),i={marketId:n,baseToken:e},o=await s.estimateGas.deployPool([i]),u=h(o,a.gasLimitRatio),{gasPrice:m}=await F(t),r=await s.write.deployPool([i],{gasLimit:u,gasPrice:m});if(await f(t).waitForTransactionReceipt({hash:r}))return await Ie({chainId:t,baseToken:e,marketId:n})}catch(a){throw typeof a=="string"?a:await l(a)}};var et=async(t,e,n)=>{try{return await(await Vt(t,e)).read.userGenesisShare([n])}catch(a){throw y(a),typeof a=="string"?a:await l(a)}};var tt=async t=>{try{let{chainId:e,poolId:n,poolType:a,slippage:s=.01,tpsl:i=[]}=t;await g(t);let o=await M(e,n);if(!o)throw new Error(R[4006]);let u=18,m=o.quoteDecimals,r=de(s,i,u,m),p=C[e],c=await ue(e),b={poolId:n,poolType:BigInt(a),tpslParams:r},E=await c.estimateGas.addTpsl([b]),I=h(E,p.gasLimitRatio),{gasPrice:d}=await F(e),T=await c.write.addTpsl([b],{gasLimit:I,gasPrice:d});return await f(e).waitForTransactionReceipt({hash:T})}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var nt=async t=>{try{let{chainId:e,orderId:n}=t;await g(t);let a=C[e],s=await ue(e),i=await s.estimateGas.cancelTpsl([n]),o=h(i,a.gasLimitRatio),{gasPrice:u}=await F(e),m=await s.write.cancelTpsl([n],{gasLimit:o,gasPrice:u});return await f(e).waitForTransactionReceipt({hash:m})}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var at=async(t,e,n)=>{try{await g({chainId:t});let a=await M(t,e);if(!a)throw new Error(R[4006]);let s=await v(t),o=((W?.Markets?.length?W?.Markets:await W.getMarkets())||[])?.find(d=>d.chainId===t&&d.marketId===n);if(!o)throw new Error("Invalid Market");let u=parseUnits(o.oracleFeeUsd.toString(),a.quoteDecimals);if(!u)throw new Error("Invalid Market");await g({tokenAddress:a.quoteToken,contractAddress:x(t).ORACLE_RESERVE,decimals:a.quoteDecimals,account:s,chainId:t,amount:formatUnits(u,a.quoteDecimals)});let m=C[t],r=await H(t),p=await r.estimateGas.reprimePool([{poolId:e}]),c=h(p,m.gasLimitRatio),{gasPrice:b}=await F(t),E=await r.write.reprimePool([{poolId:e}],{gasLimit:c,gasPrice:b});return await f(t).waitForTransactionReceipt({hash:E})}catch(a){throw y(a),typeof a=="string"?a:await l(a)}};var st=async(t,e)=>{try{let n=await fe.getInstance().getConfigManager()?.getAccessToken();if(!n)throw new Error("Failed to obtain accessToken");return (await kt(n,e,t)).data||[]}catch(n){throw y(n),n}};var ot=async t=>{try{let{chainId:e,poolId:n}=t;await g({chainId:e});let a=await M(e,n);if(!a)throw new Error(R[4006]);let s=await v(e),o=((W?.Markets?.length?W?.Markets:await W.getMarkets())||[])?.find(d=>d.chainId===e&&d.marketId===a.marketId);if(!o)throw new Error("Invalid Market");let u=parseUnits(o.boostFeeUsd.toString(),a.quoteDecimals);if(!u)throw new Error("Invalid Market");await g({tokenAddress:a.quoteToken,contractAddress:x(e).ORACLE_RESERVE,decimals:a.quoteDecimals,account:s,chainId:e,amount:formatUnits(u,a.quoteDecimals)});let m=C[e],r=await H(e),p=await r.estimateGas.boostPool([{poolId:n}]),c=h(p,m.gasLimitRatio),{gasPrice:b}=await F(e),E=await r.write.boostPool([{poolId:n}],{gasLimit:c,gasPrice:b});return await f(e).waitForTransactionReceipt({hash:E})}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var it=async t=>{try{let{chainId:e,poolId:n}=t;await g({chainId:e});let a=C[e],s=await H(e),i=await s.estimateGas.unboostPool([{poolId:n}]),o=h(i,a.gasLimitRatio),{gasPrice:u}=await F(e),m=await s.write.unboostPool([{poolId:n}],{gasLimit:o,gasPrice:u});return await f(e).waitForTransactionReceipt({hash:m})}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var rt=async t=>{try{let{chainId:e,poolId:n}=t;await g({chainId:e});let a=C[e],s=await Gt(e),i=await s.estimateGas.claimBoostFee([n]),o=h(i,a.gasLimitRatio),{gasPrice:u}=await F(e),m=await s.write.claimBoostFee([n],{gasLimit:o,gasPrice:u});return await f(e).waitForTransactionReceipt({hash:m})}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var pt=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{return await(await te(t)).read.previewLpAmountOut([n,e,a])}catch(s){throw y(s),typeof s=="string"?s:await l(s)}},dn=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{return await(await te(t)).read.previewQuoteAmountOut([n,e,a])}catch(s){throw y(s),typeof s=="string"?s:await l(s)}};var we=async({amountIn:t,chainId:e,poolId:n,state:a,slippage:s,poolType:i,account:o})=>{let u=le(a),m,r=i===0?sn:dn;if(u)try{let c=await q(e,n);if(c){let b=parseUnits(c.price,30);m=await r({chainId:e,poolId:n,amountIn:t,price:b});}}catch(c){console.error(c),m=await r({chainId:e,poolId:n,amountIn:t});}else m=await r({chainId:e,poolId:n,amountIn:t});return {data:{poolId:n,amountIn:t,minAmountOut:se(m,s),recipient:o}}};var ln=async t=>{try{let{chainId:e,poolId:n,price:a}=t,s=a,i=await $(e);if(typeof a>"u"||a===null)try{let u=await q(e,n);s=parseUnits(u?.price||"0",30);}catch{s=parseUnits("0",30);}return await i.read.withdrawableLpAmount([n,s||0n])}catch(e){throw typeof e=="string"?e:await l(e)}},yn=async t=>{try{let{chainId:e,poolId:n,amount:a,slippage:s=.01}=t,i=await M(e,n),o=i?.basePoolToken,u=C[e],m=await v(e),r=18;await g({tokenAddress:o,decimals:r,account:m,chainId:e,amount:a});let p=parseUnits(a.toString(),r),{data:c}=await we({poolId:n,chainId:e,account:m,amountIn:p,slippage:s,poolType:0,state:i?.state}),b=x(e),{hexData:E,executionGasFee:I}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"withdrawBase",args:[c],chainId:e}),{domain:d,createAt:T,txId:S,types:N,primaryType:D,signData:O}=await w.buildSignData({from:m,chainId:e,to:b.LIQUIDITY_ROUTER,data:E}),J=await(await A(e)).signTypedData({account:m,domain:d,types:N,primaryType:D,message:O}),Q=await B(e),j=await Q.estimateGas.submit([S,{...O,createdAt:BigInt(T),signature:J},[n]],{value:I}),{gasLimit:oe,gasPrice:Y}=await L(e,j),K=await Q.write.submit([S,{...O,createdAt:BigInt(T),signature:J},[n]],{value:I,gasLimit:oe,gasPrice:Y}),ye=await k.waitForTransactionReceipt(e,K);return {hash:K,txId:S,receipt:ye}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var cn=async t=>{try{let{chainId:e,account:n,poolId:a}=t;if(!e||!n||!a)return;let s=C[e],i=0n,u=(await ee(e,[a])).data?.[0]?.price||"0",m=parseUnits(u,30),p=await(await $(e)).read.pendingUserRebates([a,n,m]),[c,b]=p;return {rebates:c,genesisRebates:b}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var fn=async(t,e)=>{if(e)try{let n=await $(t),a=0n,s=await q(t,e);return s?.price&&(a=parseUnits(s.price,30)),await n.read.getPoolTokenPrice([e,a])}catch(n){throw typeof n=="string"?n:await l(n)}};var Tn={};pe(Tn,{claimQuotePoolRebate:()=>Pn,claimQuotePoolRebates:()=>Rn,deposit:()=>In,getLpPrice:()=>wn,getRewards:()=>En,transfer:()=>Cn,withdraw:()=>An,withdrawableLpAmount:()=>xn});var In=async t=>{try{let{poolId:e,chainId:n,amount:a,slippage:s=.01,tpsl:i=[]}=t;await g(t);let o=await M(n,e);if(!o)throw new Error(R[4006]);let u=await v(n),m=x(n),r=m.QUOTE_POOL,p=o.quoteToken,c=o?.quoteDecimals;await g({tokenAddress:p,contractAddress:r,decimals:c,account:u,chainId:n,amount:a});let b=parseUnits(a.toString(),c),E=le(o?.state),I;if(E){let ie=await q(n,e);if(!ie)return;let re=parseUnits(ie.price,30);I=await pt({chainId:n,poolId:e,amountIn:b,price:re});}else I=await pt({chainId:n,poolId:e,amountIn:b});let d=i.map(ie=>({amount:a,triggerPrice:ie.triggerPrice,triggerType:ie.triggerType})),T=de(s,d,18,c),S=se(I,s),N={poolId:e,amountIn:b,minAmountOut:S,recipient:u,tpslParams:T},{hexData:D,executionGasFee:O}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"depositQuote",args:[N],chainId:n}),{domain:z,createAt:J,txId:Q,types:j,primaryType:oe,signData:Y}=await w.buildSignData({from:u,chainId:n,to:m.LIQUIDITY_ROUTER,data:D}),ye=await(await A(n)).signTypedData({account:u,domain:z,types:j,primaryType:oe,message:Y}),ce=await B(n),xe=await ce.estimateGas.submit([Q,{...Y,createdAt:BigInt(J),signature:ye},[e]],{value:O}),{gasLimit:Te,gasPrice:ve}=await L(n,xe),Ae=await ce.write.submit([Q,{...Y,createdAt:BigInt(J),signature:ye},[e]],{value:O,gasLimit:Te,gasPrice:ve}),Ce=await k.waitForTransactionReceipt(n,Ae);return {txId:Q,receipt:Ce,hash:Ae}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var xn=async t=>{try{let{chainId:e,poolId:n,price:a}=t,s=a,i=await te(e);if(typeof a>"u"||a===null)try{let u=await q(e,n);s=parseUnits(u?.price||"0",30);}catch{s=parseUnits("0",30);}return await i.read.withdrawableLpAmount([n,s||0n])}catch(e){throw y(e),typeof e=="string"?e:await l(e)}},An=async t=>{try{let{chainId:e,poolId:n,amount:a,slippage:s=.01}=t,i=await M(e,n),o=i?.quotePoolToken,u=await v(e),m=18;await g({tokenAddress:o,decimals:m,account:u,chainId:e,amount:a});let r=parseUnits(a.toString(),m),{data:p}=await we({poolId:n,chainId:e,account:u,amountIn:r,slippage:s,poolType:1,state:i?.state}),c=x(e),{hexData:b,executionGasFee:E}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"withdrawQuote",args:[p],chainId:e}),{domain:I,createAt:d,txId:T,types:S,primaryType:N,signData:D}=await w.buildSignData({from:u,chainId:e,to:c.LIQUIDITY_ROUTER,data:b}),z=await(await A(e)).signTypedData({account:u,domain:I,types:S,primaryType:N,message:D}),J=await B(e),Q=await J.estimateGas.submit([T,{...D,createdAt:BigInt(d),signature:z},[n]],{value:E}),{gasLimit:j,gasPrice:oe}=await L(e,Q),Y=await J.write.submit([T,{...D,createdAt:BigInt(d),signature:z},[n]],{value:E,gasLimit:j,gasPrice:oe}),K=await k.waitForTransactionReceipt(e,Y);return {hash:Y,txId:T,receipt:K}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var Cn=async(t,e,n,a)=>{try{let s=await M(t,e),i=await M(t,n);if(!i||!s)return null;if([4,5].includes(i.state))throw new Error(R[4005]);let o=await v(t),u=C[t],m=18;await g({chainId:t,amount:a,account:o,decimals:m,tokenAddress:s.quotePoolToken});let r={fromPoolId:e,toPoolId:n,minLpOut:0n,amount:parseUnits(a.toString(),m)},p=await ue(t),c=await p.estimateGas.migrateLiquidity([r]),b=h(c,u.gasLimitRatio),{gasPrice:E}=await F(t),I=await p.write.migrateLiquidity([r],{gasLimit:b,gasPrice:E});return await f(t).waitForTransactionReceipt({hash:I})}catch(s){throw typeof s=="string"?s:await l(s)}};var En=async t=>{try{let{chainId:e,account:n,poolId:a}=t;if(!e||!n||!a)return;let i=(await ee(e,[a])).data?.[0]?.price||"0",o=parseUnits(i,30);return await(await te(e)).read.pendingUserRebates([a,n,o])}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var Pn=async t=>{try{let{chainId:e,poolId:n}=t,a=await v(e);await g({account:a,chainId:e});let{hexData:s,executionGasFee:i}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"claimQuotePoolRebate",args:[n,a],chainId:e}),o=x(e),{domain:u,createAt:m,txId:r,types:p,primaryType:c,signData:b}=await w.buildSignData({from:a,chainId:e,to:o.LIQUIDITY_ROUTER,data:s}),I=await(await A(e)).signTypedData({account:a,domain:u,types:p,primaryType:c,message:b}),d=await B(e),T=await d.estimateGas.submit([r,{...b,createdAt:BigInt(m),signature:I},[n]],{value:i}),{gasLimit:S,gasPrice:N}=await L(e,T),D=await d.write.submit([r,{...b,createdAt:BigInt(m),signature:I},[n]],{value:i,gasLimit:S,gasPrice:N}),O=await k.waitForTransactionReceipt(e,D);return {txId:r,receipt:O,hash:D}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}},Rn=async t=>{try{let{chainId:e,poolIds:n}=t;if(n.length===0)return;let a=await v(e);await g({account:a,chainId:e});let{hexData:s,executionGasFee:i}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"claimQuotePoolRebates",args:[n,a],chainId:e}),o=x(e),{domain:u,createAt:m,txId:r,types:p,primaryType:c,signData:b}=await w.buildSignData({from:a,chainId:e,to:o.LIQUIDITY_ROUTER,data:s}),I=await(await A(e)).signTypedData({account:a,domain:u,types:p,primaryType:c,message:b}),d=await B(e),T=await d.estimateGas.submit([r,{...b,createdAt:BigInt(m),signature:I},n],{value:0n}),{gasLimit:S,gasPrice:N}=await L(e,T),D=await d.write.submit([r,{...b,createdAt:BigInt(m),signature:I},n],{value:i,gasLimit:S,gasPrice:N}),O=await k.waitForTransactionReceipt(e,D);return {txId:r,receipt:O,hash:D}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var wn=async(t,e)=>{if(e)try{let n=await te(t),a=0n,s=await q(t,e);return s?.price&&(a=parseUnits(s.price,30)),await n.read.getPoolTokenPrice([e,a])}catch(n){throw y(n),typeof n=="string"?n:await l(n)}};var Mn={};pe(Mn,{getMarket:()=>vn,getOracleFee:()=>hn});var vn=async(t,e)=>{try{if(await g({chainId:t}),!e)return;let a=await(await Pe(t)).read.getMarket([e]),{quoteToken:s,baseReserveRatio:i,quoteReserveRatio:o,oracleFeeUsd:u,boostFeeUsd:m,boostRefundFeeUsd:r,poolPrimeThreshold:p,executionFee:c,maxExecutionFee:b,forwardFee:E,maxForwardFee:I}=a;return a}catch(n){throw y(n),typeof n=="string"?n:await l(n)}};var hn=async(t,e)=>{try{return await g({chainId:t}),e?await(await Pe(t)).read.getOracleFee([e]):void 0}catch(n){throw y(n),typeof n=="string"?n:await l(n)}};var Zd={createPool:Ze,getMarketPoolId:Ie,getMarketPools:je,getPoolInfo:Ke,getUserGenesisShare:et,addTpSl:tt,cancelTpSl:nt,reprime:at,getPoolDetail:M,getOpenOrders:st,boostPool:ot,unBoostPool:it,claimBoostFee:rt};
|
|
1
|
+
import {http,fallback,createPublicClient,getContract,parseUnits,getAddress,formatUnits,encodeFunctionData,getAbiItem,toFunctionSelector,maxUint256}from'viem';export{parseUnits as Aa,formatUnits as za}from'viem';import Zn from'wretch';import {WordArray}from'crypto-es';import Ma from'dayjs';import {isNil}from'lodash-es';var On=Object.defineProperty;var dt=t=>{throw TypeError(t)};var pe=(t,e)=>{for(var n in e)On(t,n,{get:e[n],enumerable:true});};var lt=(t,e,n)=>e.has(t)||dt("Cannot "+n);var yt=(t,e,n)=>(lt(t,e,"read from private field"),n?n.call(t):e.get(t)),ct=(t,e,n)=>e.has(t)?dt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),ft=(t,e,n,a)=>(lt(t,e,"write to private field"),e.set(t,n),n);var bn={};pe(bn,{claimBasePoolRebate:()=>tn,claimBasePoolRebates:()=>nn,deposit:()=>mn,getLpPrice:()=>fn,getRewards:()=>cn,previewUserWithdrawData:()=>on,withdraw:()=>yn,withdrawableLpAmount:()=>ln});var _=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"DifferentMarket",inputs:[{type:"bytes32",name:"fromPoolId"},{type:"bytes32",name:"toPoolId"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"ForwardedRecipientMustBeMasterAccount",inputs:[{type:"address",name:"recipient"},{type:"address",name:"master"}]},{type:"error",name:"InsufficientQuoteIn",inputs:[{type:"uint256",name:"orderId"},{type:"uint256",name:"quoteIn"},{type:"uint256",name:"exchangeDelta"}]},{type:"error",name:"InvalidAmount",inputs:[{type:"uint256",name:"amount"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidLiquidityAmount",inputs:[]},{type:"error",name:"InvalidTpsl",inputs:[{type:"uint256",name:"orderId"}]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"NotReachedPrice",inputs:[{type:"uint256",name:"orderId"},{type:"uint256",name:"price"},{type:"uint256",name:"triggerPrice"},{type:"uint8",name:"triggerType"}]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"SamePoolMigration",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"SlippageExceeded",inputs:[{type:"uint256",name:"expected"},{type:"uint256",name:"actual"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"__ERC2771ContextUpgradeable_init",constant:false,payable:false,inputs:[{type:"address",name:"trustedForwarder_"}],outputs:[]},{type:"function",name:"addTpsl",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"poolType"},{type:"tuple[]",name:"tpslParams",components:[{type:"uint256",name:"amount"},{type:"uint256",name:"triggerPrice"},{type:"uint8",name:"triggerType"},{type:"uint256",name:"minQuoteOut"}]}]}],outputs:[]},{type:"function",name:"cancelTpsl",constant:false,payable:false,inputs:[{type:"uint256",name:"orderId"}],outputs:[]},{type:"function",name:"claimBasePoolRebate",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"recipient"}],outputs:[]},{type:"function",name:"claimBasePoolRebates",constant:false,payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"address",name:"recipient"}],outputs:[]},{type:"function",name:"claimQuotePoolRebate",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"recipient"}],outputs:[]},{type:"function",name:"claimQuotePoolRebates",constant:false,payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"address",name:"recipient"}],outputs:[]},{type:"function",name:"currentOrderId",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"depositBase",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"},{type:"tuple[]",name:"tpslParams",components:[{type:"uint256",name:"amount"},{type:"uint256",name:"triggerPrice"},{type:"uint8",name:"triggerType"},{type:"uint256",name:"minQuoteOut"}]}]}],outputs:[]},{type:"function",name:"depositQuote",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"},{type:"tuple[]",name:"tpslParams",components:[{type:"uint256",name:"amount"},{type:"uint256",name:"triggerPrice"},{type:"uint8",name:"triggerType"},{type:"uint256",name:"minQuoteOut"}]}]}],outputs:[]},{type:"function",name:"executeTpsl",constant:false,payable:false,inputs:[{type:"uint256",name:"orderId"},{type:"uint256",name:"quoteInIfNecessary"},{type:"uint256",name:"minOut"}],outputs:[{type:"uint256",name:"baseOut"},{type:"uint256",name:"quoteOut"}]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getTpslData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint256",name:"orderId"}],outputs:[{type:"tuple",components:[{type:"address",name:"user"},{type:"bytes32",name:"poolId"},{type:"uint8",name:"poolType"},{type:"uint256",name:"amount"},{type:"uint256",name:"triggerPrice"},{type:"uint8",name:"triggerType"},{type:"uint256",name:"minQuoteOut"}]}]},{type:"function",name:"getUserTpslOrderIds",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"}],outputs:[{type:"uint256[]"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isTrustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"forwarder"}],outputs:[{type:"bool"}]},{type:"function",name:"migrateLiquidity",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"fromPoolId"},{type:"bytes32",name:"toPoolId"},{type:"uint256",name:"amount"},{type:"uint256",name:"minLpOut"}]}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"trustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"withdrawBase",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"}]}],outputs:[]},{type:"function",name:"withdrawQuote",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"}]}],outputs:[]}];var bt=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"BoostFeeClaimFailed",inputs:[]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ExceedMaxExchangeableAmount",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InsufficientReturnAmount",inputs:[{type:"uint256",name:"expected"},{type:"uint256",name:"received"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"PoolBoostReserveInsufficient",inputs:[]},{type:"error",name:"PoolOracleFeeCharged",inputs:[]},{type:"error",name:"PoolOracleFeeNotCharged",inputs:[]},{type:"error",name:"PoolOracleFeeNotExisted",inputs:[]},{type:"error",name:"PoolOracleFeeNotSoldOut",inputs:[]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"OracleFeeExchanged",inputs:[{type:"bytes32",name:"poolId",indexed:true},{type:"uint256",name:"quoteAmount",indexed:false},{type:"uint256",name:"baseAmount",indexed:false},{type:"address",name:"recipient",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"chargeBoostFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"proposer"},{type:"uint256",name:"quoteAmount"}],outputs:[]},{type:"function",name:"chargeOracleFeeFromPoolVault",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"poolVault"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"}],outputs:[]},{type:"function",name:"chargeOracleFeeFromPrimer",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"primer"},{type:"uint256",name:"quoteAmount"}],outputs:[]},{type:"function",name:"claimBoostFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[]},{type:"function",name:"confirmBoostFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"bool",name:"isAllow"}],outputs:[]},{type:"function",name:"exchangeBaseFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"recipient"},{type:"bytes",name:"data"}],outputs:[{type:"uint256",name:"baseOut"}]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getExchangeableBaseFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256",name:"quoteIn"},{type:"uint256",name:"baseOut"}]},{type:"function",name:"getPoolBoostFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"tuple",components:[{type:"address",name:"proposer"},{type:"uint256",name:"amount"},{type:"bool",name:"isClaimable"}]}]},{type:"function",name:"getPoolOracleFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"tuple",components:[{type:"address",name:"primer"},{type:"uint8",name:"state"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"}]}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isBaseFeeSoldOut",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"bool"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"refreshOracleFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"withdrawOracleFee",constant:false,payable:false,inputs:[{type:"address",name:"token"},{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[]}];var _n=(o=>(o[o.LINEA_SEPOLIA=59141]="LINEA_SEPOLIA",o[o.LINEA_MAINNET=59144]="LINEA_MAINNET",o[o.ARB_TESTNET=421614]="ARB_TESTNET",o[o.ARB_MAINNET=42161]="ARB_MAINNET",o[o.BSC_TESTNET=97]="BSC_TESTNET",o[o.BSC_MAINNET=56]="BSC_MAINNET",o))(_n||{});var kn=[421614,59141,97,42161,59144,56];function gt(t){return !!t&&kn.includes(t)}var V=10;var Za={42161:130n,421614:130n,59144:130n,59141:130n,56:150n,97:150n},It=1500000n;var xt={chainInfo:{explorer:"https://sepolia.lineascan.build/",explorerOfTX:"https://sepolia.lineascan.build/tx/",publicJsonRPCUrl:["https://rpc.sepolia.linea.build","https://linea-sepolia.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"],label:"Linea Sepolia",logoUrl:"",faucetUrl:"",chainSymbol:"Linea",gasPriceRatio:1.3,gasLimitRatio:1.2,gasAmountRatio:2,gasFeeReservedForCollateral:(.525+1)*V,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},gasPrice:0n}};var At={chainInfo:{privateJsonRPCUrl:"",publicJsonRPCUrl:["https://sepolia-rollup.arbitrum.io/rpc"],label:" Arbitrum Sepolia",chainSymbol:"Arb Sepolia",explorer:"https://sepolia.arbiscan.io/",explorerOfTX:"https://sepolia.arbiscan.io/tx/",faucetUrl:"https://bwarelabs.com/faucets/arbitrum-sepolia",logoUrl:"",gasPriceRatio:1.5,gasLimitRatio:1.3,gasAmountRatio:2,gasFeeReservedForCollateral:(.055+1)*V,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},gasPrice:0n}};var Ct={chainInfo:{privateJsonRPCUrl:"",publicJsonRPCUrl:["https://bsc-testnet-dataseed.bnbchain.org"],label:"BNB Chain Testnet",chainSymbol:"BNB Chain Testnet",explorer:"https://testnet.bscscan.com/",explorerOfTX:"https://testnet.bscscan.com/tx/",faucetUrl:"https://docs.bnbchain.org/bnb-smart-chain/developers/faucet/",logoUrl:"",gasPriceRatio:1.5,gasLimitRatio:1.3,gasAmountRatio:2,gasFeeReservedForCollateral:(5e-4+1)*V,nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},gasPrice:0n}};var Et={chainInfo:{label:"Linea Mainnet",explorer:"https://lineascan.build/",logoUrl:"",explorerOfTX:"https://lineascan.build/tx/",publicJsonRPCUrl:["https://rpc.linea.build/","https://linea.blockpi.network/v1/rpc/public","https://1rpc.io/linea","https://rpc.linea.build"],chainSymbol:"Linea",gasPriceRatio:1.3,gasLimitRatio:1.2,gasAmountRatio:2,gasFeeReservedForCollateral:(.525+.35)*V,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},gasPrice:0n}};var Pt={chainInfo:{privateJsonRPCUrl:"",publicJsonRPCUrl:["https://arb1.arbitrum.io/rpc"],label:" Arbitrum One",chainSymbol:"Arbitrum One",explorer:"https://arbiscan.io/",explorerOfTX:"https://arbiscan.io/tx/",logoUrl:"",gasPriceRatio:1.5,gasLimitRatio:1.3,gasAmountRatio:2,gasFeeReservedForCollateral:(.055+.175)*V,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},gasPrice:0n}};var Rt={chainInfo:{privateJsonRPCUrl:"",publicJsonRPCUrl:["https://bsc-dataseed.bnbchain.org"],label:"BNB Chain",chainSymbol:"BNB Chain",explorer:"https://bscscan.com/",explorerOfTX:"https://bscscan.com/tx/",faucetUrl:"https://docs.bnbchain.org/bnb-smart-chain/developers/faucet/",logoUrl:"",gasPriceRatio:1.5,gasLimitRatio:2,gasAmountRatio:2,gasFeeReservedForCollateral:(5e-4+1)*V,nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},gasPrice:100000000n}};var C={59141:xt.chainInfo,421614:At.chainInfo,97:Ct.chainInfo,59144:Et.chainInfo,42161:Pt.chainInfo,56:Rt.chainInfo};function he(t){let e=C[t];if(!e)throw new Error(`Could not find information with chain id ${t}`);return e}var Me={};function Un(t){if(!Me[t]){let e=he(t),n=[...e.privateJsonRPCUrl?[e.privateJsonRPCUrl]:[],...Array.isArray(e.publicJsonRPCUrl)?[...e.publicJsonRPCUrl]:[]].filter(Boolean);if(n.length===0)throw new Error(`${t} has no jsonRPCUrl configured`);Me[t]={id:t,name:e.label||`Chain ${t}`,nativeCurrency:e.nativeCurrency,rpcUrls:{default:{http:n}}};}return Me[t]}var De={};function f(t){if(!De[t]){let e=he(t),n=[...e.privateJsonRPCUrl?[e.privateJsonRPCUrl]:[],...Array.isArray(e.publicJsonRPCUrl)?[...e.publicJsonRPCUrl]:[]].filter(Boolean);if(n.length===0)throw new Error(`${t} has no jsonRPCUrl configured`);let a=n.length===1?http(n[0]):fallback(n.map(s=>http(s)));De[t]=createPublicClient({chain:Un(t),transport:a});}return De[t]}var Oe=null;function Ln(t){Oe=t;}function qn(){return Oe}async function A(t){let e=Oe;if(!e?.hasSigner())throw new Error("No signer: call auth({ signer }) or auth({ walletClient })");return e.getViemWalletClient(t)}var Fe=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"BaseFeeNotSoldOut",inputs:[]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidBaseToken",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"LPNotFullyMinted",inputs:[]},{type:"error",name:"MarketNotExist",inputs:[{type:"bytes32",name:"marketId"}]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"PoolDebtNotCleared",inputs:[]},{type:"error",name:"PoolExists",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"PoolNotExist",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"PositionNotEmpty",inputs:[]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"error",name:"UnauthorizedUnboost",inputs:[]},{type:"error",name:"UnexpectedPoolState",inputs:[]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"benchPool",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple[]",name:"prices",components:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"oracleType"},{type:"uint64",name:"publishTime"},{type:"bytes",name:"oracleUpdateData"}]},{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"string",name:"remark"}]}],outputs:[]},{type:"function",name:"boostPool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"}]}],outputs:[]},{type:"function",name:"checkPoolExists",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"bool"}]},{type:"function",name:"deployPool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"marketId"},{type:"address",name:"baseToken"}]}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getMarketPool",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"address",name:"asset"}],outputs:[{type:"tuple",components:[{type:"bytes32",name:"marketId"},{type:"bytes32",name:"poolId"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"state"},{type:"bool",name:"compoundEnabled"},{type:"address",name:"basePoolToken"},{type:"address",name:"quotePoolToken"},{type:"address",name:"poolVault"},{type:"address",name:"tradingVault"}]}]},{type:"function",name:"getPairToken",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"}]},{type:"function",name:"getPool",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"tuple",components:[{type:"bytes32",name:"marketId"},{type:"bytes32",name:"poolId"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"state"},{type:"bool",name:"compoundEnabled"},{type:"address",name:"basePoolToken"},{type:"address",name:"quotePoolToken"},{type:"address",name:"poolVault"},{type:"address",name:"tradingVault"}]}]},{type:"function",name:"getPoolMarket",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"bytes32",name:"marketId"},{type:"tuple",components:[{type:"address",name:"quoteToken"},{type:"uint32",name:"baseReserveRatio"},{type:"uint32",name:"quoteReserveRatio"},{type:"uint64",name:"oracleFeeUsd"},{type:"uint64",name:"boostFeeUsd"},{type:"uint64",name:"boostRefundFeeUsd"},{type:"uint128",name:"poolPrimeThreshold"},{type:"uint128",name:"executionFee"},{type:"uint128",name:"maxExecutionFee"},{type:"uint128",name:"forwardFee"},{type:"uint128",name:"maxForwardFee"}]}]},{type:"function",name:"getPoolMarketExecutionFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256",name:"executionFee"}]},{type:"function",name:"getPoolMarketForwardFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256",name:"forwardFee"}]},{type:"function",name:"getPoolMarketId",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"bytes32",name:"marketId"}]},{type:"function",name:"getPoolRiskTier",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint8"}]},{type:"function",name:"getPoolVault",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"address"}]},{type:"function",name:"getPools",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32[]",name:"pools"}]},{type:"function",name:"getTradingVault",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"address"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isPoolAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"addr"}],outputs:[{type:"bool"}]},{type:"function",name:"perBenchPool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"string",name:"remark"}]}],outputs:[]},{type:"function",name:"primePool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"referencePrice"}]}],outputs:[]},{type:"function",name:"primePoolFromBoost",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"}]}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"reprimePool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"}]}],outputs:[]},{type:"function",name:"trenchPool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"bytes32",name:"oracleFeedId"},{type:"uint32",name:"oracleDecimals"},{type:"uint8",name:"oracleType"},{type:"uint8",name:"riskTier"}]}],outputs:[]},{type:"function",name:"unboostPool",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"}]}],outputs:[]},{type:"function",name:"updatePoolCompoundEnabled",constant:false,payable:false,inputs:[{type:"tuple[]",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"bool",name:"enabled"}]}],outputs:[]},{type:"function",name:"updatePoolRiskTiers",constant:false,payable:false,inputs:[{type:"tuple[]",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"riskTier"}]}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var G=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"uint8",name:"decimals_",type:"uint8"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"InvalidShortString",type:"error"},{inputs:[{internalType:"string",name:"str",type:"string"}],name:"StringTooLong",type:"error"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"owner",type:"address"},{indexed:true,internalType:"address",name:"spender",type:"address"},{indexed:false,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:false,inputs:[],name:"EIP712DomainChanged",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"previousOwner",type:"address"},{indexed:true,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"from",type:"address"},{indexed:true,internalType:"address",name:"to",type:"address"},{indexed:false,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];var Se=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InsufficientOutputAmount",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"PoolNotActive",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"PoolNotExist",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeCastOverflowedUintToInt",inputs:[{type:"uint256",name:"value"}]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"QuotePoolProfitDistributed",inputs:[{type:"bytes32",name:"poolId",indexed:false},{type:"uint256",name:"amount",indexed:false},{type:"uint256",name:"genesisAmount",indexed:false},{type:"uint256",name:"price",indexed:false},{type:"uint256",name:"exchangeRate",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"EXCHANGE_RATE_PRECISION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"POOL_TOKEN_DECIMALS",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"REBATE_INDEX_PRECISION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"claimUserRebate",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"rebateOut"}]},{type:"function",name:"claimUserRebates",constant:false,payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256[]",name:"rebateOut"}]},{type:"function",name:"deposit",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"amountOut"}]},{type:"function",name:"distribute",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amount"},{type:"uint256",name:"genesisAmount"},{type:"uint256",name:"price"}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getExchangeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getExchangeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getPoolData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"tuple",components:[{type:"uint256",name:"genesisRebateIndex"}]}]},{type:"function",name:"getPoolTokenPrice",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"getUserData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"}],outputs:[{type:"tuple",components:[{type:"uint256",name:"index"},{type:"uint256",name:"accrued"}]}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"pendingUserRebates",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewLpAmountOut",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"quoteAmountIn"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewPoolTokenPrice",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewQuoteAmountOut",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"lpAmountIn"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewUserWithdrawData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"lpAmountIn"},{type:"address",name:"user"},{type:"uint256",name:"price"}],outputs:[{type:"uint256",name:"quoteAmountOut"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"updatePool",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"oraclePrice"}],outputs:[]},{type:"function",name:"upgradeTo",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"withdraw",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"amountOut"},{type:"uint256",name:"rebateOut"}]},{type:"function",name:"withdrawableLpAmount",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]}];var _e=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ExceedMaxProfit",inputs:[]},{type:"error",name:"ExceedMinOutputAmount",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InsufficientOutputAmount",inputs:[]},{type:"error",name:"InsufficientReturnAmount",inputs:[{type:"uint256",name:"expected"},{type:"uint256",name:"received"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"PoolNotActive",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"PoolNotCompoundable",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"PoolNotExist",inputs:[{type:"bytes32",name:"poolId"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeCastOverflowedUintToInt",inputs:[{type:"uint256",name:"value"}]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"BasePoolProfitDistributed",inputs:[{type:"bytes32",name:"poolId",indexed:true},{type:"uint256",name:"baseAmount",indexed:false},{type:"uint256",name:"quoteAmount",indexed:false},{type:"uint256",name:"price",indexed:false},{type:"uint256",name:"exchangeRate",indexed:false},{type:"uint256",name:"rebateIndex",indexed:false},{type:"uint256",name:"genesisRebateIndex",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"PoolProfitExchanged",inputs:[{type:"bytes32",name:"poolId",indexed:true},{type:"uint256",name:"baseIn",indexed:false},{type:"uint256",name:"quoteOut",indexed:false},{type:"uint256",name:"price",indexed:false},{type:"address",name:"recipient",indexed:false}]},{type:"event",anonymous:false,name:"PoolRebateIndexUpdated",inputs:[{type:"bytes32",name:"poolId",indexed:true},{type:"uint256",name:"unexchangedProfits",indexed:false},{type:"uint256",name:"oldIndex",indexed:false},{type:"uint256",name:"newIndex",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"EXCHANGE_RATE_PRECISION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"POOL_TOKEN_DECIMALS",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"REBATE_INDEX_PRECISION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"claimUserRebate",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"rebateOut"}]},{type:"function",name:"claimUserRebates",constant:false,payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256[]",name:"rebateOut"}]},{type:"function",name:"deposit",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"amountOut"}]},{type:"function",name:"distribute",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"},{type:"uint256",name:"genesisAmount"},{type:"uint256",name:"price"}],outputs:[]},{type:"function",name:"exchangeProfit",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"baseIn"},{type:"uint256",name:"minQuoteOut"},{type:"address",name:"recipient"},{type:"bytes",name:"data"}],outputs:[{type:"uint256",name:"quoteOut"}]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getExchangeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getExchangeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"getExchangeableProfit",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256",name:"baseIn"},{type:"uint256",name:"quoteOut"}]},{type:"function",name:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getPoolData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"tuple",components:[{type:"uint256",name:"rebateIndex"},{type:"uint256",name:"genesisRebateIndex"},{type:"uint256",name:"exchangeableProfits"}]}]},{type:"function",name:"getPoolTokenPrice",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"getUserData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"}],outputs:[{type:"tuple",components:[{type:"uint256",name:"index"},{type:"uint256",name:"genesisIndex"},{type:"uint256",name:"accrued"},{type:"uint256",name:"genesisAccrued"}]}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"pendingUserRebates",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"},{type:"uint256",name:"price"}],outputs:[{type:"uint256",name:"rebates"},{type:"uint256",name:"genesisRebates"}]},{type:"function",name:"previewBaseAmountOut",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"lpAmountIn"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewExchangeableProfit",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256",name:"baseIn"},{type:"uint256",name:"quoteOut"}]},{type:"function",name:"previewLpAmountOut",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"baseAmountIn"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewPoolTokenPrice",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256"}]},{type:"function",name:"previewUserWithdrawData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"lpAmountIn"},{type:"address",name:"user"},{type:"uint256",name:"price"}],outputs:[{type:"uint256",name:"baseAmountOut"},{type:"uint256",name:"rebateAmount"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"updatePool",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"oraclePrice"}],outputs:[]},{type:"function",name:"upgradeTo",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"withdraw",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"user"},{type:"address",name:"recipient"}],outputs:[{type:"uint256",name:"amountOut"},{type:"uint256",name:"rebateOut"}]},{type:"function",name:"withdrawableLpAmount",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"price"}],outputs:[{type:"uint256"}]}];var ke=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ECDSAInvalidSignature",inputs:[]},{type:"error",name:"ECDSAInvalidSignatureLength",inputs:[{type:"uint256",name:"length"}]},{type:"error",name:"ECDSAInvalidSignatureS",inputs:[{type:"bytes32",name:"s"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ExpiredFeeData",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InsufficientBalance",inputs:[]},{type:"error",name:"InvalidFeeRate",inputs:[]},{type:"error",name:"InvalidFeeTier",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"NoRebateToClaim",inputs:[]},{type:"error",name:"NotBrokerSigner",inputs:[{type:"address",name:"signer"}]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{type:"address",name:"owner"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{type:"address",name:"account"}]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"error",name:"UnsupportedAssetClass",inputs:[{type:"uint8",name:"assetClass"}]},{type:"error",name:"UnsupportedFeeTier",inputs:[{type:"uint8",name:"tier"}]},{type:"event",anonymous:false,name:"BrokerFeesWithdrawn",inputs:[{type:"address",name:"broker",indexed:true},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false},{type:"address",name:"recipient",indexed:false}]},{type:"event",anonymous:false,name:"BrokerStatusUpdated",inputs:[{type:"address",name:"broker",indexed:false},{type:"bool",name:"isActive",indexed:false}]},{type:"event",anonymous:false,name:"EIP712DomainChanged",inputs:[]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"OwnershipTransferStarted",inputs:[{type:"address",name:"previousOwner",indexed:true},{type:"address",name:"newOwner",indexed:true}]},{type:"event",anonymous:false,name:"OwnershipTransferred",inputs:[{type:"address",name:"previousOwner",indexed:true},{type:"address",name:"newOwner",indexed:true}]},{type:"event",anonymous:false,name:"RebateClaimed",inputs:[{type:"address",name:"user",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"SignerUpdated",inputs:[{type:"address",name:"signer",indexed:false},{type:"bool",name:"isSigner",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"FEE_TYPEHASH",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"__ERC2771ContextUpgradeable_init",constant:false,payable:false,inputs:[{type:"address",name:"trustedForwarder_"}],outputs:[]},{type:"function",name:"acceptOwnership",constant:false,payable:false,inputs:[],outputs:[]},{type:"function",name:"activeFeeTiers",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"}],outputs:[{type:"uint256[]"}]},{type:"function",name:"activeSpecialFeeTierList",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"}],outputs:[{type:"uint256[]"}]},{type:"function",name:"addressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"batchSetSpecialFeeTiers",constant:false,payable:false,inputs:[{type:"tuple[]",name:"params",components:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"},{type:"int32",name:"makerFeeRate"},{type:"uint32",name:"takerFeeRate"}]}],outputs:[]},{type:"function",name:"batchUpdateFeeTiers",constant:false,payable:false,inputs:[{type:"tuple[]",name:"params",components:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"},{type:"tuple",name:"addOnFeeRate",components:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]}]}],outputs:[]},{type:"function",name:"checkAndResetExpiredTier",constant:false,payable:false,inputs:[{type:"address",name:"user"}],outputs:[]},{type:"function",name:"claimRebate",constant:false,payable:false,inputs:[{type:"address",name:"token"}],outputs:[]},{type:"function",name:"claimRebates",constant:false,payable:false,inputs:[{type:"address[]",name:"tokens"}],outputs:[]},{type:"function",name:"domainSeparatorV4",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"eip712Domain",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes1",name:"fields"},{type:"string",name:"name"},{type:"string",name:"version"},{type:"uint256",name:"chainId"},{type:"address",name:"verifyingContract"},{type:"bytes32",name:"salt"},{type:"uint256[]",name:"extensions"}]},{type:"function",name:"getAddOnFeeTier",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"}],outputs:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]},{type:"function",name:"getBaseFeeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"assetClass"}],outputs:[{type:"tuple",name:"baseFeeRate",components:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]}]},{type:"function",name:"getSpecialFeeTier",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"}],outputs:[{type:"int32",name:"makerFeeRate"},{type:"uint32",name:"takerFeeRate"}]},{type:"function",name:"getUserFeeRate",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"},{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"}],outputs:[{type:"uint32",name:"takerFeeRate"},{type:"int32",name:"makerFeeRate"},{type:"uint32",name:"baseTakerFeeRate"},{type:"uint32",name:"baseMakerFeeRate"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"_addressManager"},{type:"address",name:"owner"},{type:"string",name:"_brokerName"},{type:"address[]",name:"brokerSigners"},{type:"uint8[]",name:"assetClasses"},{type:"tuple[]",name:"baseFeeRates",components:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]}],outputs:[]},{type:"function",name:"isActive",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bool"}]},{type:"function",name:"isTrustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"forwarder"}],outputs:[{type:"bool"}]},{type:"function",name:"name",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"onBrokerFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"},{type:"address",name:"token"},{type:"uint256",name:"feeAmount"}],outputs:[{type:"uint256",name:"totalReferralRebate"},{type:"uint256",name:"referrerRebate"},{type:"address",name:"referrer"}]},{type:"function",name:"owner",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"pendingOwner",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"renounceOwnership",constant:false,payable:false,inputs:[],outputs:[]},{type:"function",name:"setSigner",constant:false,payable:false,inputs:[{type:"address",name:"signer"},{type:"bool",name:"isSigner"}],outputs:[]},{type:"function",name:"setSpecialFeeTier",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"},{type:"int32",name:"makerFeeRate"},{type:"uint32",name:"takerFeeRate"}]}],outputs:[]},{type:"function",name:"setUserFeeData",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"address",name:"user"},{type:"uint64",name:"nonce"},{type:"uint64",name:"deadline"},{type:"tuple",name:"feeData",components:[{type:"uint8",name:"tier"},{type:"address",name:"referrer"},{type:"uint32",name:"totalReferralRebatePct"},{type:"uint32",name:"referrerRebatePct"},{type:"uint64",name:"expiry"}]},{type:"bytes",name:"signature"}]}],outputs:[]},{type:"function",name:"setUserSpecialFeeTier",constant:false,payable:false,inputs:[{type:"address",name:"user"},{type:"uint8",name:"feeTier"}],outputs:[]},{type:"function",name:"supportedAssetClasses",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256[]"}]},{type:"function",name:"syncAssetClass",constant:false,payable:false,inputs:[{type:"uint8",name:"assetClass"}],outputs:[]},{type:"function",name:"transferOwnership",constant:false,payable:false,inputs:[{type:"address",name:"newOwner"}],outputs:[]},{type:"function",name:"trustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"updateBaseFeeRates",constant:false,payable:false,inputs:[{type:"tuple[]",name:"params",components:[{type:"uint8",name:"assetClass"},{type:"bool",name:"isEnable"},{type:"tuple",name:"baseFeeRate",components:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]}]}],outputs:[]},{type:"function",name:"updateBrokerStatus",constant:false,payable:false,inputs:[{type:"bool",name:"active"}],outputs:[]},{type:"function",name:"updateFeeTier",constant:false,payable:false,inputs:[{type:"uint8",name:"assetClass"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"feeTier"},{type:"tuple",name:"feeRate",components:[{type:"uint32",name:"takerFeeRate"},{type:"uint32",name:"makerFeeRate"}]}],outputs:[]},{type:"function",name:"updateUserFeeData",constant:false,payable:false,inputs:[{type:"address",name:"user"},{type:"tuple",name:"feeData",components:[{type:"uint8",name:"tier"},{type:"address",name:"referrer"},{type:"uint32",name:"totalReferralRebatePct"},{type:"uint32",name:"referrerRebatePct"},{type:"uint64",name:"expiry"}]}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"userFeeData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"}],outputs:[{type:"uint8",name:"tier"},{type:"address",name:"referrer"},{type:"uint32",name:"totalReferralRebatePct"},{type:"uint32",name:"referrerRebatePct"},{type:"uint64",name:"expiry"}]},{type:"function",name:"userNonces",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"}],outputs:[{type:"uint64",name:"nonce"}]},{type:"function",name:"userRebates",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"},{type:"address",name:"token"}],outputs:[{type:"uint256",name:"rebateAmount"}]},{type:"function",name:"withdrawBrokerFees",constant:false,payable:false,inputs:[{type:"address",name:"token"},{type:"uint256",name:"amount"},{type:"address",name:"recipient"}],outputs:[]}];var Ne=[{type:"constructor",payable:false,inputs:[]},{type:"error",name:"ERC20InsufficientAllowance",inputs:[{type:"address",name:"spender"},{type:"uint256",name:"allowance"},{type:"uint256",name:"needed"}]},{type:"error",name:"ERC20InsufficientBalance",inputs:[{type:"address",name:"sender"},{type:"uint256",name:"balance"},{type:"uint256",name:"needed"}]},{type:"error",name:"ERC20InvalidApprover",inputs:[{type:"address",name:"approver"}]},{type:"error",name:"ERC20InvalidReceiver",inputs:[{type:"address",name:"receiver"}]},{type:"error",name:"ERC20InvalidSender",inputs:[{type:"address",name:"sender"}]},{type:"error",name:"ERC20InvalidSpender",inputs:[{type:"address",name:"spender"}]},{type:"error",name:"InsufficientBalance",inputs:[{type:"address",name:"account"},{type:"uint256",name:"balance"},{type:"uint256",name:"needed"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"event",anonymous:false,name:"Approval",inputs:[{type:"address",name:"owner",indexed:true},{type:"address",name:"spender",indexed:true},{type:"uint256",name:"value",indexed:false}]},{type:"event",anonymous:false,name:"GenesisShareBurned",inputs:[{type:"address",name:"account",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"GenesisShareMinted",inputs:[{type:"address",name:"account",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"Transfer",inputs:[{type:"address",name:"from",indexed:true},{type:"address",name:"to",indexed:true},{type:"uint256",name:"value",indexed:false}]},{type:"function",name:"addressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"allowance",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"owner"},{type:"address",name:"spender"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",constant:false,payable:false,inputs:[{type:"address",name:"spender"},{type:"uint256",name:"value"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"}],outputs:[{type:"uint256"}]},{type:"function",name:"burnFrom",constant:false,payable:false,inputs:[{type:"address",name:"from"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"decimals",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"_addressManager"},{type:"bytes32",name:"_poolId"},{type:"address",name:"_underlyingToken"},{type:"string",name:"name"},{type:"string",name:"symbol"}],outputs:[]},{type:"function",name:"mint",constant:false,payable:false,inputs:[{type:"address",name:"to"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"name",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"poolId",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"symbol",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalGenesisShare",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"totalSupply",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",constant:false,payable:false,inputs:[{type:"address",name:"to"},{type:"uint256",name:"value"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",constant:false,payable:false,inputs:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"}],outputs:[{type:"bool"}]},{type:"function",name:"underlyingToken",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"userGenesisShare",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"}],outputs:[{type:"uint256"}]}];var Be=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"InvalidQuoteTokenAddress",inputs:[]},{type:"error",name:"InvalidRatioParams",inputs:[]},{type:"error",name:"MarketAlreadyExisted",inputs:[]},{type:"error",name:"MarketNotExisted",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"ExecutionFeeUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint256",name:"oldExecutionFee",indexed:false},{type:"uint256",name:"newExecutionFee",indexed:false}]},{type:"event",anonymous:false,name:"ForwardFeeUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint256",name:"oldForwardFee",indexed:false},{type:"uint256",name:"newForwardFee",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"MaxExecutionFeeUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint256",name:"oldMaxExecutionFee",indexed:false},{type:"uint256",name:"newMaxExecutionFee",indexed:false}]},{type:"event",anonymous:false,name:"MaxForwardFeeUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint256",name:"oldMaxForwardFee",indexed:false},{type:"uint256",name:"newMaxForwardFee",indexed:false}]},{type:"event",anonymous:false,name:"OracleFeeUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint64",name:"newOracleFeeUsd",indexed:false}]},{type:"event",anonymous:false,name:"PoolPrimeThresholdUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint128",name:"newPoolPrimeThreshold",indexed:false}]},{type:"event",anonymous:false,name:"ReserveRatioUpdated",inputs:[{type:"bytes32",name:"marketId",indexed:false},{type:"uint32",name:"newBaseReserveRatio",indexed:false},{type:"uint32",name:"newQuoteReserveRatio",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"createMarket",constant:false,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"uint64",name:"chainId"},{type:"address",name:"quoteToken"},{type:"uint32",name:"baseReserveRatio"},{type:"uint32",name:"quoteReserveRatio"},{type:"uint64",name:"oracleFeeUsd"},{type:"uint64",name:"boostFeeUsd"},{type:"uint64",name:"boostRefundFeeUsd"},{type:"uint128",name:"poolPrimeThreshold"},{type:"uint128",name:"executionFee"},{type:"uint128",name:"maxExecutionFee"},{type:"uint128",name:"forwardFee"},{type:"uint128",name:"maxForwardFee"}]},{type:"tuple",name:"quoteParams",components:[{type:"address",name:"priceContract"},{type:"bool",name:"applyExchangeRate"},{type:"uint16",name:"minDeviationRatio"}]}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getBoostFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getBoostRefundFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getExecutionFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getExecutionFeeByToken",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"quoteToken"}],outputs:[{type:"uint256"}]},{type:"function",name:"getForwardFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"uint256"}]},{type:"function",name:"getForwardFeeByToken",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"quoteToken"}],outputs:[{type:"uint256"}]},{type:"function",name:"getMarket",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"tuple",components:[{type:"address",name:"quoteToken"},{type:"uint32",name:"baseReserveRatio"},{type:"uint32",name:"quoteReserveRatio"},{type:"uint64",name:"oracleFeeUsd"},{type:"uint64",name:"boostFeeUsd"},{type:"uint64",name:"boostRefundFeeUsd"},{type:"uint128",name:"poolPrimeThreshold"},{type:"uint128",name:"executionFee"},{type:"uint128",name:"maxExecutionFee"},{type:"uint128",name:"forwardFee"},{type:"uint128",name:"maxForwardFee"}]}]},{type:"function",name:"getMarketIds",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32[]"}]},{type:"function",name:"getOracleFee",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"uint256"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"marketExists",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"marketId"}],outputs:[{type:"bool"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"updateExecutionFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint128",name:"_executionFee"}],outputs:[]},{type:"function",name:"updateForwardFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint128",name:"_forwardFee"}],outputs:[]},{type:"function",name:"updateMarketQuoteConfiguration",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"tuple",name:"quoteParams",components:[{type:"address",name:"priceContract"},{type:"bool",name:"applyExchangeRate"},{type:"uint16",name:"minDeviationRatio"}]}],outputs:[]},{type:"function",name:"updateMaxExecutionFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint128",name:"_maxExecutionFee"}],outputs:[]},{type:"function",name:"updateMaxForwardFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint128",name:"_maxForwardFee"}],outputs:[]},{type:"function",name:"updateOracleFee",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint64",name:"_oracleFeeUsd"}],outputs:[]},{type:"function",name:"updatePoolPrimeThreshold",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint128",name:"_poolPrimeThreshold"}],outputs:[]},{type:"function",name:"updateReserveRatio",constant:false,payable:false,inputs:[{type:"bytes32",name:"marketId"},{type:"uint32",name:"_baseReserveRatio"},{type:"uint32",name:"_quoteReserveRatio"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var Ue=[{type:"error",name:"PositionNotHealthy",inputs:[{type:"bytes32",name:"positionId"},{type:"uint256",name:"marginRatio"}]},{type:"error",name:"SafeCastOverflowedUintToInt",inputs:[{type:"uint256",name:"value"}]},{type:"function",name:"ADDRESS_MANAGER",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getAccountInfo",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"user"}],outputs:[{type:"tuple",name:"accountInfo",components:[{type:"uint256",name:"freeMargin"},{type:"uint256",name:"walletBalance"},{type:"uint256",name:"freeBaseAmount"},{type:"uint256",name:"baseProfit"},{type:"uint256",name:"quoteProfit"},{type:"uint256",name:"reservedAmount"},{type:"uint64",name:"releaseTime"}]}]},{type:"function",name:"getAvailableLiquiditySize",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint256",name:"executePrice"}],outputs:[{type:"uint256"}]},{type:"function",name:"getBrokerFeeTiers",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"brokerAddress"},{type:"uint8[]",name:"assetClasses"},{type:"uint8[]",name:"riskTiers"},{type:"bool",name:"isMYXBroker"}],outputs:[{type:"tuple[]",name:"brokerFees",components:[{type:"uint8",name:"asset"},{type:"tuple[]",name:"riskTieredBrokerFees",components:[{type:"uint8",name:"riskTier"},{type:"tuple[]",name:"addOnFeeTiers",components:[{type:"uint8",name:"tier"},{type:"uint32",name:"takerFeeRate"},{type:"int32",name:"makerFeeRate"}]},{type:"tuple[]",name:"baseFeeRate",components:[{type:"uint8",name:"assetClass"},{type:"uint32",name:"makerFeeRate"},{type:"uint32",name:"takerFeeRate"}]},{type:"tuple[]",name:"specialFeeTiers",components:[{type:"uint8",name:"tier"},{type:"uint32",name:"takerFeeRate"},{type:"int32",name:"makerFeeRate"}]}]}]}]},{type:"function",name:"getExchangeables",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"uint256[]",name:"marketPrices"}],outputs:[{type:"tuple[]",name:"exchangeables",components:[{type:"uint256",name:"maxBaseIn"},{type:"uint256",name:"maxQuoteIn"},{type:"uint256",name:"maxBaseOut"},{type:"uint256",name:"maxQuoteOut"}]}]},{type:"function",name:"getLiquidationPrice",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"positionId"},{type:"uint256",name:"marketPrice"}],outputs:[{type:"uint256"}]},{type:"function",name:"getPoolInfo",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"marketPrice"}],outputs:[{type:"tuple",components:[{type:"tuple",name:"basePool",components:[{type:"address",name:"poolToken"},{type:"uint256",name:"exchangeRate"},{type:"uint256",name:"poolTokenPrice"},{type:"uint256",name:"poolTokenSupply"},{type:"uint256",name:"totalDebt"},{type:"uint256",name:"baseCollateral"}]},{type:"tuple",name:"quotePool",components:[{type:"address",name:"poolToken"},{type:"uint256",name:"exchangeRate"},{type:"uint256",name:"poolTokenPrice"},{type:"uint256",name:"poolTokenSupply"},{type:"uint256",name:"totalDebt"},{type:"uint256",name:"baseCollateral"}]},{type:"tuple",name:"reserveInfo",components:[{type:"uint256",name:"baseTotalAmount"},{type:"uint256",name:"baseReservedAmount"},{type:"uint256",name:"quoteTotalAmount"},{type:"uint256",name:"quoteReservedAmount"}]},{type:"tuple",name:"fundingInfo",components:[{type:"int256",name:"nextFundingRate"},{type:"int256",name:"lastFundingFeeTracker"},{type:"uint256",name:"nextEpochTime"}]},{type:"tuple",name:"oi",components:[{type:"int256",name:"tracker"},{type:"uint256",name:"longSize"},{type:"uint256",name:"shortSize"},{type:"uint256",name:"poolEntryPrice"}]},{type:"tuple",name:"liquidityInfo",components:[{type:"uint256",name:"windowCaps"},{type:"int256",name:"openInterest"}]}]}]},{type:"function",name:"getPoolInfos",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"uint256[]",name:"marketPrices"}],outputs:[{type:"tuple[]",components:[{type:"tuple",name:"basePool",components:[{type:"address",name:"poolToken"},{type:"uint256",name:"exchangeRate"},{type:"uint256",name:"poolTokenPrice"},{type:"uint256",name:"poolTokenSupply"},{type:"uint256",name:"totalDebt"},{type:"uint256",name:"baseCollateral"}]},{type:"tuple",name:"quotePool",components:[{type:"address",name:"poolToken"},{type:"uint256",name:"exchangeRate"},{type:"uint256",name:"poolTokenPrice"},{type:"uint256",name:"poolTokenSupply"},{type:"uint256",name:"totalDebt"},{type:"uint256",name:"baseCollateral"}]},{type:"tuple",name:"reserveInfo",components:[{type:"uint256",name:"baseTotalAmount"},{type:"uint256",name:"baseReservedAmount"},{type:"uint256",name:"quoteTotalAmount"},{type:"uint256",name:"quoteReservedAmount"}]},{type:"tuple",name:"fundingInfo",components:[{type:"int256",name:"nextFundingRate"},{type:"int256",name:"lastFundingFeeTracker"},{type:"uint256",name:"nextEpochTime"}]},{type:"tuple",name:"oi",components:[{type:"int256",name:"tracker"},{type:"uint256",name:"longSize"},{type:"uint256",name:"shortSize"},{type:"uint256",name:"poolEntryPrice"}]},{type:"tuple",name:"liquidityInfo",components:[{type:"uint256",name:"windowCaps"},{type:"int256",name:"openInterest"}]}]}]},{type:"function",name:"getPoolTokenPrices",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32[]",name:"poolIds"},{type:"uint256[]",name:"marketPrices"}],outputs:[{type:"tuple[]",components:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"basePoolTokenPrice"},{type:"uint256",name:"quotePoolTokenPrice"}]}]},{type:"function",name:"getPositionFees",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"positionId"},{type:"address",name:"broker"},{type:"uint256",name:"price"}],outputs:[{type:"int256",name:"netCollateral"},{type:"uint256",name:"collateralAmount"},{type:"int256",name:"tradingFee"},{type:"int256",name:"fundingFee"},{type:"int256",name:"unrealizedPnl"}]},{type:"function",name:"getRiskParameters",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint8",name:"maxRiskTier"}],outputs:[{type:"tuple[]",name:"params",components:[{type:"tuple",name:"tradeLimitParams",components:[{type:"uint64",name:"minTradeUsd"},{type:"uint16",name:"maxPriceDeviation"}]},{type:"tuple",name:"riskLockParams",components:[{type:"uint64",name:"windowCapUsd"},{type:"uint64",name:"liquidityWindowSize"},{type:"uint64",name:"profitWindowSize"},{type:"uint16",name:"priceRangePct"},{type:"uint32",name:"baseSlippage"}]},{type:"tuple",name:"poolConfigParams",components:[{type:"uint16",name:"leverage"},{type:"uint16",name:"maintainMarginRate"},{type:"uint16",name:"baseTokenCollateralRatio"},{type:"uint16",name:"exchangeIncentiveRate"},{type:"uint16",name:"genesisRebateRatio"},{type:"uint8",name:"assetClass"}]},{type:"tuple",name:"fundingRateParams",components:[{type:"int32",name:"maxRate"},{type:"uint32",name:"equilibriumRange"},{type:"int32",name:"lowGrowthRate"},{type:"int32",name:"highGrowthRate"},{type:"uint32",name:"epochDuration"}]}]}]},{type:"function",name:"getSumProfitLock",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address[]",name:"respondents"}],outputs:[{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"},{type:"tuple[]",name:"infos",components:[{type:"address",name:"account"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"}]}]},{type:"function",name:"getUserPositionInfos",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"},{type:"bytes32[]",name:"poolIds"}],outputs:[{type:"tuple[]",name:"positions",components:[{type:"bytes32",name:"positionId"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"size"},{type:"uint256",name:"entryPrice"},{type:"int256",name:"fundingRateIndex"},{type:"uint256",name:"earlyClosePrice"},{type:"uint8",name:"direction"},{type:"uint8",name:"riskTier"},{type:"uint64",name:"lastUpdateTime"},{type:"uint256",name:"collateralAmount"}]}]}];var Le=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC2771ForwarderExpiredRequest",inputs:[{type:"uint48",name:"deadline"}]},{type:"error",name:"ERC2771ForwarderInvalidSigner",inputs:[{type:"address",name:"signer"},{type:"address",name:"from"}]},{type:"error",name:"ERC2771ForwarderMismatchedValue",inputs:[{type:"uint256",name:"requestedValue"},{type:"uint256",name:"msgValue"}]},{type:"error",name:"ERC2771UntrustfulTarget",inputs:[{type:"address",name:"target"},{type:"address",name:"forwarder"}]},{type:"error",name:"ExceedsMaximumRelayFee",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InconsistentParamsLength",inputs:[]},{type:"error",name:"InsufficientBalance",inputs:[{type:"uint256",name:"balance"},{type:"uint256",name:"needed"}]},{type:"error",name:"InsufficientFeeAllowance",inputs:[{type:"address",name:"user"},{type:"uint256",name:"allowance"},{type:"uint256",name:"required"}]},{type:"error",name:"InsufficientFeeBalance",inputs:[{type:"address",name:"user"},{type:"uint256",name:"balance"},{type:"uint256",name:"required"}]},{type:"error",name:"InvalidAccountNonce",inputs:[{type:"address",name:"account"},{type:"uint256",name:"currentNonce"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"MismatchExecuteFee",inputs:[{type:"uint256",name:"balanceBefore"},{type:"uint256",name:"balanceAfter"},{type:"uint256",name:"expected"}]},{type:"error",name:"MismatchedSender",inputs:[{type:"address",name:"sender"}]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotAllowedTarget",inputs:[{type:"address",name:"target"}]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"OnlyRelayer",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"RelayerRegistered",inputs:[{type:"address",name:"relayer"}]},{type:"error",name:"RemoveRelayerFailed",inputs:[]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"AddAllowedTarget",inputs:[{type:"address",name:"target",indexed:false}]},{type:"event",anonymous:false,name:"ChargeForwardFee",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"feeToken",indexed:false},{type:"uint256",name:"relayFee",indexed:false}]},{type:"event",anonymous:false,name:"EIP712DomainChanged",inputs:[]},{type:"event",anonymous:false,name:"ERC20PermitFailed",inputs:[{type:"address",name:"token",indexed:false},{type:"string",name:"reason",indexed:false}]},{type:"event",anonymous:false,name:"ERC20PermitLowLevelFailed",inputs:[{type:"bytes",name:"data",indexed:false}]},{type:"event",anonymous:false,name:"ExecutedForwardRequest",inputs:[{type:"address",name:"signer",indexed:true},{type:"uint256",name:"nonce",indexed:false},{type:"bool",name:"success",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"RemoveAllowedTarget",inputs:[{type:"address",name:"target",indexed:false}]},{type:"event",anonymous:false,name:"SetUserRelayer",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"relayer",indexed:false},{type:"bool",name:"enable",indexed:false}]},{type:"event",anonymous:false,name:"UpdateAcquiescentFeeToken",inputs:[{type:"address",name:"sender",indexed:false},{type:"address",name:"oldRelayGas",indexed:false},{type:"address",name:"newRelayGas",indexed:false}]},{type:"event",anonymous:false,name:"UpdateEquilibriumGas",inputs:[{type:"address",name:"sender",indexed:false},{type:"uint256",name:"oldRelayGas",indexed:false},{type:"uint256",name:"newRelayGas",indexed:false}]},{type:"event",anonymous:false,name:"UpdateMaxRelayFee",inputs:[{type:"address",name:"sender",indexed:false},{type:"uint256",name:"oldMaxRelayFee",indexed:false},{type:"uint256",name:"newMaxRelayFee",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"__ERC2771ContextUpgradeable_init",constant:false,payable:false,inputs:[{type:"address",name:"trustedForwarder_"}],outputs:[]},{type:"function",name:"addAllowedTarget",constant:false,payable:false,inputs:[{type:"address",name:"target"}],outputs:[]},{type:"function",name:"batchExecuteForwarder",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"forwardFeeToken"},{type:"tuple[]",name:"bundleParams",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]}],outputs:[]},{type:"function",name:"eip712Domain",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes1",name:"fields"},{type:"string",name:"name"},{type:"string",name:"version"},{type:"uint256",name:"chainId"},{type:"address",name:"verifyingContract"},{type:"bytes32",name:"salt"},{type:"uint256[]",name:"extensions"}]},{type:"function",name:"equilibriumGas",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"execute",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]},{type:"address"}],outputs:[]},{type:"function",name:"executeBatch",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple[]",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]},{type:"address"},{type:"address"}],outputs:[]},{type:"function",name:"executeForwarder",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"forwardFeeToken"},{type:"tuple",name:"params",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]}],outputs:[]},{type:"function",name:"exitForwardMode",constant:false,payable:false,inputs:[],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getAllowedTargets",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address[]"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getDesignatedToken",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getEquilibriumGas",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getUserRelayers",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"}],outputs:[{type:"address[]"}]},{type:"function",name:"inForwardMode",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bool"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"},{type:"uint256",name:"_equilibriumGas"}],outputs:[]},{type:"function",name:"isAllowedTargets",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"contractAddr"}],outputs:[{type:"bool"}]},{type:"function",name:"isTrustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"forwarder"}],outputs:[{type:"bool"}]},{type:"function",name:"isUserRelayerEnabled",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"},{type:"address",name:"relayer"}],outputs:[{type:"bool"}]},{type:"function",name:"nonces",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{type:"function",name:"originAccount",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"relayer"}],outputs:[{type:"address",name:"account"}]},{type:"function",name:"permitAndApproveForwarder",constant:false,payable:false,inputs:[{type:"address",name:"relayer"},{type:"bool",name:"enable"},{type:"tuple[]",name:"permitParams",components:[{type:"address",name:"token"},{type:"address",name:"owner"},{type:"address",name:"spender"},{type:"uint256",name:"value"},{type:"uint256",name:"deadline"},{type:"uint8",name:"v"},{type:"bytes32",name:"r"},{type:"bytes32",name:"s"}]}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"removeAllowedTarget",constant:false,payable:false,inputs:[{type:"address",name:"target"}],outputs:[]},{type:"function",name:"trustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"updateEquilibriumGas",constant:false,payable:false,inputs:[{type:"uint256",name:"_equilibriumGas"}],outputs:[]},{type:"function",name:"upgradeTo",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"verify",constant:true,stateMutability:"view",payable:false,inputs:[{type:"tuple",name:"request",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]}],outputs:[{type:"bool"}]}];var qe=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"AlreadyClaimed",inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"user"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidAmount",inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"user"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"MerkleTreeVerificationFailed",inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"user"}]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"ReimbursementValidity",inputs:[{type:"uint256",name:"caseId"}]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"TreeAlreadySet",inputs:[]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementClaimExpired",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"user",indexed:false},{type:"address",name:"baseToken",indexed:false},{type:"address",name:"quoteToken",indexed:false},{type:"uint256",name:"baseAmount",indexed:false},{type:"uint256",name:"quoteAmount",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementClaimed",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"user",indexed:false},{type:"address",name:"baseToken",indexed:false},{type:"address",name:"quoteToken",indexed:false},{type:"uint256",name:"baseAmount",indexed:false},{type:"uint256",name:"quoteAmount",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementInfoSet",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"bytes32",name:"merkleRoot",indexed:false},{type:"address",name:"baseToken",indexed:false},{type:"address",name:"quoteToken",indexed:false},{type:"uint256",name:"totalBaseAmount",indexed:false},{type:"uint256",name:"totalQuoteAmount",indexed:false},{type:"uint256",name:"claimedBaseAmount",indexed:false},{type:"uint256",name:"claimedQuoteAmount",indexed:false},{type:"uint256",name:"expireTime",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"claimExpiredCases",constant:false,payable:false,inputs:[{type:"uint256[]",name:"caseIds"},{type:"address",name:"receiver"}],outputs:[]},{type:"function",name:"claimReimbursement",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"},{type:"bytes32[]",name:"merkleProof"}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getReimbursementInfo",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[{type:"tuple",components:[{type:"bytes32",name:"merkleRoot"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint256",name:"totalBaseAmount"},{type:"uint256",name:"totalQuoteAmount"},{type:"uint256",name:"claimedBaseAmount"},{type:"uint256",name:"claimedQuoteAmount"},{type:"uint256",name:"expireTime"}]}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"setReimbursementInfo",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"tuple",name:"reimbursementInfo",components:[{type:"bytes32",name:"merkleRoot"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint256",name:"totalBaseAmount"},{type:"uint256",name:"totalQuoteAmount"},{type:"uint256",name:"claimedBaseAmount"},{type:"uint256",name:"claimedQuoteAmount"},{type:"uint256",name:"expireTime"}]},{type:"bytes32[]",name:"zeroMerkleProof"}],outputs:[]},{type:"function",name:"upgradeTo",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var Ge=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"BondNotReleased",inputs:[]},{type:"error",name:"BondZeroAmount",inputs:[]},{type:"error",name:"CaseAppealNotFinished",inputs:[]},{type:"error",name:"CaseDeadlineNotReached",inputs:[]},{type:"error",name:"CaseDeadlineReached",inputs:[]},{type:"error",name:"CaseNotAccepted",inputs:[]},{type:"error",name:"CaseNotExist",inputs:[{type:"uint256",name:"caseId"}]},{type:"error",name:"CaseRespondentAppealed",inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"respondent"}]},{type:"error",name:"DisputeNotAllowed",inputs:[]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"InvalidPoolToken",inputs:[]},{type:"error",name:"InvalidProfitAmount",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotCaseRespondent",inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"respondent"}]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"OnlyRelayer",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"RiskCloseNotCompleted",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"error",name:"UnexpectedCaseState",inputs:[]},{type:"error",name:"UnexpectedCaseType",inputs:[]},{type:"event",anonymous:false,name:"AppealCanceled",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint256",name:"appealCaseId",indexed:false},{type:"address",name:"complainant",indexed:false},{type:"bool",name:"isMalicious",indexed:false}]},{type:"event",anonymous:false,name:"AppealFiled",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint256",name:"appealCaseId",indexed:false},{type:"address",name:"respondent",indexed:false},{type:"address",name:"appealToken",indexed:false},{type:"uint256",name:"appealBond",indexed:false},{type:"uint64",name:"appealDeadline",indexed:false}]},{type:"event",anonymous:false,name:"AppealResolved",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint256",name:"appealCaseId",indexed:false},{type:"uint8",name:"resolution",indexed:false},{type:"address",name:"complainant",indexed:false}]},{type:"event",anonymous:false,name:"BondClaimed",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"user",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"CaseAppealsResolved",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint256",name:"remaining",indexed:false}]},{type:"event",anonymous:false,name:"CaseRiskClosed",inputs:[{type:"uint256",name:"caseId",indexed:false}]},{type:"event",anonymous:false,name:"DisputeCanceled",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"complainant",indexed:false},{type:"bool",name:"isMalicious",indexed:false}]},{type:"event",anonymous:false,name:"DisputeConfigurationUpdated",inputs:[{type:"tuple",name:"newDisputeConfigration",indexed:false,components:[{type:"address",name:"appealToken"},{type:"uint64",name:"disputeBondUsd"},{type:"uint64",name:"appealBondUsd"},{type:"uint64",name:"disputeThresholdUsd"},{type:"uint64",name:"caseDuration"},{type:"uint64",name:"voteDuration"},{type:"uint64",name:"resolveDuration"}]}]},{type:"event",anonymous:false,name:"DisputeFiled",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"bytes32",name:"poolId",indexed:false},{type:"address",name:"complainant",indexed:false},{type:"address",name:"poolToken",indexed:false},{type:"uint256",name:"disputeBond",indexed:false},{type:"uint64",name:"caseDeadline",indexed:false}]},{type:"event",anonymous:false,name:"DisputeResolved",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint8",name:"resolution",indexed:false},{type:"uint64",name:"appealDeadline",indexed:false}]},{type:"event",anonymous:false,name:"ForfeitBondsClaimed",inputs:[{type:"address",name:"receiver",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementProcessed",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"tuple",name:"reimbursementInfo",indexed:false,components:[{type:"bytes32",name:"merkleRoot"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint256",name:"totalBaseAmount"},{type:"uint256",name:"totalQuoteAmount"},{type:"uint256",name:"claimedBaseAmount"},{type:"uint256",name:"claimedQuoteAmount"},{type:"uint256",name:"expireTime"}]}]},{type:"event",anonymous:false,name:"ReimbursementVoteOpened",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"bytes32",name:"merkleRoot",indexed:false},{type:"uint256",name:"totalBaseAmount",indexed:false},{type:"uint256",name:"totalQuoteAmount",indexed:false},{type:"uint64",name:"voteDeadline",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementVoteRejected",inputs:[{type:"uint256",name:"caseId",indexed:false}]},{type:"event",anonymous:false,name:"ReimbursementVoteSubmitted",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"validator",indexed:false},{type:"uint8",name:"voteOption",indexed:false}]},{type:"event",anonymous:false,name:"RelayerAdded",inputs:[{type:"address",name:"relayer",indexed:false}]},{type:"event",anonymous:false,name:"RelayerRemoved",inputs:[{type:"address",name:"relayer",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"event",anonymous:false,name:"Voted",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"address",name:"voter",indexed:false},{type:"uint8",name:"voteOption",indexed:false}]},{type:"event",anonymous:false,name:"VotingOpened",inputs:[{type:"uint256",name:"caseId",indexed:false},{type:"uint256",name:"evidenceId",indexed:false},{type:"uint64",name:"voteDeadline",indexed:false},{type:"address[]",name:"respondents",indexed:false}]},{type:"event",anonymous:false,name:"WormholeConfigurationUpdated",inputs:[{type:"tuple",name:"newWormholeConfiguration",indexed:false,components:[{type:"address",name:"wormhole"},{type:"address",name:"validatorView"},{type:"uint32",name:"maxAge"},{type:"bytes4",name:"selector"}]}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"addRelayers",constant:false,payable:false,inputs:[{type:"address[]",name:"relayers"}],outputs:[]},{type:"function",name:"appeal",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[]},{type:"function",name:"canRiskControlClose",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[{type:"bool"}]},{type:"function",name:"cancelAppeal",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"uint256",name:"appealCaseId"},{type:"bool",name:"isMalicious"}],outputs:[]},{type:"function",name:"cancelDispute",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"bool",name:"isMalicious"}],outputs:[]},{type:"function",name:"caseIdSequencer",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"checkRiskControlCloseCompleted",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[]},{type:"function",name:"claimBond",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[]},{type:"function",name:"claimForfeitBonds",constant:false,payable:false,inputs:[{type:"address",name:"receiver"}],outputs:[]},{type:"function",name:"fileDispute",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple[]",name:"prices",components:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"oracleType"},{type:"uint64",name:"publishTime"},{type:"bytes",name:"oracleUpdateData"}]},{type:"bytes32",name:"poolId"},{type:"address",name:"poolToken"}],outputs:[]},{type:"function",name:"fileDisputeFromStaker",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getDisputeConfiguration",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"tuple",components:[{type:"address",name:"appealToken"},{type:"uint64",name:"disputeBondUsd"},{type:"uint64",name:"appealBondUsd"},{type:"uint64",name:"disputeThresholdUsd"},{type:"uint64",name:"caseDuration"},{type:"uint64",name:"voteDuration"},{type:"uint64",name:"resolveDuration"}]},{type:"uint32"},{type:"uint32"}]},{type:"function",name:"getRelayers",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address[]"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isCaseRespondents",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"account"}],outputs:[{type:"bool"}]},{type:"function",name:"openReimbursementVote",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"bytes32",name:"merkleRoot"},{type:"uint256",name:"totalBaseAmount"},{type:"uint256",name:"totalQuoteAmount"}],outputs:[]},{type:"function",name:"openVoting",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"uint256",name:"evidenceId"},{type:"address[]",name:"respondents"}],outputs:[]},{type:"function",name:"processReimbursement",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"tuple",name:"reimbursementInfo",components:[{type:"bytes32",name:"merkleRoot"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint256",name:"totalBaseAmount"},{type:"uint256",name:"totalQuoteAmount"},{type:"uint256",name:"claimedBaseAmount"},{type:"uint256",name:"claimedQuoteAmount"},{type:"uint256",name:"expireTime"}]},{type:"bytes32[]",name:"zeroMerkleProof"}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"removeRelayers",constant:false,payable:false,inputs:[{type:"address[]",name:"relayers"}],outputs:[]},{type:"function",name:"resolveCaseAppeals",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"uint256",name:"limit"}],outputs:[]},{type:"function",name:"resolveDispute",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"}],outputs:[]},{type:"function",name:"updateDisputeConfiguration",constant:false,payable:false,inputs:[{type:"tuple",name:"disputeConfiguration",components:[{type:"address",name:"appealToken"},{type:"uint64",name:"disputeBondUsd"},{type:"uint64",name:"appealBondUsd"},{type:"uint64",name:"disputeThresholdUsd"},{type:"uint64",name:"caseDuration"},{type:"uint64",name:"voteDuration"},{type:"uint64",name:"resolveDuration"}]},{type:"uint32",name:"voteCountRate"},{type:"uint32",name:"effectiveVoteRate"}],outputs:[]},{type:"function",name:"updateWormholeConfiguration",constant:false,payable:false,inputs:[{type:"tuple",name:"wormholeConfiguration",components:[{type:"address",name:"wormhole"},{type:"address",name:"validatorView"},{type:"uint32",name:"maxAge"},{type:"bytes4",name:"selector"}]}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"vote",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"validator"},{type:"uint8",name:"voteOption"},{type:"uint256",name:"deadline"},{type:"uint8",name:"v"},{type:"bytes32",name:"r"},{type:"bytes32",name:"s"}],outputs:[]},{type:"function",name:"voteReimbursement",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"address",name:"validator"},{type:"uint8",name:"voteOption"},{type:"uint256",name:"deadline"},{type:"uint8",name:"v"},{type:"bytes32",name:"r"},{type:"bytes32",name:"s"}],outputs:[]}];var Tt=[{type:"error",name:"AccountInsufficientFreeAmount",inputs:[]},{type:"error",name:"AccountInsufficientReservedAmount",inputs:[]},{type:"error",name:"AccountInsufficientTradableAmount",inputs:[{type:"uint256",name:"accountTradableAmount"},{type:"uint256",name:"requiredTradableAmount"}]},{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"DepositToAccount",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"ExecuteCompensation",inputs:[{type:"bytes32",name:"poolId",indexed:false},{type:"uint256",name:"baseAmount",indexed:false},{type:"uint256",name:"quoteAmount",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"PayWithPrincipal",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"receiver",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"PayWithProfitFirst",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"receiver",indexed:false},{type:"bytes32",name:"poolId",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"usedFreeAmount",indexed:false},{type:"uint256",name:"usedRestrictedAmount",indexed:false}]},{type:"event",anonymous:false,name:"ReleaseForOrder",inputs:[{type:"bytes32",name:"poolId",indexed:false},{type:"uint256",name:"orderId",indexed:false},{type:"address",name:"account",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"ReleaseProfit",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"ReserveForOrder",inputs:[{type:"bytes32",name:"poolId",indexed:false},{type:"uint256",name:"orderId",indexed:false},{type:"address",name:"account",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"event",anonymous:false,name:"SettleToAccount",inputs:[{type:"address",name:"account",indexed:false},{type:"bytes32",name:"positionId",indexed:false},{type:"address",name:"baseToken",indexed:false},{type:"address",name:"quoteToken",indexed:false},{type:"uint256",name:"freeBase",indexed:false},{type:"uint256",name:"profitBase",indexed:false},{type:"uint256",name:"freeAmount",indexed:false},{type:"uint256",name:"profitAmount",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"event",anonymous:false,name:"WithdrawFromAccount",inputs:[{type:"address",name:"account",indexed:false},{type:"address",name:"token",indexed:false},{type:"uint256",name:"amount",indexed:false}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"__ERC2771ContextUpgradeable_init",constant:false,payable:false,inputs:[{type:"address",name:"trustedForwarder_"}],outputs:[]},{type:"function",name:"deposit",constant:false,payable:false,inputs:[{type:"address",name:"account"},{type:"address",name:"token"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"executeCompensation",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"reimbursement"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getPoolWithdrawableBaseToken",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"},{type:"bytes32",name:"poolId"}],outputs:[{type:"uint256",name:"baseAmount"}]},{type:"function",name:"getTradableAmount",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"},{type:"bytes32",name:"poolId"}],outputs:[{type:"bool"},{type:"uint256"},{type:"uint256"},{type:"uint256"}]},{type:"function",name:"getUserAsset",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"},{type:"address",name:"token"}],outputs:[{type:"uint256",name:"amount"}]},{type:"function",name:"getUserAssets",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"account"}],outputs:[{type:"tuple[]",components:[{type:"address",name:"asset"},{type:"uint256",name:"amount"}]}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isTrustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"forwarder"}],outputs:[{type:"bool"}]},{type:"function",name:"payWithPrincipal",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"address",name:"account"},{type:"address",name:"token"},{type:"uint256",name:"amount"},{type:"address",name:"receiver"}],outputs:[]},{type:"function",name:"payWithProfitFirst",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"orderId"},{type:"address",name:"account"},{type:"address",name:"token"},{type:"uint256",name:"amount"}],outputs:[{type:"uint256",name:"usedFreeAmount"},{type:"uint256",name:"usedRestrictedAmount"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"releaseForCancelOrder",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"orderId"},{type:"address",name:"account"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"releaseFromProfitUnlock",constant:false,payable:false,inputs:[{type:"address",name:"account"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"baseAmount"},{type:"uint256",name:"quoteAmount"}],outputs:[]},{type:"function",name:"reserveForOrder",constant:false,payable:false,inputs:[{type:"bytes32",name:"poolId"},{type:"uint256",name:"orderId"},{type:"address",name:"account"},{type:"address",name:"token"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"settlementDeposit",constant:false,payable:false,inputs:[{type:"bytes32",name:"positionId"},{type:"address",name:"account"},{type:"tuple",name:"pool",components:[{type:"bytes32",name:"marketId"},{type:"bytes32",name:"poolId"},{type:"address",name:"baseToken"},{type:"address",name:"quoteToken"},{type:"uint8",name:"riskTier"},{type:"uint8",name:"state"},{type:"address",name:"basePoolToken"},{type:"address",name:"quotePoolToken"},{type:"uint16",name:"maxPriceDeviation"},{type:"bool",name:"compoundEnabled"},{type:"uint64",name:"windowCapUsd"},{type:"address",name:"poolVault"},{type:"address",name:"tradingVault"}]},{type:"uint256",name:"freeBaseAmount"},{type:"uint256",name:"freeQuoteAmount"},{type:"uint256",name:"receivedBaseAmount"},{type:"uint256",name:"receivedQuoteAmount"}],outputs:[]},{type:"function",name:"trustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"updateAndWithdraw",constant:false,payable:false,inputs:[{type:"address",name:"receiver"},{type:"bytes32",name:"poolId"},{type:"bool",name:"isQuoteToken"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"upgradeTo",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var vt={USDC:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",POOL_MANAGER:"0xb394948BC6c5d13189440Bd44E481f7833d29694",Account:"0x3edb8F5838603f70896d37233AD7F618D024c351",POSITION_MANAGER:"0xb8fAf2037788594e1BD27F1905A6eF090A5857ad",ORDER_MANAGER:"0xC016fD1b62A22991aa7085D4F7851C35e45d1B1b",PYTH:"0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF",ERC20:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",LIQUIDITY_ROUTER:"0xD375b2096602D613725E465c9a83e2C078B0273E",BASE_POOL:"0x2e217CB7e52cFca09132aDf4b12a04F4a9aB79E7",QUOTE_POOL:"0xBD8559b42aCd1c86b5Bf32e9858b559d3b71D94f",ORACLE:"0xEFCA7bB69e09125953C274715BE560b4a1603BE2",EIP7702Delegation:"0x7823b642DA17419717A8362B035E8a951110152E",MARKET_MANAGER:"0xf7810B57cb9A54fa751A4d82C4AeC4e2518CEb23",DATA_PROVIDER:"0x5B23C37A89f7F631D1cbA333545ad6Dce7B0da9E",ORACLE_RESERVE:"0x4Ffaf942B6d678Ca65001Fe87A30A0019393a2eE",FORWARDER:"0x5793932070EDeb981128650Aed7178F9B2F05690",TRADING_ROUTER:"0xA2cF15a8c3788802060F7d68cf888B28dA962b08",REIMBURSEMENT:"0xB26B967964498a1db1a77d3Aa62080D0B2dBff9e",DISPUTE_COURT:"0x62b6a26ae299cF31d01A77DAde7E5b39CC4A1eB0",EXECUTION_POOL:"0x83cA2bd1959F77eb07C3238e0Eb5b87427F66c89"};var ht={USDC:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",POOL_MANAGER:"0x05314a21Fc97B74f168730153b2B63A870D25dE5",Account:"0xAC0ca67fd6C7Ff9c80DE58420B840115b6d51c6e",POSITION_MANAGER:"0x1a8cC8391Ee19c3817de64a52904D0557f519bA5",ORDER_MANAGER:"0x3138f425f11f14fE33a180e9Bbf0661C8dc6d8AD",PYTH:"0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF",ERC20:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",LIQUIDITY_ROUTER:"0xfb790ECE13Cd9e296b4a06ABF38D10431360c236",BASE_POOL:"0x1F767BEa83EDe5E0C18904f439C579f52c2c0F1b",QUOTE_POOL:"0x50ad7da312c58c6689bEF028954a366cb5b8ee13",ORACLE:"0x3e437094C5687Ed6eDb1883b0bd445Efa9103a55",EIP7702Delegation:"0xc68fdf81ca68B26fdB296645F42a734c12E63751",MARKET_MANAGER:"0x71b57CcB7539aB761fd5C5767362A207a295e337",DATA_PROVIDER:"0xd4FdE3cc72D29b71507823cA43Dd6fD520644E92",ORACLE_RESERVE:"0x4fC26Cf34e5d486BFF211315bf17D77d34130971",FORWARDER:"0x58fb1a663b08871A755734231C387E1d10ac2B10",TRADING_ROUTER:"0x89ba8EDBD63f577cAA1095F25Df0A44A226f28bc",REIMBURSEMENT:"0xDbCe02B080C68671EF6EcEc1a01A789441A3a564",DISPUTE_COURT:"0x47648D171925a69b3A334898AaaE6e7cc41B1735",EXECUTION_POOL:"0x0000000000000000000000000000000000000000"};var Mt={USDC:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",POOL_MANAGER:"0x79412588c9dC5022f04b989595bd8e96Fd58A5fa",Account:"0x37C7B6ED8129312Ed51c9ee2CBd162F2096816c0",POSITION_MANAGER:"0x7d56F5ac970873741Ec29b95e48b8216574338Aa",ORDER_MANAGER:"0xc31d5b922eE6A6B829D2ad214bA5edC225401942",PYTH:"0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",ERC20:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",LIQUIDITY_ROUTER:"0x248F77f2E55Dd14715c5f35F4327Bb5feDB39B2B",BASE_POOL:"0x2c04502Fc87D55cBF91FD8aC32D5197c0FD54c13",QUOTE_POOL:"0x4bdB9C8B96e4cf8c7C1CcC05c2607ba781f49eeF",ORACLE:"0xac8F09568b048a259a6De474E1f51893D1fc3951",EIP7702Delegation:"0x7e3d707599aee82C06435F8338A9548f57fAa28e",MARKET_MANAGER:"0x9D0e83123AB97E93b3810913462746c7A4815b5E",DATA_PROVIDER:"0xf80999c3bB3C67c06bb0Bc917B430f9f79c51A7B",ORACLE_RESERVE:"0x666A9CD9920e0D751198b17c02B6eA0b620A3de0",FORWARDER:"0x45cc7768bb3D9242E5E9C63D7eb41Db3B4B32066",TRADING_ROUTER:"0x5dAea62F75fB4192Ec96Ec721895Bdbe12b47Cbe",REIMBURSEMENT:"0xd1a496A628a48bd56d465b99f8600F3FAcc40a35",DISPUTE_COURT:"0x7f17EF3779BbE5671Ad9b4Bb73C0849CbaC34e11",EXECUTION_POOL:"0x65C31A1f684adA8b6Db5f1Fc7F042B1B3f23A45c"};var Dt={POOL_MANAGER:"0xcf51a6895864c6D8E507fC31EF16b9011287c5f4",Account:"0x35054EfE58Bbdae792aeCaD7bC2e4939c169560f",POSITION_MANAGER:"0x689A0C7E46785584FF7636700ceF5d5e7c141F8D",ORDER_MANAGER:"0xa0B5E5AE9D3E214096C90DDeC04D39B27ED9B272",PYTH:"0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",ERC20:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",LIQUIDITY_ROUTER:"0x0AE31989318565620c03d35889a0B2536b8fba5C",BASE_POOL:"0xc9e3826c42183207B418116A16827C1605132c51",QUOTE_POOL:"0x9A9934D3b22103dE822d94A22A3177d728FE0e5a",ORACLE:"0x0dD8293765358cF7f2646D0B91bA59804E197FC6",EIP7702Delegation:"0x4686F8a0d44b056037b2A51c4342EE7FA8e0A48F",MARKET_MANAGER:"0xe99dAB65c5546D7C87850Bbc40C6a7BEd7328Efa",DATA_PROVIDER:"0x5b6Be9839552a49302d552aB3C223b60Adb8BF1D",ORACLE_RESERVE:"0xB3D5a67223905FE73a0749e7A03525838063C54C",USDC:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",FORWARDER:"0x6C40462A4d45BA4119af59Fb9e41b8eaC9293962",TRADING_ROUTER:"0x0000000000000000000000000000000000000000",REIMBURSEMENT:"0x0000000000000000000000000000000000000000",DISPUTE_COURT:"0x0000000000000000000000000000000000000000",EXECUTION_POOL:"0x0000000000000000000000000000000000000000"};var Ot={USDC:"0x9C452Ef0e7b158F81A0e00a81aaea8ae04132cBc",POOL_MANAGER:"0x48855b7c2168D38F029E3fdb3Bc96C8f35Bab955",Account:"0xB6BFE4cC301718AA5d3C2a3ccac52Ff9C5b7E20E",POSITION_MANAGER:"0xb5fa0Bde66D892f1451CD298A6f9a7a7e39409b0",ORDER_MANAGER:"0xdbC710cD74737d4Dd08E637177c475665273a798",PYTH:"0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb",ERC20:"0x9C452Ef0e7b158F81A0e00a81aaea8ae04132cBc",LIQUIDITY_ROUTER:"0x42E93f7dC6eA3e35b87529d2e0fc2deda7D4De85",BASE_POOL:"0x7553AA06c47E94F43128dC99e4FF83FB05304B8c",QUOTE_POOL:"0x573933e9e3299Ef4DB0f8207037BB4010C8728DD",ORACLE:"0xC3246f4c5c1463940993917467B8B5287D5F8233",EIP7702Delegation:"0x415f1bFf28023888B54E757eF9Ff0292ae309c6A",MARKET_MANAGER:"0xdA9D9Bf96466c1F4e4CF3D5667CF160834b46da8",DATA_PROVIDER:"0xe6C8e5F948BB33B78c157A995F48008c0bF7CcF1",ORACLE_RESERVE:"0xE7147190274E1175610D8e0e3CC5E8bb8670d148",FORWARDER:"0xDeA7223732f9Aa1740A94409633A65D45AA3571A",TRADING_ROUTER:"0xe3d6eEAF463ece18a57b2D5BbE7Bd7fF2836C4c4",REIMBURSEMENT:"0x53656983Bb07987729e1DA65bad53bCc9E618589",DISPUTE_COURT:"0xF4f535b61600735C6786e04A2a307B515C66f05B",EXECUTION_POOL:"0x9ca3Fc47abFD609b9b07d9Ecba7a4452AE61f926"};var Ft={USDC:"0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",POOL_MANAGER:"0x9E84a999e15CCdb2F64a5AF10939c25769dF6b07",Account:"0x42A1BC012CeC51Ebf3bbf79142bf2a912396FB0e",POSITION_MANAGER:"0x011a25Fe39b2f9033E49d1587CF24780242e40dA",ORDER_MANAGER:"0xfc30D3C858B72a9EDfE6679Fc3355039D276f811",PYTH:"0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb",ERC20:"0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",LIQUIDITY_ROUTER:"0x0F4C6f18Fb136DD1eBd6Da3C5d86a86597CF79a3",BASE_POOL:"0x51B62554a76197d5DF2D5dC4D57FF54d40775938",QUOTE_POOL:"0x783Ed065a12e1C1D33c2a8d6408385C1843D3084",ORACLE:"0xaF26d69BC0A6f1DEf8AeB00B6DAD28398ba67a53",EIP7702Delegation:"0xc8558cD3905F273ff45B1dd6D10894445bFa622f",MARKET_MANAGER:"0x3b809daB550f9DD0DbE82567f6EA6137C174532c",DATA_PROVIDER:"0x4B5888025570934cC9D31807feBAAEDaC823Cb8e",ORACLE_RESERVE:"0x3011dA5822c1ECA7fcda64716779769D0089945D",FORWARDER:"0x2943a063ae2A772f4314FaA28E00De827A491Dd3",TRADING_ROUTER:"0xaA16801F36e49cDD4f87938032487C7E6cfbb389",REIMBURSEMENT:"0xBF72B69bA547D0bB7D1255B43Ff5D7f2615326dF",DISPUTE_COURT:"0xeD8B129a5919c45c7391AA73632eA691A471C672",EXECUTION_POOL:"0x0000000000000000000000000000000000000000"};var Ee=Zn(),ea=(t,e)=>e?(e=JSON.parse(JSON.stringify(e)),t.includes("?")?t+"&"+new URLSearchParams(e).toString():t+"?"+new URLSearchParams(e).toString()):t,X={get:(t,e,n={})=>{let a=ea(t,e);return Ee.url(a).options(n).get().json()},post:(t,e,n={})=>Ee.url(t).options(n).post(e).json(),put:(t,e,n={})=>Ee.url(t).options(n).put(e).json(),delete:(t,e={})=>Ee.url(t).options(e).delete().json()};var ta=(p=>(p[p.SUCCESS=9200]="SUCCESS",p[p.SUCCESS_ORIGIN=0]="SUCCESS_ORIGIN",p[p.IDENTITY_VERIFICATION_FAILED=9401]="IDENTITY_VERIFICATION_FAILED",p[p.PERMISSION_DENIED=9403]="PERMISSION_DENIED",p[p.NOT_EXIST=9404]="NOT_EXIST",p[p.REQUEST_LIMIT=9429]="REQUEST_LIMIT",p[p.SERVICE_ERROR=9500]="SERVICE_ERROR",p[p.MISS_REQUESTED_PARAMETER=9900]="MISS_REQUESTED_PARAMETER",p[p.INVALID_PARAMETER=9901]="INVALID_PARAMETER",p.NETWORK_ERROR="ERR_NETWORK",p))(ta||{}),na=(o=>(o[o.Cook=0]="Cook",o[o.Boosted=1]="Boosted",o[o.Primed=2]="Primed",o[o.Trench=3]="Trench",o[o.PreBench=4]="PreBench",o[o.Bench=5]="Bench",o))(na||{}),St=(n=>(n[n.Chainlink=1]="Chainlink",n[n.Pyth=2]="Pyth",n))(St||{}),aa=(r=>(r[r.Minute1=1]="Minute1",r[r.Minute5=5]="Minute5",r[r.Minute15=15]="Minute15",r[r.Minute30=30]="Minute30",r[r.Hour1=60]="Hour1",r[r.Hour4=240]="Hour4",r[r.Day1=1440]="Day1",r[r.Week1=10080]="Week1",r[r.Month1=40320]="Month1",r))(aa||{}),sa=(s=>(s[s.Contract=1]="Contract",s[s.Cook=2]="Cook",s[s.Earn=3]="Earn",s[s.Cooking=4]="Cooking",s))(sa||{}),oa=(i=>(i[i.All=0]="All",i[i.Contract=1]="Contract",i[i.Cook=2]="Cook",i[i.Earn=3]="Earn",i[i.Cooking=4]="Cooking",i))(oa||{}),ia=(n=>(n[n.BlueChips=1]="BlueChips",n[n.Alpha=2]="Alpha",n))(ia||{}),ra=(a=>(a[a.BlueChips=1]="BlueChips",a[a.Alpha=2]="Alpha",a[a.Favorite=3]="Favorite",a))(ra||{});var pa=(s=>(s[s.Market=0]="Market",s[s.Limit=1]="Limit",s[s.Stop=2]="Stop",s[s.Conditional=3]="Conditional",s))(pa||{}),ua=(n=>(n[n.Increase=0]="Increase",n[n.Decrease=1]="Decrease",n))(ua||{}),ma=(d=>(d[d.Increase=0]="Increase",d[d.Decrease=1]="Decrease",d[d.AddMargin=2]="AddMargin",d[d.RemoveMargin=3]="RemoveMargin",d[d.CancelOrder=4]="CancelOrder",d[d.ADL=5]="ADL",d[d.Liquidation=6]="Liquidation",d[d.MarketClose=7]="MarketClose",d[d.EarlyClose=8]="EarlyClose",d[d.AddTPSL=9]="AddTPSL",d[d.SecurityDeposit=10]="SecurityDeposit",d[d.TransferToWallet=11]="TransferToWallet",d[d.MarginAccountDeposit=12]="MarginAccountDeposit",d[d.ReferralReward=13]="ReferralReward",d[d.ReferralRewardClaim=14]="ReferralRewardClaim",d))(ma||{}),da=(a=>(a[a.Unknown=0]="Unknown",a[a.GTE=1]="GTE",a[a.LTE=2]="LTE",a))(da||{}),la=(n=>(n[n.Long=0]="Long",n[n.Short=1]="Short",n))(la||{}),ya=(s=>(s[s.Cancelled=1]="Cancelled",s[s.Expired=2]="Expired",s[s.Successful=9]="Successful",s[s.PartialFilled=8]="PartialFilled",s))(ya||{}),ca=(r=>(r[r.Market=1]="Market",r[r.Limit=2]="Limit",r[r.TP=3]="TP",r[r.SL=4]="SL",r[r.ADL=5]="ADL",r[r.ADLTrigger=6]="ADLTrigger",r[r.Liquidation=7]="Liquidation",r[r.EarlyClose=8]="EarlyClose",r[r.MarketClose=9]="MarketClose",r))(ca||{}),fa=(p=>(p[p.Open=0]="Open",p[p.PartialClose=1]="PartialClose",p[p.FullClose=2]="FullClose",p[p.Liquidation=3]="Liquidation",p[p.EarlyClose=4]="EarlyClose",p[p.MarketClose=5]="MarketClose",p[p.ADL=6]="ADL",p[p.TP=7]="TP",p[p.SL=8]="SL",p[p.Increase=9]="Increase",p))(fa||{}),ba=(a=>(a[a.MarginAccount=1]="MarginAccount",a[a.WalletAccount=2]="WalletAccount",a[a.ReferralReward=3]="ReferralReward",a))(ba||{});var ga=(s=>(s[s.EXECUTING=1]="EXECUTING",s[s.BROADCAST_FAILED=2]="BROADCAST_FAILED",s[s.TIMEOUT_CANCEL=3]="TIMEOUT_CANCEL",s[s.EXECUTED=9]="EXECUTED",s))(ga||{});var Xs=async()=>X.get(`${Z()}/openapi/gateway/scan/market/list`);var Z=()=>{let{isTestnet:t,isBetaMode:e}=W?.getConfigManager()?.getConfig()||{};return e?"https://api-beta.myx.finance":t?"https://api-test.myx.cash":"https://api.myx.finance"},ee=async(t,e=[])=>e.length?X.get(`${Z()}/openapi/gateway/quote/price/oracles`,{chainId:t,poolIds:e.join(",")}):Promise.reject(new Error("Invalid pool id")),_t=async(t,e)=>await X.get(`${Z()}/openapi/gateway/scan/market/info?chainId=${t}&poolId=${e}`),kt=async(t,e,n)=>await X.get(`${Z()}/openapi/gateway/scan/market/pool-order/open?chainId=${n}`,void 0,{headers:{myx_openapi_access_token:t,myx_openapi_account:e}}),Zs=async({chainId:t,poolIds:e},n)=>X.get(`${Z()}/openapi/gateway/quote/candle/tickers`,{chainId:t,poolIds:e.join(",")}),eo=async({...t})=>X.get(`${Z()}/openapi/gateway/scan/market/base-details`,t),to=async({...t})=>X.get(`${Z()}/openapi/gateway/scan/market/detail`,t),Nt=async()=>X.get(`${Z()}/openapi/gateway/scan/market`);var be,ze=class ze{constructor(){this.version="1.0.24-beta.3";ct(this,be);}setConfigManager(e){ft(this,be,e);}getConfigManager(){return yt(this,be)}setProvider(e){this.provider=e;}getProvider(){return this.provider}static getInstance(){return this._instance||(this._instance=new ze),this._instance}async getMarkets(){try{let n=(await Nt())?.data||[];return this.Markets=n,n}catch(e){throw e}}};be=new WeakMap;var fe=ze,Bt=fe.getInstance(),W=Bt,uo=async t=>{let e=Bt.getConfigManager();if(!e?.hasSigner())throw new Error("No signer: call auth({ signer }) or auth({ walletClient })");return e.getViemWalletClient(t)};var Ut={USDC:"0x55d398326f99059fF775485246999027B3197955",POOL_MANAGER:"0x0dec8f3c72bcd5ef1377F74Db4Bb63672560eC1B",Account:"0x800Bc56D4970E4795203a7185c8c1E3a5fA93890",POSITION_MANAGER:"0x4A9a02F2E9aC66045861086EBEf611caAeB65A22",ORDER_MANAGER:"0xa0caD9E70078092b8E19E72dA069D1ef3be881e7",PYTH:"0x4D7E825f80bDf85e913E0DD2A2D54927e9dE1594",ERC20:"0x55d398326f99059fF775485246999027B3197955",LIQUIDITY_ROUTER:"0x9Fb871Ed8D6f20a3EB245250836F515D7aE89D4D",BASE_POOL:"0x6F8349A752b22b5e73f06A6980d2E3a33F385b6F",QUOTE_POOL:"0x677E05eD7f304734974A6b8a187e79f848aB7C87",ORACLE:"0x8E249E13538B76AaA1babd5eA2f0D8635E9860F0",EIP7702Delegation:"0x82B3bbd260FF451fa3877a67Ef23888f94E67104",MARKET_MANAGER:"0x4b1c6687c6E7E9900a9bF2A065540A3Ba83F98C3",DATA_PROVIDER:"0x14D209ff2C48aBD560bCF8317B2b560E254fb888",ORACLE_RESERVE:"0x586481B378895a889F26cA9E49D26211AC51D209",FORWARDER:"0x42dD6b225d8721314fe116Dfcd11C0D5275E301E",TRADING_ROUTER:"0xe1aB79710640FF72Ab9fc10D951cb939DA9766B1",REIMBURSEMENT:"0xFd3ee16Fe39CF75e49CDb46bEf76c67039680222",DISPUTE_COURT:"0x6B3a09E75306C054F18361D9Cc18AA411D299757",EXECUTION_POOL:"0x0000000000000000000000000000000000000000"};var x=t=>{let{isBetaMode:e}=W?.getConfigManager()?.getConfig()||{};switch(t){case 421614:return e?ht:vt;case 59141:return e?Dt:Mt;case 97:return e?Ft:Ot;case 56:return Ut;default:return {}}};var Lt=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"DesignatedTokenMismatch",inputs:[{type:"address",name:"collectToken"},{type:"address",name:"designatedToken"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"ForwardedRecipientMustBeMasterAccount",inputs:[{type:"address",name:"recipient"},{type:"address",name:"master"}]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotActiveBroker",inputs:[{type:"address",name:"broker"}]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotForwardAllowedTarget",inputs:[{type:"address",name:"from"}]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotOrderOwner",inputs:[]},{type:"error",name:"NotPositionOwner",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"CollectExecutionFee",inputs:[{type:"uint8",name:"source",indexed:false},{type:"bytes32",name:"positionId",indexed:false},{type:"address",name:"account",indexed:false},{type:"uint256",name:"executionFee",indexed:false},{type:"address",name:"token",indexed:false}]},{type:"event",anonymous:false,name:"CollectForwardFee",inputs:[{type:"uint8",name:"source",indexed:false},{type:"bytes32",name:"positionId",indexed:false},{type:"address",name:"account",indexed:false},{type:"uint256",name:"forwardFee",indexed:false},{type:"address",name:"token",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"__ERC2771ContextUpgradeable_init",constant:false,payable:false,inputs:[{type:"address",name:"trustedForwarder_"}],outputs:[]},{type:"function",name:"adjustCollateral",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"bytes32",name:"positionId"},{type:"int256",name:"adjustAmount"}],outputs:[]},{type:"function",name:"cancelOrder",constant:false,payable:false,inputs:[{type:"uint256",name:"orderId"}],outputs:[]},{type:"function",name:"cancelOrders",constant:false,payable:false,inputs:[{type:"uint256[]",name:"orderIds"}],outputs:[]},{type:"function",name:"collectExecutionFee",constant:false,payable:false,inputs:[{type:"uint8",name:"source"},{type:"bytes",name:"data"},{type:"address",name:"feeRecipient"}],outputs:[]},{type:"function",name:"collectForwardFeeIfNecessary",constant:false,payable:false,inputs:[{type:"uint8",name:"source"},{type:"bytes",name:"data"}],outputs:[]},{type:"function",name:"depositToAccount",constant:false,payable:false,inputs:[{type:"address",name:"recipient"},{type:"address",name:"token"},{type:"uint256",name:"amount"}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"isTrustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"forwarder"}],outputs:[{type:"bool"}]},{type:"function",name:"placeOrderWithPosition",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"bytes32",name:"positionId"},{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"tuple",name:"orderParams",components:[{type:"address",name:"user"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{type:"address",name:"broker"},{type:"uint256",name:"tpSize"},{type:"uint256",name:"tpPrice"},{type:"uint256",name:"slSize"},{type:"uint256",name:"slPrice"}]}],outputs:[]},{type:"function",name:"placeOrderWithSalt",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"uint64",name:"userPositionSalt"},{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"tuple",name:"orderParams",components:[{type:"address",name:"user"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{type:"address",name:"broker"},{type:"uint256",name:"tpSize"},{type:"uint256",name:"tpPrice"},{type:"uint256",name:"slSize"},{type:"uint256",name:"slPrice"}]}],outputs:[]},{type:"function",name:"placeOrdersWithPosition",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"bytes32[]",name:"positionIds"},{type:"tuple[]",name:"orderParams",components:[{type:"address",name:"user"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{type:"address",name:"broker"},{type:"uint256",name:"tpSize"},{type:"uint256",name:"tpPrice"},{type:"uint256",name:"slSize"},{type:"uint256",name:"slPrice"}]}],outputs:[]},{type:"function",name:"placeOrdersWithSalt",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"uint64[]",name:"userPositionSalts"},{type:"tuple[]",name:"orderParams",components:[{type:"address",name:"user"},{type:"bytes32",name:"poolId"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{type:"address",name:"broker"},{type:"uint256",name:"tpSize"},{type:"uint256",name:"tpPrice"},{type:"uint256",name:"slSize"},{type:"uint256",name:"slPrice"}]}],outputs:[]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"trustedForwarder",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"updateOrder",constant:false,payable:false,inputs:[{type:"tuple",name:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"tuple",name:"params",components:[{type:"uint256",name:"orderId"},{type:"address",name:"broker"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"tuple",name:"tpsl",components:[{type:"uint256",name:"tpSize"},{type:"uint256",name:"tpPrice"},{type:"uint256",name:"slSize"},{type:"uint256",name:"slPrice"}]}]}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var Ve=[{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"CollectFailed",inputs:[]},{type:"error",name:"DeadlineInPast",inputs:[]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{type:"address",name:"implementation"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ExecutionExpired",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"ExecutionNotExpired",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"ExecutionsNotExist",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"GracePeriodNotExpired",inputs:[]},{type:"error",name:"InsufficientGasEscrow",inputs:[]},{type:"error",name:"InvalidDataLength",inputs:[]},{type:"error",name:"InvalidGasEscrow",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidRequest",inputs:[]},{type:"error",name:"MaxPendingExceeded",inputs:[]},{type:"error",name:"NotAddressManager",inputs:[]},{type:"error",name:"NotDependencyManager",inputs:[]},{type:"error",name:"NotExecutionOwner",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotProxyAdmin",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"PoolNotExists",inputs:[{type:"bytes32"}]},{type:"error",name:"ReentrancyGuardReentrantCall",inputs:[]},{type:"error",name:"RefundExceedsEscrow",inputs:[{type:"uint256",name:"refund"},{type:"uint256",name:"escrow"}]},{type:"error",name:"RefundFailed",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"SelectorNotRegistered",inputs:[{type:"bytes4",name:"selector"}]},{type:"error",name:"TxIdAlreadyExists",inputs:[{type:"bytes32",name:"txId"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{type:"bytes32",name:"slot"}]},{type:"event",anonymous:false,name:"ExecutionCancelled",inputs:[{type:"bytes32",name:"txId",indexed:false},{type:"string",name:"remark",indexed:false}]},{type:"event",anonymous:false,name:"ExecutionExecuted",inputs:[{type:"bytes32[]",name:"txIds",indexed:false}]},{type:"event",anonymous:false,name:"ExecutionSubmitted",inputs:[{type:"bytes32",name:"txId",indexed:false},{type:"bytes32[]",name:"poolId",indexed:false},{type:"address",name:"from",indexed:false},{type:"uint64",name:"deadline",indexed:false}]},{type:"event",anonymous:false,name:"GasCollected",inputs:[{type:"bytes32[]",name:"txIds",indexed:false},{type:"uint256",name:"gasAmount",indexed:false}]},{type:"event",anonymous:false,name:"GasEscrowSelectorRemoved",inputs:[{type:"bytes4",name:"selector",indexed:false}]},{type:"event",anonymous:false,name:"GasEscrowSelectorUpdated",inputs:[{type:"bytes4",name:"selector",indexed:false},{type:"uint256",name:"gasEscrow",indexed:false}]},{type:"event",anonymous:false,name:"GracePeriodUpdated",inputs:[{type:"uint64",name:"gracePeriod",indexed:false}]},{type:"event",anonymous:false,name:"Initialized",inputs:[{type:"uint64",name:"version",indexed:false}]},{type:"event",anonymous:false,name:"MaxPendingUpdated",inputs:[{type:"uint256",name:"maxPendingPerUser",indexed:false}]},{type:"event",anonymous:false,name:"Upgraded",inputs:[{type:"address",name:"implementation",indexed:true}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{type:"function",name:"cancel",constant:false,payable:false,inputs:[{type:"bytes32",name:"txId"}],outputs:[]},{type:"function",name:"cancelExpired",constant:false,payable:false,inputs:[{type:"bytes32",name:"txId"}],outputs:[]},{type:"function",name:"consumeExecutions",constant:false,payable:false,inputs:[{type:"bytes32[]",name:"txIds"}],outputs:[]},{type:"function",name:"executePublic",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"bytes32",name:"txId"},{type:"tuple[]",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"uint8",name:"oracleType"},{type:"uint64",name:"publishTime"},{type:"bytes",name:"oracleUpdateData"}]}],outputs:[]},{type:"function",name:"getAddressManager",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{type:"function",name:"getAllGasEscrowSelectors",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32[]",name:"selectors"},{type:"uint256[]",name:"escrows"}]},{type:"function",name:"getDependencyAddress",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"identifier"}],outputs:[{type:"address"}]},{type:"function",name:"getExecutionRequest",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes32",name:"txId"}],outputs:[{type:"bool",name:"isExpired"},{type:"tuple",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]}]},{type:"function",name:"getGasEscrowForSelector",constant:true,stateMutability:"view",payable:false,inputs:[{type:"bytes4",name:"selector"}],outputs:[{type:"uint256"}]},{type:"function",name:"gracePeriod",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint64"}]},{type:"function",name:"initialize",constant:false,payable:false,inputs:[{type:"address",name:"addressManager"}],outputs:[]},{type:"function",name:"maxPendingCount",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"pendingCount",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"user"}],outputs:[{type:"uint256",name:"count"}]},{type:"function",name:"proxiableUUID",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"removeGasEscrowForSelector",constant:false,payable:false,inputs:[{type:"bytes4",name:"selector"}],outputs:[]},{type:"function",name:"setGasEscrowForSelector",constant:false,payable:false,inputs:[{type:"bytes4",name:"selector"},{type:"uint256",name:"escrow"}],outputs:[]},{type:"function",name:"setGracePeriod",constant:false,payable:false,inputs:[{type:"uint64",name:"_gracePeriod"}],outputs:[]},{type:"function",name:"setMaxPendingCount",constant:false,payable:false,inputs:[{type:"uint256",name:"_maxPendingCount"}],outputs:[]},{type:"function",name:"submit",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"bytes32",name:"txId"},{type:"tuple",name:"execution",components:[{type:"address",name:"from"},{type:"address",name:"to"},{type:"uint256",name:"value"},{type:"uint256",name:"gas"},{type:"uint48",name:"createdAt"},{type:"uint48",name:"deadline"},{type:"bytes",name:"data"},{type:"bytes",name:"signature"}]},{type:"bytes32[]",name:"updatePricePoolIds"}],outputs:[]},{type:"function",name:"upgradeToAndCall",constant:false,stateMutability:"payable",payable:true,inputs:[{type:"address",name:"newImplementation"},{type:"bytes",name:"data"}],outputs:[]}];var Qo=(t,e)=>{let n=f(t);return getContract({address:e,abi:G,client:n})},Ho=async t=>{let e=x(t),n=await A(t);return getContract({address:e.TRADING_ROUTER,abi:Lt,client:n})},qt=async(t,e)=>{let n=await A(t);return getContract({address:e,abi:G,client:n})},v=async t=>{let e=await A(t),[n]=await e.getAddresses();return n??void 0},ue=async t=>{let e=x(t),n=await A(t);return getContract({address:e.LIQUIDITY_ROUTER,abi:_,client:n})},Gt=async t=>{let e=x(t),n=await A(t);return getContract({address:e.ORACLE_RESERVE,abi:bt,client:n})},H=(t,e=1)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.POOL_MANAGER,abi:Fe,client:a})):A(t).then(s=>getContract({address:n.POOL_MANAGER,abi:Fe,client:s}))};var te=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.QUOTE_POOL,abi:Se,client:a})):A(t).then(s=>getContract({address:n.QUOTE_POOL,abi:Se,client:s}))},$=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.BASE_POOL,abi:_e,client:a})):A(t).then(s=>getContract({address:n.BASE_POOL,abi:_e,client:s}))},Jo=async(t,e)=>{let n=await A(t);return getContract({address:e,abi:ke,client:n})},B=async t=>{let e=await A(t),n=x(t);return getContract({address:n.EXECUTION_POOL,abi:Ve,client:e})},zt=async t=>{let e=await f(t),n=x(t);return getContract({address:n.EXECUTION_POOL,abi:Ve,client:e})};var Yo=(t,e)=>{let n=f(t);return getContract({address:e,abi:ke,client:n})};var Vt=(t,e,n=0)=>{let a=n===0?f(t):null;return a?Promise.resolve(getContract({address:e,abi:Ne,client:a})):A(t).then(s=>getContract({address:e,abi:Ne,client:s}))},Pe=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.MARKET_MANAGER,abi:Be,client:a})):A(t).then(s=>getContract({address:n.MARKET_MANAGER,abi:Be,client:s}))},Wt=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.DATA_PROVIDER,abi:Ue,client:a})):A(t).then(s=>getContract({address:n.DATA_PROVIDER,abi:Ue,client:s}))},Xo=async t=>{let e=x(t),n=await A(t);return getContract({address:e.Account,abi:Tt,client:n})},Qt=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.FORWARDER,abi:Le,client:a})):A(t).then(s=>getContract({address:n.FORWARDER,abi:Le,client:s}))},$o=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.REIMBURSEMENT,abi:qe,client:a})):A(t).then(s=>getContract({address:n.REIMBURSEMENT,abi:qe,client:s}))},jo=(t,e=0)=>{let n=x(t),a=e===0?f(t):null;return a?Promise.resolve(getContract({address:n.DISPUTE_COURT,abi:Ge,client:a})):A(t).then(s=>getContract({address:n.DISPUTE_COURT,abi:Ge,client:s}))};var me=null;function Aa(t){me=t;}function We(){return me??{}}function Qe(){}function Ca(...t){(me?.log??me?.info??Qe)(...t);}function Ea(...t){(me?.warn??Qe)(...t);}function y(...t){(me?.error??Qe)(...t);}var Ht=class{constructor(e){this.options={...e,logLevel:e?.logLevel??"info"};}get out(){return this.options.sink??We()}debug(e,...n){this.options.logLevel!=="none"&&this.options.logLevel==="debug"&&(this.out.log??this.out.info)?.(`[MYX-SDK-DEBUG] ${e}`,...n);}info(e,...n){this.options.logLevel!=="none"&&(this.options.logLevel==="debug"||this.options.logLevel==="info")&&(this.out.log??this.out.info)?.(`[MYX-SDK-INFO] ${e}`,...n);}error(e,...n){this.options.logLevel!=="none"&&(this.options.logLevel==="debug"||this.options.logLevel==="info"||this.options.logLevel==="error")&&this.out.error?.(`[MYX-SDK-ERROR] ${e}`,...n);}warn(e,...n){this.options.logLevel!=="none"&&this.out.warn?.(`[MYX-SDK-WARN] ${e}`,...n);}};var He={"0xfa52dfc0":"AccountInsufficientFreeAmount()","0xe2a1a260":"AccountInsufficientReservedAmount()","0xffd10028":"AccountInsufficientTradableAmount(uint256,uint256)","0x9996b315":"AddressEmptyCode(address)","0x4c9c8ce3":"ERC1967InvalidImplementation(address)","0xb398979f":"ERC1967NonPayable()","0xd6bda275":"FailedCall()","0xf92ee8a9":"InvalidInitialization()","0x44d3438f":"NotAddressManager()","0x3fc81f20":"NotDependencyManager()","0xd7e6bcf8":"NotInitializing()","0x507f487a":"NotProxyAdmin()","0xe03f6024":"PermissionDenied(address,address)","0x5274afe7":"SafeERC20FailedOperation(address)","0xe07c8dba":"UUPSUnauthorizedCallContext()","0xaa1d49a4":"UUPSUnsupportedProxiableUUID(bytes32)","0x24775e06":"SafeCastOverflowedUintToInt(uint256)","0xba767932":"ConvertAmountMismatch(uint256,uint256)","0xd93c0665":"EnforcedPause()","0x8dfc202b":"ExpectedPause()","0x059e2f49":"InRewindMode()","0x42301c23":"InsufficientOutputAmount()","0xcaa99aac":"MismatchExecuteFee(uint256,uint256,uint256)","0x8637dfc0":"NotInRewindMode()","0x4578ddb8":"OnlyRelayer()","0x1e4fbdf7":"OwnableInvalidOwner(address)","0x118cdaa7":"OwnableUnauthorizedAccount(address)","0x3ee5aeb5":"ReentrancyGuardReentrantCall()","0x90b8ec18":"TransferFailed()","0xbe1af266":"InternalOnly()","0x3385aa1f":"ExceedOrderSize(uint256)","0xb07e3bc4":"InsufficientCollateral(uint256,uint256)","0x613970e0":"InvalidParameter()","0x27d08510":"NotActiveBroker(address)","0xf6412b5a":"NotOrderOwner()","0x70d645e3":"NotPositionOwner()","0xe75316c6":"OrderNotExist(OrderId)","0xba01b06f":"PoolNotActive(PoolId)","0xddefae28":"AlreadyMinted()","0x64283d7b":"ERC721IncorrectOwner(address,uint256,address)","0x177e802f":"ERC721InsufficientApproval(address,uint256)","0xa9fbf51f":"ERC721InvalidApprover(address)","0x5b08ba18":"ERC721InvalidOperator(address)","0x89c62b64":"ERC721InvalidOwner(address)","0x64a0ae92":"ERC721InvalidReceiver(address)","0x73c6ac6e":"ERC721InvalidSender(address)","0x7e273289":"ERC721NonexistentToken(uint256)","0xb4762117":"ExceedMaxLeverage(PositionId)","0x29143a42":"ExceedPositionSize()","0x8ea9158f":"InvalidPosition(PositionId)","0xa5afd143":"PositionNotHealthy(PositionId,uint256)","0xba0d3752":"PositionNotInitialized(PositionId)","0xc20f35b7":"UnderflowOI()","0xf4d678b8":"InsufficientBalance()","0x6aee3c1a":"InsufficientRiskReserves()","0x2c5211c6":"InvalidAmount()","0x82cb17ef":"InvalidSplitConfig()","0xe921c36b":"AlreadyMigrated(PositionId,PositionId)","0xd34e366f":"ExceedBaseCollateral(uint256,uint256)","0xc7544914":"ExceedDebt(uint256,uint256)","0xe7aa687a":"ExceedExchangeable()","0x4b3c8f33":"ExceedMaxBaseProfit()","0xdc82bd68":"ExceedMinOutputAmount()","0xdb42144d":"InsufficientBalance(address,uint256,uint256)","0x5646203f":"InsufficientCollateral(PositionId,uint256)","0x9ac13039":"InsufficientPoolProfit()","0x14be833f":"InsufficientReturnAmount(uint256,uint256)","0x419ecd12":"MatchNotSupported()","0x4ec4fd74":"PoolFundingFeeNotPositive(int256,uint256,Direction)","0xba8f5df5":"PoolNotCompoundable(PoolId)","0xf645eedf":"ECDSAInvalidSignature()","0xfce698f7":"ECDSAInvalidSignatureLength(uint256)","0xd78bce0c":"ECDSAInvalidSignatureS(bytes32)","0x48834bee":"ExpiredFeeData()","0x56d69198":"InvalidFeeRate()","0x80577032":"NoRebateToClaim()","0x6e6b79b0":"NotBrokerSigner(address)","0xff70343d":"UnsupportedAssetClass(AssetClass)","0x185676be":"UnsupportedFeeTier(uint8)","0x60b25fe4":"BrokerAlreadyExists()","0x7eb4a674":"BrokerNotFound()","0x8c3b5bf0":"NotBrokerAdmin()","0x3733548a":"InvalidFeeTier()","0x192105d7":"InitializationFunctionReverted(address,bytes)","0x97c7f537":"ExcessiveSlippage()","0x700deaad":"InvalidADLPosition(OrderId,PositionId)","0xf64fa6a8":"InvalidOrder(OrderId)","0xd4944235":"NoADLNeeded(OrderId)","0xe079169e":"NotReachedPrice(OrderId,uint256,uint256,TriggerType)","0xc60eb335":"OnlyKeeper()","0xa8ce4432":"SafeCastOverflowedIntToUint(int256)","0x17229ec4":"NotMeetEarlyCloseCriteria(PositionId)","0x0dc149f0":"AlreadyInitialized()","0x7a5c919f":"InvalidRewindPrice()","0xc53f84e7":"PositionRemainsHealthy(PositionId)","0x1dab59cf":"InvalidOrderPair(OrderId,OrderId)","0x230e8e43":"PoolNotInPreBenchState(PoolId)","0x107dec14":"RiskCloseNotAllowed()","0x664431a8":"NotAllowedTarget(address)","0x03357c6c":"ExceedsMaximumRelayFee()","0x0d10f63b":"InconsistentParamsLength()","0x38802743":"InsufficientFeeAllowance(address,uint256,uint256)","0xd95b4ad5":"InsufficientFeeBalance(address,uint256,uint256)","0xa3972305":"MismatchedSender(address)","0xc3b80e86":"RelayerRegistered(address)","0xee0844a3":"RemoveRelayerFailed()","0xc583a8da":"IncorrectFee(uint256)","0x00bfc921":"InvalidPrice()","0x148cd0dd":"VerifyPriceFailed()","0xb12d13eb":"ETHTransferFailed()","0xa83325d4":"PoolOracleFeeCharged()","0x6b75f90d":"PoolOracleFeeNotCharged()","0x42a0e2a7":"PoolOracleFeeNotExisted()","0x8ee01e1c":"PoolOracleFeeNotSoldOut()","0x5e0a829b":"ETHTransferFailed(address,uint256)","0x4ba6536f":"GasLimitExceeded(address,uint256,uint256)","0xca1aae4b":"GasLimitNotSet(address)","0x3728b83d":"InvalidAmount(uint256)","0x3484727e":"BaseFeeNotSoldOut()","0x0251bde4":"LPNotFullyMinted()","0x1acb203e":"PositionNotEmpty()","0x2be7b24b":"UnexpectedPoolState()","0x759b3876":"UnhealthyAfterRiskTierApplied(PositionId)","0x7bd42a2e":"NotEmptyAddress()","0x6697b232":"AccessControlBadConfirmation()","0xe2517d3f":"AccessControlUnauthorizedAccount(address,bytes32)","0x7c9a1cf9":"AlreadyVoted()","0x796ea3a6":"BondNotReleased()","0x6511c20d":"BondZeroAmount()","0xf38e5973":"CaseAppealNotFinished()","0x1eaa4a59":"CaseDeadlineNotReached()","0xe6c67e3a":"CaseDeadlineReached()","0x0fc957b1":"CaseNotAccepted()","0x3ddb819d":"CaseNotExist(CaseId)","0x79eab18d":"CaseRespondentAppealed(CaseId,address)","0xa179f8c9":"ChainIdMismatch()","0x311c16d3":"DisputeNotAllowed()","0x752d88c0":"InvalidAccountNonce(address,uint256)","0xa710429d":"InvalidContractAddress()","0x8076dd8a":"InvalidFunctionSignature()","0xc37906a0":"InvalidPayloadLength(uint256,uint256)","0xdcdedda9":"InvalidPoolToken()","0x3471a3c2":"InvalidProfitAmount()","0x1d9617a0":"InvalidResponseVersion()","0x9284b197":"InvalidSourceChain()","0xb9021668":"NoChainResponse()","0xc546bca4":"NotCaseRespondent(CaseId,address)","0x84ae4a30":"NumberOfResponsesMismatch()","0x02164961":"RequestTypeMismatch()","0x4cf72652":"RiskCloseNotCompleted()","0x0819bdcd":"SignatureExpired()","0xc00ca938":"UnexpectedCaseState()","0x7935e939":"UnexpectedCaseType()","0x5e7bd6ec":"UnexpectedNumberOfResults()","0x51ee5853":"UnsupportedQueryType(uint8)","0x29ca666b":"UntrustfulVoting()","0x439cc0cd":"VerificationFailed()","0x714f5513":"VersionMismatch()","0x96b8e05b":"WrongQueryType(uint8,uint8)","0xbb6b170d":"ZeroQueries()","0xa9214540":"AlreadyClaimed(CaseId,address)","0xd4ac59c1":"InvalidAmount(CaseId,address)","0x7a6f5328":"MerkleTreeVerificationFailed(CaseId,address)","0x094a5cfe":"ReimbursementValidity(CaseId)","0x8b922563":"TreeAlreadySet()","0x7b27120a":"InDisputeMode()","0xb04111ef":"InsufficientFreeCollateral(PositionId,uint256)","0x12f1b11a":"InsufficientLockedCollateral(PositionId,uint256)","0x6dfcc650":"SafeCastOverflowedUintDowncast(uint8,uint256)","0xd24b47fb":"UserProfitFrozen()","0x1c151780":"ExceedMinOutput(uint256,uint256)","0xe1f0493d":"NotAllowedCaller(address)","0xfb8f41b2":"ERC20InsufficientAllowance(address,uint256,uint256)","0xe450d38c":"ERC20InsufficientBalance(address,uint256,uint256)","0xe602df05":"ERC20InvalidApprover(address)","0xec442f05":"ERC20InvalidReceiver(address)","0x96c6fd1e":"ERC20InvalidSender(address)","0x94280d62":"ERC20InvalidSpender(address)","0x62791302":"ERC2612ExpiredSignature(uint256)","0x4b800e46":"ERC2612InvalidSigner(address,address)","0xb3512b0c":"InvalidShortString()","0x305a27a9":"StringTooLong(string)","0xfd0f789d":"ExceedMaxPriceDeviation()","0x407b87e5":"ExchangeRateAlreadyApplied()","0x5c6c5686":"ExchangeRateAlreadyDisabled()","0x1ae17fcd":"InvalidDeviationRatio()","0x18b88897":"InvalidUpdateFee()","0xf76740e3":"PriceDeviationBelowMinimum()","0x49386283":"PriceDeviationThresholdReached()","0x19abf40e":"StalePrice()","0xe351cd13":"ExceedMaxExchangeableAmount()","0x15912a6f":"NotSupportVersion()","0xf1364a74":"ArrayEmpty()","0x15ed381d":"ExceedMaxProfit()","0x51aeee6c":"PoolNotExist(PoolId)","0x70f6c197":"InvalidQuoteTokenAddress()","0x0b8457f4":"InvalidRatioParams()","0x29dae146":"MarketAlreadyExisted()","0xf040b67a":"MarketNotExisted()","0x0e442a4a":"InvalidBaseToken()","0x24e219c7":"MarketNotExist(MarketId)","0xcc36f935":"PoolExists(PoolId)","0xe84c308d":"ExceedBaseReserved(uint256,uint256)","0x3e241751":"ExceedQuoteReserved(uint256,uint256)","0xde656889":"ExceedReservable(uint256,uint256,uint256)","0xd54d0fc4":"InsufficientLiquidity(uint256,uint256,uint256)","0x7e562a65":"InvalidDistributionAmount()","0x83c7580d":"ReservableNotEnough(uint256,uint256)","0x94eef58a":"ERC2771ForwarderExpiredRequest(uint48)","0xc845a056":"ERC2771ForwarderInvalidSigner(address,address)","0x70647f79":"ERC2771ForwarderMismatchedValue(uint256,uint256)","0xd2650cd1":"ERC2771UntrustfulTarget(address,address)","0xcf479181":"InsufficientBalance(uint256,uint256)","0x4c150d8f":"DifferentMarket(PoolId,PoolId)","0xaa98b06a":"InsufficientQuoteIn(uint256,uint256,uint256)","0x3e589bee":"InvalidLiquidityAmount()","0xaebd3617":"InvalidTpsl(uint256)","0x7fe81129":"SamePoolMigration(PoolId)","0x71c4efed":"SlippageExceeded(uint256,uint256)","0x62b9bc7b":"DesignatedTokenMismatch(address,address)","0x49465eb0":"NotForwardAllowedTarget(address)","0x301b6707":"ExecutionFeeNotCollected()","0xc6e8248a":"InsufficientSize()","0xd15b4fe2":"InvalidQuoteToken()","0xd8daec7c":"MarketNotInitialized()","0xcd4891b6":"NotInDisputeMode()","0x1ad308dc":"OrderExpired(OrderId)","0x486aa307":"PoolNotInitialized()"};var R={1:"Invalid Chain",2:"Invalid Token Address",4001:"User Rejected",3:"Insufficient Balance",4:"Insufficient Amount Of Approved",4002:"Invalid Base Token Address",4003:"Invalid Slippage",4004:"Invalid Amount",4005:"Invalid Pool State",4006:"Invalid Params",4007:"Invalid Amount Withdrawable LP Amount"};function Pa(t){let e=t;for(;e;){if(e.name==="UserRejectedRequestError"||e.code===4001)return true;let n=(e.message||"").toLowerCase();if(n.includes("user rejected")||n.includes("user denied")||n.includes("rejected the request"))return true;e=e.cause;}return false}function Je(t){if(!t||typeof t!="string")return null;let e=t.match(/(0x[0-9a-fA-F]{8,})/);if(!e)return null;let n=e[1].slice(0,10).toLowerCase(),a=Object.keys(He).find(s=>s.toLowerCase()===n);return a?{selector:n,message:He[a]}:null}function Jt(t){let e=t;for(;e;){if(typeof e.data=="string"){let n=Je(e.data);if(n)return n}if(typeof e.details=="string"){let n=Je(e.details);if(n)return n}for(let n of ["message","shortMessage"])if(typeof e[n]=="string"){let a=Je(e[n]);if(a)return a}e=e.cause;}return null}function Yt(t){if(!t)return "Unknown error";if(t?.data?.errorName)return `${t.data.errorName}()`;if(Array.isArray(t?.metaMessages)){let n=t.metaMessages.find(a=>a.includes("Error:"));if(n)return n.replace("Error: ","").trim()}let e=Jt(t);return e?e.message:t?.cause?Yt(t.cause):t?.reason?t.reason:t?.shortMessage?t.shortMessage:t?.message?t.message:String(t)}async function l(t){if(typeof t=="string")return {error:t};if(Pa(t))return {error:R[4001]};let e=Jt(t);if(e)return {error:{code:e.selector,message:e.message}};let n=Yt(t);return {error:{code:t?.code||t?.name||"Unknown Error",message:n}}}var Xt=async(t,e,n)=>{try{return await f(t).readContract({address:n,abi:G,functionName:"balanceOf",args:[e]})}catch(a){throw y(a),a}};var $t=async(t,e,n,a,s)=>{try{return await f(t).readContract({address:n,abi:G,functionName:"allowance",args:[e,a]})>=s}catch(i){throw i}};var U=30,ne=18;var h=(t,e)=>BigInt(t)*parseUnits(e.toString(),8)/BigInt(10**8),F=async t=>{try{let e=C[t],n=e?.gasPrice||0n,s=await f(t).getGasPrice();if(s==null)throw new Error("Network Error");let i=h(s,e.gasPriceRatio);return {gasPrice:i>n?i:n}}catch(e){throw e}},L=async(t,e)=>{let n=C[t],a=h(e,n.gasLimitRatio),{gasPrice:s}=await F(t);return {gasLimit:a,gasPrice:s}},se=(t,e=.01)=>{let n=parseUnits("1",8)-parseUnits(e.toString(),8);return t*n/BigInt(10**8)};var jt=async(t,e,n,a,s)=>{try{let i=C[t],o=await qt(t,n);if(!o.write)throw new Error("Wallet client required for write");let u=await o.estimateGas.approve([a,s]),m=h(u,i.gasLimitRatio),{gasPrice:r}=await F(t),p=await o.write.approve([a,s],{gasLimit:m,gasPrice:r});await f(t).waitForTransactionReceipt({hash:p});}catch(i){throw i}};var g=async t=>{if("chainId"in t&&!gt(t.chainId))throw new Error(R[1]);if("slippage"in t&&!(Number(t?.slippage)<=1&&Number(t?.slippage)>0))throw new Error(R[4003]);if("amount"in t&&(Number(t.amount)===Number.NaN||Number(t.amount)<0))throw new Error(R[4004]);let{tokenAddress:e,contractAddress:n,chainId:a,amount:s,decimals:i,account:o}=t;if(s&&a&&Number(i)>=0&&o){let u=parseUnits(s.toString(),Number(i));if(e){let m=await Xt(a,o,e);if(!m||m<u)throw new Error(R[3])}n&&e&&(await $t(a,o,e,n,u)||await jt(a,o,e,n,maxUint256));}};async function va(t){try{return (await fetch(t,{method:"HEAD"})).ok}catch{return false}}var ki=async(t,e,n)=>{try{let a=f(t),s=e,[i,o,u,m]=await Promise.all([a.readContract({address:s,abi:G,functionName:"name"}),a.readContract({address:s,abi:G,functionName:"symbol"}),a.readContract({address:s,abi:G,functionName:"decimals"}),a.readContract({address:s,abi:G,functionName:"totalSupply"})]),r=getAddress(s),p=`https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/${t}/assets/${r}/logo.png`,b=await va(p)?p:"",E;if(n){let I=await a.readContract({address:s,abi:G,functionName:"balanceOf",args:[n]});E=Number(formatUnits(I,Number(u)));}return {address:e,name:i,symbol:o,decimals:Number(u),icon:b,totalSupply:Number(formatUnits(m,Number(u))),...n?{balance:E}:{}}}catch(a){throw y(a),a}};var w={};pe(w,{buildHexDataAndExecutionGasFee:()=>_a,buildSignData:()=>Sa,generateTxId:()=>Zt,getExecutionTimestamp:()=>en});var Zt=()=>`0x${WordArray.random(32).toString()}`,en=()=>{let t=Ma(),e=t.unix(),n=t.add(1,"minute").unix();return {createAt:e,deadline:n}},Sa=async({chainId:t,data:e,from:n,to:a})=>{let s=await ge.getForwardEip712Domain(t),{createAt:i,deadline:o}=en(),u=Zt(),{types:m,primaryType:r}=ge.getForwardRequestTypes();return {domain:s,createAt:i,deadline:o,txId:u,types:m,primaryType:r,signData:{from:n,to:a,deadline:o,data:e,value:0n,gas:It}}},_a=async({chainId:t,abi:e,method:n,args:a})=>{let s=encodeFunctionData({abi:e,functionName:n,args:a}),i=getAbiItem({abi:e,name:n}),o=toFunctionSelector(i),m=await(await zt(t)).read.getGasEscrowForSelector([o]);return {hexData:s,executionGasFee:m}};var ge={};pe(ge,{getForwardEip712Domain:()=>ka,getForwardRequestTypes:()=>Na});var ka=async t=>{let n=await(await Qt(t)).read.eip712Domain();return {name:n[1],version:n[2],chainId:n[3],verifyingContract:n[4]}},Na=()=>({types:{ForwardRequest:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"gas",type:"uint256"},{name:"deadline",type:"uint48"},{name:"data",type:"bytes"}]},primaryType:"ForwardRequest"});var k={};pe(k,{waitForTransactionReceipt:()=>Ba});var Ba=async(t,e)=>f(t).waitForTransactionReceipt({hash:e});var tn=async t=>{try{let{chainId:e,poolId:n}=t,a=await v(e);await g({account:a,chainId:e});let{hexData:s,executionGasFee:i}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"claimBasePoolRebate",args:[n,a],chainId:e}),o=await A(e),m=x(e).LIQUIDITY_ROUTER,{domain:r,createAt:p,txId:c,types:b,primaryType:E,signData:I}=await w.buildSignData({chainId:e,data:s,from:a,to:m}),d=await o.signTypedData({account:a,domain:r,types:b,primaryType:E,message:I}),T=await B(e),S=await T.estimateGas.submit([c,{...I,createdAt:BigInt(p),signature:d},[n]],{value:i}),{gasLimit:N,gasPrice:D}=await L(e,S),O=await T.write.submit([c,{...I,createdAt:BigInt(p),signature:d},[n]],{value:i,gasLimit:N,gasPrice:D}),z=await k.waitForTransactionReceipt(e,O);return {hash:O,txId:c,receipt:z}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}},nn=async t=>{try{let{chainId:e,poolIds:n}=t;if(n.length===0)return;let a=await v(e);await g({account:a,chainId:e});let{hexData:s,executionGasFee:i}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"claimBasePoolRebates",args:[n,a],chainId:e}),o=x(e),u=await A(e),m=o.LIQUIDITY_ROUTER,{domain:r,createAt:p,txId:c,types:b,primaryType:E,signData:I}=await w.buildSignData({chainId:e,data:s,from:a,to:m}),d=await u.signTypedData({account:a,domain:r,types:b,primaryType:E,message:I}),T=await B(e),S=await T.estimateGas.submit([c,{...I,createdAt:BigInt(p),signature:d},n],{value:i}),{gasLimit:N,gasPrice:D}=await L(e,S),O=await T.write.submit([c,{...I,createdAt:BigInt(p),signature:d},n],{value:i,gasLimit:N,gasPrice:D}),z=await k.waitForTransactionReceipt(e,O);return {hash:O,txId:c,receipt:z}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var Xe=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{let s=C[t];return await(await $(t)).read.previewLpAmountOut([n,e,a])}catch(s){throw y(s),typeof s=="string"?s:await l(s)}},sn=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{let s=C[t];return await(await $(t)).read.previewBaseAmountOut([n,e,a])}catch(s){throw y(s),typeof s=="string"?s:await l(s)}},on=async({chainId:t,account:e,poolId:n,amount:a=0})=>{try{if(!t||!e||!n)return;if(!a)return {baseAmountOut:0n,rebateAmount:0n};let s=C[t],i=18;await g({decimals:i,account:e,chainId:t,amount:a});let o=parseUnits(a.toString(),i),m=(await ee(t,[n])).data?.[0]?.price||"0",r=parseUnits(m,30),c=await(await $(t)).read.previewUserWithdrawData([n,o,e,r]),[b,E]=c;return {baseAmountOut:b,rebateAmount:E}}catch(s){throw typeof s=="string"?s:await l(s)}};var M=async(t,e)=>{try{return !t||!e?void 0:(await _t(t,e)).data}catch(n){throw typeof n=="string"?n:await l(n)}};var rn=async(t,e)=>await Promise.all(e.map(async a=>{let{publishTime:s,vaa:i,oracleType:o,nativeFee:u,price:m,poolId:r}=a,p=isNil(u)?1n:BigInt(u);return {poolId:r,price:m,value:p,publishTime:s,oracleType:o??2,vaa:i}})),Tr=async(t,e)=>{if(!e||!e.length)return;let n=await ee(t,e);return await rn(t,n.data)},q=async(t,e)=>{if(!e)return;let a=(await ee(t,[e]))?.data?.[0];if(!a)throw new Error(`Unable to get price for ${e}`);return (await rn(t,[a]))?.[0]};function pn(t){return t.includes(".")?t.split(".")[1].length:0}var de=(t=.01,e=[],n=18,a)=>{if(e.length===0)return [];if(e.filter(i=>i.amount&&i.triggerPrice&&i.triggerType).length===0)throw new Error(R[4006]);return e.map(i=>{let o=parseUnits(i.amount.toString(),n),u=parseUnits(i.triggerPrice.toString(),30),m=pn(i.triggerPrice.toString()),r=parseUnits(i.triggerPrice.toString(),m),p=se(o*r*BigInt(10**a)/BigInt(10**(m+n)),t);return {amount:o,triggerPrice:u,triggerType:BigInt(i.triggerType),minQuoteOut:p}})};var le=t=>!(t===0||t===1||t===2||t===5);var mn=async t=>{try{let{poolId:e,chainId:n,amount:a,slippage:s=.01,tpsl:i=[]}=t;await g(t);let o=await M(n,e);if(!o)throw new Error(R[4006]);let u=o?.baseDecimals,m=o?.quoteDecimals,r=o?.baseToken,p=await v(n),c=x(n),b=c.BASE_POOL;await g({tokenAddress:r,contractAddress:b,decimals:u,account:p,chainId:n,amount:a});let E=le(o?.state),I=parseUnits(a.toString(),u),d;if(E){let re=await q(n,e);if(!re)return;let Dn=parseUnits(re.price,30);d=await Xe({chainId:n,poolId:e,amountIn:I,price:Dn});}else d=await Xe({chainId:n,poolId:e,amountIn:I});let T=i.map(re=>({amount:a,triggerPrice:re.triggerPrice,triggerType:re.triggerType})),S=de(s,T,18,m),N=se(d,s),D={poolId:e,amountIn:I,minAmountOut:N,recipient:p,tpslParams:S},{hexData:O,executionGasFee:z}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"depositBase",args:[D],chainId:n}),{domain:J,createAt:Q,txId:j,types:oe,primaryType:Y,signData:K}=await w.buildSignData({from:p,chainId:n,to:c.LIQUIDITY_ROUTER,data:O}),ce=await(await A(n)).signTypedData({account:p,domain:J,types:oe,primaryType:Y,message:K}),xe=await B(n),Te=await xe.estimateGas.submit([j,{...K,createdAt:BigInt(Q),signature:ce},[e]],{value:z}),{gasLimit:ve,gasPrice:Ae}=await L(n,Te),Ce=await xe.write.submit([j,{...K,createdAt:BigInt(Q),signature:ce},[e]],{value:z,gasLimit:ve,gasPrice:Ae}),ie=await k.waitForTransactionReceipt(n,Ce);return {hash:Ce,txId:j,receipt:ie}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var Ie=async({chainId:t,baseToken:e,marketId:n})=>{try{if(!e)throw new Error(R[2]);let a=x(t),s=await H(t,0),i=[n,e],o=await s.read.getMarketPool(i);return o.poolId==="0x0000000000000000000000000000000000000000000000000000000000000000"||!o.poolId?void 0:o.poolId}catch(a){throw y(a),typeof a=="string"?a:await l(a)}},je=async t=>{try{return await(await H(t)).read.getPools()||[]}catch(e){throw y(e),typeof e=="string"?e:await l(e)}},Ke=async(t,e,n=0n)=>{try{let s=await(await Wt(t)).read.getPoolInfo([e,n]);return {quotePool:{poolToken:s.quotePool.poolToken,exchangeRate:s.quotePool.exchangeRate,poolTokenPrice:s.quotePool.poolTokenPrice,poolTokenSupply:s.quotePool.poolTokenSupply,totalDebt:s.quotePool.totalDebt,baseCollateral:s.quotePool.baseCollateral},basePool:{poolToken:s.basePool.poolToken,exchangeRate:s.basePool.exchangeRate,poolTokenPrice:s.basePool.poolTokenPrice,poolTokenSupply:s.basePool.poolTokenSupply,totalDebt:s.basePool.totalDebt,baseCollateral:s.basePool.baseCollateral},reserveInfo:{baseTotalAmount:s.reserveInfo.baseTotalAmount,baseReservedAmount:s.reserveInfo.baseReservedAmount,quoteTotalAmount:s.reserveInfo.quoteTotalAmount,quoteReservedAmount:s.reserveInfo.quoteReservedAmount},fundingInfo:{nextFundingRate:s.fundingInfo.nextFundingRate,lastFundingFeeTracker:s.fundingInfo.lastFundingFeeTracker,nextEpochTime:s.fundingInfo.nextEpochTime},ioTracker:{tracker:s.oi.tracker,longSize:s.oi.longSize,shortSize:s.oi.shortSize,poolEntryPrice:s.oi.poolEntryPrice},liquidityInfo:{windowCaps:s.liquidityInfo.windowCaps,openInterest:s.liquidityInfo.openInterest}}}catch(a){throw y(a),typeof a=="string"?a:await l(a)}};var Ze=async({chainId:t,baseToken:e,marketId:n})=>{try{if(!e)throw new Error(R[2]);let a=C[t],s=await H(t),i={marketId:n,baseToken:e},o=await s.estimateGas.deployPool([i]),u=h(o,a.gasLimitRatio),{gasPrice:m}=await F(t),r=await s.write.deployPool([i],{gasLimit:u,gasPrice:m});if(await f(t).waitForTransactionReceipt({hash:r}))return await Ie({chainId:t,baseToken:e,marketId:n})}catch(a){throw typeof a=="string"?a:await l(a)}};var et=async(t,e,n)=>{try{return await(await Vt(t,e)).read.userGenesisShare([n])}catch(a){throw y(a),typeof a=="string"?a:await l(a)}};var tt=async t=>{try{let{chainId:e,poolId:n,poolType:a,slippage:s=.01,tpsl:i=[]}=t;await g(t);let o=await M(e,n);if(!o)throw new Error(R[4006]);let u=18,m=o.quoteDecimals,r=de(s,i,u,m),p=C[e],c=await ue(e),b={poolId:n,poolType:BigInt(a),tpslParams:r},E=await c.estimateGas.addTpsl([b]),I=h(E,p.gasLimitRatio),{gasPrice:d}=await F(e),T=await c.write.addTpsl([b],{gasLimit:I,gasPrice:d});return await f(e).waitForTransactionReceipt({hash:T})}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var nt=async t=>{try{let{chainId:e,orderId:n}=t;await g(t);let a=C[e],s=await ue(e),i=await s.estimateGas.cancelTpsl([n]),o=h(i,a.gasLimitRatio),{gasPrice:u}=await F(e),m=await s.write.cancelTpsl([n],{gasLimit:o,gasPrice:u});return await f(e).waitForTransactionReceipt({hash:m})}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var at=async(t,e,n)=>{try{await g({chainId:t});let a=await M(t,e);if(!a)throw new Error(R[4006]);let s=await v(t),o=((W?.Markets?.length?W?.Markets:await W.getMarkets())||[])?.find(d=>d.chainId===t&&d.marketId===n);if(!o)throw new Error("Invalid Market");let u=parseUnits(o.oracleFeeUsd.toString(),a.quoteDecimals);if(!u)throw new Error("Invalid Market");await g({tokenAddress:a.quoteToken,contractAddress:x(t).ORACLE_RESERVE,decimals:a.quoteDecimals,account:s,chainId:t,amount:formatUnits(u,a.quoteDecimals)});let m=C[t],r=await H(t),p=await r.estimateGas.reprimePool([{poolId:e}]),c=h(p,m.gasLimitRatio),{gasPrice:b}=await F(t),E=await r.write.reprimePool([{poolId:e}],{gasLimit:c,gasPrice:b});return await f(t).waitForTransactionReceipt({hash:E})}catch(a){throw y(a),typeof a=="string"?a:await l(a)}};var st=async(t,e)=>{try{let n=await fe.getInstance().getConfigManager()?.getAccessToken();if(!n)throw new Error("Failed to obtain accessToken");return (await kt(n,e,t)).data||[]}catch(n){throw y(n),n}};var ot=async t=>{try{let{chainId:e,poolId:n}=t;await g({chainId:e});let a=await M(e,n);if(!a)throw new Error(R[4006]);let s=await v(e),o=((W?.Markets?.length?W?.Markets:await W.getMarkets())||[])?.find(d=>d.chainId===e&&d.marketId===a.marketId);if(!o)throw new Error("Invalid Market");let u=parseUnits(o.boostFeeUsd.toString(),a.quoteDecimals);if(!u)throw new Error("Invalid Market");await g({tokenAddress:a.quoteToken,contractAddress:x(e).ORACLE_RESERVE,decimals:a.quoteDecimals,account:s,chainId:e,amount:formatUnits(u,a.quoteDecimals)});let m=C[e],r=await H(e),p=await r.estimateGas.boostPool([{poolId:n}]),c=h(p,m.gasLimitRatio),{gasPrice:b}=await F(e),E=await r.write.boostPool([{poolId:n}],{gasLimit:c,gasPrice:b});return await f(e).waitForTransactionReceipt({hash:E})}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var it=async t=>{try{let{chainId:e,poolId:n}=t;await g({chainId:e});let a=C[e],s=await H(e),i=await s.estimateGas.unboostPool([{poolId:n}]),o=h(i,a.gasLimitRatio),{gasPrice:u}=await F(e),m=await s.write.unboostPool([{poolId:n}],{gasLimit:o,gasPrice:u});return await f(e).waitForTransactionReceipt({hash:m})}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var rt=async t=>{try{let{chainId:e,poolId:n}=t;await g({chainId:e});let a=C[e],s=await Gt(e),i=await s.estimateGas.claimBoostFee([n]),o=h(i,a.gasLimitRatio),{gasPrice:u}=await F(e),m=await s.write.claimBoostFee([n],{gasLimit:o,gasPrice:u});return await f(e).waitForTransactionReceipt({hash:m})}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var pt=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{return await(await te(t)).read.previewLpAmountOut([n,e,a])}catch(s){throw y(s),typeof s=="string"?s:await l(s)}},dn=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{return await(await te(t)).read.previewQuoteAmountOut([n,e,a])}catch(s){throw y(s),typeof s=="string"?s:await l(s)}};var we=async({amountIn:t,chainId:e,poolId:n,state:a,slippage:s,poolType:i,account:o})=>{let u=le(a),m,r=i===0?sn:dn;if(u)try{let c=await q(e,n);if(c){let b=parseUnits(c.price,30);m=await r({chainId:e,poolId:n,amountIn:t,price:b});}}catch(c){console.error(c),m=await r({chainId:e,poolId:n,amountIn:t});}else m=await r({chainId:e,poolId:n,amountIn:t});return {data:{poolId:n,amountIn:t,minAmountOut:se(m,s),recipient:o}}};var ln=async t=>{try{let{chainId:e,poolId:n,price:a}=t,s=a,i=await $(e);if(typeof a>"u"||a===null)try{let u=await q(e,n);s=parseUnits(u?.price||"0",30);}catch{s=parseUnits("0",30);}return await i.read.withdrawableLpAmount([n,s||0n])}catch(e){throw typeof e=="string"?e:await l(e)}},yn=async t=>{try{let{chainId:e,poolId:n,amount:a,slippage:s=.01}=t,i=await M(e,n),o=i?.basePoolToken,u=C[e],m=await v(e),r=18;await g({tokenAddress:o,decimals:r,account:m,chainId:e,amount:a});let p=parseUnits(a.toString(),r),{data:c}=await we({poolId:n,chainId:e,account:m,amountIn:p,slippage:s,poolType:0,state:i?.state}),b=x(e),{hexData:E,executionGasFee:I}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"withdrawBase",args:[c],chainId:e}),{domain:d,createAt:T,txId:S,types:N,primaryType:D,signData:O}=await w.buildSignData({from:m,chainId:e,to:b.LIQUIDITY_ROUTER,data:E}),J=await(await A(e)).signTypedData({account:m,domain:d,types:N,primaryType:D,message:O}),Q=await B(e),j=await Q.estimateGas.submit([S,{...O,createdAt:BigInt(T),signature:J},[n]],{value:I}),{gasLimit:oe,gasPrice:Y}=await L(e,j),K=await Q.write.submit([S,{...O,createdAt:BigInt(T),signature:J},[n]],{value:I,gasLimit:oe,gasPrice:Y}),ye=await k.waitForTransactionReceipt(e,K);return {hash:K,txId:S,receipt:ye}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var cn=async t=>{try{let{chainId:e,account:n,poolId:a}=t;if(!e||!n||!a)return;let s=C[e],i=0n,u=(await ee(e,[a])).data?.[0]?.price||"0",m=parseUnits(u,30),p=await(await $(e)).read.pendingUserRebates([a,n,m]),[c,b]=p;return {rebates:c,genesisRebates:b}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var fn=async(t,e)=>{if(e)try{let n=await $(t),a=0n,s=await q(t,e);return s?.price&&(a=parseUnits(s.price,30)),await n.read.getPoolTokenPrice([e,a])}catch(n){throw typeof n=="string"?n:await l(n)}};var Tn={};pe(Tn,{claimQuotePoolRebate:()=>Pn,claimQuotePoolRebates:()=>Rn,deposit:()=>In,getLpPrice:()=>wn,getRewards:()=>En,transfer:()=>Cn,withdraw:()=>An,withdrawableLpAmount:()=>xn});var In=async t=>{try{let{poolId:e,chainId:n,amount:a,slippage:s=.01,tpsl:i=[]}=t;await g(t);let o=await M(n,e);if(!o)throw new Error(R[4006]);let u=await v(n),m=x(n),r=m.QUOTE_POOL,p=o.quoteToken,c=o?.quoteDecimals;await g({tokenAddress:p,contractAddress:r,decimals:c,account:u,chainId:n,amount:a});let b=parseUnits(a.toString(),c),E=le(o?.state),I;if(E){let ie=await q(n,e);if(!ie)return;let re=parseUnits(ie.price,30);I=await pt({chainId:n,poolId:e,amountIn:b,price:re});}else I=await pt({chainId:n,poolId:e,amountIn:b});let d=i.map(ie=>({amount:a,triggerPrice:ie.triggerPrice,triggerType:ie.triggerType})),T=de(s,d,18,c),S=se(I,s),N={poolId:e,amountIn:b,minAmountOut:S,recipient:u,tpslParams:T},{hexData:D,executionGasFee:O}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"depositQuote",args:[N],chainId:n}),{domain:z,createAt:J,txId:Q,types:j,primaryType:oe,signData:Y}=await w.buildSignData({from:u,chainId:n,to:m.LIQUIDITY_ROUTER,data:D}),ye=await(await A(n)).signTypedData({account:u,domain:z,types:j,primaryType:oe,message:Y}),ce=await B(n),xe=await ce.estimateGas.submit([Q,{...Y,createdAt:BigInt(J),signature:ye},[e]],{value:O}),{gasLimit:Te,gasPrice:ve}=await L(n,xe),Ae=await ce.write.submit([Q,{...Y,createdAt:BigInt(J),signature:ye},[e]],{value:O,gasLimit:Te,gasPrice:ve}),Ce=await k.waitForTransactionReceipt(n,Ae);return {txId:Q,receipt:Ce,hash:Ae}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var xn=async t=>{try{let{chainId:e,poolId:n,price:a}=t,s=a,i=await te(e);if(typeof a>"u"||a===null)try{let u=await q(e,n);s=parseUnits(u?.price||"0",30);}catch{s=parseUnits("0",30);}return await i.read.withdrawableLpAmount([n,s||0n])}catch(e){throw y(e),typeof e=="string"?e:await l(e)}},An=async t=>{try{let{chainId:e,poolId:n,amount:a,slippage:s=.01}=t,i=await M(e,n),o=i?.quotePoolToken,u=await v(e),m=18;await g({tokenAddress:o,decimals:m,account:u,chainId:e,amount:a});let r=parseUnits(a.toString(),m),{data:p}=await we({poolId:n,chainId:e,account:u,amountIn:r,slippage:s,poolType:1,state:i?.state}),c=x(e),{hexData:b,executionGasFee:E}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"withdrawQuote",args:[p],chainId:e}),{domain:I,createAt:d,txId:T,types:S,primaryType:N,signData:D}=await w.buildSignData({from:u,chainId:e,to:c.LIQUIDITY_ROUTER,data:b}),z=await(await A(e)).signTypedData({account:u,domain:I,types:S,primaryType:N,message:D}),J=await B(e),Q=await J.estimateGas.submit([T,{...D,createdAt:BigInt(d),signature:z},[n]],{value:E}),{gasLimit:j,gasPrice:oe}=await L(e,Q),Y=await J.write.submit([T,{...D,createdAt:BigInt(d),signature:z},[n]],{value:E,gasLimit:j,gasPrice:oe}),K=await k.waitForTransactionReceipt(e,Y);return {hash:Y,txId:T,receipt:K}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var Cn=async(t,e,n,a)=>{try{let s=await M(t,e),i=await M(t,n);if(!i||!s)return null;if([4,5].includes(i.state))throw new Error(R[4005]);let o=await v(t),u=C[t],m=18;await g({chainId:t,amount:a,account:o,decimals:m,tokenAddress:s.quotePoolToken});let r={fromPoolId:e,toPoolId:n,minLpOut:0n,amount:parseUnits(a.toString(),m)},p=await ue(t),c=await p.estimateGas.migrateLiquidity([r]),b=h(c,u.gasLimitRatio),{gasPrice:E}=await F(t),I=await p.write.migrateLiquidity([r],{gasLimit:b,gasPrice:E});return await f(t).waitForTransactionReceipt({hash:I})}catch(s){throw typeof s=="string"?s:await l(s)}};var En=async t=>{try{let{chainId:e,account:n,poolId:a}=t;if(!e||!n||!a)return;let i=(await ee(e,[a])).data?.[0]?.price||"0",o=parseUnits(i,30);return await(await te(e)).read.pendingUserRebates([a,n,o])}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var Pn=async t=>{try{let{chainId:e,poolId:n}=t,a=await v(e);await g({account:a,chainId:e});let{hexData:s,executionGasFee:i}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"claimQuotePoolRebate",args:[n,a],chainId:e}),o=x(e),{domain:u,createAt:m,txId:r,types:p,primaryType:c,signData:b}=await w.buildSignData({from:a,chainId:e,to:o.LIQUIDITY_ROUTER,data:s}),I=await(await A(e)).signTypedData({account:a,domain:u,types:p,primaryType:c,message:b}),d=await B(e),T=await d.estimateGas.submit([r,{...b,createdAt:BigInt(m),signature:I},[n]],{value:i}),{gasLimit:S,gasPrice:N}=await L(e,T),D=await d.write.submit([r,{...b,createdAt:BigInt(m),signature:I},[n]],{value:i,gasLimit:S,gasPrice:N}),O=await k.waitForTransactionReceipt(e,D);return {txId:r,receipt:O,hash:D}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}},Rn=async t=>{try{let{chainId:e,poolIds:n}=t;if(n.length===0)return;let a=await v(e);await g({account:a,chainId:e});let{hexData:s,executionGasFee:i}=await w.buildHexDataAndExecutionGasFee({abi:_,method:"claimQuotePoolRebates",args:[n,a],chainId:e}),o=x(e),{domain:u,createAt:m,txId:r,types:p,primaryType:c,signData:b}=await w.buildSignData({from:a,chainId:e,to:o.LIQUIDITY_ROUTER,data:s}),I=await(await A(e)).signTypedData({account:a,domain:u,types:p,primaryType:c,message:b}),d=await B(e),T=await d.estimateGas.submit([r,{...b,createdAt:BigInt(m),signature:I},n],{value:0n}),{gasLimit:S,gasPrice:N}=await L(e,T),D=await d.write.submit([r,{...b,createdAt:BigInt(m),signature:I},n],{value:i,gasLimit:S,gasPrice:N}),O=await k.waitForTransactionReceipt(e,D);return {txId:r,receipt:O,hash:D}}catch(e){throw y(e),typeof e=="string"?e:await l(e)}};var wn=async(t,e)=>{if(e)try{let n=await te(t),a=0n,s=await q(t,e);return s?.price&&(a=parseUnits(s.price,30)),await n.read.getPoolTokenPrice([e,a])}catch(n){throw y(n),typeof n=="string"?n:await l(n)}};var Mn={};pe(Mn,{getMarket:()=>vn,getOracleFee:()=>hn});var vn=async(t,e)=>{try{if(await g({chainId:t}),!e)return;let a=await(await Pe(t)).read.getMarket([e]),{quoteToken:s,baseReserveRatio:i,quoteReserveRatio:o,oracleFeeUsd:u,boostFeeUsd:m,boostRefundFeeUsd:r,poolPrimeThreshold:p,executionFee:c,maxExecutionFee:b,forwardFee:E,maxForwardFee:I}=a;return a}catch(n){throw y(n),typeof n=="string"?n:await l(n)}};var hn=async(t,e)=>{try{return await g({chainId:t}),e?await(await Pe(t)).read.getOracleFee([e]):void 0}catch(n){throw y(n),typeof n=="string"?n:await l(n)}};var Zd={createPool:Ze,getMarketPoolId:Ie,getMarketPools:je,getPoolInfo:Ke,getUserGenesisShare:et,addTpSl:tt,cancelTpSl:nt,reprime:at,getPoolDetail:M,getOpenOrders:st,boostPool:ot,unBoostPool:it,claimBoostFee:rt};
|
|
2
2
|
export{Xo as $,la as A,ya as B,Tr as Ba,ca as C,q as Ca,fa as D,bn as Da,ba as E,Tn as Ea,ga as F,Mn as Fa,Xs as G,Zd as Ga,Z as H,ee as I,_t as J,kt as K,Zs as L,eo as M,to as N,Nt as O,fe as P,uo as Q,x as R,Lt as S,Qo as T,Ho as U,qt as V,Jo as W,B as X,Yo as Y,Pe as Z,Wt as _,_n as a,Qt as aa,gt as b,$o as ba,Za as c,jo as ca,C as d,Aa as da,he as e,We as ea,f,Ca as fa,Ln as g,Ea as ga,qn as h,y as ha,A as i,Ht as ia,ke as j,He as ja,Le as k,Pa as ka,Ge as l,l as la,Tt as m,Xt as ma,X as n,$t as na,ta as o,U as oa,na as p,ne as pa,St as q,h as qa,aa as r,F as ra,sa as s,L as sa,oa as t,se as ta,ia as u,jt as ua,ra as v,ki as va,pa as w,w as wa,ua as x,ge as xa,ma as y,k as ya,da as z};
|