-
Notifications
You must be signed in to change notification settings - Fork 0
/
src__pages__PPP__List.async.js
1 lines (1 loc) · 10.9 KB
/
src__pages__PPP__List.async.js
1
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6119],{76255:function(e,t,r){r.r(t);var n=r(15009),o=r.n(n),s=r(99289),a=r.n(s),i=r(5574),u=r.n(i),c=r(80059),d=r(17346),l=r(64119),f=r(98165),p=r(11774),x=r(92340),m=r(59530),h=r(80507),v=r(45360),y=r(7134),k=r(9669),b=r.n(k),N=r(27484),S=r.n(N),j=r(62435),P=(r(8849),r(86074));t.default=function(){var e=(0,m.useDispatch)(),t=(0,m.useSelector)((function(e){return e.global.contractKit})),r=(0,m.useSelector)((function(e){return e.global.host})),n=(0,m.useSelector)((function(e){return e.ecosystem.pppDataSource})),s=(0,j.useState)(!0),i=u()(s,2),k=i[0],N=i[1],w=v.ZP.useMessage(),R=u()(w,2),_=R[0],g=R[1],D=(0,m.useIntl)().formatMessage({id:"ecosystem.update"}),T=(0,j.useCallback)(function(){var e=a()(o()().mark((function e(t){var r,n,s,a,i,u,c;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.load("swapswapswap");case 3:return r=e.sent,n=r.table("markets"),e.next=7,n.all();case 7:return s=e.sent,a=[],"usdtusdtusdt-USDT-8",u="eosio.token-DFS-8",c=[],(i={})["usdtusdtusdt-USDT-8"]=1,i[u]=(0,l.ri)(s[0].reserve0)/(0,l.ri)(s[0].reserve1),s.forEach((function(e){var t=e.contract0.toString()+"-"+e.sym0.toString().split(",")[1]+"-"+e.sym0.toString().split(",")[0],r=e.contract1.toString()+"-"+e.sym1.toString().split(",")[1]+"-"+e.sym1.toString().split(",")[0];a.includes(t)||a.push(t),a.includes(r)||a.push(r);var n=(0,l.ri)(e.reserve0),o=(0,l.ri)(e.reserve1);"eosio.token"===e.contract0.toString()?i.hasOwnProperty(r)||(i[r]=n/o*i[u]):"eosio.token"===e.contract1.toString()?i.hasOwnProperty(t)||(i[t]=o/n*i[u]):"usdtusdtusdt"===e.contract0.toString()?i.hasOwnProperty(r)||(i[r]=n/o):"usdtusdtusdt"===e.contract1.toString()?i.hasOwnProperty(t)||(i[t]=o/n):c.push({key0:t,key1:r,value0:n,value1:o})})),c.forEach((function(e){i.hasOwnProperty(e.key0)&&!i.hasOwnProperty(e.key1)?i[e.key1]=e.value0/e.value1*i[e.key0]:!i.hasOwnProperty(e.key0)&&i.hasOwnProperty(e.key1)?i[e.key0]=e.value1/e.value0*i[e.key1]:i.hasOwnProperty(e.key0)||i.hasOwnProperty(e.key1)||(i[e.key0]=0,i[e.key1]=0)})),Object.keys(i).forEach((function(e){Number.isNaN(i[e])&&(i[e]=0)})),e.abrupt("return",i);case 21:return e.prev=21,e.t0=e.catch(0),(0,l.Tv)(e.t0,_,"handleGetTokenPrice"),e.abrupt("return",{});case 25:case"end":return e.stop()}}),e,null,[[0,21]])})));return function(t){return e.apply(this,arguments)}}(),[l.Tv]),I=(0,j.useCallback)(a()(o()().mark((function e(){var t,n,s,a,i,c,d,f,p,x,m,v,y,k;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t={},n=1e3,s="1",a="";case 4:return e.next=7,(0,l.zI)(b().post("".concat(r,"/v2/chain/get_scope_rows"),{code:"dfspppreward",table:"rewardpools",lower_bound:s,primary_lower_bound:a,limit:n,index_position:"primary",key_type:"i64"}));case 7:if(i=e.sent,c=u()(i,2),d=c[0],f=c[1],d||200!==f.status){e.next=22;break}for(p=f.data.rows,x=0;x<p.length;++x)m=p[x].scope,v=h.VG.from(m),y=v.value.toNumber(),k=p[x].data,t.hasOwnProperty(y)||(t[y]=[]),t[y].push(k);if(!f.data.more){e.next=19;break}s=f.data.next_key,a=f.data.next_primary_key,e.next=20;break;case 19:return e.abrupt("break",26);case 20:e.next=24;break;case 22:return _.error(d),e.abrupt("break",26);case 24:e.next=4;break;case 26:return e.abrupt("return",t);case 27:case"end":return e.stop()}}),e)}))),[]),F=(0,j.useCallback)(function(){var t=a()(o()().mark((function t(r){var n,s,a,i,u,c,f,p,x,m,v,y,k,j,P;return o()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n="eosio.token-DFS-8",t.next=3,r.load("dfs3protocol");case 3:return s=t.sent,a=s.table("projects"),i=s.table("stat"),u=s.table("vaults"),t.next=9,a.all({scope:"dfs3protocol"});case 9:return c=t.sent,t.next=12,i.all({scope:"dfs3protocol"});case 12:return f=t.sent,t.next=15,u.all({scope:"dfs3protocol"});case 15:return p=t.sent,t.next=18,T(r);case 18:return x=t.sent,t.next=21,I();case 21:return m=t.sent,v={},Object.keys(m).forEach((function(e){var t,r=0;m[e].forEach((function(e){var t=e.cnt,n=h.xR.from(e.balance),o=t+"-"+n.symbol.name+"-"+n.symbol.precision;x.hasOwnProperty(o)&&(r+=x[o]*(0,l.ri)(n))})),t=r/x[n],v[e]={totalRewordValueUsdt:r,totalRewordValueDfs:t}})),t.next=26,b().get("https://api.dfs.land/dfschain/pppvolume2");case 26:200!==(y=t.sent).status&&_.error("获取pppvolume2数据失败"),k=y.data,j=[],c.forEach((function(e){k.hasOwnProperty(e.id.toString())&&j.push(e)})),j.sort((function(e,t){var r=e.id.toString(),n=t.id.toString();return k[n].volume_24h-k[r].volume_24h})),P=[],j.forEach((function(e,t){for(var r=e.id.toNumber(),o=e.creator.toString(),s=e.project_name,a=e.nft_name,i=e.nft_img,u=e.nft_bgm,c=e.desc,d=e.twitter,l=e.telegram,m=e.website,h=e.token_url,y=e.init_nft_number.toNumber(),k=e.init_nft_price.toString(),b=e.init_nft_price.value,N=e.init_nft_price.symbol,j=e.init_nft_price.symbol.precision,w=2*b,R=w+" "+N.name,_=e.token_per_nft.toString(),g=e.max_token_supply.toString(),D=e.round.toNumber(),T=e.mid.toNumber(),I=e.sec_to_burn_nft.toNumber(),F=e.sec_per_round.toNumber(),U=e.increase_per_round.toNumber(),O=U/100,E=e.trade_fee_ratio.toNumber(),C=S().utc(e.last_round.toString()).local().format("YYYY-MM-DDTHH:mm:ss"),M=S().utc(e.create_time.toString()).local().format("YYYY-MM-DDTHH:mm:ss"),Y=f.filter((function(e){return e.cid.toNumber()===r}))[0],V=Y.supply.toNumber(),H=Y.max_supply.toNumber(),B=100*(O-1-O*(E/1e4+.005)),A=Number((b*O).toFixed(j)),z=b;z*O<w;)z*=O;var Z=(2*A*(1-E/1e4-.005)-z)/z*100,q=31536e3/F*B,G=S().utc(e.last_round.toString()).add(F,"seconds").local(),K=G.valueOf(),W=G.format("YYYY-MM-DDTHH:mm:ss"),J=v[r]?v[r].totalRewordValueUsdt:0,L=v[r]?v[r].totalRewordValueDfs:0,Q=0,X=0,$=p.filter((function(e){return e.pid.toNumber()===r}));$.length&&(Q=$[0].quantity.value,X=x[n]*Q),P.push({key:t,id:r,creator:o,projectName:s,nftName:a,nftImg:i,nftBgm:u,desc:c,twitter:d,telegram:l,website:m,tokenUrl:h,initNftNumber:y,initNftPrice:k,splitNftPrice:R,tokenPerNft:_,maxTokenSupply:g,round:D,mid:T,secToBurnNft:I,secPerRound:F,increasePerRound:U,tradeFeeRatio:E,lastRound:C,createTime:M,nftSupply:V,nftMaxSupply:H,profitRate:B,profitRateSplit:Z,profitRateApr:q,nextRoundValue:K,nextRoundText:W,rewordPoolUsdt:J,rewordPoolDfs:L,vaultDfs:Q,vaultUsdt:X})})),e(d.N.setPPPDataSource(P)),N(!1);case 36:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),[t,T,I]),U=(0,j.useMemo)((function(){return[{title:"PID",dataIndex:"id",key:"id",sorter:function(e,t){return e.id-t.id},render:function(e,t){return(0,P.jsxs)("span",{children:["#",t.id]})}},{title:"项目",dataIndex:"id",key:"id",render:function(e,t){var r=t.nftImg;return(0,P.jsxs)("div",{children:[(0,P.jsxs)("div",{className:"flex",children:[(0,P.jsx)(y.C,{className:"mr-2",size:"large",shape:"square",src:r}),(0,P.jsxs)("div",{children:[(0,P.jsx)("div",{children:t.nftName}),(0,P.jsxs)("div",{children:["mid: ",t.mid]})]})]}),(0,P.jsx)("div",{children:t.projectName}),(0,P.jsxs)("div",{children:["@",t.creator]})]})}},{title:"下一轮倒计时",dataIndex:"nextRoundValue",key:"nextRoundValue",sorter:function(e,t){return e.nextRoundValue-t.nextRoundValue},render:function(e,t){var r=t.secPerRound/3600+" Hours";return(0,P.jsxs)("div",{children:[(0,P.jsx)(c.Wo,{className:"font-medium text-base",value:t.nextRoundValue}),(0,P.jsx)("div",{children:t.nextRoundText}),(0,P.jsx)("div",{children:r})]})}},{title:"流通量",dataIndex:"nftSupply",key:"nftSupply",sorter:function(e,t){return t.nftSupply-e.nftSupply},render:function(e,t){return(0,P.jsx)("div",{children:t.nftSupply})}},{title:"每轮涨幅",dataIndex:"increasePerRound",key:"increasePerRound",sorter:function(e,t){return e.increasePerRound-t.increasePerRound},render:function(e,t){var r=(t.increasePerRound-100).toFixed(2)+" %";return(0,P.jsx)("span",{children:r})}},{title:"手续费",dataIndex:"tradeFeeRatio",key:"tradeFeeRatio",sorter:function(e,t){return e.tradeFeeRatio-t.tradeFeeRatio},render:function(e,t){var r=t.tradeFeeRatio/100+" %";return(0,P.jsx)("span",{children:r})}},{title:"利润率",dataIndex:"profitRate",key:"profitRate",sorter:function(e,t){return t.profitRate-e.profitRate},render:function(e,t){var r=t.profitRate.toFixed(2)+" %",n=t.profitRateSplit.toFixed(2)+" %";return(0,P.jsxs)("div",{children:[(0,P.jsx)("div",{children:r}),(0,P.jsx)("div",{children:n})]})}},{title:"年化率",dataIndex:"profitRateApr",key:"profitRateApr",sorter:function(e,t){return t.profitRateApr-e.profitRateApr},render:function(e,t){var r=t.profitRateApr.toFixed(0)+" %";return(0,P.jsx)("div",{children:(0,P.jsx)("div",{children:r})})}},{title:"奖励池(DFS|USDT)",dataIndex:"rewordPoolUsdt",key:"rewordPoolUsdt",sorter:function(e,t){return t.rewordPoolUsdt-e.rewordPoolUsdt},render:function(e,t){return(0,P.jsxs)("div",{children:[(0,P.jsxs)("div",{children:[(0,l.CE)(t.rewordPoolDfs)," DFS"]}),(0,P.jsxs)("div",{children:[(0,l.CE)(t.rewordPoolUsdt)," USDT"]})]})}},{title:"金库(DFS|USDT)",dataIndex:"vaultDfs",key:"vaultDfs",sorter:function(e,t){return t.vaultDfs-e.vaultDfs},render:function(e,t){return(0,P.jsxs)("div",{children:[(0,P.jsxs)("div",{children:[(0,l.CE)(t.vaultDfs)," DFS"]}),(0,P.jsxs)("div",{children:[(0,l.CE)(t.vaultUsdt)," USDT"]})]})}},{title:"每轮时间",dataIndex:"secPerRound",key:"secPerRound",sorter:function(e,t){return e.secPerRound-t.secPerRound},render:function(e,t){var r=t.secPerRound/3600+" Hours";return(0,P.jsx)("span",{children:r})}},{title:"初始发行量",dataIndex:"initNftNumber",key:"initNftNumber",render:function(e,t){return(0,P.jsx)("span",{children:t.initNftNumber})}},{title:"最大发行量",dataIndex:"nftMaxSupply",key:"nftMaxSupply",render:function(e,t){return(0,P.jsx)("span",{children:t.nftMaxSupply})}},{title:"初始价格",dataIndex:"initNftPrice",key:"initNftPrice",render:function(e,t){var r=t.initNftPrice.split(" "),n=u()(r,2),o=n[0],s=n[1],a=(0,l.CE)(o)+" "+s;return(0,P.jsx)("span",{children:a})}},{title:"销毁时间",dataIndex:"secToBurnNft",key:"secToBurnNft",sorter:function(e,t){return e.secToBurnNft-t.secToBurnNft},render:function(e,t){var r=t.secToBurnNft/3600+" Hours";return(0,P.jsx)("span",{children:r})}},{title:"销毁兑换",dataIndex:"tokenPerNft",key:"tokenPerNft",render:function(e,t){var r=t.tokenPerNft.split(" "),n=u()(r,2),o=n[0],s=n[1],a=(0,l.CE)(o)+" "+s;return(0,P.jsxs)("div",{children:[(0,P.jsx)("div",{children:a}),(0,P.jsxs)("div",{children:["mid: ",t.mid]})]})}},{title:"创建时间",dataIndex:"createTime",key:"createTime",render:function(e,t){return(0,P.jsx)("span",{children:t.createTime})}}]}),[l.CE]);return(0,j.useEffect)((function(){t?(n.length?N(!1):N(!0),F(t)):N(!0)}),[t,F]),(0,P.jsxs)(p._z,{className:"ppp-list",ghost:!0,children:[(0,P.jsx)("div",{className:"flex justify-between items-center mb-2",children:(0,P.jsxs)("div",{children:[(0,P.jsx)(f.Z,{spin:k,className:"ml-[8px] hover:cursor-pointer",style:{color:"#1677ff"},onClick:function(){N(!0),F(t)}}),(0,P.jsxs)("span",{className:"ml-[8px]",children:[D,": ",S()().format().substring(0,19)]})]})}),(0,P.jsx)(x.Z,{className:"",scroll:{x:!0},size:"small",columns:U,dataSource:n,defaultData:[],search:!1,options:!1,pagination:{pageSize:50}}),g]})}},8849:function(){}}]);