(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[228],{76876:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/buy",function(){return s(58053)}])},83989:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(31134).Z)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},68655:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(31134).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},74598:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(31134).Z)("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},89346:function(e,t,s){"use strict";s.d(t,{Ol:function(){return l},SZ:function(){return o},Zb:function(){return i},aY:function(){return d},eW:function(){return u},ll:function(){return c}});var r=s(85893),n=s(67294),a=s(94777);let i=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,a.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",s),...n})});i.displayName="Card";let l=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,a.cn)("flex flex-col space-y-1.5 p-6",s),...n})});l.displayName="CardHeader";let c=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,r.jsx)("h3",{ref:t,className:(0,a.cn)("text-2xl font-semibold leading-none tracking-tight",s),...n})});c.displayName="CardTitle";let o=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,r.jsx)("p",{ref:t,className:(0,a.cn)("text-sm text-muted-foreground",s),...n})});o.displayName="CardDescription";let d=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,a.cn)("p-6 pt-0",s),...n})});d.displayName="CardContent";let u=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,a.cn)("flex items-center p-6 pt-0",s),...n})});u.displayName="CardFooter"},88860:function(e,t,s){"use strict";s.d(t,{I:function(){return i}});var r=s(85893),n=s(67294),a=s(94777);let i=n.forwardRef((e,t)=>{let{className:s,type:n,...i}=e;return(0,r.jsx)("input",{type:n,className:(0,a.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",s),ref:t,...i})});i.displayName="Input"},58053:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return O}});var r=s(85893),n=s(67294),a=s(34240),i=s(89346),l=s(98778),c=s(88860),o=s(68655),d=s(83989),u=s(74598),h=s(55678),m=s(25675),x=s.n(m),f=s(39332),p=s(82020),b=s(78033),g=s(89810),y=s(54124),N=s(39625),j=s(33305),v=s(1958),w=s(49321),k=s(3112),F=s(80419);function O(){let[e,t]=(0,n.useState)(""),[s,m]=(0,n.useState)(""),O=(0,F.p)(),C=(0,f.useSearchParams)(),{address:R,isConnected:M}=(0,p.Tj)(),{data:L}=(0,b.K)({address:R,chainId:56,query:{select:e=>(null==e?void 0:e.value)?parseFloat((0,N.d)(e.value)):0}}),{data:S}=(0,g.u)({address:k.OL,abi:k.pG,chainId:56,functionName:"getAmountOut",args:[(0,j.f)(e||"0")],query:{enabled:!!e&&e.length>0&&!isNaN(Number.parseFloat(e)),select:e=>e?parseFloat((0,N.d)(e)):0}}),{data:B}=(0,g.u)({address:k.I,abi:k.NX,chainId:56,functionName:"priceOf",args:[k.Xh],query:{refetchInterval:3e3,select:e=>e?parseFloat((0,N.d)(e)):0}}),{data:Z}=(0,g.u)({address:k.I,abi:k.NX,chainId:56,functionName:"priceOfBNB",query:{refetchInterval:3e3,select:e=>e?parseFloat((0,N.d)(e)):1}}),{writeContract:E}=(0,y.S)();return(0,n.useEffect)(()=>{if(O&&O!=v.DR&&(0,w.U)(O,{strict:!1})){m(O);return}let e=C.get("ref");e&&(0,w.U)(e,{strict:!1})?m(e):m(v.DR)},[C,O]),(0,r.jsx)(a.Z,{children:(0,r.jsxs)("div",{className:"w-full flex flex-col gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("h1",{className:"text-3xl font-bold text-white",children:"Buy LFG Tokens"}),(0,r.jsx)("p",{className:"text-gray-400",children:"Purchase LFG tokens using BNB"})]}),M?(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,r.jsxs)(i.Zb,{className:"bg-green-900/30 border-green-800/50 backdrop-blur-sm",children:[(0,r.jsxs)(i.Ol,{children:[(0,r.jsx)(i.ll,{className:"text-white",children:"Buy LFG"}),(0,r.jsx)(i.SZ,{className:"text-gray-400",children:"Enter the amount of BNB you want to spend"})]}),(0,r.jsxs)(i.aY,{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm text-gray-400",children:"Your BNB Balance:"}),(0,r.jsxs)("span",{className:"font-medium text-white",children:[(L||0).toFixed(4)," BNB"]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("label",{htmlFor:"bnb-amount",className:"text-sm text-gray-400",children:"BNB Amount"}),(0,r.jsx)(l.z,{variant:"ghost",size:"sm",className:"h-6 text-xs text-primary hover:text-primary hover:bg-primary/20",onClick:()=>{t(Math.max(0,(L||0)-.003).toFixed(6))},children:"MAX"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(c.I,{id:"bnb-amount",type:"number",placeholder:"0.0",value:e,onChange:e=>{t(e.target.value)},className:"bg-green-950/50 border-green-800 text-white"}),(0,r.jsx)("div",{className:"flex items-center gap-2 bg-green-950/50 border border-green-800 rounded-md px-3 py-2",children:(0,r.jsx)(x(),{src:"/icons/tokens/bnb.png",alt:"BNB",width:20,height:20,className:"rounded-full"})})]})]}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)(d.Z,{className:"text-primary h-6 w-6"})}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{htmlFor:"lfg-amount",className:"text-sm text-gray-400",children:"LFG Amount (Estimated)"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(c.I,{id:"lfg-amount",type:"text",readOnly:!0,value:S||0,className:"bg-green-950/50 border-green-800 text-white"}),(0,r.jsx)("div",{className:"flex items-center gap-2 bg-green-950/50 border border-green-800 rounded-md px-3 py-2",children:(0,r.jsx)(x(),{src:"/icons/lfg-logo.png",alt:"LFG",width:20,height:20,className:"rounded-full"})})]})]}),s&&s!=v.DR&&(0,r.jsxs)("div",{className:"flex items-center gap-2 bg-green-950/50 border border-green-800 rounded-md p-3",children:[(0,r.jsx)(u.Z,{className:"h-4 w-4 text-primary flex-shrink-0"}),(0,r.jsxs)("p",{className:"text-sm text-gray-300",children:["You were referred by: ",(0,r.jsx)("span",{className:"text-white font-medium",children:s})]})]})]}),(0,r.jsx)(i.eW,{children:(0,r.jsx)(l.z,{onClick:()=>{if(!e||0>=Number.parseFloat(e)){h.Am.error("Please enter a valid amount");return}E({address:k.OL,abi:k.pG,functionName:"buy",args:[s],chainId:56,value:(0,j.f)(e)},{onSuccess(e){console.log("Transaction successful:",e),h.Am.success("Successfully purchased LFG!")},onError(e){console.error("Transaction error:",e),h.Am.error("Transaction failed, please try again.")}})},className:"w-full bg-primary text-black hover:bg-primary/90 font-semibold",disabled:!e||0>=Number.parseFloat(e),children:"Buy LFG"})})]}),(0,r.jsxs)(i.Zb,{className:"bg-green-900/30 border-green-800/50 backdrop-blur-sm",children:[(0,r.jsx)(i.Ol,{children:(0,r.jsx)(i.ll,{className:"text-white",children:"About LFG"})}),(0,r.jsxs)(i.aY,{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)(x(),{src:"/icons/lfg-logo.png",alt:"LFG Token",width:64,height:64,className:"rounded-full"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-white font-semibold text-lg",children:"LFG Token"}),(0,r.jsx)("p",{className:"text-gray-400",children:"Let's F*cking Grow Protocol"})]})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center border-b border-green-800/30 pb-2",children:[(0,r.jsx)("span",{className:"text-gray-400",children:"Current Price"}),(0,r.jsxs)("span",{className:"text-white font-medium",children:["$",(B||0).toFixed(3)," USD"]})]}),(0,r.jsxs)("div",{className:"flex justify-between items-center border-b border-green-800/30 pb-2",children:[(0,r.jsx)("span",{className:"text-gray-400",children:"Market Cap"}),(0,r.jsxs)("span",{className:"text-white font-medium",children:["$",(5e5*(B||0)).toLocaleString([],{maximumFractionDigits:0})," USD"]})]}),(0,r.jsxs)("div",{className:"flex justify-between items-center border-b border-green-800/30 pb-2",children:[(0,r.jsx)("span",{className:"text-gray-400",children:"Total Supply"}),(0,r.jsx)("span",{className:"text-white font-medium",children:"500,000 LFG"})]}),(0,r.jsxs)("div",{className:"flex justify-between items-center",children:[(0,r.jsx)("span",{className:"text-gray-400",children:"Exchange Rate"}),(0,r.jsxs)("span",{className:"text-white font-medium",children:["1 BNB = ",((Z||1)/(B||1)).toFixed(2)," LFG"]})]})]}),(0,r.jsxs)("div",{className:"bg-green-950/50 border border-green-800 rounded-md p-4",children:[(0,r.jsxs)("h4",{className:"text-white font-medium mb-2 flex items-center gap-2",children:[(0,r.jsx)(u.Z,{className:"h-4 w-4 text-primary"}),"Token Utility"]}),(0,r.jsxs)("ul",{className:"text-gray-300 text-sm space-y-2",children:[(0,r.jsx)("li",{children:"• Stake LFG to earn high daily yields"}),(0,r.jsx)("li",{children:"• Participate in governance decisions"}),(0,r.jsx)("li",{children:"• Access premium features in the ecosystem"}),(0,r.jsx)("li",{children:"• Reduced fees on upcoming protocol services"})]})]})]})]})]})}):(0,r.jsx)(i.Zb,{className:"bg-green-900/30 border-green-800/50 backdrop-blur-sm",children:(0,r.jsxs)(i.aY,{className:"flex flex-col items-center justify-center py-12",children:[(0,r.jsx)("div",{className:"w-16 h-16 rounded-full bg-green-900/50 flex items-center justify-center mb-4",children:(0,r.jsx)(o.Z,{className:"h-8 w-8 text-primary"})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Connect Your Wallet"}),(0,r.jsx)("p",{className:"text-gray-400 text-center max-w-md mb-6",children:"Please connect your wallet to buy LFG tokens."}),(0,r.jsx)("appkit-connect-button",{})]})})]})})}},33305:function(e,t,s){"use strict";s.d(t,{f:function(){return a}});var r=s(84192),n=s(48120);function a(e,t="wei"){return(0,n.v)(e,r.ez[t])}},78033:function(e,t,s){"use strict";s.d(t,{K:function(){return c}});var r=s(88972),n=s(36100),a=s(1212),i=s(82002),l=s(37122);function c(e={}){let{address:t,query:s={}}=e,c=(0,l.Z)(e),o=(0,i.x)({config:c}),d=function(e,t={}){return{async queryFn({queryKey:t}){let{address:s,scopeKey:n,...a}=t[1];if(!s)throw Error("address is required");return await (0,r.s)(e,{...a,address:s})??null},queryKey:function(e={}){return["balance",(0,n.OP)(e)]}(t)}}(c,{...e,chainId:e.chainId??o}),u=!!(t&&(s.enabled??!0));return(0,a.aM)({...s,...d,enabled:u})}},54124:function(e,t,s){"use strict";s.d(t,{S:function(){return m}});var r=s(67294),n=s(59289),a=s(27037),i=s(7506),l=s(24139),c=class extends i.l{#e;#t=void 0;#s;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,l.VS)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,l.Ym)(t.mutationKey)!==(0,l.Ym)(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(e){this.#n(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#n(),this.#a()}mutate(e,t){return this.#r=t,this.#s?.removeObserver(this),this.#s=this.#e.getMutationCache().build(this.#e,this.options),this.#s.addObserver(this),this.#s.execute(e)}#n(){let e=this.#s?.state??(0,n.R)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#a(e){a.Vr.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,s=this.#t.context;e?.type==="success"?(this.#r.onSuccess?.(e.data,t,s),this.#r.onSettled?.(e.data,null,t,s)):e?.type==="error"&&(this.#r.onError?.(e.error,t,s),this.#r.onSettled?.(void 0,e.error,t,s))}this.listeners.forEach(e=>{e(this.#t)})})}},o=s(30202),d=s(86290),u=s(82693),h=s(37122);function m(e={}){var t;let{mutation:s}=e,n=(t=(0,h.Z)(e),{mutationFn:e=>(0,u.n)(t,e),mutationKey:["writeContract"]}),{mutate:i,mutateAsync:l,...m}=function(e,t){let s=(0,o.NL)(void 0),[n]=r.useState(()=>new c(s,e));r.useEffect(()=>{n.setOptions(e)},[n,e]);let i=r.useSyncExternalStore(r.useCallback(e=>n.subscribe(a.Vr.batchCalls(e)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),l=r.useCallback((e,t)=>{n.mutate(e,t).catch(d.Z)},[n]);if(i.error&&(0,d.L)(n.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:l,mutateAsync:i.mutate}}({...s,...n});return{...m,writeContract:i,writeContractAsync:l}}}},function(e){e.O(0,[9221,5666,6525,2888,9774,179],function(){return e(e.s=76876)}),_N_E=e.O()}]);