PageSourceSearch

https://analitas.com/js/8386.590d877f.chunk.js

js analitas.com collected 2026-10-08 23:43:28 UTC 9,462 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[8386],{70063(t,a,e){e.d(a,{A:()=>r});var s=e(92047),i=e(74848);const r=(0,s.A)((0,i.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m.88 15.76V19h-1.75v-1.29c-.74-.18-2.39-.77-3.02-2.96l1.65-.67c.06.22.58 2.09 2.4 2.09.93 0 1.98-.48 1.98-1.61 0-.96-.7-1.46-2.28-2.03-1.1-.39-3.35-1.03-3.35-3.31 0-.1.01-2.4 2.62-2.96V5h1.75v1.24c1.84.32 2.51 1.79 2.66 2.23l-1.58.67c-.11-.35-.59-1.34-1.9-1.34-.7 0-1.81.37-1.81 1.39 0 .95.86 1.31 2.64 1.9 2.4.83 3.01 2.05 3.01 3.45 0 2.63-2.5 3.13-3.02 3.22"}),"Paid")},48386(t,a,e){e.a(t,async(t,s)=>{try{e.r(a),e.d(a,{default:()=>S});var i=e(96540),r=e(74209),n=e(46952),o=e(39353),c=e(51365),l=e(56310),d=e(70063),u=e(69634),m=e(6594),y=e(24985),p=e(48468),v=e(72425),b=e(74848),f=t([r]),k=f.then?(await f)():f;function h(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);a&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,s)}return e}function j(t){for(var a=1;a<arguments.length;a++){var e=null!=arguments[a]?arguments[a]:{};a%2?h(Object(e),!0).forEach(function(a){g(t,a,e[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):h(Object(e)).forEac
1h(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(e,a))})}return t}function g(t,a,e){return(a=x(a))in t?Object.defineProperty(t,a,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[a]=e,t}function x(t){var a=w(t,"string");return"symbol"==typeof a?a:a+""}function w(t,a){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var s=e.call(t,a||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===a?String:Number)(t)}r=k[0];const S=()=>{const{account:t,contracts:a,initialized:e,contractService:s}=(0,p.n)(),[f,k]=(0,i.useState)({totalStaked:"0",stakerCount:0,totalDividendsDistributed:"0",totalDividendsClaimed:"0",treasuryBalance:"0"}),[h,g]=(0,i.useState)({staked:"0",rewards:"0",timestamp:0,canUnstake:!1}),[x,w]=(0,i.useState)([]),[S,C]=(0,i.useState)(!1),[D,A]=(0,i.useState)(""),[T,N]=(0,i.useState)(""),P=async()=>{if(t&&e&&a)try{const e=await a.treasury.stakedBalance(t);g({staked:s.formatPOLI(e),rewards:"0",timestamp:0,canUnstake:!0});const i=await a.treasury.totalStaked(),r=await a.treasury.getStakerCount(),n=await a.treasury.getAddress(),o=a.mockUSDC||a.usdc;if(!o)throw new Error("USDC contract not initialized");const c=await o.balanceOf(n),l=await a.treasury.totalDividendsDistributed(),d=await a.treasury.totalDividendsClaimed();let u="0";try{let e=0n;for(let s=1;s<=10;s++)try{e+=await a.treasury.getClaimableAmount(s,t)}catch(t){break}u=s.formatUSDC(e)}catch(t){}k({totalStaked:s.formatPOLI(i),stakerCount:Number(r),totalDividendsDistributed:s.formatUSDC(l),totalDividendsClaimed:s.formatUSDC(d),treasuryBalance:s.formatUSDC(c)}),g(t=>j(j({},t),{},{pendingDividends:u}));const m=[];let y=0;try{y=await a.treasury.distributionCount()}catch(t){}const p=y>0?Number(y):10;for(let e=1;e<=p;e++)try{const i=await a.treasury.getDistributionInfo(e);if(i[3]){const r=await a.treasury.getClaimableAmount(e,t),n=await a.treasury.hasClaimed(e,t);m.push({id:e,totalAmount:s.formatUSDC(i[0]),tokenTotalSupply:s.formatPOLI(i[1]),timestamp:Number(i[2]),activated:i[3],claimableAmount:s.formatUSDC(r),claimed:n})}}catch(t){if(e>y)break}w(m.reverse())}catch(t){console.error("Error loading treasury data:",t)}};(0,i.useEffect)(()=>{P();const t=setInterval(P,3e4);return()=>clearInterval(t)},[t,e,a,s]);const O=()=>x.filter(t=>!t.claimed&&t.activated).reduce((t,a)=>t+parseFloat(a.claimableAmount),0).toFixed(2);return t?(0,b.jsxs)("div",{className:"web3-page treasury-page",children:[(0,b.jsx)(r.pU,{name:"Treasury",description:"Treasury staking and dividends"}),(0,b.jsx)(r.d8,{title:"Treasury",description:"Stake tokens in the treasury to earn rewards and receive dividend distributions",icon:(0,b.jsx)(n.A,{}),children:f&&(0,b.jsxs)("div",{className:"stats-container flex",children:[(0,b.jsx)(r.ro,{title:"Your Staked",value:"".concat((0,v.qC)((null==h?void 0:h.staked)||"0",2),' <span style="font-size: 0.6em; opacity: 0.7;">SIMPLE</span>'),isLoading:!1,tooltip:"Your treasury staked tokens",dangerouslySetInnerHTML:!0,icon:(0,b.jsx)(l.A,{})}),(0,b.jsx)(r.ro,{title:"Total Treasury Staked",value:"".concat((0,v.qC)(f.totalStaked,2),' <span style="font-size: 0.6em; opacity: 0.7;">SIMPLE</span>'),isLoading:!1,tooltip:"Total tokens staked in treasury",dangerouslySetInnerHTML:!0,icon:(0,b.jsx)(m.A,{})}),(0,b.jsx)(r.ro,{title:"Total Stakers",value:(0,v.qC)(f.stakerCount),isLoading:!1,tooltip:"Number of treasury stakers",icon:(0,b.jsx)(u.A,{})}),(0,b.jsx)(r.ro,{title:"Treasury Balance",value:"".concat((0,v.qC)(f.treasuryBalance,2),' <span style="font-size: 0.6em; opacity: 0.7;">USDC</span>'),isLoading:!1,tooltip:"Available USDC in treasury",dangerouslySetInnerHTML:!0,icon:(0,b.jsx)(n.A,{})})]})}),(0,b.jsxs)("div",{className:"treasury-actions",children:[(0,b.jsx)(r.d8,{title:"Stake Tokens",description:"Stake your tokens in the treasury",icon:(0,b.jsx)(l.A,{}),className:"action-section",children:(0,b.jsx)(r.ox,{type:"number",placeholder:"Amount to stake",value:D,onChange:t=>A(t.target.value),disabled:S,icon:(0,b.jsx)(l.A,{}),buttonText:S?"Staking...":"Stake",onClick:async()=>
1{if(D&&a){C(!0);try{const e=s.parsePOLI(D),i=await a.simpleToken.approve(a.treasury.target,e);await s.waitForTransaction(i);const r=await a.treasury.stake(e);await s.waitForTransaction(r),A("");const n=await a.treasury.stakedBalance(t);g(t=>j(j({},t),{},{staked:s.formatPOLI(n)}))}catch(t){console.error("Error staking:",t)}C(!1)}},isLoading:S,isDisabled:!D||parseFloat(D)<=0,buttonClassNames:"primary fit small",helperText:"Staking Duration: ".concat((()=>{if(null==h||!h.timestamp)return"0 days";const t=Math.floor((Date.now()-h.timestamp)/864e5);return"".concat(t," ").concat(1===t?"day":"days")})())})}),(0,b.jsx)(r.d8,{title:"Unstake Tokens",description:"Withdraw your staked tokens",icon:(0,b.jsx)(y.A,{}),className:"action-section",children:(0,b.jsx)(r.ox,{type:"number",placeholder:"Amount to unstake",value:T,onChange:t=>N(t.target.value),disabled:S,icon:(0,b.jsx)(y.A,{}),buttonText:S?"Unstaking...":"Unstake",onClick:async()=>{if(T&&a){C(!0);try{const e=s.parsePOLI(T),i=await a.treasury.unstake(e);await s.waitForTransaction(i),N("");const r=await a.treasury.stakedBalance(t);g(t=>j(j({},t),{},{staked:s.formatPOLI(r)}))}catch(t){console.error("Error unstaking:",t)}C(!1)}},isLoading:S,isDisabled:!T||parseFloat(T)<=0||!(null!=h&&h.canUnstake),buttonClassNames:"secondary fit small",helperText:"Available: ".concat((0,v.qC)((null==h?void 0:h.staked)||"0",2)," SIMPLE").concat(null!=h&&h.canUnstake?"":" (Locked)")})})]}),(0,b.jsxs)(r.d8,{title:"Dividend Distributions",icon:(0,b.jsx)(c.A,{}),className:"dividends-section",children:[(0,b.jsxs)("div",{className:"dividends-header",children:[(0,b.jsxs)("div",{className:"dividends-summary",children:[(0,b.jsxs)("div",{className:"summary-item",children:[(0,b.jsx)("span",{className:"label",children:"Total Distributed"}),(0,b.jsxs)("span",{className:"value",children:[(0,v.qC)((null==f?void 0:f.totalDividendsDistributed)||"0",2)," USDC"]})]}),(0,b.jsxs)("div",{className:"summary-item",children:[(0,b.jsx)("span",{className:"label",children:"Total Claimed"}),(0,b.jsxs)("span",{className:"value",children:[(0,v.qC)((null==f?void 0:f.totalDividendsClaimed)||"0",2)," USDC"]})]}),(0,b.jsxs)("div",{className:"summary-item",children:[(0,b.jsx)("span",{className:"label",children:"Your Pending"}),(0,b.jsxs)("span",{className:"value highlight",children:[O()," USDC"]})]})]}),x.some(t=>!t.claimed&&t.activated)&&(0,b.jsx)(r.K0,{icon:(0,b.jsx)(d.A,{}),text:"Claim All (".concat(O()," USDC)"),onClick:async()=>{C(!0);try{const t=x.filter(t=>!t.claimed&&t.activated).map(t=>t.id);for(const e of t){const t=await a.treasury.claimDividend(e);await t.wait()}await P()}catch(t){console.error("Error claiming all dividends:",t)}C(!1)},isLoading:S,classNames:"primary fit"})]}),(0,b.jsx)(r.XI,{headers:["Distribution","Total Amount","Your Share","Date","Status","Action"],data:x,isLoading:!1,totalItems:x.length,itemsPerPage:10,transformRow:e=>{return["#".concat(e.id),"".concat((0,v.qC)(e.totalAmount,2)," USDC"),"".concat((0,v.qC)(e.claimableAmount,2)," USDC"),(s=1e3*e.timestamp,new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})),(0,b.jsx)("span",{className:"status-badge ".concat(e.claimed?"claimed":"pending"),children:e.claimed?"Claimed":"Pending"}),!e.claimed&&e.activated?(0,b.jsx)(r.K0,{icon:(0,b.jsx)(d.A,{}),text:"Claim",onClick:()=>(async e=>{if(null!=a&&a.treasury&&t){C(!0);try{const t=await a.treasury.claimDividend(e);await t.wait(),await P()}catch(t){console.error("Error claiming dividend:",t)}finally{C(!1)}}})(e.id),isLoading:S,classNames:"primary fit small"}):(0,b.jsx)("span",{children:"—"})];var s},emptyStateTitle:"No Dividend Distributions",emptyStateDescription:"There are no dividend distributions available yet"})]})]}):(0,b.jsxs)("div",{className:"web3-page",children:[(0,b.jsx)(r.pU,{name:"Treasury",description:"Treasury staking and dividends"}),(0,b.jsx)(r.mV,{title:"Connect Your Wallet",description:"Please connect your MetaMask wallet to access the treasury.",icon:o.A})]})};s()}catch(C){s(C)}})}}]);

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.