@myx-trade/sdk 1.0.9 → 1.0.10
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var viem=require('viem'),Pn=require('wretch'),ethersDecodeError=require('ethers-decode-error'),lodashEs=require('lodash-es');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Pn__default=/*#__PURE__*/_interopDefault(Pn);var tn=Object.defineProperty;var We=t=>{throw TypeError(t)};var le=(t,e)=>{for(var n in e)tn(t,n,{get:e[n],enumerable:true});};var Ve=(t,e,n)=>e.has(t)||We("Cannot "+n);var Je=(t,e,n)=>(Ve(t,e,"read from private field"),n?n.call(t):e.get(t)),He=(t,e,n)=>e.has(t)?We("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Ye=(t,e,n,a)=>(Ve(t,e,"write to private field"),e.set(t,n),n);var qt={};le(qt,{claimBasePoolRebate:()=>wt,claimBasePoolRebates:()=>vt,deposit:()=>kt,getLpPrice:()=>Lt,getRewards:()=>Ut,previewUserWithdrawData:()=>Dt,withdraw:()=>Bt,withdrawableLpAmount:()=>Ft});var $e=[{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:"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:"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,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:"recipient"}],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,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:"poolIds"},{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:"claimQuotePoolRebate",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:"recipient"}],outputs:[]},{type:"function",name:"claimQuotePoolRebates",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:"poolIds"},{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:"depositBase",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:"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:"depositQuote",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:"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:"executeTpsl",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:"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:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],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:"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:"withdrawBase",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:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"}]}],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:[]},{type:"function",name:"withdrawQuote",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:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"}]}],outputs:[]}];var an=(r=>(r[r.LINEA_SEPOLIA=59141]="LINEA_SEPOLIA",r[r.LINEA_MAINNET=59144]="LINEA_MAINNET",r[r.ARB_TESTNET=421614]="ARB_TESTNET",r[r.ARB_MAINNET=42161]="ARB_MAINNET",r[r.BSC_TESTNET=97]="BSC_TESTNET",r[r.BSC_MAINNET=56]="BSC_MAINNET",r))(an||{});var sn=[421614,59141,97,42161,59144,56];function je(t){return !!t&&sn.includes(t)}var N=10;var pa={42161:130n,421614:130n,59144:130n,59141:130n,56:150n,97:150n};var Xe={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)*N,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18}}};var Ke={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)*N,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18}}};var Ze={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)*N,nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18}}};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)*N,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18}}};var tt={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)*N,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18}}};var nt={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:1.3,gasAmountRatio:2,gasFeeReservedForCollateral:(5e-4+1)*N,nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18}}};var g={59141:Xe.chainInfo,421614:Ke.chainInfo,97:Ze.chainInfo,59144:et.chainInfo,42161:tt.chainInfo,56:nt.chainInfo};function de(t){let e=g[t];if(!e)throw new Error(`Could not find information with chain id ${t}`);return e}var ce={};function pn(t){if(!ce[t]){let e=de(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`);ce[t]={id:t,name:e.label||`Chain ${t}`,nativeCurrency:e.nativeCurrency,rpcUrls:{default:{http:n}}};}return ce[t]}var fe={};function c(t){if(!fe[t]){let e=de(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?viem.http(n[0]):viem.fallback(n.map(s=>viem.http(s)));fe[t]=viem.createPublicClient({chain:pn(t),transport:a});}return fe[t]}var st=null;function un(t){st=t;}async function O(t){let e=st;if(!e?.hasSigner())throw new Error("No signer: call auth({ signer }) or auth({ walletClient })");return e.getViemWalletClient(t)}var be=[{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:"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:"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,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"string",name:"remark"}]}],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:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],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:"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:"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:"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:"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 S=[{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 ge=[{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 Ie=[{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 Ae=[{type:"constructor",payable:false,inputs:[]},{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:"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:"NotActiveBroker",inputs:[{type:"address",name:"broker"}]},{type:"error",name:"NotBrokerSigner",inputs:[{type:"address",name:"signer"}]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotOrderOwner",inputs:[]},{type:"error",name:"NotPositionOwner",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:"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:"event",anonymous:false,name:"UserFeeDataReset",inputs:[{type:"address",name:"broker",indexed:false},{type:"address",name:"signer",indexed:false},{type:"uint256",name:"epoch",indexed:false}]},{type:"event",anonymous:false,name:"UserFeeDataUpdated",inputs:[{type:"address",name:"broker",indexed:true},{type:"address",name:"signer",indexed:false},{type:"address",name:"user",indexed:false},{type:"uint256",name:"epoch",indexed:false},{type:"uint8",name:"tier",indexed:false},{type:"address",name:"referrer",indexed:false},{type:"uint32",name:"totalReferralRebatePct",indexed:false},{type:"uint32",name:"referrerRebatePct",indexed:false}]},{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:"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:"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:"currentFeeDataEpoch",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{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:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{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:"getUserFeeDataDigest",constant:true,stateMutability:"view",payable:false,inputs:[{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"}]}],outputs:[{type:"bytes32",name:"digest"}]},{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:"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:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{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:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{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:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{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:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{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:"renounceOwnership",constant:false,payable:false,inputs:[],outputs:[]},{type:"function",name:"resetAllUserFeeData",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:"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:"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:"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:"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:"updatePriceAndAdjustCollateral",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:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"bytes32",name:"positionId"},{type:"int256",name:"adjustAmount"}],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"}]}],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:"userFeeData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint256",name:"userFeeDataEpoch"},{type:"address",name:"user"}],outputs:[{type:"uint8",name:"tier"},{type:"address",name:"referrer"},{type:"uint32",name:"totalReferralRebatePct"},{type:"uint32",name:"referrerRebatePct"}]},{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"}]}];var Ce=[{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 Re=[{type:"constructor",payable:false,inputs:[]},{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:"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:"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:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{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:"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:"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 Pe=[{type:"constructor",payable:false,inputs:[{type:"address",name:"addressManager"}]},{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"},{type:"address",name:"broker"}],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:"uint256",name:"tradingFee"},{type:"int256",name:"fundingFee"}]},{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 Ee=[{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 xe=[{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 Te=[{type:"constructor",payable:false,inputs:[]},{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"AlreadyVoted",inputs:[]},{type:"error",name:"BondNotReleased",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:"ChainIdMismatch",inputs:[]},{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:"InvalidAccountNonce",inputs:[{type:"address",name:"account"},{type:"uint256",name:"currentNonce"}]},{type:"error",name:"InvalidContractAddress",inputs:[]},{type:"error",name:"InvalidFunctionSignature",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"InvalidPayloadLength",inputs:[{type:"uint256",name:"received"},{type:"uint256",name:"expected"}]},{type:"error",name:"InvalidPoolToken",inputs:[]},{type:"error",name:"InvalidProfitAmount",inputs:[]},{type:"error",name:"InvalidResponseVersion",inputs:[]},{type:"error",name:"InvalidSourceChain",inputs:[]},{type:"error",name:"NoChainResponse",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:"NumberOfResponsesMismatch",inputs:[]},{type:"error",name:"OnlyRelayer",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"RequestTypeMismatch",inputs:[]},{type:"error",name:"RiskCloseNotCompleted",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"SignatureExpired",inputs:[]},{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:"error",name:"UnexpectedNumberOfResults",inputs:[]},{type:"error",name:"UnsupportedQueryType",inputs:[{type:"uint8",name:"received"}]},{type:"error",name:"UntrustfulVoting",inputs:[]},{type:"error",name:"VerificationFailed",inputs:[]},{type:"error",name:"VersionMismatch",inputs:[]},{type:"error",name:"WrongQueryType",inputs:[{type:"uint8",name:"received"},{type:"uint8",name:"expected"}]},{type:"error",name:"ZeroQueries",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:"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:"uint32",name:"voteCountRate"},{type:"uint32",name:"effectiveVoteRate"}]}]},{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:"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:"staker"},{type:"bytes4",name:"selector"}]}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{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"},{type:"bytes",name:"response"},{type:"tuple[]",name:"guardianSignatures",components:[{type:"bytes32",name:"r"},{type:"bytes32",name:"s"},{type:"uint8",name:"v"},{type:"uint8",name:"guardianIndex"}]}],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",name:"voteCountRate"},{type:"uint32",name:"effectiveVoteRate"}]}]},{type:"function",name:"getImplementation",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:"nonces",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{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:"resolveCaseAppeals",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"bytes",name:"response"},{type:"tuple[]",name:"guardianSignatures",components:[{type:"bytes32",name:"r"},{type:"bytes32",name:"s"},{type:"uint8",name:"v"},{type:"uint8",name:"guardianIndex"}]}],outputs:[]},{type:"function",name:"resolveDispute",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"bytes",name:"response"},{type:"tuple[]",name:"guardianSignatures",components:[{type:"bytes32",name:"r"},{type:"bytes32",name:"s"},{type:"uint8",name:"v"},{type:"uint8",name:"guardianIndex"}]}],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:"staker"},{type:"bytes4",name:"selector"}]}],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:"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:[]}];var rt=[{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 ot={USDC:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",POOL_MANAGER:"0xB131655F326E82753b0e76c1ce853E257524f3a4",Account:"0x0dF5950d0D89d808acC8B712Ed5d5A96fe6A3830",POSITION_MANAGER:"0xE6A51b8FC1b0e2a7f6ab8a0a85Ec4ab5210dF4fB",ORDER_MANAGER:"0xBD72c9F021F1eEA52Ac5dA378C9ffA3612Bfb687",PYTH:"0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF",ERC20:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",LIQUIDITY_ROUTER:"0x0fb875c10fe2fF981e467765E3daaE4355b180D0",BASE_POOL:"0xeC0b3C76cC1C47f9B29313c706c1F6FD8D1C023f",QUOTE_POOL:"0x608Bfd6B8Df0807aA6d1500B76a3eAb3C9DFd728",ORACLE:"0xDa5f18BFeC36A397ad9c4AFc82ddfAb1429C66Be",EIP7702Delegation:"0x56Db3d459c8b9386f5B9ddFd91C0ef149200Cfc4",MARKET_MANAGER:"0xa7C6eD2b34a281463bEeE30b3784f9bc4696e7f1",DATA_PROVIDER:"0xdf535EF442a99B1b2C9fBd0a52D7d612234d123c",ORACLE_RESERVE:"0xf8fC5a3E721f83a75A319313C1A5eAa1bbC838FE",FORWARDER:"0x64A5099C3382f7fdA44F9D329faa86C27dA3D375",TRADING_ROUTER:"0x1168c934cFBDADF425280e890B5f2d47ddE778BE",REIMBURSEMENT:"0x6bAac84Ec2B9586A0Da460CC04dFB69efBe85724",DISPUTE_COURT:"0x51fF606E074637A8C7DDD276B3794a8205739b42"};var it={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"};var pt={USDC:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",POOL_MANAGER:"0x85e869d98216221807A06636541Ec93C9c0a4B0c",Account:"0xA2c5f49a8722408CDa79460CcEd5B97aDcA4cD56",POSITION_MANAGER:"0x68fE700557Fc766DF9b9959E11fd9DacA3f2ccdA",ORDER_MANAGER:"0xC2C479bfb9b6317D37d77C9A1867Af15a457B39D",PYTH:"0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",ERC20:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",LIQUIDITY_ROUTER:"0xc5331ab0159379E6CfCC1f09b63360D0B9715D74",BASE_POOL:"0x8440a78E65F07D8013dd5B0640E0E713c8fd9893",QUOTE_POOL:"0x50F1F7A772672FE0637cF89AD3aFc093584eD040",ORACLE:"0x9F8e2296fa10d77897E7B252460d27b855eeD251",EIP7702Delegation:"0x9558a64E54de8294E7bcCBA62Ee7323c43473abb",MARKET_MANAGER:"0x3BEaaBc8ba2e117E5B66354F8F5D6dc97F71d434",DATA_PROVIDER:"0x7C672f90CCB8b3500F4285Bf22eBb3A98b4eFEB5",ORACLE_RESERVE:"0x27fd8356cE30Aae5440ce2B765beA5d2527efbAD",FORWARDER:"0xb7Bc467202C8C023ba064E368d979381BCfeD62E",TRADING_ROUTER:"0x2894Ea4ca2D177E6070Ad7b53Bf6C20C6BE83cd6",REIMBURSEMENT:"0x0C076Af7AC1861cf85a76eC8bdE4f67dbf23f2b2",DISPUTE_COURT:"0xbf9C0bbfd60e28906C5b1EB05875411A0Ba01435"};var ut={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"};var mt={USDC:"0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",POOL_MANAGER:"0x4F917ef137b573D9790b87e3cF6dfb698cF00c9c",Account:"0xE58CC82F96c86f8F809A98BE14D9DC929d503e25",POSITION_MANAGER:"0x7A5000A1DDE26520BfC893c676a288F98F8a029c",ORDER_MANAGER:"0x343d7563eFb904375Fea81BcC4A3eCdDc0CDa8C9",PYTH:"0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb",ERC20:"0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",LIQUIDITY_ROUTER:"0xe9F2E58562aD1D50AfB1eD92EAa6D367A6D0e552",BASE_POOL:"0x39506f97D1c1A91EAfD59368697E20dC1fE5eEDB",QUOTE_POOL:"0x80DAa474e7e2C9c86708e434B80636b92fb4e9EE",ORACLE:"0xB980765F0D5D3B482601F1a62Ec898619DA9c0C5",EIP7702Delegation:"0x9d43e7847f74E141E1A2B4C413D5F89520995551",MARKET_MANAGER:"0x624d1D5258b34d5C3F4f9CdCB7582F677643cdDC",DATA_PROVIDER:"0xb3c6b1448F04B3Eb9A5D83D6c32B0a10F3E7281B",ORACLE_RESERVE:"0x949e8a0284eA5509B47619e7667C3aA43B7c0336",FORWARDER:"0x73F9F9205E2F7E0Fb886afC3D2a53399C85383a5",TRADING_ROUTER:"0x0000000000000000000000000000000000000000",REIMBURSEMENT:"0x0000000000000000000000000000000000000000",DISPUTE_COURT:"0x0000000000000000000000000000000000000000"};var yt={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"};var re=Pn__default.default(),En=(t,e)=>e?(e=JSON.parse(JSON.stringify(e)),t.includes("?")?t+"&"+new URLSearchParams(e).toString():t+"?"+new URLSearchParams(e).toString()):t,L={get:(t,e,n={})=>{let a=En(t,e);return re.url(a).options(n).get().json()},post:(t,e,n={})=>re.url(t).options(n).post(e).json(),put:(t,e,n={})=>re.url(t).options(n).put(e).json(),delete:(t,e={})=>re.url(t).options(e).delete().json()};var xn=(i=>(i[i.SUCCESS=9200]="SUCCESS",i[i.SUCCESS_ORIGIN=0]="SUCCESS_ORIGIN",i[i.IDENTITY_VERIFICATION_FAILED=9401]="IDENTITY_VERIFICATION_FAILED",i[i.PERMISSION_DENIED=9403]="PERMISSION_DENIED",i[i.NOT_EXIST=9404]="NOT_EXIST",i[i.REQUEST_LIMIT=9429]="REQUEST_LIMIT",i[i.SERVICE_ERROR=9500]="SERVICE_ERROR",i[i.MISS_REQUESTED_PARAMETER=9900]="MISS_REQUESTED_PARAMETER",i[i.INVALID_PARAMETER=9901]="INVALID_PARAMETER",i.NETWORK_ERROR="ERR_NETWORK",i))(xn||{}),Tn=(o=>(o[o.Cook=0]="Cook",o[o.Primed=1]="Primed",o[o.Trench=2]="Trench",o[o.PreBench=3]="PreBench",o[o.Bench=4]="Bench",o))(Tn||{}),lt=(n=>(n[n.Chainlink=1]="Chainlink",n[n.Pyth=2]="Pyth",n))(lt||{}),wn=(p=>(p[p.Minute1=1]="Minute1",p[p.Minute5=5]="Minute5",p[p.Minute15=15]="Minute15",p[p.Minute30=30]="Minute30",p[p.Hour1=60]="Hour1",p[p.Hour4=240]="Hour4",p[p.Day1=1440]="Day1",p[p.Week1=10080]="Week1",p[p.Month1=40320]="Month1",p))(wn||{}),vn=(a=>(a[a.Contract=1]="Contract",a[a.Cook=2]="Cook",a[a.Earn=3]="Earn",a))(vn||{}),hn=(s=>(s[s.All=0]="All",s[s.Contract=1]="Contract",s[s.Cook=2]="Cook",s[s.Earn=3]="Earn",s))(hn||{}),Mn=(n=>(n[n.BlueChips=1]="BlueChips",n[n.Alpha=2]="Alpha",n))(Mn||{}),Dn=(a=>(a[a.BlueChips=1]="BlueChips",a[a.Alpha=2]="Alpha",a[a.Favorite=3]="Favorite",a))(Dn||{});var On=(s=>(s[s.Market=0]="Market",s[s.Limit=1]="Limit",s[s.Stop=2]="Stop",s[s.Conditional=3]="Conditional",s))(On||{}),_n=(n=>(n[n.Increase=0]="Increase",n[n.Decrease=1]="Decrease",n))(_n||{}),kn=(m=>(m[m.Increase=0]="Increase",m[m.Decrease=1]="Decrease",m[m.AddMargin=2]="AddMargin",m[m.RemoveMargin=3]="RemoveMargin",m[m.CancelOrder=4]="CancelOrder",m[m.ADL=5]="ADL",m[m.Liquidation=6]="Liquidation",m[m.MarketClose=7]="MarketClose",m[m.EarlyClose=8]="EarlyClose",m[m.AddTPSL=9]="AddTPSL",m[m.SecurityDeposit=10]="SecurityDeposit",m[m.TransferToWallet=11]="TransferToWallet",m[m.MarginAccountDeposit=12]="MarginAccountDeposit",m[m.ReferralReward=13]="ReferralReward",m[m.ReferralRewardClaim=14]="ReferralRewardClaim",m))(kn||{}),Sn=(a=>(a[a.Unknown=0]="Unknown",a[a.GTE=1]="GTE",a[a.LTE=2]="LTE",a))(Sn||{}),Nn=(n=>(n[n.Long=0]="Long",n[n.Short=1]="Short",n))(Nn||{}),Fn=(s=>(s[s.Cancelled=1]="Cancelled",s[s.Expired=2]="Expired",s[s.Successful=9]="Successful",s[s.PartialFilled=8]="PartialFilled",s))(Fn||{}),Bn=(p=>(p[p.Market=1]="Market",p[p.Limit=2]="Limit",p[p.TP=3]="TP",p[p.SL=4]="SL",p[p.ADL=5]="ADL",p[p.ADLTrigger=6]="ADLTrigger",p[p.Liquidation=7]="Liquidation",p[p.EarlyClose=8]="EarlyClose",p[p.MarketClose=9]="MarketClose",p))(Bn||{}),Un=(i=>(i[i.Open=0]="Open",i[i.PartialClose=1]="PartialClose",i[i.FullClose=2]="FullClose",i[i.Liquidation=3]="Liquidation",i[i.EarlyClose=4]="EarlyClose",i[i.MarketClose=5]="MarketClose",i[i.ADL=6]="ADL",i[i.TP=7]="TP",i[i.SL=8]="SL",i[i.Increase=9]="Increase",i))(Un||{}),Ln=(a=>(a[a.MarginAccount=1]="MarginAccount",a[a.WalletAccount=2]="WalletAccount",a[a.ReferralReward=3]="ReferralReward",a))(Ln||{});var qn=(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))(qn||{});var ss=async()=>L.get(`${G()}/openapi/gateway/scan/market/list`);var G=()=>{let{isTestnet:t,isBetaMode:e}=V?.getConfigManager()?.getConfig()||{};return e?"https://api-beta.myx.finance":t?"https://api-test.myx.cash":"https://api.myx.finance"},z=async(t,e=[])=>e.length?L.get(`${G()}/openapi/gateway/quote/price/oracles`,{chainId:t,poolIds:e.join(",")}):Promise.reject(new Error("Invalid pool id")),dt=async(t,e)=>await L.get(`${G()}/openapi/gateway/scan/market/info?chainId=${t}&poolId=${e}`),ct=async(t,e,n)=>await L.get(`${G()}/openapi/gateway/scan/market/pool-order/open?chainId=${n}`,void 0,{headers:{myx_openapi_access_token:t,myx_openapi_account:e}}),ps=async({chainId:t,poolIds:e},n)=>L.get(`${G()}/openapi/gateway/quote/candle/tickers`,{chainId:t,poolIds:e.join(",")}),us=async({...t})=>L.get(`${G()}/openapi/gateway/scan/market/base-details`,t),ms=async({...t})=>L.get(`${G()}/openapi/gateway/scan/market/detail`,t),ft=async()=>L.get(`${G()}/openapi/gateway/scan/market`);var te,we=class we{constructor(){this.version="1.0.9";He(this,te);}setConfigManager(e){Ye(this,te,e);}getConfigManager(){return Je(this,te)}setProvider(e){this.provider=e;}getProvider(){return this.provider}static getInstance(){return this._instance||(this._instance=new we),this._instance}async getMarkets(){try{let n=(await ft())?.data||[];return this.Markets=n,n}catch(e){throw e}}};te=new WeakMap;var ee=we,bt=ee.getInstance(),V=bt,Is=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 gt={USDC:"0x55d398326f99059fF775485246999027B3197955",POOL_MANAGER:"0x04218C23f89cAA2E4395a7Bd94410057705D1184",Account:"0x269cdAd14cf2cD3c720BC16ef0321700CccaC574",POSITION_MANAGER:"0x04218C23f89cAA2E4395a7Bd94410057705D1184",ORDER_MANAGER:"0x8d38a857390E1586481cF8994F4feBc315D0249b",PYTH:"0x4D7E825f80bDf85e913E0DD2A2D54927e9dE1594",ERC20:"0x55d398326f99059fF775485246999027B3197955",LIQUIDITY_ROUTER:"0x637dB5906E51e6e73fF6EF059870cf70B1874aa5",BASE_POOL:"0x6a775E908629eFC6357b3d89E5528524a6f378Dd",QUOTE_POOL:"0x73b2dcfdc7dC78a7A51B778E93c09FC173923BcE",ORACLE:"0xAdD60e47D2C5e7d57B1e5a3F9d24dE43933b8A7A",EIP7702Delegation:"0x798860BbBC6e011C5508f92a102ee53a44cECfb7",MARKET_MANAGER:"0x98Af86B194ce82cac650C87F45e5B9f7A4A40AB2",DATA_PROVIDER:"0x96955bE362b35846c2E7b9B40fC961080DCBbA67",ORACLE_RESERVE:"0xBFE7b174F4013e9f6526030EB0c52b094A237E6E",FORWARDER:"0xD0894e09317F455dd698A706bb62D783e95aA7Ad",TRADING_ROUTER:"0xb0c56a233535971b8903497f98b90Cf53aE77A13",REIMBURSEMENT:"0x5EFB5E4C3807b6152157DbF4Ae75c31F0Cdec478",DISPUTE_COURT:"0xEaAf5b9184C48486a6Fb51f70E101087598a95C8"};var h=t=>{let{isBetaMode:e}=V?.getConfigManager()?.getConfig()||{};switch(t){case 421614:return e?it:ot;case 59141:return e?ut:pt;case 97:return e?yt:mt;case 56:return gt;default:return {}}};var Ys=(t,e)=>{let n=c(t);return viem.getContract({address:e,abi:S,client:n})},It=async(t,e)=>{let n=await O(t);return viem.getContract({address:e,abi:S,client:n})},M=async t=>{let e=await O(t),[n]=await e.getAddresses();return n??void 0},v=async t=>{let e=h(t),n=await O(t);return viem.getContract({address:e.LIQUIDITY_ROUTER,abi:$e,client:n})},Y=(t,e=1)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.POOL_MANAGER,abi:be,client:a})):O(t).then(s=>viem.getContract({address:n.POOL_MANAGER,abi:be,client:s}))};var Q=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.QUOTE_POOL,abi:ge,client:a})):O(t).then(s=>viem.getContract({address:n.QUOTE_POOL,abi:ge,client:s}))},q=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.BASE_POOL,abi:Ie,client:a})):O(t).then(s=>viem.getContract({address:n.BASE_POOL,abi:Ie,client:s}))},$s=async(t,e)=>{let n=await O(t);return viem.getContract({address:e,abi:Ae,client:n})};var js=(t,e)=>{let n=c(t);return viem.getContract({address:e,abi:Ae,client:n})};var At=(t,e,n=0)=>{let a=n===0?c(t):null;return a?Promise.resolve(viem.getContract({address:e,abi:Ce,client:a})):O(t).then(s=>viem.getContract({address:e,abi:Ce,client:s}))},oe=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.MARKET_MANAGER,abi:Re,client:a})):O(t).then(s=>viem.getContract({address:n.MARKET_MANAGER,abi:Re,client:s}))},Ct=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.DATA_PROVIDER,abi:Pe,client:a})):O(t).then(s=>viem.getContract({address:n.DATA_PROVIDER,abi:Pe,client:s}))},Xs=async t=>{let e=h(t),n=await O(t);return viem.getContract({address:e.Account,abi:rt,client:n})},Ks=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.FORWARDER,abi:Ee,client:a})):O(t).then(s=>viem.getContract({address:n.FORWARDER,abi:Ee,client:s}))},Zs=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.REIMBURSEMENT,abi:xe,client:a})):O(t).then(s=>viem.getContract({address:n.REIMBURSEMENT,abi:xe,client:s}))},er=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.DISPUTE_COURT,abi:Te,client:a})):O(t).then(s=>viem.getContract({address:n.DISPUTE_COURT,abi:Te,client:s}))};var $=null;function Gn(t){$=t;}function ve(){return $??{}}function he(){}function zn(...t){($?.log??$?.info??he)(...t);}function Qn(...t){($?.warn??he)(...t);}function d(...t){($?.error??he)(...t);}var Rt=class{constructor(e){this.options={...e,logLevel:e?.logLevel??"info"};}get out(){return this.options.sink??ve()}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);}};ethersDecodeError.ErrorDecoder.create();var w={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 Vn(t){let e=t;for(;e;){if(e.name==="UserRejectedRequestError")return true;e=e.cause;}return false}async function y(t){let e=t?.shortMessage||t?.details||t?.message;return typeof t=="string"?{error:t}:Vn(t)?{error:w[4001]}:{error:{code:t?.code||t?.name||"Unknow Error",message:e}}}var Pt=async(t,e,n)=>{try{return await c(t).readContract({address:n,abi:S,functionName:"balanceOf",args:[e]})}catch(a){throw d(a),a}};var Et=async(t,e,n,a,s)=>{try{return await c(t).readContract({address:n,abi:S,functionName:"allowance",args:[e,a]})>=s}catch(o){throw o}};var _=30,W=18;var R=(t,e)=>BigInt(t)*viem.parseUnits(e.toString(),8)/BigInt(10**8),P=async t=>{try{let e=g[t],a=await c(t).getGasPrice();if(a==null)throw new Error("Network Error");return {gasPrice:R(a,e.gasPriceRatio)}}catch(e){throw e}},J=(t,e=.01)=>{let n=viem.parseUnits("1",8)-viem.parseUnits(e.toString(),8);return t*n/BigInt(10**8)};var xt=async(t,e,n,a,s)=>{try{let o=g[t],r=await It(t,n);if(!r.write)throw new Error("Wallet client required for write");let u=await r.estimateGas.approve([a,s]),l=R(u,o.gasLimitRatio),{gasPrice:p}=await P(t),i=await r.write.approve([a,s],{gasLimit:l,gasPrice:p});await c(t).waitForTransactionReceipt({hash:i});}catch(o){throw o}};var A=async t=>{if("chainId"in t&&!je(t.chainId))throw new Error(w[1]);if("slippage"in t&&!(Number(t?.slippage)<=1&&Number(t?.slippage)>0))throw new Error(w[4003]);if("amount"in t&&(Number(t.amount)===Number.NaN||Number(t.amount)<0))throw new Error(w[4004]);let{tokenAddress:e,contractAddress:n,chainId:a,amount:s,decimals:o,account:r}=t;if(s&&a&&Number(o)>=0&&r){let u=viem.parseUnits(s.toString(),Number(o));if(e){let l=await Pt(a,r,e);if(!l||l<u)throw new Error(w[3])}n&&e&&(await Et(a,r,e,n,u)||await xt(a,r,e,n,viem.maxUint256));}};var Tt=async(t,e)=>await Promise.all(e.map(async a=>{let{publishTime:s,vaa:o,oracleType:r,nativeFee:u,price:l,poolId:p}=a,i=lodashEs.isNil(u)?1n:BigInt(u);return {poolId:p,price:l,value:i,publishTime:s,oracleType:r??2,vaa:o}})),j=async(t,e)=>{if(!e||!e.length)return;let n=await z(t,e);return await Tt(t,n.data)},k=async(t,e)=>{if(!e)return;let a=(await z(t,[e]))?.data?.[0];if(!a)throw new Error(`Unable to get price for ${e}`);return (await Tt(t,[a]))?.[0]};var wt=async t=>{try{let{chainId:e,poolId:n}=t,a=g[e],s=await M(e);await A({account:s,chainId:e});let o=await j(e,[n]);if(!o)return;let r=o.map(C=>C.value),u=o.map(C=>({poolId:n,oracleType:C.oracleType,publishTime:C.publishTime,oracleUpdateData:C?.vaa??"0"})),l={prices:u,values:r,poolId:n,recipient:s},p=await v(e),i=await p.estimateGas.claimBasePoolRebate([u,n,s],{value:r[0]}),b=R(i,a.gasLimitRatio),{gasPrice:I}=await P(e);return await p.write.claimBasePoolRebate([u,n,s],{gasLimit:b,gasPrice:I,value:r[0]})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}},vt=async t=>{try{let{chainId:e,poolIds:n}=t;if(n.length===0)return;let a=g[e],s=await M(e);await A({account:s,chainId:e});let o=await j(e,n);if(!o)return;let r=o.map(x=>({poolId:x.poolId,oracleType:x.oracleType,publishTime:x.publishTime,oracleUpdateData:x?.vaa??"0"})),l=o.map(x=>x.value).reduce((x,T)=>T+x,0n),p={prices:r,poolIds:n,value:l,recipient:s},i=await v(e),b=await i.estimateGas.claimBasePoolRebates([r,n,s],{value:l}),I=R(b,a.gasLimitRatio),{gasPrice:f}=await P(e),C=await i.write.claimBasePoolRebates([r,n,s],{gasLimit:I,gasPrice:f,value:l});return await c(e).waitForTransactionReceipt({hash:C})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var De=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{let s=g[t];return await(await q(t)).read.previewLpAmountOut([n,e,a])}catch(s){throw d(s),typeof s=="string"?s:await y(s)}},Mt=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{let s=g[t];return await(await q(t)).read.previewBaseAmountOut([n,e,a])}catch(s){throw d(s),typeof s=="string"?s:await y(s)}},Dt=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=g[t],o=18;await A({decimals:o,account:e,chainId:t,amount:Number(a)});let r=viem.parseUnits(a.toString(),o),l=(await z(t,[n])).data?.[0]?.price||"0",p=viem.parseUnits(l,30),b=await(await q(t)).read.previewUserWithdrawData([n,r,e,p]),[I,f]=b;return {baseAmountOut:I,rebateAmount:f}}catch(s){throw typeof s=="string"?s:await y(s)}};var D=async(t,e)=>{try{return !t||!e?void 0:(await dt(t,e)).data}catch(n){throw typeof n=="string"?n:await y(n)}};function Ot(t){return t.includes(".")?t.split(".")[1].length:0}var X=(t=.01,e=[],n=18,a)=>{if(e.length===0)return [];if(e.filter(o=>o.amount&&o.triggerPrice&&o.triggerType).length===0)throw new Error(w[4006]);return e.map(o=>{let r=viem.parseUnits(o.amount.toString(),n),u=viem.parseUnits(o.triggerPrice.toString(),30),l=Ot(o.triggerPrice.toString()),p=viem.parseUnits(o.triggerPrice.toString(),l),i=J(r*p*BigInt(10**a)/BigInt(10**(l+n)),t);return {amount:r,triggerPrice:u,triggerType:BigInt(o.triggerType),minQuoteOut:i}})};var kt=async t=>{try{let{poolId:e,chainId:n,amount:a,slippage:s=.01,tpsl:o=[]}=t;await A(t);let r=await D(n,e);if(!r)throw new Error(w[4006]);let u=r?.baseDecimals,l=r?.quoteDecimals,p=r?.baseToken,i=g[n],b=await M(n),f=h(n).BASE_POOL;await A({tokenAddress:p,contractAddress:f,decimals:u,account:b,chainId:n,amount:a});let C=!(Number(r?.state)===0||Number(r?.state)===1),m=[],x=viem.parseUnits(a.toString(),u),T=0n,F;if(C){let B=await k(n,e);if(!B)return;let en=viem.parseUnits(B.price,30);m.push({poolId:e,oracleType:B.oracleType,publishTime:BigInt(B.publishTime),oracleUpdateData:B.vaa}),F=await De({chainId:n,poolId:e,amountIn:x,price:en}),T=B.value;}else F=await De({chainId:n,poolId:e,amountIn:x});let K=o.map(B=>({amount:a,triggerPrice:B.triggerPrice,triggerType:B.triggerType})),ae=X(s,K,u,l),Z={poolId:e,amountIn:x,minAmountOut:J(F,s),recipient:b,tpslParams:ae},se=await v(n),ue=await se.estimateGas.depositBase([m,Z],{value:T}),me=R(ue,i.gasLimitRatio),{gasPrice:ye}=await P(n),Qe=await se.write.depositBase([m,Z],{gasLimit:me,gasPrice:ye,value:T});return await c(n).waitForTransactionReceipt({hash:Qe})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var ne=async({chainId:t,baseToken:e,marketId:n})=>{try{if(!e)throw new Error(w[2]);let a=h(t),s=await Y(t,0),o=[n,e],r=await s.read.getMarketPool(o);return r.poolId==="0x0000000000000000000000000000000000000000000000000000000000000000"||!r.poolId?void 0:r.poolId}catch(a){throw d(a),typeof a=="string"?a:await y(a)}},_e=async t=>{try{return await(await Y(t)).read.getPools()||[]}catch(e){throw d(e),typeof e=="string"?e:await y(e)}},ke=async(t,e,n=0n)=>{try{let s=await(await Ct(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 d(a),typeof a=="string"?a:await y(a)}};var Se=async({chainId:t,baseToken:e,marketId:n})=>{try{if(!e)throw new Error(w[2]);let a=g[t],s=await Y(t),o={marketId:n,baseToken:e},r=await s.estimateGas.deployPool([o]),u=R(r,a.gasLimitRatio),{gasPrice:l}=await P(t),p=await s.write.deployPool([o],{gasLimit:u,gasPrice:l});if(await c(t).waitForTransactionReceipt({hash:p}))return await ne({chainId:t,baseToken:e,marketId:n})}catch(a){throw typeof a=="string"?a:await y(a)}};var Ne=async(t,e,n)=>{try{return await(await At(t,e)).read.userGenesisShare([n])}catch(a){throw d(a),typeof a=="string"?a:await y(a)}};var Fe=async t=>{try{let{chainId:e,poolId:n,poolType:a,slippage:s=.01,tpsl:o=[]}=t;await A(t);let r=await D(e,n);if(!r)throw new Error(w[4006]);let u=18,l=r.quoteDecimals,p=X(s,o,u,l),i=g[e],b=await v(e),I={poolId:n,poolType:BigInt(a),tpslParams:p},f=await b.estimateGas.addTpsl([I]),C=R(f,i.gasLimitRatio),{gasPrice:m}=await P(e),x=await b.write.addTpsl([I],{gasLimit:C,gasPrice:m});return await c(e).waitForTransactionReceipt({hash:x})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Be=async t=>{try{let{chainId:e,orderId:n}=t;await A(t);let a=g[e],s=await v(e),o=await s.estimateGas.cancelTpsl([n]),r=R(o,a.gasLimitRatio),{gasPrice:u}=await P(e),l=await s.write.cancelTpsl([n],{gasLimit:r,gasPrice:u});return await c(e).waitForTransactionReceipt({hash:l})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};async function jn(t){try{return (await fetch(t,{method:"HEAD"})).ok}catch{return false}}var mi=async(t,e,n)=>{try{let a=c(t),s=e,[o,r,u,l]=await Promise.all([a.readContract({address:s,abi:S,functionName:"name"}),a.readContract({address:s,abi:S,functionName:"symbol"}),a.readContract({address:s,abi:S,functionName:"decimals"}),a.readContract({address:s,abi:S,functionName:"totalSupply"})]),p=viem.getAddress(s),i=`https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/${t}/assets/${p}/logo.png`,I=await jn(i)?i:"",f;if(n){let C=await a.readContract({address:s,abi:S,functionName:"balanceOf",args:[n]});f=Number(viem.formatUnits(C,Number(u)));}return {address:e,name:o,symbol:r,decimals:Number(u),icon:I,totalSupply:Number(viem.formatUnits(l,Number(u))),...n?{balance:f}:{}}}catch(a){throw d(a),a}};var Ue=async(t,e,n)=>{try{await A({chainId:t});let a=await D(t,e);if(!a)throw new Error(w[4006]);let s=await M(t),r=((V?.Markets?.length?V?.Markets:await V.getMarkets())||[])?.find(m=>m.chainId===t&&m.marketId===n);if(!r)throw new Error("Invalid Market");let u=viem.parseUnits(r.oracleFeeUsd.toString(),a.quoteDecimals);if(!u)throw new Error("Invalid Market");await A({tokenAddress:a.quoteToken,contractAddress:h(t).ORACLE_RESERVE,decimals:a.quoteDecimals,account:s,chainId:t,amount:Number(viem.formatUnits(u,a.quoteDecimals))});let l=g[t],p=await Y(t),i=await p.estimateGas.reprimePool([{poolId:e}]),b=R(i,l.gasLimitRatio),{gasPrice:I}=await P(t),f=await p.write.reprimePool([{poolId:e}],{gasLimit:b,gasPrice:I});return await c(t).waitForTransactionReceipt({hash:f})}catch(a){throw d(a),typeof a=="string"?a:await y(a)}};var Le=async(t,e)=>{try{let n=await ee.getInstance().getConfigManager()?.getAccessToken();if(!n)throw new Error("Failed to obtain accessToken");return (await ct(n,e,t)).data||[]}catch(n){throw d(n),n}};var qe=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{return await(await Q(t)).read.previewLpAmountOut([n,e,a])}catch(s){throw d(s),typeof s=="string"?s:await y(s)}},Nt=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{return await(await Q(t)).read.previewQuoteAmountOut([n,e,a])}catch(s){throw d(s),typeof s=="string"?s:await y(s)}};var pe=async({amountIn:t,chainId:e,poolId:n,state:a,slippage:s,poolType:o,account:r})=>{let u=!(a===0||a===1),l=[],p=0n,i,b=o===0?Mt:Nt;if(u)try{let f=await k(e,n);if(f){let C=viem.parseUnits(f.price,30);l.push({poolId:n,oracleType:f.oracleType,publishTime:BigInt(f.publishTime),oracleUpdateData:f.vaa}),i=await b({chainId:e,poolId:n,amountIn:t,price:C}),p=f.value;}}catch(f){console.error(f),i=await b({chainId:e,poolId:n,amountIn:t});}else i=await b({chainId:e,poolId:n,amountIn:t});let I={poolId:n,amountIn:t,minAmountOut:J(i,s),recipient:r};return {price:l,data:I,value:p}};var Ft=async t=>{try{let{chainId:e,poolId:n,price:a}=t,s=a,o=await q(e);if(typeof a>"u"||a===null)try{let u=await k(e,n);s=viem.parseUnits(u?.price||"0",30);}catch{s=viem.parseUnits("0",30);}return await o.read.withdrawableLpAmount([n,s||0n])}catch(e){throw typeof e=="string"?e:await y(e)}},Bt=async t=>{try{let{chainId:e,poolId:n,amount:a,slippage:s=.01}=t,o=await D(e,n),r=o?.basePoolToken,u=g[e],l=await M(e),p=18;await A({tokenAddress:r,decimals:p,account:l,chainId:e,amount:a});let i=viem.parseUnits(a.toString(),p),{price:b,data:I,value:f}=await pe({poolId:n,chainId:e,account:l,amountIn:i,slippage:s,poolType:0,state:o?.state}),C=await v(e),m=await C.estimateGas.withdrawBase([b,I],{value:f}),x=R(m,u.gasLimitRatio),{gasPrice:T}=await P(e),F=await C.write.withdrawBase([b,I],{gasLimit:x,gasPrice:T,value:f});return await c(e).waitForTransactionReceipt({hash:F})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Ut=async t=>{try{let{chainId:e,account:n,poolId:a}=t;if(!e||!n||!a)return;let s=g[e],o=0n,u=(await z(e,[a])).data?.[0]?.price||"0",l=viem.parseUnits(u,30),i=await(await q(e)).read.pendingUserRebates([a,n,l]);return {rebates:i?.rebates,genesisRebates:i?.genesisRebates}}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Lt=async(t,e)=>{if(e)try{let n=await q(t),a=0n,s=await k(t,e);return s?.price&&(a=viem.parseUnits(s.price,30)),await n.read.getPoolTokenPrice([e,a])}catch(n){throw typeof n=="string"?n:await y(n)}};var jt={};le(jt,{claimQuotePoolRebate:()=>Ht,claimQuotePoolRebates:()=>Yt,deposit:()=>zt,getLpPrice:()=>$t,getRewards:()=>Jt,transfer:()=>Vt,withdraw:()=>Wt,withdrawableLpAmount:()=>Qt});var zt=async t=>{try{let{poolId:e,chainId:n,amount:a,slippage:s=.01,tpsl:o=[]}=t;await A(t);let r=await D(n,e);if(!r)throw new Error(w[4006]);let u=g[n],l=await M(n),i=h(n).QUOTE_POOL,b=r.quoteToken,I=r?.quoteDecimals;await A({tokenAddress:b,contractAddress:i,decimals:I,account:l,chainId:n,amount:a});let f=viem.parseUnits(a.toString(),I),C=!(Number(r?.state)===0||Number(r?.state)===1),m=[],x=0n,T;if(C){let U=await k(n,e);if(!U)return;let B=viem.parseUnits(U.price,30);m.push({poolId:e,oracleType:U.oracleType,publishTime:BigInt(U.publishTime),oracleUpdateData:U.vaa}),T=await qe({chainId:n,poolId:e,amountIn:f,price:B}),x=U.value;}else T=await qe({chainId:n,poolId:e,amountIn:f});let F=o.map(U=>({amount:a,triggerPrice:U.triggerPrice,triggerType:U.triggerType})),K=X(s,F,I,I),ae={poolId:e,amountIn:f,minAmountOut:J(T,s),recipient:l,tpslParams:K},Z=await v(n),se=await Z.estimateGas.depositQuote([m,ae],{value:x}),ue=R(se,u.gasLimitRatio),{gasPrice:me}=await P(n),ye=await Z.write.depositQuote([m,ae],{gasLimit:ue,gasPrice:me,value:x});return await c(n).waitForTransactionReceipt({hash:ye})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Qt=async t=>{try{let{chainId:e,poolId:n,price:a}=t,s=a,o=await Q(e);if(typeof a>"u"||a===null)try{let u=await k(e,n);s=viem.parseUnits(u?.price||"0",30);}catch{s=viem.parseUnits("0",30);}return await o.read.withdrawableLpAmount([n,s||0n])}catch(e){throw d(e),typeof e=="string"?e:await y(e)}},Wt=async t=>{try{let{chainId:e,poolId:n,amount:a,slippage:s=.01}=t,o=await D(e,n),r=o?.quotePoolToken,u=g[e],l=await M(e),p=18;await A({tokenAddress:r,decimals:p,account:l,chainId:e,amount:a});let i=viem.parseUnits(a.toString(),p),{price:b,data:I,value:f}=await pe({poolId:n,chainId:e,account:l,amountIn:i,slippage:s,poolType:1,state:o?.state}),C=await v(e),m=await C.estimateGas.withdrawQuote([b,I],{value:f}),x=R(m,u.gasLimitRatio),{gasPrice:T}=await P(e),F=await C.write.withdrawQuote([b,I],{gasLimit:x,gasPrice:T,value:f});return await c(e).waitForTransactionReceipt({hash:F})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Vt=async(t,e,n,a)=>{try{let s=await D(t,e),o=await D(t,n);if(!o||!s)return null;if([3,4].includes(o.state))throw new Error(w[4005]);let r=await M(t),u=g[t],l=18;await A({chainId:t,amount:a,account:r,decimals:l,tokenAddress:s.quotePoolToken});let p={fromPoolId:e,toPoolId:n,minLpOut:0n,amount:viem.parseUnits(a.toString(),l)},i=await v(t),b=await i.estimateGas.migrateLiquidity([p]),I=R(b,u.gasLimitRatio),{gasPrice:f}=await P(t),C=await i.write.migrateLiquidity([p],{gasLimit:I,gasPrice:f});return await c(t).waitForTransactionReceipt({hash:C})}catch(s){throw typeof s=="string"?s:await y(s)}};var Jt=async t=>{try{let{chainId:e,account:n,poolId:a}=t;if(!e||!n||!a)return;let o=(await z(e,[a])).data?.[0]?.price||"0",r=viem.parseUnits(o,30);return await(await Q(e)).read.pendingUserRebates([a,n,r])}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Ht=async t=>{try{let{chainId:e,poolId:n}=t,a=g[e],s=await M(e),o=18;await A({account:s,chainId:e});let r=await j(e,[n]);if(!r)return;let u=r.map(m=>m.value),l=r.map(m=>({poolId:m.poolId,oracleUpdateData:m?.vaa??"0",publishTime:m.publishTime,oracleType:m.oracleType})),p={prices:l,values:u,poolId:n,recipient:s},i=await v(e),b=await i.estimateGas.claimQuotePoolRebate([l,n,s],{value:u[0]}),I=R(b,a.gasLimitRatio),{gasPrice:f}=await P(e);return await i.write.claimQuotePoolRebate([l,n,s],{gasLimit:I,gasPrice:f,value:u[0]})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}},Yt=async t=>{try{let{chainId:e,poolIds:n}=t;if(n.length===0)return;let a=g[e],s=await M(e),o=18;await A({account:s,chainId:e});let r=await j(e,n);if(!r)return;let u=r.map(T=>({poolId:T.poolId,oracleType:T.oracleType,publishTime:T.publishTime,oracleUpdateData:T?.vaa??"0"})),p=r.map(T=>T.value).reduce((T,F)=>F+T,0n),i={prices:u,value:p,poolIds:n,recipient:s},b=await v(e),I=await b.estimateGas.claimQuotePoolRebates([u,n,s],{value:p}),f=R(I,a.gasLimitRatio),{gasPrice:C}=await P(e),m=await b.write.claimQuotePoolRebates([u,n,s],{gasLimit:f,gasPrice:C,value:p});return await c(e).waitForTransactionReceipt({hash:m})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var $t=async(t,e)=>{if(e)try{let n=await Q(t),a=0n,s=await k(t,e);return s?.price&&(a=viem.parseUnits(s.price,30)),await n.read.getPoolTokenPrice([e,a])}catch(n){throw d(n),typeof n=="string"?n:await y(n)}};var Zt={};le(Zt,{getMarket:()=>Xt,getOracleFee:()=>Kt});var Xt=async(t,e)=>{try{return await A({chainId:t}),e?await(await oe(t)).read.getMarket([e]):void 0}catch(n){throw d(n),typeof n=="string"?n:await y(n)}};var Kt=async(t,e)=>{try{return await A({chainId:t}),e?await(await oe(t)).read.getOracleFee([e]):void 0}catch(n){throw d(n),typeof n=="string"?n:await y(n)}};var Zu={createPool:Se,getMarketPoolId:ne,getMarketPools:_e,getPoolInfo:ke,getUserGenesisShare:Ne,addTpSl:Fe,cancelTpSl:Be,reprime:Ue,getPoolDetail:D,getOpenOrders:Le};
|
|
1
|
+
'use strict';var viem=require('viem'),Pn=require('wretch'),ethersDecodeError=require('ethers-decode-error'),lodashEs=require('lodash-es');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Pn__default=/*#__PURE__*/_interopDefault(Pn);var tn=Object.defineProperty;var We=t=>{throw TypeError(t)};var le=(t,e)=>{for(var n in e)tn(t,n,{get:e[n],enumerable:true});};var Ve=(t,e,n)=>e.has(t)||We("Cannot "+n);var Je=(t,e,n)=>(Ve(t,e,"read from private field"),n?n.call(t):e.get(t)),He=(t,e,n)=>e.has(t)?We("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Ye=(t,e,n,a)=>(Ve(t,e,"write to private field"),e.set(t,n),n);var qt={};le(qt,{claimBasePoolRebate:()=>wt,claimBasePoolRebates:()=>vt,deposit:()=>kt,getLpPrice:()=>Lt,getRewards:()=>Ut,previewUserWithdrawData:()=>Dt,withdraw:()=>Bt,withdrawableLpAmount:()=>Ft});var $e=[{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:"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:"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,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:"recipient"}],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,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:"poolIds"},{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:"claimQuotePoolRebate",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:"recipient"}],outputs:[]},{type:"function",name:"claimQuotePoolRebates",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:"poolIds"},{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:"depositBase",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:"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:"depositQuote",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:"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:"executeTpsl",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:"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:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],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:"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:"withdrawBase",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:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"}]}],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:[]},{type:"function",name:"withdrawQuote",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:"uint256",name:"amountIn"},{type:"uint256",name:"minAmountOut"},{type:"address",name:"recipient"}]}],outputs:[]}];var an=(r=>(r[r.LINEA_SEPOLIA=59141]="LINEA_SEPOLIA",r[r.LINEA_MAINNET=59144]="LINEA_MAINNET",r[r.ARB_TESTNET=421614]="ARB_TESTNET",r[r.ARB_MAINNET=42161]="ARB_MAINNET",r[r.BSC_TESTNET=97]="BSC_TESTNET",r[r.BSC_MAINNET=56]="BSC_MAINNET",r))(an||{});var sn=[421614,59141,97,42161,59144,56];function je(t){return !!t&&sn.includes(t)}var N=10;var pa={42161:130n,421614:130n,59144:130n,59141:130n,56:150n,97:150n};var Xe={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)*N,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18}}};var Ke={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)*N,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18}}};var Ze={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)*N,nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18}}};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)*N,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18}}};var tt={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)*N,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18}}};var nt={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:1.3,gasAmountRatio:2,gasFeeReservedForCollateral:(5e-4+1)*N,nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18}}};var g={59141:Xe.chainInfo,421614:Ke.chainInfo,97:Ze.chainInfo,59144:et.chainInfo,42161:tt.chainInfo,56:nt.chainInfo};function de(t){let e=g[t];if(!e)throw new Error(`Could not find information with chain id ${t}`);return e}var ce={};function pn(t){if(!ce[t]){let e=de(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`);ce[t]={id:t,name:e.label||`Chain ${t}`,nativeCurrency:e.nativeCurrency,rpcUrls:{default:{http:n}}};}return ce[t]}var fe={};function c(t){if(!fe[t]){let e=de(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?viem.http(n[0]):viem.fallback(n.map(s=>viem.http(s)));fe[t]=viem.createPublicClient({chain:pn(t),transport:a});}return fe[t]}var st=null;function un(t){st=t;}async function O(t){let e=st;if(!e?.hasSigner())throw new Error("No signer: call auth({ signer }) or auth({ walletClient })");return e.getViemWalletClient(t)}var be=[{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:"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:"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,payable:false,inputs:[{type:"tuple",name:"params",components:[{type:"bytes32",name:"poolId"},{type:"string",name:"remark"}]}],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:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],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:"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:"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:"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:"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 S=[{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 ge=[{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 Ie=[{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 Ae=[{type:"constructor",payable:false,inputs:[]},{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:"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:"NotActiveBroker",inputs:[{type:"address",name:"broker"}]},{type:"error",name:"NotBrokerSigner",inputs:[{type:"address",name:"signer"}]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotOrderOwner",inputs:[]},{type:"error",name:"NotPositionOwner",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:"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:"event",anonymous:false,name:"UserFeeDataReset",inputs:[{type:"address",name:"broker",indexed:false},{type:"address",name:"signer",indexed:false},{type:"uint256",name:"epoch",indexed:false}]},{type:"event",anonymous:false,name:"UserFeeDataUpdated",inputs:[{type:"address",name:"broker",indexed:true},{type:"address",name:"signer",indexed:false},{type:"address",name:"user",indexed:false},{type:"uint256",name:"epoch",indexed:false},{type:"uint8",name:"tier",indexed:false},{type:"address",name:"referrer",indexed:false},{type:"uint32",name:"totalReferralRebatePct",indexed:false},{type:"uint32",name:"referrerRebatePct",indexed:false}]},{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:"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:"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:"currentFeeDataEpoch",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"uint256"}]},{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:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{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:"getUserFeeDataDigest",constant:true,stateMutability:"view",payable:false,inputs:[{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"}]}],outputs:[{type:"bytes32",name:"digest"}]},{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:"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:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{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:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{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:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{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:"uint8",name:"orderType"},{type:"uint8",name:"triggerType"},{type:"uint8",name:"operation"},{type:"uint8",name:"direction"},{type:"uint256",name:"collateralAmount"},{type:"uint256",name:"size"},{type:"uint256",name:"price"},{type:"uint8",name:"timeInForce"},{type:"bool",name:"postOnly"},{type:"uint16",name:"slippagePct"},{type:"uint16",name:"leverage"},{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:"renounceOwnership",constant:false,payable:false,inputs:[],outputs:[]},{type:"function",name:"resetAllUserFeeData",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:"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:"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:"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:"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:"updatePriceAndAdjustCollateral",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:"depositParams",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]},{type:"bytes32",name:"positionId"},{type:"int256",name:"adjustAmount"}],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"}]}],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:"userFeeData",constant:true,stateMutability:"view",payable:false,inputs:[{type:"uint256",name:"userFeeDataEpoch"},{type:"address",name:"user"}],outputs:[{type:"uint8",name:"tier"},{type:"address",name:"referrer"},{type:"uint32",name:"totalReferralRebatePct"},{type:"uint32",name:"referrerRebatePct"}]},{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"}]}];var Ce=[{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 Re=[{type:"constructor",payable:false,inputs:[]},{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:"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:"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:"getImplementation",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"address"}]},{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:"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:"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 Pe=[{type:"constructor",payable:false,inputs:[{type:"address",name:"addressManager"}]},{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"},{type:"address",name:"broker"}],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:"uint256",name:"tradingFee"},{type:"int256",name:"fundingFee"}]},{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 Ee=[{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 xe=[{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 Te=[{type:"constructor",payable:false,inputs:[]},{type:"error",name:"AddressEmptyCode",inputs:[{type:"address",name:"target"}]},{type:"error",name:"AlreadyVoted",inputs:[]},{type:"error",name:"BondNotReleased",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:"ChainIdMismatch",inputs:[]},{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:"InvalidAccountNonce",inputs:[{type:"address",name:"account"},{type:"uint256",name:"currentNonce"}]},{type:"error",name:"InvalidContractAddress",inputs:[]},{type:"error",name:"InvalidFunctionSignature",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParameter",inputs:[]},{type:"error",name:"InvalidPayloadLength",inputs:[{type:"uint256",name:"received"},{type:"uint256",name:"expected"}]},{type:"error",name:"InvalidPoolToken",inputs:[]},{type:"error",name:"InvalidProfitAmount",inputs:[]},{type:"error",name:"InvalidResponseVersion",inputs:[]},{type:"error",name:"InvalidSourceChain",inputs:[]},{type:"error",name:"NoChainResponse",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:"NumberOfResponsesMismatch",inputs:[]},{type:"error",name:"OnlyRelayer",inputs:[]},{type:"error",name:"PermissionDenied",inputs:[{type:"address",name:"caller"},{type:"address",name:"target"}]},{type:"error",name:"RequestTypeMismatch",inputs:[]},{type:"error",name:"RiskCloseNotCompleted",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{type:"address",name:"token"}]},{type:"error",name:"SignatureExpired",inputs:[]},{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:"error",name:"UnexpectedNumberOfResults",inputs:[]},{type:"error",name:"UnsupportedQueryType",inputs:[{type:"uint8",name:"received"}]},{type:"error",name:"UntrustfulVoting",inputs:[]},{type:"error",name:"VerificationFailed",inputs:[]},{type:"error",name:"VersionMismatch",inputs:[]},{type:"error",name:"WrongQueryType",inputs:[{type:"uint8",name:"received"},{type:"uint8",name:"expected"}]},{type:"error",name:"ZeroQueries",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:"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:"uint32",name:"voteCountRate"},{type:"uint32",name:"effectiveVoteRate"}]}]},{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:"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:"staker"},{type:"bytes4",name:"selector"}]}]},{type:"function",name:"UPGRADE_INTERFACE_VERSION",constant:true,stateMutability:"view",payable:false,inputs:[],outputs:[{type:"string"}]},{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"},{type:"bytes",name:"response"},{type:"tuple[]",name:"guardianSignatures",components:[{type:"bytes32",name:"r"},{type:"bytes32",name:"s"},{type:"uint8",name:"v"},{type:"uint8",name:"guardianIndex"}]}],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",name:"voteCountRate"},{type:"uint32",name:"effectiveVoteRate"}]}]},{type:"function",name:"getImplementation",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:"nonces",constant:true,stateMutability:"view",payable:false,inputs:[{type:"address",name:"owner"}],outputs:[{type:"uint256"}]},{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:"resolveCaseAppeals",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"bytes",name:"response"},{type:"tuple[]",name:"guardianSignatures",components:[{type:"bytes32",name:"r"},{type:"bytes32",name:"s"},{type:"uint8",name:"v"},{type:"uint8",name:"guardianIndex"}]}],outputs:[]},{type:"function",name:"resolveDispute",constant:false,payable:false,inputs:[{type:"uint256",name:"caseId"},{type:"bytes",name:"response"},{type:"tuple[]",name:"guardianSignatures",components:[{type:"bytes32",name:"r"},{type:"bytes32",name:"s"},{type:"uint8",name:"v"},{type:"uint8",name:"guardianIndex"}]}],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:"staker"},{type:"bytes4",name:"selector"}]}],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:"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:[]}];var rt=[{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 ot={USDC:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",POOL_MANAGER:"0xB131655F326E82753b0e76c1ce853E257524f3a4",Account:"0x0dF5950d0D89d808acC8B712Ed5d5A96fe6A3830",POSITION_MANAGER:"0xE6A51b8FC1b0e2a7f6ab8a0a85Ec4ab5210dF4fB",ORDER_MANAGER:"0xBD72c9F021F1eEA52Ac5dA378C9ffA3612Bfb687",PYTH:"0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF",ERC20:"0x7E248Ec1721639413A280d9E82e2862Cae2E6E28",LIQUIDITY_ROUTER:"0x0fb875c10fe2fF981e467765E3daaE4355b180D0",BASE_POOL:"0xeC0b3C76cC1C47f9B29313c706c1F6FD8D1C023f",QUOTE_POOL:"0x608Bfd6B8Df0807aA6d1500B76a3eAb3C9DFd728",ORACLE:"0xDa5f18BFeC36A397ad9c4AFc82ddfAb1429C66Be",EIP7702Delegation:"0x56Db3d459c8b9386f5B9ddFd91C0ef149200Cfc4",MARKET_MANAGER:"0xa7C6eD2b34a281463bEeE30b3784f9bc4696e7f1",DATA_PROVIDER:"0xdf535EF442a99B1b2C9fBd0a52D7d612234d123c",ORACLE_RESERVE:"0xf8fC5a3E721f83a75A319313C1A5eAa1bbC838FE",FORWARDER:"0x64A5099C3382f7fdA44F9D329faa86C27dA3D375",TRADING_ROUTER:"0x1168c934cFBDADF425280e890B5f2d47ddE778BE",REIMBURSEMENT:"0x6bAac84Ec2B9586A0Da460CC04dFB69efBe85724",DISPUTE_COURT:"0x51fF606E074637A8C7DDD276B3794a8205739b42"};var it={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"};var pt={USDC:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",POOL_MANAGER:"0x85e869d98216221807A06636541Ec93C9c0a4B0c",Account:"0xA2c5f49a8722408CDa79460CcEd5B97aDcA4cD56",POSITION_MANAGER:"0x68fE700557Fc766DF9b9959E11fd9DacA3f2ccdA",ORDER_MANAGER:"0xC2C479bfb9b6317D37d77C9A1867Af15a457B39D",PYTH:"0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",ERC20:"0xD984fd34f91F92DA0586e1bE82E262fF27DC431b",LIQUIDITY_ROUTER:"0xc5331ab0159379E6CfCC1f09b63360D0B9715D74",BASE_POOL:"0x8440a78E65F07D8013dd5B0640E0E713c8fd9893",QUOTE_POOL:"0x50F1F7A772672FE0637cF89AD3aFc093584eD040",ORACLE:"0x9F8e2296fa10d77897E7B252460d27b855eeD251",EIP7702Delegation:"0x9558a64E54de8294E7bcCBA62Ee7323c43473abb",MARKET_MANAGER:"0x3BEaaBc8ba2e117E5B66354F8F5D6dc97F71d434",DATA_PROVIDER:"0x7C672f90CCB8b3500F4285Bf22eBb3A98b4eFEB5",ORACLE_RESERVE:"0x27fd8356cE30Aae5440ce2B765beA5d2527efbAD",FORWARDER:"0xb7Bc467202C8C023ba064E368d979381BCfeD62E",TRADING_ROUTER:"0x2894Ea4ca2D177E6070Ad7b53Bf6C20C6BE83cd6",REIMBURSEMENT:"0x0C076Af7AC1861cf85a76eC8bdE4f67dbf23f2b2",DISPUTE_COURT:"0xbf9C0bbfd60e28906C5b1EB05875411A0Ba01435"};var ut={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"};var mt={USDC:"0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",POOL_MANAGER:"0x4F917ef137b573D9790b87e3cF6dfb698cF00c9c",Account:"0xE58CC82F96c86f8F809A98BE14D9DC929d503e25",POSITION_MANAGER:"0x7A5000A1DDE26520BfC893c676a288F98F8a029c",ORDER_MANAGER:"0x343d7563eFb904375Fea81BcC4A3eCdDc0CDa8C9",PYTH:"0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb",ERC20:"0xe944d7c0f7005a76E898Ee3B9Ec10479EbA9Cc02",LIQUIDITY_ROUTER:"0xe9F2E58562aD1D50AfB1eD92EAa6D367A6D0e552",BASE_POOL:"0x39506f97D1c1A91EAfD59368697E20dC1fE5eEDB",QUOTE_POOL:"0x80DAa474e7e2C9c86708e434B80636b92fb4e9EE",ORACLE:"0xB980765F0D5D3B482601F1a62Ec898619DA9c0C5",EIP7702Delegation:"0x9d43e7847f74E141E1A2B4C413D5F89520995551",MARKET_MANAGER:"0x624d1D5258b34d5C3F4f9CdCB7582F677643cdDC",DATA_PROVIDER:"0xb3c6b1448F04B3Eb9A5D83D6c32B0a10F3E7281B",ORACLE_RESERVE:"0x949e8a0284eA5509B47619e7667C3aA43B7c0336",FORWARDER:"0x73F9F9205E2F7E0Fb886afC3D2a53399C85383a5",TRADING_ROUTER:"0x0000000000000000000000000000000000000000",REIMBURSEMENT:"0x0000000000000000000000000000000000000000",DISPUTE_COURT:"0x0000000000000000000000000000000000000000"};var yt={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"};var re=Pn__default.default(),En=(t,e)=>e?(e=JSON.parse(JSON.stringify(e)),t.includes("?")?t+"&"+new URLSearchParams(e).toString():t+"?"+new URLSearchParams(e).toString()):t,L={get:(t,e,n={})=>{let a=En(t,e);return re.url(a).options(n).get().json()},post:(t,e,n={})=>re.url(t).options(n).post(e).json(),put:(t,e,n={})=>re.url(t).options(n).put(e).json(),delete:(t,e={})=>re.url(t).options(e).delete().json()};var xn=(i=>(i[i.SUCCESS=9200]="SUCCESS",i[i.SUCCESS_ORIGIN=0]="SUCCESS_ORIGIN",i[i.IDENTITY_VERIFICATION_FAILED=9401]="IDENTITY_VERIFICATION_FAILED",i[i.PERMISSION_DENIED=9403]="PERMISSION_DENIED",i[i.NOT_EXIST=9404]="NOT_EXIST",i[i.REQUEST_LIMIT=9429]="REQUEST_LIMIT",i[i.SERVICE_ERROR=9500]="SERVICE_ERROR",i[i.MISS_REQUESTED_PARAMETER=9900]="MISS_REQUESTED_PARAMETER",i[i.INVALID_PARAMETER=9901]="INVALID_PARAMETER",i.NETWORK_ERROR="ERR_NETWORK",i))(xn||{}),Tn=(o=>(o[o.Cook=0]="Cook",o[o.Primed=1]="Primed",o[o.Trench=2]="Trench",o[o.PreBench=3]="PreBench",o[o.Bench=4]="Bench",o))(Tn||{}),lt=(n=>(n[n.Chainlink=1]="Chainlink",n[n.Pyth=2]="Pyth",n))(lt||{}),wn=(p=>(p[p.Minute1=1]="Minute1",p[p.Minute5=5]="Minute5",p[p.Minute15=15]="Minute15",p[p.Minute30=30]="Minute30",p[p.Hour1=60]="Hour1",p[p.Hour4=240]="Hour4",p[p.Day1=1440]="Day1",p[p.Week1=10080]="Week1",p[p.Month1=40320]="Month1",p))(wn||{}),vn=(a=>(a[a.Contract=1]="Contract",a[a.Cook=2]="Cook",a[a.Earn=3]="Earn",a))(vn||{}),hn=(s=>(s[s.All=0]="All",s[s.Contract=1]="Contract",s[s.Cook=2]="Cook",s[s.Earn=3]="Earn",s))(hn||{}),Mn=(n=>(n[n.BlueChips=1]="BlueChips",n[n.Alpha=2]="Alpha",n))(Mn||{}),Dn=(a=>(a[a.BlueChips=1]="BlueChips",a[a.Alpha=2]="Alpha",a[a.Favorite=3]="Favorite",a))(Dn||{});var On=(s=>(s[s.Market=0]="Market",s[s.Limit=1]="Limit",s[s.Stop=2]="Stop",s[s.Conditional=3]="Conditional",s))(On||{}),_n=(n=>(n[n.Increase=0]="Increase",n[n.Decrease=1]="Decrease",n))(_n||{}),kn=(m=>(m[m.Increase=0]="Increase",m[m.Decrease=1]="Decrease",m[m.AddMargin=2]="AddMargin",m[m.RemoveMargin=3]="RemoveMargin",m[m.CancelOrder=4]="CancelOrder",m[m.ADL=5]="ADL",m[m.Liquidation=6]="Liquidation",m[m.MarketClose=7]="MarketClose",m[m.EarlyClose=8]="EarlyClose",m[m.AddTPSL=9]="AddTPSL",m[m.SecurityDeposit=10]="SecurityDeposit",m[m.TransferToWallet=11]="TransferToWallet",m[m.MarginAccountDeposit=12]="MarginAccountDeposit",m[m.ReferralReward=13]="ReferralReward",m[m.ReferralRewardClaim=14]="ReferralRewardClaim",m))(kn||{}),Sn=(a=>(a[a.Unknown=0]="Unknown",a[a.GTE=1]="GTE",a[a.LTE=2]="LTE",a))(Sn||{}),Nn=(n=>(n[n.Long=0]="Long",n[n.Short=1]="Short",n))(Nn||{}),Fn=(s=>(s[s.Cancelled=1]="Cancelled",s[s.Expired=2]="Expired",s[s.Successful=9]="Successful",s[s.PartialFilled=8]="PartialFilled",s))(Fn||{}),Bn=(p=>(p[p.Market=1]="Market",p[p.Limit=2]="Limit",p[p.TP=3]="TP",p[p.SL=4]="SL",p[p.ADL=5]="ADL",p[p.ADLTrigger=6]="ADLTrigger",p[p.Liquidation=7]="Liquidation",p[p.EarlyClose=8]="EarlyClose",p[p.MarketClose=9]="MarketClose",p))(Bn||{}),Un=(i=>(i[i.Open=0]="Open",i[i.PartialClose=1]="PartialClose",i[i.FullClose=2]="FullClose",i[i.Liquidation=3]="Liquidation",i[i.EarlyClose=4]="EarlyClose",i[i.MarketClose=5]="MarketClose",i[i.ADL=6]="ADL",i[i.TP=7]="TP",i[i.SL=8]="SL",i[i.Increase=9]="Increase",i))(Un||{}),Ln=(a=>(a[a.MarginAccount=1]="MarginAccount",a[a.WalletAccount=2]="WalletAccount",a[a.ReferralReward=3]="ReferralReward",a))(Ln||{});var qn=(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))(qn||{});var ss=async()=>L.get(`${G()}/openapi/gateway/scan/market/list`);var G=()=>{let{isTestnet:t,isBetaMode:e}=V?.getConfigManager()?.getConfig()||{};return e?"https://api-beta.myx.finance":t?"https://api-test.myx.cash":"https://api.myx.finance"},z=async(t,e=[])=>e.length?L.get(`${G()}/openapi/gateway/quote/price/oracles`,{chainId:t,poolIds:e.join(",")}):Promise.reject(new Error("Invalid pool id")),dt=async(t,e)=>await L.get(`${G()}/openapi/gateway/scan/market/info?chainId=${t}&poolId=${e}`),ct=async(t,e,n)=>await L.get(`${G()}/openapi/gateway/scan/market/pool-order/open?chainId=${n}`,void 0,{headers:{myx_openapi_access_token:t,myx_openapi_account:e}}),ps=async({chainId:t,poolIds:e},n)=>L.get(`${G()}/openapi/gateway/quote/candle/tickers`,{chainId:t,poolIds:e.join(",")}),us=async({...t})=>L.get(`${G()}/openapi/gateway/scan/market/base-details`,t),ms=async({...t})=>L.get(`${G()}/openapi/gateway/scan/market/detail`,t),ft=async()=>L.get(`${G()}/openapi/gateway/scan/market`);var te,we=class we{constructor(){this.version="1.0.10";He(this,te);}setConfigManager(e){Ye(this,te,e);}getConfigManager(){return Je(this,te)}setProvider(e){this.provider=e;}getProvider(){return this.provider}static getInstance(){return this._instance||(this._instance=new we),this._instance}async getMarkets(){try{let n=(await ft())?.data||[];return this.Markets=n,n}catch(e){throw e}}};te=new WeakMap;var ee=we,bt=ee.getInstance(),V=bt,Is=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 gt={USDC:"0x55d398326f99059fF775485246999027B3197955",POOL_MANAGER:"0x04218C23f89cAA2E4395a7Bd94410057705D1184",Account:"0x269cdAd14cf2cD3c720BC16ef0321700CccaC574",POSITION_MANAGER:"0x04218C23f89cAA2E4395a7Bd94410057705D1184",ORDER_MANAGER:"0x8d38a857390E1586481cF8994F4feBc315D0249b",PYTH:"0x4D7E825f80bDf85e913E0DD2A2D54927e9dE1594",ERC20:"0x55d398326f99059fF775485246999027B3197955",LIQUIDITY_ROUTER:"0x637dB5906E51e6e73fF6EF059870cf70B1874aa5",BASE_POOL:"0x6a775E908629eFC6357b3d89E5528524a6f378Dd",QUOTE_POOL:"0x73b2dcfdc7dC78a7A51B778E93c09FC173923BcE",ORACLE:"0xAdD60e47D2C5e7d57B1e5a3F9d24dE43933b8A7A",EIP7702Delegation:"0x798860BbBC6e011C5508f92a102ee53a44cECfb7",MARKET_MANAGER:"0x98Af86B194ce82cac650C87F45e5B9f7A4A40AB2",DATA_PROVIDER:"0x96955bE362b35846c2E7b9B40fC961080DCBbA67",ORACLE_RESERVE:"0xBFE7b174F4013e9f6526030EB0c52b094A237E6E",FORWARDER:"0xD0894e09317F455dd698A706bb62D783e95aA7Ad",TRADING_ROUTER:"0xb0c56a233535971b8903497f98b90Cf53aE77A13",REIMBURSEMENT:"0x5EFB5E4C3807b6152157DbF4Ae75c31F0Cdec478",DISPUTE_COURT:"0xEaAf5b9184C48486a6Fb51f70E101087598a95C8"};var h=t=>{let{isBetaMode:e}=V?.getConfigManager()?.getConfig()||{};switch(t){case 421614:return e?it:ot;case 59141:return e?ut:pt;case 97:return e?yt:mt;case 56:return gt;default:return {}}};var Ys=(t,e)=>{let n=c(t);return viem.getContract({address:e,abi:S,client:n})},It=async(t,e)=>{let n=await O(t);return viem.getContract({address:e,abi:S,client:n})},M=async t=>{let e=await O(t),[n]=await e.getAddresses();return n??void 0},v=async t=>{let e=h(t),n=await O(t);return viem.getContract({address:e.LIQUIDITY_ROUTER,abi:$e,client:n})},Y=(t,e=1)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.POOL_MANAGER,abi:be,client:a})):O(t).then(s=>viem.getContract({address:n.POOL_MANAGER,abi:be,client:s}))};var Q=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.QUOTE_POOL,abi:ge,client:a})):O(t).then(s=>viem.getContract({address:n.QUOTE_POOL,abi:ge,client:s}))},q=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.BASE_POOL,abi:Ie,client:a})):O(t).then(s=>viem.getContract({address:n.BASE_POOL,abi:Ie,client:s}))},$s=async(t,e)=>{let n=await O(t);return viem.getContract({address:e,abi:Ae,client:n})};var js=(t,e)=>{let n=c(t);return viem.getContract({address:e,abi:Ae,client:n})};var At=(t,e,n=0)=>{let a=n===0?c(t):null;return a?Promise.resolve(viem.getContract({address:e,abi:Ce,client:a})):O(t).then(s=>viem.getContract({address:e,abi:Ce,client:s}))},oe=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.MARKET_MANAGER,abi:Re,client:a})):O(t).then(s=>viem.getContract({address:n.MARKET_MANAGER,abi:Re,client:s}))},Ct=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.DATA_PROVIDER,abi:Pe,client:a})):O(t).then(s=>viem.getContract({address:n.DATA_PROVIDER,abi:Pe,client:s}))},Xs=async t=>{let e=h(t),n=await O(t);return viem.getContract({address:e.Account,abi:rt,client:n})},Ks=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.FORWARDER,abi:Ee,client:a})):O(t).then(s=>viem.getContract({address:n.FORWARDER,abi:Ee,client:s}))},Zs=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.REIMBURSEMENT,abi:xe,client:a})):O(t).then(s=>viem.getContract({address:n.REIMBURSEMENT,abi:xe,client:s}))},er=(t,e=0)=>{let n=h(t),a=e===0?c(t):null;return a?Promise.resolve(viem.getContract({address:n.DISPUTE_COURT,abi:Te,client:a})):O(t).then(s=>viem.getContract({address:n.DISPUTE_COURT,abi:Te,client:s}))};var $=null;function Gn(t){$=t;}function ve(){return $??{}}function he(){}function zn(...t){($?.log??$?.info??he)(...t);}function Qn(...t){($?.warn??he)(...t);}function d(...t){($?.error??he)(...t);}var Rt=class{constructor(e){this.options={...e,logLevel:e?.logLevel??"info"};}get out(){return this.options.sink??ve()}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);}};ethersDecodeError.ErrorDecoder.create();var w={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 Vn(t){let e=t;for(;e;){if(e.name==="UserRejectedRequestError")return true;e=e.cause;}return false}async function y(t){let e=t?.shortMessage||t?.details||t?.message;return typeof t=="string"?{error:t}:Vn(t)?{error:w[4001]}:{error:{code:t?.code||t?.name||"Unknow Error",message:e}}}var Pt=async(t,e,n)=>{try{return await c(t).readContract({address:n,abi:S,functionName:"balanceOf",args:[e]})}catch(a){throw d(a),a}};var Et=async(t,e,n,a,s)=>{try{return await c(t).readContract({address:n,abi:S,functionName:"allowance",args:[e,a]})>=s}catch(o){throw o}};var _=30,W=18;var R=(t,e)=>BigInt(t)*viem.parseUnits(e.toString(),8)/BigInt(10**8),P=async t=>{try{let e=g[t],a=await c(t).getGasPrice();if(a==null)throw new Error("Network Error");return {gasPrice:R(a,e.gasPriceRatio)}}catch(e){throw e}},J=(t,e=.01)=>{let n=viem.parseUnits("1",8)-viem.parseUnits(e.toString(),8);return t*n/BigInt(10**8)};var xt=async(t,e,n,a,s)=>{try{let o=g[t],r=await It(t,n);if(!r.write)throw new Error("Wallet client required for write");let u=await r.estimateGas.approve([a,s]),l=R(u,o.gasLimitRatio),{gasPrice:p}=await P(t),i=await r.write.approve([a,s],{gasLimit:l,gasPrice:p});await c(t).waitForTransactionReceipt({hash:i});}catch(o){throw o}};var A=async t=>{if("chainId"in t&&!je(t.chainId))throw new Error(w[1]);if("slippage"in t&&!(Number(t?.slippage)<=1&&Number(t?.slippage)>0))throw new Error(w[4003]);if("amount"in t&&(Number(t.amount)===Number.NaN||Number(t.amount)<0))throw new Error(w[4004]);let{tokenAddress:e,contractAddress:n,chainId:a,amount:s,decimals:o,account:r}=t;if(s&&a&&Number(o)>=0&&r){let u=viem.parseUnits(s.toString(),Number(o));if(e){let l=await Pt(a,r,e);if(!l||l<u)throw new Error(w[3])}n&&e&&(await Et(a,r,e,n,u)||await xt(a,r,e,n,viem.maxUint256));}};var Tt=async(t,e)=>await Promise.all(e.map(async a=>{let{publishTime:s,vaa:o,oracleType:r,nativeFee:u,price:l,poolId:p}=a,i=lodashEs.isNil(u)?1n:BigInt(u);return {poolId:p,price:l,value:i,publishTime:s,oracleType:r??2,vaa:o}})),j=async(t,e)=>{if(!e||!e.length)return;let n=await z(t,e);return await Tt(t,n.data)},k=async(t,e)=>{if(!e)return;let a=(await z(t,[e]))?.data?.[0];if(!a)throw new Error(`Unable to get price for ${e}`);return (await Tt(t,[a]))?.[0]};var wt=async t=>{try{let{chainId:e,poolId:n}=t,a=g[e],s=await M(e);await A({account:s,chainId:e});let o=await j(e,[n]);if(!o)return;let r=o.map(C=>C.value),u=o.map(C=>({poolId:n,oracleType:C.oracleType,publishTime:C.publishTime,oracleUpdateData:C?.vaa??"0"})),l={prices:u,values:r,poolId:n,recipient:s},p=await v(e),i=await p.estimateGas.claimBasePoolRebate([u,n,s],{value:r[0]}),b=R(i,a.gasLimitRatio),{gasPrice:I}=await P(e);return await p.write.claimBasePoolRebate([u,n,s],{gasLimit:b,gasPrice:I,value:r[0]})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}},vt=async t=>{try{let{chainId:e,poolIds:n}=t;if(n.length===0)return;let a=g[e],s=await M(e);await A({account:s,chainId:e});let o=await j(e,n);if(!o)return;let r=o.map(x=>({poolId:x.poolId,oracleType:x.oracleType,publishTime:x.publishTime,oracleUpdateData:x?.vaa??"0"})),l=o.map(x=>x.value).reduce((x,T)=>T+x,0n),p={prices:r,poolIds:n,value:l,recipient:s},i=await v(e),b=await i.estimateGas.claimBasePoolRebates([r,n,s],{value:l}),I=R(b,a.gasLimitRatio),{gasPrice:f}=await P(e),C=await i.write.claimBasePoolRebates([r,n,s],{gasLimit:I,gasPrice:f,value:l});return await c(e).waitForTransactionReceipt({hash:C})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var De=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{let s=g[t];return await(await q(t)).read.previewLpAmountOut([n,e,a])}catch(s){throw d(s),typeof s=="string"?s:await y(s)}},Mt=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{let s=g[t];return await(await q(t)).read.previewBaseAmountOut([n,e,a])}catch(s){throw d(s),typeof s=="string"?s:await y(s)}},Dt=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=g[t],o=18;await A({decimals:o,account:e,chainId:t,amount:Number(a)});let r=viem.parseUnits(a.toString(),o),l=(await z(t,[n])).data?.[0]?.price||"0",p=viem.parseUnits(l,30),b=await(await q(t)).read.previewUserWithdrawData([n,r,e,p]),[I,f]=b;return {baseAmountOut:I,rebateAmount:f}}catch(s){throw typeof s=="string"?s:await y(s)}};var D=async(t,e)=>{try{return !t||!e?void 0:(await dt(t,e)).data}catch(n){throw typeof n=="string"?n:await y(n)}};function Ot(t){return t.includes(".")?t.split(".")[1].length:0}var X=(t=.01,e=[],n=18,a)=>{if(e.length===0)return [];if(e.filter(o=>o.amount&&o.triggerPrice&&o.triggerType).length===0)throw new Error(w[4006]);return e.map(o=>{let r=viem.parseUnits(o.amount.toString(),n),u=viem.parseUnits(o.triggerPrice.toString(),30),l=Ot(o.triggerPrice.toString()),p=viem.parseUnits(o.triggerPrice.toString(),l),i=J(r*p*BigInt(10**a)/BigInt(10**(l+n)),t);return {amount:r,triggerPrice:u,triggerType:BigInt(o.triggerType),minQuoteOut:i}})};var kt=async t=>{try{let{poolId:e,chainId:n,amount:a,slippage:s=.01,tpsl:o=[]}=t;await A(t);let r=await D(n,e);if(!r)throw new Error(w[4006]);let u=r?.baseDecimals,l=r?.quoteDecimals,p=r?.baseToken,i=g[n],b=await M(n),f=h(n).BASE_POOL;await A({tokenAddress:p,contractAddress:f,decimals:u,account:b,chainId:n,amount:a});let C=!(Number(r?.state)===0||Number(r?.state)===1),m=[],x=viem.parseUnits(a.toString(),u),T=0n,F;if(C){let B=await k(n,e);if(!B)return;let en=viem.parseUnits(B.price,30);m.push({poolId:e,oracleType:B.oracleType,publishTime:BigInt(B.publishTime),oracleUpdateData:B.vaa}),F=await De({chainId:n,poolId:e,amountIn:x,price:en}),T=B.value;}else F=await De({chainId:n,poolId:e,amountIn:x});let K=o.map(B=>({amount:a,triggerPrice:B.triggerPrice,triggerType:B.triggerType})),ae=X(s,K,u,l),Z={poolId:e,amountIn:x,minAmountOut:J(F,s),recipient:b,tpslParams:ae},se=await v(n),ue=await se.estimateGas.depositBase([m,Z],{value:T}),me=R(ue,i.gasLimitRatio),{gasPrice:ye}=await P(n),Qe=await se.write.depositBase([m,Z],{gasLimit:me,gasPrice:ye,value:T});return await c(n).waitForTransactionReceipt({hash:Qe})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var ne=async({chainId:t,baseToken:e,marketId:n})=>{try{if(!e)throw new Error(w[2]);let a=h(t),s=await Y(t,0),o=[n,e],r=await s.read.getMarketPool(o);return r.poolId==="0x0000000000000000000000000000000000000000000000000000000000000000"||!r.poolId?void 0:r.poolId}catch(a){throw d(a),typeof a=="string"?a:await y(a)}},_e=async t=>{try{return await(await Y(t)).read.getPools()||[]}catch(e){throw d(e),typeof e=="string"?e:await y(e)}},ke=async(t,e,n=0n)=>{try{let s=await(await Ct(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 d(a),typeof a=="string"?a:await y(a)}};var Se=async({chainId:t,baseToken:e,marketId:n})=>{try{if(!e)throw new Error(w[2]);let a=g[t],s=await Y(t),o={marketId:n,baseToken:e},r=await s.estimateGas.deployPool([o]),u=R(r,a.gasLimitRatio),{gasPrice:l}=await P(t),p=await s.write.deployPool([o],{gasLimit:u,gasPrice:l});if(await c(t).waitForTransactionReceipt({hash:p}))return await ne({chainId:t,baseToken:e,marketId:n})}catch(a){throw typeof a=="string"?a:await y(a)}};var Ne=async(t,e,n)=>{try{return await(await At(t,e)).read.userGenesisShare([n])}catch(a){throw d(a),typeof a=="string"?a:await y(a)}};var Fe=async t=>{try{let{chainId:e,poolId:n,poolType:a,slippage:s=.01,tpsl:o=[]}=t;await A(t);let r=await D(e,n);if(!r)throw new Error(w[4006]);let u=18,l=r.quoteDecimals,p=X(s,o,u,l),i=g[e],b=await v(e),I={poolId:n,poolType:BigInt(a),tpslParams:p},f=await b.estimateGas.addTpsl([I]),C=R(f,i.gasLimitRatio),{gasPrice:m}=await P(e),x=await b.write.addTpsl([I],{gasLimit:C,gasPrice:m});return await c(e).waitForTransactionReceipt({hash:x})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Be=async t=>{try{let{chainId:e,orderId:n}=t;await A(t);let a=g[e],s=await v(e),o=await s.estimateGas.cancelTpsl([n]),r=R(o,a.gasLimitRatio),{gasPrice:u}=await P(e),l=await s.write.cancelTpsl([n],{gasLimit:r,gasPrice:u});return await c(e).waitForTransactionReceipt({hash:l})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};async function jn(t){try{return (await fetch(t,{method:"HEAD"})).ok}catch{return false}}var mi=async(t,e,n)=>{try{let a=c(t),s=e,[o,r,u,l]=await Promise.all([a.readContract({address:s,abi:S,functionName:"name"}),a.readContract({address:s,abi:S,functionName:"symbol"}),a.readContract({address:s,abi:S,functionName:"decimals"}),a.readContract({address:s,abi:S,functionName:"totalSupply"})]),p=viem.getAddress(s),i=`https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/${t}/assets/${p}/logo.png`,I=await jn(i)?i:"",f;if(n){let C=await a.readContract({address:s,abi:S,functionName:"balanceOf",args:[n]});f=Number(viem.formatUnits(C,Number(u)));}return {address:e,name:o,symbol:r,decimals:Number(u),icon:I,totalSupply:Number(viem.formatUnits(l,Number(u))),...n?{balance:f}:{}}}catch(a){throw d(a),a}};var Ue=async(t,e,n)=>{try{await A({chainId:t});let a=await D(t,e);if(!a)throw new Error(w[4006]);let s=await M(t),r=((V?.Markets?.length?V?.Markets:await V.getMarkets())||[])?.find(m=>m.chainId===t&&m.marketId===n);if(!r)throw new Error("Invalid Market");let u=viem.parseUnits(r.oracleFeeUsd.toString(),a.quoteDecimals);if(!u)throw new Error("Invalid Market");await A({tokenAddress:a.quoteToken,contractAddress:h(t).ORACLE_RESERVE,decimals:a.quoteDecimals,account:s,chainId:t,amount:Number(viem.formatUnits(u,a.quoteDecimals))});let l=g[t],p=await Y(t),i=await p.estimateGas.reprimePool([{poolId:e}]),b=R(i,l.gasLimitRatio),{gasPrice:I}=await P(t),f=await p.write.reprimePool([{poolId:e}],{gasLimit:b,gasPrice:I});return await c(t).waitForTransactionReceipt({hash:f})}catch(a){throw d(a),typeof a=="string"?a:await y(a)}};var Le=async(t,e)=>{try{let n=await ee.getInstance().getConfigManager()?.getAccessToken();if(!n)throw new Error("Failed to obtain accessToken");return (await ct(n,e,t)).data||[]}catch(n){throw d(n),n}};var qe=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{return await(await Q(t)).read.previewLpAmountOut([n,e,a])}catch(s){throw d(s),typeof s=="string"?s:await y(s)}},Nt=async({chainId:t,amountIn:e,poolId:n,price:a=0n})=>{try{return await(await Q(t)).read.previewQuoteAmountOut([n,e,a])}catch(s){throw d(s),typeof s=="string"?s:await y(s)}};var pe=async({amountIn:t,chainId:e,poolId:n,state:a,slippage:s,poolType:o,account:r})=>{let u=!(a===0||a===1),l=[],p=0n,i,b=o===0?Mt:Nt;if(u)try{let f=await k(e,n);if(f){let C=viem.parseUnits(f.price,30);l.push({poolId:n,oracleType:f.oracleType,publishTime:BigInt(f.publishTime),oracleUpdateData:f.vaa}),i=await b({chainId:e,poolId:n,amountIn:t,price:C}),p=f.value;}}catch(f){console.error(f),i=await b({chainId:e,poolId:n,amountIn:t});}else i=await b({chainId:e,poolId:n,amountIn:t});let I={poolId:n,amountIn:t,minAmountOut:J(i,s),recipient:r};return {price:l,data:I,value:p}};var Ft=async t=>{try{let{chainId:e,poolId:n,price:a}=t,s=a,o=await q(e);if(typeof a>"u"||a===null)try{let u=await k(e,n);s=viem.parseUnits(u?.price||"0",30);}catch{s=viem.parseUnits("0",30);}return await o.read.withdrawableLpAmount([n,s||0n])}catch(e){throw typeof e=="string"?e:await y(e)}},Bt=async t=>{try{let{chainId:e,poolId:n,amount:a,slippage:s=.01}=t,o=await D(e,n),r=o?.basePoolToken,u=g[e],l=await M(e),p=18;await A({tokenAddress:r,decimals:p,account:l,chainId:e,amount:a});let i=viem.parseUnits(a.toString(),p),{price:b,data:I,value:f}=await pe({poolId:n,chainId:e,account:l,amountIn:i,slippage:s,poolType:0,state:o?.state}),C=await v(e),m=await C.estimateGas.withdrawBase([b,I],{value:f}),x=R(m,u.gasLimitRatio),{gasPrice:T}=await P(e),F=await C.write.withdrawBase([b,I],{gasLimit:x,gasPrice:T,value:f});return await c(e).waitForTransactionReceipt({hash:F})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Ut=async t=>{try{let{chainId:e,account:n,poolId:a}=t;if(!e||!n||!a)return;let s=g[e],o=0n,u=(await z(e,[a])).data?.[0]?.price||"0",l=viem.parseUnits(u,30),i=await(await q(e)).read.pendingUserRebates([a,n,l]),[b,I]=i;return {rebates:b,genesisRebates:I}}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Lt=async(t,e)=>{if(e)try{let n=await q(t),a=0n,s=await k(t,e);return s?.price&&(a=viem.parseUnits(s.price,30)),await n.read.getPoolTokenPrice([e,a])}catch(n){throw typeof n=="string"?n:await y(n)}};var jt={};le(jt,{claimQuotePoolRebate:()=>Ht,claimQuotePoolRebates:()=>Yt,deposit:()=>zt,getLpPrice:()=>$t,getRewards:()=>Jt,transfer:()=>Vt,withdraw:()=>Wt,withdrawableLpAmount:()=>Qt});var zt=async t=>{try{let{poolId:e,chainId:n,amount:a,slippage:s=.01,tpsl:o=[]}=t;await A(t);let r=await D(n,e);if(!r)throw new Error(w[4006]);let u=g[n],l=await M(n),i=h(n).QUOTE_POOL,b=r.quoteToken,I=r?.quoteDecimals;await A({tokenAddress:b,contractAddress:i,decimals:I,account:l,chainId:n,amount:a});let f=viem.parseUnits(a.toString(),I),C=!(Number(r?.state)===0||Number(r?.state)===1),m=[],x=0n,T;if(C){let U=await k(n,e);if(!U)return;let B=viem.parseUnits(U.price,30);m.push({poolId:e,oracleType:U.oracleType,publishTime:BigInt(U.publishTime),oracleUpdateData:U.vaa}),T=await qe({chainId:n,poolId:e,amountIn:f,price:B}),x=U.value;}else T=await qe({chainId:n,poolId:e,amountIn:f});let F=o.map(U=>({amount:a,triggerPrice:U.triggerPrice,triggerType:U.triggerType})),K=X(s,F,I,I),ae={poolId:e,amountIn:f,minAmountOut:J(T,s),recipient:l,tpslParams:K},Z=await v(n),se=await Z.estimateGas.depositQuote([m,ae],{value:x}),ue=R(se,u.gasLimitRatio),{gasPrice:me}=await P(n),ye=await Z.write.depositQuote([m,ae],{gasLimit:ue,gasPrice:me,value:x});return await c(n).waitForTransactionReceipt({hash:ye})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Qt=async t=>{try{let{chainId:e,poolId:n,price:a}=t,s=a,o=await Q(e);if(typeof a>"u"||a===null)try{let u=await k(e,n);s=viem.parseUnits(u?.price||"0",30);}catch{s=viem.parseUnits("0",30);}return await o.read.withdrawableLpAmount([n,s||0n])}catch(e){throw d(e),typeof e=="string"?e:await y(e)}},Wt=async t=>{try{let{chainId:e,poolId:n,amount:a,slippage:s=.01}=t,o=await D(e,n),r=o?.quotePoolToken,u=g[e],l=await M(e),p=18;await A({tokenAddress:r,decimals:p,account:l,chainId:e,amount:a});let i=viem.parseUnits(a.toString(),p),{price:b,data:I,value:f}=await pe({poolId:n,chainId:e,account:l,amountIn:i,slippage:s,poolType:1,state:o?.state}),C=await v(e),m=await C.estimateGas.withdrawQuote([b,I],{value:f}),x=R(m,u.gasLimitRatio),{gasPrice:T}=await P(e),F=await C.write.withdrawQuote([b,I],{gasLimit:x,gasPrice:T,value:f});return await c(e).waitForTransactionReceipt({hash:F})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Vt=async(t,e,n,a)=>{try{let s=await D(t,e),o=await D(t,n);if(!o||!s)return null;if([3,4].includes(o.state))throw new Error(w[4005]);let r=await M(t),u=g[t],l=18;await A({chainId:t,amount:a,account:r,decimals:l,tokenAddress:s.quotePoolToken});let p={fromPoolId:e,toPoolId:n,minLpOut:0n,amount:viem.parseUnits(a.toString(),l)},i=await v(t),b=await i.estimateGas.migrateLiquidity([p]),I=R(b,u.gasLimitRatio),{gasPrice:f}=await P(t),C=await i.write.migrateLiquidity([p],{gasLimit:I,gasPrice:f});return await c(t).waitForTransactionReceipt({hash:C})}catch(s){throw typeof s=="string"?s:await y(s)}};var Jt=async t=>{try{let{chainId:e,account:n,poolId:a}=t;if(!e||!n||!a)return;let o=(await z(e,[a])).data?.[0]?.price||"0",r=viem.parseUnits(o,30);return await(await Q(e)).read.pendingUserRebates([a,n,r])}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var Ht=async t=>{try{let{chainId:e,poolId:n}=t,a=g[e],s=await M(e),o=18;await A({account:s,chainId:e});let r=await j(e,[n]);if(!r)return;let u=r.map(m=>m.value),l=r.map(m=>({poolId:m.poolId,oracleUpdateData:m?.vaa??"0",publishTime:m.publishTime,oracleType:m.oracleType})),p={prices:l,values:u,poolId:n,recipient:s},i=await v(e),b=await i.estimateGas.claimQuotePoolRebate([l,n,s],{value:u[0]}),I=R(b,a.gasLimitRatio),{gasPrice:f}=await P(e);return await i.write.claimQuotePoolRebate([l,n,s],{gasLimit:I,gasPrice:f,value:u[0]})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}},Yt=async t=>{try{let{chainId:e,poolIds:n}=t;if(n.length===0)return;let a=g[e],s=await M(e),o=18;await A({account:s,chainId:e});let r=await j(e,n);if(!r)return;let u=r.map(T=>({poolId:T.poolId,oracleType:T.oracleType,publishTime:T.publishTime,oracleUpdateData:T?.vaa??"0"})),p=r.map(T=>T.value).reduce((T,F)=>F+T,0n),i={prices:u,value:p,poolIds:n,recipient:s},b=await v(e),I=await b.estimateGas.claimQuotePoolRebates([u,n,s],{value:p}),f=R(I,a.gasLimitRatio),{gasPrice:C}=await P(e),m=await b.write.claimQuotePoolRebates([u,n,s],{gasLimit:f,gasPrice:C,value:p});return await c(e).waitForTransactionReceipt({hash:m})}catch(e){throw d(e),typeof e=="string"?e:await y(e)}};var $t=async(t,e)=>{if(e)try{let n=await Q(t),a=0n,s=await k(t,e);return s?.price&&(a=viem.parseUnits(s.price,30)),await n.read.getPoolTokenPrice([e,a])}catch(n){throw d(n),typeof n=="string"?n:await y(n)}};var Zt={};le(Zt,{getMarket:()=>Xt,getOracleFee:()=>Kt});var Xt=async(t,e)=>{try{return await A({chainId:t}),e?await(await oe(t)).read.getMarket([e]):void 0}catch(n){throw d(n),typeof n=="string"?n:await y(n)}};var Kt=async(t,e)=>{try{return await A({chainId:t}),e?await(await oe(t)).read.getOracleFee([e]):void 0}catch(n){throw d(n),typeof n=="string"?n:await y(n)}};var Zu={createPool:Se,getMarketPoolId:ne,getMarketPools:_e,getPoolInfo:ke,getUserGenesisShare:Ne,addTpSl:Fe,cancelTpSl:Be,reprime:Ue,getPoolDetail:D,getOpenOrders:Le};
|
|
2
2
|
Object.defineProperty(exports,"ra",{enumerable:true,get:function(){return viem.formatUnits}});Object.defineProperty(exports,"sa",{enumerable:true,get:function(){return viem.parseUnits}});exports.$=Gn;exports.A=Fn;exports.B=Bn;exports.C=Un;exports.D=Ln;exports.E=qn;exports.F=ss;exports.G=G;exports.H=z;exports.I=dt;exports.J=ct;exports.K=ps;exports.L=us;exports.M=ms;exports.N=ft;exports.O=ee;exports.P=Is;exports.Q=h;exports.R=Ys;exports.S=It;exports.T=$s;exports.U=js;exports.V=oe;exports.W=Ct;exports.X=Xs;exports.Y=Ks;exports.Z=Zs;exports._=er;exports.a=an;exports.aa=ve;exports.b=je;exports.ba=zn;exports.c=pa;exports.ca=Qn;exports.d=g;exports.da=d;exports.e=de;exports.ea=Rt;exports.f=c;exports.fa=y;exports.g=un;exports.ga=Pt;exports.h=O;exports.ha=Et;exports.i=Ae;exports.ia=_;exports.j=Ee;exports.ja=W;exports.k=Te;exports.ka=R;exports.l=rt;exports.la=P;exports.m=L;exports.ma=J;exports.n=xn;exports.na=xt;exports.o=Tn;exports.oa=j;exports.p=lt;exports.pa=k;exports.q=wn;exports.qa=mi;exports.r=vn;exports.s=hn;exports.t=Mn;exports.ta=qt;exports.u=Dn;exports.ua=jt;exports.v=On;exports.va=Zt;exports.w=_n;exports.wa=Zu;exports.x=kn;exports.y=Sn;exports.z=Nn;
|