PageSourceSearch

https://aerodrome.finance/assets/index-BlWyLZW2.js

js aerodrome.finance collected 2026-10-02 06:14:43 UTC 14,913 bytes, 1 lines download raw bytes

1import{u as F,bS as P,p as R,a as c,l as B,cb as _,j as e,a6 as O,U as w,Y as S,a0 as T,D as f,Z as v,N as j,M as b,bP as U,F as C,A as g,I as W,J as $,aw as H,c3 as Y,n as N,bW as q,cc as J,cd as V,bD as Z,aR as G,bR as K,$ as Q,bH as X,c1 as ee,c2 as se,bU as te,f as ae,bT as re,bY as ne,aS as oe}from"./index-hZR_pMzJ.js";import{u as ce}from"./relay-BZxVB3RT.js";import{C as z}from"./Checkbox-BdWiQbp9.js";import{V as ie}from"./VeNFTSelect-CVa6CY7j.js";import{R as de}from"./RelayAvatar-Czze3b50.js";const M=c.createContext(void 0);function le({children:s}){const{address:a}=F(),[,r]=P("/relay/:id/:tab?"),n=r?.id,{data:t,error:o,isFetching:i}=R(),{data:l=[],error:d,refetch:x,isFetching:u}=ce(a,t,{refetchOnWindowFocus:!1,enabled:!!t}),h=c.useMemo(()=>{if(!B.isEmpty(l)&&n)return l.find(p=>p.relay.toLowerCase()===n.toLowerCase())},[l,n]),m=u||i;return c.useEffect(()=>{(o||d)&&toast.error(o||d)},[o,d]),c.useEffect(()=>{!h&&!m&&_("/locks")},[h,m]),e.jsx(M.Provider,{value:{relay:h,refetchRelays:x},children:h?s:e.jsx(O,{message:"Loading relay..."})})}function E(){const s=c.useContext(M);if(s===void 0)throw new Error("useRelayContext must be used within a RelayContextProvider");return s}function ue({venft:s,relay:a,setTx:r,refetchData:n,onPendingStateChange:t,onError:o}){return e.jsx(w,{write:{chainId:f.id,address:T,abi:S(["function depositManaged(uint, uint) external"]),functionName:"depositManaged",args:[s.id,a.venft_id]},successMessage:"Lock deposited",onSuccess:i=>{r(i),n()},onPendingStateChange:t,onError:o,autoExecute:!0,children:"Deposit lock"})}function xe({venft:s,relay:a,refetchData:r,setIsDepositing:n,setSuccess:t}){const[o,i]=c.useState(),[l,d]=c.useState(!1),[x,u]=c.useState(void 0);return c.useEffect(()=>{t(!!o)},[o]),e.jsxs(e.Fragment,{children:[e.jsx(v,{title:o?"Your lock has been deposited":"Confirm your lock relay deposit",success:!!o,loading:l,error:x,txId:o,chainId:f.id}),e.jsx("div",{className:"flex items-center gap-4 [&>*]:flex-1",children:o?e.jsx(j,{href:"/locks",color:"secondary",size:"lg",useButton:!0,children:"Manage locks"}):e.jsxs(e.Fragment,{children:[e.jsx(b,{color:"secondary",size:"lg",onClick:()=>n(!1),children:"Change lock"}),e.jsx(ue,{venft:s,relay:a,refetchData:r,setTx:i,onPendingStateChange:d,onError:u})]})})]})}function he({venft:s,refetchData:a,setIsDepositing:r}){const[n,t]=c.useState(!1),[o,i]=c.useState(void 0);return e.jsxs(e.Fragment,{children:[e.jsx(v,{title:"Lock needs a reset to continue",loading:n,error:o,chainId:f.id}),e.jsxs("div",{className:"flex items-center gap-4 [&>*]:flex-1",children:[e.jsx(b,{color:"secondary",size:"lg",onClick:()=>r(!1),children:"Back"}),e.jsx(U,{venft:s,refetchData:a,onPendingStateChange:t,onError:i,useButton:!0})]})]})}function me({venft:s,relay:a,refetchData:r,setIsDepositing:n,success:t,setSuccess:o}){return e.jsx("div",{className:"-m-px rounded-[17px] bg-gradient-to-b from-primary/50 to-background p-px",children:e.jsx("div",{className:"space-y-4 rounded-2xl bg-gradient-to-b from-accent-0 to-background p-5 sm:p-8",children:s.voted_at>0n&&!t?e.jsx(he,{venft:s,refetchData:r,setIsDepositing:n}):e.jsx(xe,{venft:s,relay:a,refetchData:r,setIsDepositing:n,setSuccess:o})})})}function fe({setVenftId:s,isDepositing:a,setIsDepositing:r,venfts:n,venft:t,success:o}){const[i,l]=c.useState(!1);return a&&t?e.jsx(C,{title:`Lock #${String(t.id)}`,onEdit:o?void 0:()=>r(!1),children:e.jsx("div",{className:"flex items-center gap-1.5 text-sm",children:e.jsx(g,{amount:t.amount,tokenAddress:t.token,chainId:f.id,symbolPrefix:"ve",showSymbol:!0,plain:!0})})}):e.jsxs("div",{className:"space-y-5 rounded-2xl bg-gradient-to-b from-accent-0 to-background p-5 sm:space-y-8 sm:p-8",children:[e.jsx(ie,{venfts:n,onSelect:d=>s(d?.id.toString()),selected:t,children:"Select the Lock you want to deposit"}),t&&t.epochStartedAt<=t.voted_at?e.jsx(W,{type:"error",icon:$,children:"Locks require a reset before depositing into Relay. Locks that voted this epoch, will have to wait for the next epoch to be reset and deposited."}):e.jsxs(e.Fragment,{children:[e.jsx(z,{checked:i,onChange:l,children:"I understand that by depositing my Lock into a Relay strategy, the Lock unlock date will be extended to 4 years."}),e.jsxs("div",{className:"flex items-center gap-4 [&>*]:flex-1",children:[e.jsx(j,{href:"/locks",color:"secondary",useButton:!0,size:"lg",children:"Back"}),e.jsx(b,{size:"lg",onClick:()=>r(!0),disabled:!t||!i,children:"Deposit lock"})]})]})]})}function I({relay:s,title:a}){const{isSm:r}=H();return e.jsxs("div",{className:"space-y-5 rounded-2xl bg-accent-0 p-5 sm:p-8",children:[e.jsx("h2",{className:"flex items-center gap-2 border-b border-accent-10 pb-5 text-lg font-semibold sm:text-xl",children:a}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(de,{relay:s}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(j,{href:"/locks",useButton:!0,pill:!0,color:"secondary",size:r?"md":"sm",children:"Change"})})]})]})}function pe(){const{address:s}=F(),{relay:a,refetchRelays:r}=E(),[n,t]=c.useState(!1),[o,i]=c.useState(!0),[l,d]=c.useState(),{data:x,error:u,refetch:h}=Y(s,{refetchOnWindowFocus:!1}),m=c.useMemo(()=>x?.find(y=>y.id.toString()===l),[x,l]),p=()=>{h(),r()};return c.useEffect(()=>{u&&toast.error(u)},[u]),e.jsxs(e.Fragment,{children:[e.jsx(I,{relay:a,title:"Relay deposit"}),e.jsx(fe,{venfts:x,venft:m,setVenftId:d,isDepositing:n,setIsDepositing:t,success:o}),n&&m&&e.jsx(me,{venft:m,relay:a,refetchData:p,setIsDepositing:t,success:o,setSuccess:i})]})}function ge({relay:s,toAddress:a,setTx:r,refetch:n,token:t,onPendingStateChange:o,onError:i}){const l={onSuccess:d=>{r(d),n()},successMessage:`Reward transferred to ${a}`,onPendingStateChange:o,onError:i,autoExecute:!0};return s.compounder?e.jsx(w,{write:{chainId:f.id,address:s.relay,abi:S(["function sweep(address[], address[]) external"]),functionName:"sweep",args:[[t.address],[a]],query:{enabled:N(a)}},...l,children:"Withdraw rewards"}):e.jsx(w,{write:{chainId:f.id,address:s.relay,abi:S(["function sweep(address, address, uint256) external"]),functionName:"sweep",args:[t.address,a,t.balance],query:{enabled:N(a)}},...l,children:"Withdraw rewards"})}function je({relay:s,token:a,toAddress:r,refetch:n,setIsSweeping:t,setSuccess:o}){const[i,l]=c.useState(),[d,x]=c.useState(!1),[u,h]=c.useState(void 0);return c.useEffect(()=>{o(!!i)},[i]),e.jsx("div",{className:"-m-px rounded-[17px] bg-gradient-to-b from-primary/50 to-background p-px",children:e.jsxs("div",{className:"space-y-4 rounded-2xl bg-gradient-to-b from-accent-0 to-background p-5 sm:p-8",children:[e.jsx(v,{title:i?"Relay rewards withdrawn":"Confirm reward withdrawal",success:!!i,loading:d,error:u,txId:i,chainId:f.id}),e.jsx("div",{className:"flex items-center gap-4 [&>*]:flex-1",children:i?e.jsx(j,{href:"/locks",color:"secondary",size:"lg",useButton:!0,children:"Manage locks"}):e.jsxs(e.Fragment,{children:[e.jsx(b,{color:"secondary",size:"lg",onClick:()=>t(!1),children:"Edit"}),e.jsx(ge,{relay:s,setTx:l,toAddress:r,refetch:n,token:a,onPendingStateChange:x,onError:h})]})})]})})}function be({relayTokensBalance:s,setSelectedReward:a,selectedReward:r,toAddress:n,setToAddress:t,isSweeping:o,setIsSweeping:i,success:l}){return o&&r?e.jsx(C,{title:"Transfer",onEdit:l?void 0:()=>i(!1),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{amount:r.balance,tokenAddress:r.address,chainId:r.chainId,showLogo:!0,showSymbol:!0,plain:!0}),e.jsx("span",{className:"text-accent-50",children:"to"})," ",e.jsx(q,{address:n,className:"font-sans"})]})}):e.jsxs("div",{className:"space-y-5 rounded-2xl bg-gradient-to-b from-accent-0 to-background p-5 sm:space-y-8 sm:p-8",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"text-sm font-semibold",children:"Rewards"}),e.jsx(J,{value:r,onChange:a,className:"space-y-0",children:s?.map(d=>e.jsxs(V,{value:d,className:"group flex cursor-pointer items-center justify-between gap-3 border-t border-accent-10 py-4 text-sm focus:outline-none",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex items-center justify-center rounded-full border border-accent-30 p-0.5 group-data-[checked]:border-primary group-data-[checked]:bg-primary",children:e.jsx(Z,{className:"invisible size-3 text-white group-data-[checked]:visible",strokeWidth:2})}),e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx(g,{amount:d.balance,tokenAddress:d.address,chainId:d.chainId,showLogo:!0,showSymbol:!0,plain:!0})})]}),e.jsx("div",{className:"text-accent-50",children:e.jsx(g,{amount:d.balance,tokenAddress:d.address,chainId:d.chainId,showLogo:!1,displayUsdOnly:!0})})]},d.address))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("span",{className:"text-sm font-semibold",children:"Transfer rewards to wallet address"}),e.jsx(G,{placeholder:"0x...",value:n,onChange:d=>t(d.target.value),endIcon:e.jsx(K,{className:"mr-3 size-5 text-accent-50",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex items-center gap-4 [&>*]:flex-1",children:[e.jsx(j,{href:"/locks",color:"secondary",useButton:!0,size:"lg",children:"Back"}),e.jsx(b,{size:"lg",onClick:()=>i(!0),disabled:!r||!N(n),children:"Withdraw rewards"})]})]})}function ye(){const{relay:s,refetchRelays:a}=E(),[r,n]=c.useState(""),[t,o]=c.useState(),[i,l]=c.useState(!1),[d,x]=c.useState(!0),{data:u,error:h}=R(s?.relay,{enabled:!!s}
1),m=u?.sorted?.filter(p=>p.balance!==0n);return c.useEffect(()=>{h&&toast.error(h)},[h]),e.jsxs(e.Fragment,{children:[e.jsx(I,{relay:s,title:"Withdraw rewards"}),e.jsx(be,{relayTokensBalance:m,selectedReward:t,toAddress:r,setToAddress:n,setSelectedReward:o,isSweeping:i,setIsSweeping:l,success:d}),i&&t&&r&&e.jsx(je,{relay:s,token:t,toAddress:r,refetch:a,setIsSweeping:l,setSuccess:x})]})}function ke({venft:s,refetch:a,setTx:r,onPendingStateChange:n,onError:t}){return e.jsx(w,{write:{chainId:f.id,address:T,abi:Q,functionName:"withdrawManaged",args:[s.id]},successMessage:"Lock withdrawn",onSuccess:o=>{r(o),a()},onPendingStateChange:n,onError:t,autoExecute:!0,children:"Withdraw lock"})}function we({venft:s,refetch:a,setIsWithdrawing:r,setSuccess:n}){const[t,o]=c.useState(),[i,l]=c.useState(!1),[d,x]=c.useState(void 0);return c.useEffect(()=>{n(!!t)},[t]),e.jsx("div",{className:"-m-px rounded-[17px] bg-gradient-to-b from-primary/50 to-background p-px",children:e.jsxs("div",{className:"space-y-4 rounded-2xl bg-gradient-to-b from-accent-0 to-background p-5 sm:p-8",children:[e.jsx(v,{title:t?"Your lock has been withdrawn":"Confirm your lock relay withdrawal",success:!!t,loading:i,error:d,txId:t,chainId:f.id}),e.jsx("div",{className:"flex items-center gap-4 [&>*]:flex-1",children:t?e.jsx(j,{href:"/locks",color:"secondary",size:"lg",useButton:!0,children:"Manage locks"}):e.jsxs(e.Fragment,{children:[e.jsx(b,{color:"secondary",size:"lg",onClick:()=>r(!1),children:"Back"}),e.jsx(ke,{venft:s,refetch:a,setTx:o,onPendingStateChange:l,onError:x})]})})]})})}function ve({rewards:s,compoundingConfirm:a,setCompoundingConfirm:r}){return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border-b border-accent-10 pb-4 text-sm font-semibold",children:"Rewards pending compounding"}),s.map(n=>e.jsxs("div",{className:"flex items-center justify-between border-b border-accent-10 pb-4 text-sm last:border-b-0",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx(g,{amount:n.balance,tokenAddress:n.address,chainId:n.chainId,showLogo:!0,showSymbol:!0,plain:!0})}),e.jsx("div",{className:"text-accent-50",children:e.jsx(g,{amount:n.balance,tokenAddress:n.address,chainId:n.chainId,showLogo:!1,displayUsdOnly:!0})})]},`toekn-${n.address}`))]}),e.jsxs(W,{type:"warning",icon:X,children:["There are rewards pending to be compounded. Please refer to the"," ",e.jsx(ee,{content:e.jsx(se,{}),children:e.jsx("span",{className:"cursor-pointer underline hover:opacity-80",children:"help section"})})," ","to understand when automations run the compounding."]}),e.jsx(z,{checked:a,onChange:r,children:"I understand that by withdrawing now I won't be able to claim later the compound from these rewards."})]})}function Se({relayVenft:s,rewards:a,isWithdrawing:r,setIsWithdrawing:n,compoundingConfirm:t,setCompoundingConfirm:o,success:i}){return r?e.jsx(C,{title:`Withdraw lock #${String(s.id)}`,onEdit:i?void 0:()=>n(!1),children:s.earned>0n&&e.jsx("div",{className:"flex items-center gap-1.5 text-sm",children:e.jsx(g,{amount:s.amount+s.earned,tokenAddress:s.token,chainId:f.id,symbolPrefix:"ve",showSymbol:!0,plain:!0})})}):e.jsxs("div",{className:"space-y-4 rounded-2xl bg-gradient-to-b from-accent-0 to-background p-4 sm:space-y-8 sm:p-8",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border-b border-accent-10 pb-4 text-sm font-semibold",children:"Selected lock"}),e.jsx(te,{venft:s})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border-b border-accent-10 pb-4 text-sm font-semibold",children:"Compounded rewards"}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("div",{children:e.jsx(g,{amount:s.earned??0n,tokenAddress:s.token,chainId:f.id,showSymbol:!0,plain:!0})}),e.jsx("div",{className:"text-accent-50",children:e.jsx(g,{amount:s.earned??0n,tokenAddress:s.token,chainId:f.id,showLogo:!1,displayUsdOnly:!0})})]})]}),a.length>0&&e.jsx(ve,{rewards:a,compoundingConfirm:t,setCompoundingConfirm:o}),e.jsxs("div",{className:"flex items-center gap-4 [&>*]:flex-1",children:[e.jsx(j,{href:"/locks",color:"secondary",useButton:!0,size:"lg",children:"Back"}),e.jsx(b,{size:"lg",onClick:()=>n(!0),disabled:!t,children:"Withdraw lock"})]})]})}function Ne(){const[s]=ae(),{relay:a,refetchRelays:r}=E(),n=s.get("id"),[t,o]=c.useState(!1),[i,l]=c.useState(!0),[d,x]=c.useState(!1),{data:u,error:h}=re(n?BigInt(n):void 0),{data:m,error:p}=R(a?.relay),y=c.useMemo(()=>m?m.sorted.filter(k=>k.balance!==0n):[],[m]),L=c.useMemo(()=>
1{if(!u||!a)return;const k=a.account_venfts.find(D=>D.id===u.id);return k?{...u,...k,expiresAt:ne().add(4,"years").unix()}:u},[u,a]);return c.useEffect(()=>{x(B.isEmpty(y))},[y]),c.useEffect(()=>{(h||p)&&toast.error(h||p)},[h,p]),L?e.jsxs(e.Fragment,{children:[e.jsx(I,{relay:a,title:"Relay withdraw"}),e.jsx(Se,{relayVenft:L,rewards:y,compoundingConfirm:d,setCompoundingConfirm:x,isWithdrawing:t,setIsWithdrawing:o,success:i}),t&&u&&e.jsx(we,{venft:u,refetch:r,setIsWithdrawing:o,setSuccess:l})]}):null}const A=["deposit","withdraw","sweeper"];function Ae(){const[,s]=P("/relay/:id/:tab?"),[,a]=oe(),r=s?.tab??A[0];return c.useEffect(()=>{s?.tab&&!A.includes(s.tab)&&a(`/relay/${s.id}`,{replace:!0})},[s,a]),e.jsx(le,{children:e.jsxs("div",{className:"mx-auto max-w-screen-sm space-y-2",children:[r==="deposit"&&e.jsx(pe,{}),r==="withdraw"&&e.jsx(Ne,{}),r==="sweeper"&&e.jsx(ye,{})]})})}export{Ae as default};

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.