1import{eO as V,eP as T,dq as k,dR as u,v as o,a1 as M,eQ as F,a5 as q,d$ as E,l as y,c8 as I,aG as H,ac as G}from"./index-hZR_pMzJ.js";function N(t,s,c){return t>0?`CL${t}-${s?.symbol}/${c?.symbol}`:`${t===0?"s":"v"}AMM-${s?.symbol}/${c?.symbol}`}function O(t,s,c,n){return H({chainId:t.id,address:t.superchainConfig.sugar,abi:G,functionName:"all",args:[BigInt(c),BigInt(n),s?0n:4n]}).then(d=>d.map(r=>({...r,chainId:t.id})))}async function x(t,s){const{limit:c,upperBound:n}=await V(t);return T({limit:c,upperBound:n,fetchData:O.bind(null,t,s)})}async function z(t,s){const c=100n,n=10000n,d=k(String(24n*60n*60n)),r=k(String(c*365n)),L=k("200"),v=new Date(Date.UTC(new Date().getUTCFullYear(),new Date().getUTCMonth(),new Date().getUTCDate()-((new Date().getUTCDay()+4)%7||7),23,59,59));return(t||[]).map(e=>{const a=s[`${e.chainId}:${e.token0.toLowerCase()}`],l=s[`${e.chainId}:${e.token1.toLowerCase()}`],m=s[`${e.chainId}:${e.emissions_token.toLowerCase()}`],b=a?.balance||0n,D=l?.balance||0n,g=e.type>0?u(e.pool_fee,n,0,0):u(e.pool_fee,c,0,0),f=u(c,g,0);e.created_at>0&&e.type===-1&&(e.token0_fees=e.token0_fees*e.liquidity/10n**18n,e.token1_fees=e.token1_fees*e.liquidity/10n**18n);const h=o(e.reserve0,a?.price||0n,a?.decimals)+o(e.reserve1,l?.price||0n,l?.decimals),_=o(e.token0_fees,a?.price||0n,a?.decimals)+o(e.token1_fees,l?.price||0n,l?.decimals),S=o(_,f),A=o(e.token0_fees,f,a?.decimals,e.decimals,a?.decimals),B=o(e.token1_fees,f,l?.decimals,e.decimals,l?.decimals);let C=0n,w=0n;if(h!==0n&&e.emissions!=0n){const i=o(e.emissions,m?.price||0n,m?.decimals),P=o(i,d,m?.decimals),U=o(e.staked0,a?.price||0n,a?.decimals)+o(e.staked1,l?.price||0n,l?.decimals);C=o(u(P,U,m?.decimals),r,m?.decimals)}const $=e.gauge!==M&&e.emissions>0n&&e.gauge_alive;if(h>L&&(e.created_at||$)){let i=0n;$?i=BigInt(Math.ceil(Date.now()/1e3)-v.valueOf()/1e3):i=BigInt(Math.ceil(Date.now()/1e3)-Number(e.created_at)),w=o(F(o(u(e.token0_fees,e.reserve0,a?.decimals,a?.decimals),u(e.token1_fees,e.reserve1,l?.decimals,l?.decimals)),18),u(365n*d,i,18,0))*100n}return{...e,symbol:N(e.type,s.all[`${e.chainId}:${e.token0.toLowerCase()}`],s.all[`${e.chainId}:${e.token1.toLowerCase()}`]),address:e.lp.toLowerCase(),factory:e.factory,superchainKey:`${e.chainId}:${e.lp.toLowerCase()}`,oldCL:q.concentrated(e.type)&&e.factory.toLowerCase()!==E[e.chainId].superchainConfig.slipstreamFactory.toLowerCase(),tvl:h,apr:C,feeApr:w,token0Balance:b,token1Balance:D,poolFee:g,feesValue:_,token0Volume:A,token1Volume:B,volume:S,accountAmount0:0n,accountAmount1:0n,accountValue:0n,accountStaked0:0n,accountStaked1:0n,accountStakedValue:0n}})}function K(t){const s=y.concat(t).flat(),c=y.orderBy(y.orderBy(s,[n=>n.symbol.split("-")[1]]),[n=>parseFloat(I(n.accountValue)),n=>parseFloat(I(n.accountStakedValue))],["desc","desc"]);return c.reduce((n,d)=>(n[d.chainId]||(n[d.chainId]=[]),n[d.chainId].push(d),n),{all:c})}export{x as fetchLps,K as mergePools,z as processPools,N as symbolize};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.