2 lines
27 KiB
JavaScript
2 lines
27 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{225:function(e,t,a){e.exports=a(421)},420:function(e,t,a){},421:function(e,t,a){"use strict";a.r(t);var n=a(1),r=a.n(n),i=a(14),o=a.n(i),c=a(462),l=a(461),s=a(65),m=a.n(s),u=a(118),d=a(13),p=a(422),f=a(467),h=a(460),g=a(423),b=a(464),x=a(458),v=a(459),E=a(466),y=a(457),k="https://medium.com/block-science/cadcad-filling-a-critical-gap-in-open-source-data-science-fcd0d3faa8ed",j=Object(p.a)(function(e){return Object(f.a)({title:{},subtitle:{color:e.palette.text.secondary,margin:e.spacing(3,0,0)},subsubtitle:{color:e.palette.text.secondary,opacity:.6},lightBulb:{verticalAlign:"middle",marginRight:e.spacing(1)},link:{color:e.palette.primary.main},logoContainer:{display:"flex",alignItems:"center",justifyContent:"center",marginBottom:e.spacing(4)},logo:{width:"25px",marginRight:"4px"},logoText:{display:"inline",fontSize:"1.1rem",fontWeight:500}})});function O(){var e=j();return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:e.logoContainer},r.a.createElement("img",{src:"./favicon.ico",className:e.logo,alt:"logo"}),r.a.createElement(g.a,{className:e.logoText},"Commons Stack")),r.a.createElement(g.a,{className:e.title,variant:"h4"},"Augmented Token Bonding Curve Design"),r.a.createElement(g.a,{className:e.subtitle},"Experiment and test augmented token bonding curves"),r.a.createElement(g.a,{className:e.subsubtitle},"A narrative showcase of ",r.a.createElement(y.a,{href:k},"cadCAD"),"'s capabilities"))}var C=a(84),w=a(194),N=a(463),B=a(177),A=a.n(B),F=a(7),S=a(468),T=Object(F.a)({root:{height:8},thumb:{height:24,width:24,backgroundColor:"#fff",border:"2px solid currentColor",marginTop:-8,marginLeft:-12,"&:focus,&:hover,&$active":{boxShadow:"inherit"}},active:{},valueLabel:{left:"calc(-50% + 4px)"},track:{height:8,borderRadius:4},rail:{height:8,borderRadius:4},markLabel:{top:30}})(S.a),R=a(21),M=a(465),I=Object(p.a)(function(e){var t;return{container:{color:e.palette.text.secondary,display:"flex",marginLeft:"6px",fontSize:"0.9rem",cursor:"pointer",transition:"color ease 150ms","&:hover":{color:"#c3c9d0"}},popoverContainer:{padding:e.spacing(2),"& > p:not(:last-child)":{paddingBottom:e.spacing(1),marginBottom:e.spacing(1),borderBottom:"1px solid #3f5463"}},paper:(t={backgroundColor:"#384b59",maxWidth:.9*e.breakpoints.values.md},Object(R.a)(t,"@media screen and (max-width: ".concat(e.breakpoints.values.md,"px)"),{maxWidth:"90vw"}),Object(R.a)(t,"padding",e.spacing(.5)),t),descriptionBody:{color:"#dbdfe4"}}});function P(e){var t=e.content,a=e.popoverText,n=I(),i=r.a.useState(null),o=Object(d.a)(i,2),c=o[0],l=o[1];function s(){l(null)}var m=Boolean(c),u=m?"simple-popover":void 0;return r.a.createElement("div",{className:n.container},r.a.createElement("div",{"aria-describedby":u,onClick:function(e){l(e.currentTarget)}},r.a.createElement(g.a,{gutterBottom:!0},t)),r.a.createElement(M.a,{PaperProps:{className:n.paper},id:u,open:m,anchorEl:c,onClose:s,onClick:s,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"}},r.a.createElement(b.a,{className:n.popoverContainer},r.a.createElement(g.a,null,t),r.a.createElement(g.a,{className:n.descriptionBody},a))))}var D=Object(p.a)(function(e){return Object(f.a)({root:{margin:e.spacing(6,0,3)},lightBulb:{verticalAlign:"middle",marginRight:e.spacing(1)},leftContainer:{color:e.palette.text.secondary},centerContainer:{},listBoxContainer:{"& > div:not(:last-child)":{paddingBottom:"12px",marginBottom:"12px",borderBottom:"1px solid #313d47"}},listBox:{"& > div":{display:"flex",alignItems:"center","& p":{marginBottom:0}},"& > div:not(:last-child)":{paddingRight:"12px"}},slider:{color:e.palette.primary.main},secondaryColor:{color:e.palette.secondary.light}})});function V(e){var t=e.inputRef,a=e.onChange,n=e.prefix,i=e.suffix,o=Object(w.a)(e,["inputRef","onChange","prefix","suffix"]);return r.a.createElement(A.a,Object.assign({},o,{getInputRef:t,onValueChange:function(e){a({target:{value:e.value}})},thousandSeparator:!0,prefix:n,suffix:i}))}function H(e){var t=e.inputFields,a=e.onChangeCommited,n=D();return r.a.createElement("div",{className:n.listBoxContainer},t.map(function(e){var t=e.label,i=e.description,o=e.value,c=e.setter,l=e.min,s=e.max,m=e.step,u=e.prefix,d=e.suffix,p=e.secondaryColor,f=e.format,h=e.toText,g=e.toNum;function b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;isNaN(e)&&(e=0),e>s?e=s:e<l&&(e=l),c(e)}return r.a.createElement(v.a,{key:t,container:!0,spacing:0,className:n.listBox},r.a.createElement(v.a,{item:!0,xs:6,className:n.leftContainer},r.a.createElement(P,{content:t,popoverText:i})),r.a.createElement(v.a,{item:!0,xs:2,className:n.centerContainer},r.a.createElement(N.a,{onChange:function(e){b(g?g(e.target.value):parseFloat(e.target.value)),a()},InputProps:{inputComponent:V,disableUnderline:!0,inputProps:{prefix:u,suffix:d}},value:h?h(o):o})),r.a.createElement(v.a,{item:!0,xs:4},r.a.createElement(T,{className:"".concat(n.slider," ").concat(p?n.secondaryColor:""),valueLabelDisplay:"auto","aria-label":t,defaultValue:o,onChange:function(e,t){return b(Number(t))},onChangeCommitted:a,value:o,min:l,max:s,step:m,valueLabelFormat:function(e){return f(e).replace("$","")}})))}))}var L={theta:{name:"Allocation to funding pool",text:"The percentage of the funds raised in the Hatch sale that go directly into the project funding pool to compensate future work done in the project"},p0:{name:"Hatch price",text:"The price paid per 'ABC token' by community members involved in hatching the project"},p1:{name:"Post-hatch price",text:"The price of the 'ABC token' when the curve enters the open phase and is live for public participation"},wFee:{name:"Exit tribute",text:"The percentage of funds that are diverted to the project funding pool from community members who exit funds from the project by burning 'ABC tokens' in exchange for collateral"},d0:{name:"Initial raise",text:"Total funds raised in the hatch period of the ABC launch"}},W={price:{name:"Price",text:"Price of the token over time."},floorPrice:{name:"Floor price",text:"Lower bound of the price guaranteed by the vesting of hatch tokens. It decreases over time as more hatch tokens are allowed to be traded"},exitTributes:{name:"Total exit tributes",text:"Cumulative sum of exit tributes collected from only exit /sell transactions"}},z={totalReserve:{name:"Total reserve",text:"Total DAI in the smart contract reserve at the end of the simulated period"},initialHatchFunds:{name:"Funds generated from initial hatch",text:"Fraction of the funds (theta) raised during the hatch that go directly to the cause (analytic result)"},exitTributes:{name:"Funds generated from exit tributes",text:W.exitTributes.text},slippage:{name:"Average slippage",text:"Average of the slippage of each transaction occured during the simulation period"}};function K(e){var t=e.curveParams,a=e.setCurveParams,i=Object(n.useState)(.35),o=Object(d.a)(i,2),c=o[0],l=o[1],s=Object(n.useState)(.1),m=Object(d.a)(s,2),u=m[0],p=m[1],f=Object(n.useState)(.3),h=Object(d.a)(f,2),g=h[0],b=h[1],x=Object(n.useState)(.05),v=Object(d.a)(x,2),E=v[0],y=v[1];Object(n.useEffect)(function(){l(t.theta),p(t.p0),b(t.p1),y(t.wFee)},[t]);var k=10,j=[{label:"Allocation to funding pool",description:L.theta.text,value:c,setter:l,min:0,max:.9,step:.01,suffix:"%",format:function(e){return"".concat(Math.round(100*e),"%")},toText:function(e){return String(+(100*e).toFixed(0))},toNum:function(e){return.01*parseFloat(e)}},{label:"Hatch price (DAI/token)",description:L.p0.text,value:u,setter:function(e){p(e),g<e?b(e):g>e*k&&b(e*k)},min:.01,max:1,step:.01,toText:function(e){return String(+e.toFixed(2))},toNum:function(e){return parseFloat(e)},format:function(e){return"$".concat(e)}},{label:"Post-hatch price (DAI/token)",description:L.p1.text,value:g,setter:b,min:u||.1,max:Number((k*u).toFixed(2)),step:.01,toText:function(e){return String(+e.toFixed(2))},toNum:function(e){return parseFloat(e)},format:function(e){return"$".concat(e)}},{label:"Exit tribute",description:L.wFee.text,value:E,setter:y,min:0,max:.1,step:.001,suffix:"%",format:function(e){return"".concat(+(100*e).toFixed(1),"%")},toText:function(e){return String(+(100*e).toFixed(1))},toNum:function(e){return.01*parseFloat(e)}}];return r.a.createElement(H,{inputFields:j,onChangeCommited:function(){a(function(e){return Object(C.a)({},e,{theta:c,p0:u,p1:g,wFee:E})})}})}function $(e){var t=e.curveParams,a=e.setCurveParams,i=Object(n.useState)(3e6),o=Object(d.a)(i,2),c=o[0],l=o[1];Object(n.useEffect)(function(){l(t.d0)},[t]);var s=[{label:"Initial raise (DAI)",description:L.d0.text,value:c,setter:l,min:1e5,max:1e7,step:1e5,suffix:"M",format:function(e){return"$".concat(+(1e-6*e).toFixed(1),"M")},toText:function(e){return String(+(1e-6*e).toFixed(1))},toNum:function(e){return Math.floor(1e6*parseFloat(e))},secondaryColor:!0}];return r.a.createElement(H,{inputFields:s,onChangeCommited:function(){a(function(e){return Object(C.a)({},e,{d0:c})})}})}var q=a(15);function G(e){for(var t=e.from,a=void 0===t?0:t,n=e.to,r=e.steps,i=[],o=a;o<=n;o+=(n-a)/r)i.push(o);return i}function J(e,t){for(var a=[],n=(e[e.length-1]-e[0])/t,r=e[0];r<e[e.length-1];r+=n)a.push(r);return a.length<t+1&&a.push(e[e.length-1]),a}function U(e){return e[e.length-1]}function Q(e){return e.reduce(function(e,t){return e+Math.abs(t)},0)/e.length}function X(e){return new Promise(function(t){return setTimeout(t,e)})}var Y=a(64);function Z(e){var t=e.d0,a=e.theta,n=e.p0,r=e.p1/n/(1-a),i=(1-a)*t,o=t/n;return{k:r,R0:i,S0:o,V0:Math.pow(o,r)/i}}function _(e){var t=e.S,a=e.V0,n=e.k;return Math.pow(t,n)/a}function ee(e){var t=e.R,a=e.V0,n=e.k;return Math.pow(a*t,1/n)}function te(e){var t=e.S,a=e.H,n=e.V0,r=e.k;if(t===a){var i=ae({R:_({S:t,V0:n,k:r}),V0:n,k:r});return Math.abs(i)}return ae({R:_({S:t-a,V0:n,k:r}),V0:n,k:r})}function ae(e){var t=e.R,a=e.V0,n=e.k;return n*Math.pow(t,(n-1)/n)/Math.pow(a,1/n)}function ne(e){var t=e.R,a=e.deltaR,n=e.V0,r=e.k,i=Math.pow(n*t,1/r),o=a/(Math.pow(n*(t+a),1/r)-i),c=ae({R:t,V0:n,k:r});return Math.abs(o-c)/c}function re(e){var t=e.R,a=e.k,n=e.priceGrowth;return-t+Math.pow(n*Math.pow(t,1-1/a),a/(-1+a))}function ie(e){for(var t=e.sum,a=e.num,n=t/a,r=n*e.spread,i=[],o=0;o<a;o++)i.push(le(n-r,n+r));return i}function oe(e){var t=e.week,a=e.H,n=e.halflife;return t<e.cliff?0:a*(1-Math.pow(.5,1/n))}function ce(e,t){return Math.random()*(t-e)+e}function le(e,t){for(var a=0,n=0;0===a;)a=Math.random();for(;0===n;)n=Math.random();var r=Math.sqrt(-2*Math.log(a))*Math.cos(2*Math.PI*n);return((r=r/10+.5)>1||r<0)&&(r=le(e,t)),r*=t-e,r+=e}function se(e){var t=Math.floor(e.length/2),a=Object(Y.a)(e).sort(function(e,t){return e-t});return e.length%2!==0?a[t]:(a[t-1]+a[t])/2}var me=a(195),ue="x",de="Supply (tokens) / Reserve (DAI)",pe=Object(p.a)(function(e){return Object(f.a)({tooltip:{border:"1px solid #313d47",backgroundColor:"#384b59",padding:e.spacing(1),color:"#c7ccd2"}})});var fe=function(e){for(var t=e.theta,a=Z({d0:e.d0,theta:t,p0:e.p0,p1:e.p1}),n=a.k,i=a.R0,o=a.S0,c=a.V0,l=Math.round(i),s=function(e){return o*Math.pow(e/l,1/n)},m=4*l,u=Math.round((m-0)/100),p=Math.max(m,s(m)),f=p>5e8?[1e9,"B"]:p>5e5?[1e6,"M"]:p>500?[1e3,"K"]:[1,""],h=Object(d.a)(f,2),g=h[0],b=h[1],x=[],v=0;v<101;v++){var E,y=Math.round(0+u*v);x.push((E={},Object(R.a)(E,ue,y),Object(R.a)(E,de,s(y)),E))}var k=Object(me.a)(),j=pe(),O=function(e){return(+(e/g).toPrecision(2)).toLocaleString()};return r.a.createElement(q.f,{debounce:1},r.a.createElement(q.b,{width:0,height:400,data:x,margin:{top:10,right:30,left:0,bottom:0}},r.a.createElement(q.c,{strokeDasharray:"3 3"}),r.a.createElement(q.h,{interval:24,dataKey:ue,tickFormatter:O,unit:b,tick:{fill:k.palette.text.secondary},stroke:k.palette.text.secondary}),r.a.createElement(q.i,{interval:"preserveStartEnd",ticks:J(x.map(function(e){return e[de]}),3),tickFormatter:O,unit:b,tick:{fill:k.palette.text.secondary},domain:[0,s(m)],stroke:k.palette.text.secondary}),r.a.createElement(q.g,{content:r.a.createElement(function(e){var t=e.active,a=e.payload,i=e.label;if(t){var o=a[0].value,l=i,s=ae({R:l,V0:c,k:n}),m=[["Supply",O(o)+b,"tokens"],["Reserve",O(l)+b,"DAI"],["Price",s.toFixed(2),"DAI/token"]];return r.a.createElement("div",{className:j.tooltip},r.a.createElement("table",null,r.a.createElement("tbody",null,m.map(function(e){var t=Object(d.a)(e,3),a=t[0],n=t[1],i=t[2];return r.a.createElement("tr",{key:a},r.a.createElement("td",null,a),r.a.createElement("td",null,n),r.a.createElement("td",null,i))}))))}return null},null)}),r.a.createElement(q.a,{isAnimationActive:!1,type:"monotone",dataKey:de,stroke:k.palette.primary.main,fill:k.palette.primary.main,fillOpacity:.3,strokeWidth:2}),r.a.createElement(q.e,{x:l,stroke:k.palette.primary.main,strokeDasharray:"9 0",label:r.a.createElement(function(e){var t=e.textAnchor,a=e.viewBox;return r.a.createElement("text",{x:a.x+10,y:30,fill:k.palette.text.secondary,textAnchor:t},"Initial value")},null)}),r.a.createElement(q.d,{formatter:function(e){return r.a.createElement("span",{style:{color:k.palette.text.secondary}},e)}})))},he=Object(p.a)(function(e){return Object(f.a)({root:{margin:e.spacing(6,0,3)},lightBulb:{verticalAlign:"middle",marginRight:e.spacing(1)},leftContainer:{color:e.palette.text.secondary},centerContainer:{},listBoxContainer:{"& > div:not(:last-child)":{marginBottom:"12px",borderBottom:"1px solid #313d47"}},listBox:{paddingBottom:"12px","& > div":{display:"flex",alignItems:"center","& p":{marginBottom:0}},"& > div:not(:last-child)":{paddingRight:"12px"}}})});function ge(e){var t=e.resultFields,a=he();return r.a.createElement("div",{className:a.listBoxContainer},t.map(function(e){var t=e.label,n=e.description,i=e.value;return r.a.createElement(v.a,{key:t,container:!0,spacing:0,className:a.listBox},r.a.createElement(v.a,{item:!0,xs:8,className:a.leftContainer},r.a.createElement(P,{content:t,popoverText:n})),r.a.createElement(v.a,{item:!0,xs:4,className:a.centerContainer},r.a.createElement(g.a,{gutterBottom:!0},i)))}))}var be="x",xe="Price (DAI/token)",ve="Total exit tributes (DAI)",Ee="Floor price (DAI/token)",ye=Object(p.a)(function(e){return Object(f.a)({tooltip:{border:"1px solid #313d47",backgroundColor:"#384b59",padding:e.spacing(1),color:"#c7ccd2"}})});var ke=function(e){for(var t=e.priceTimeseries,a=e.withdrawFeeTimeseries,n=e.floorpriceTimeseries,i=e.p0,o=e.p1,c=[],l=0;l<t.length;l++){var s;c.push((s={},Object(R.a)(s,be,l),Object(R.a)(s,xe,t[l]||0),Object(R.a)(s,Ee,n[l]||0),Object(R.a)(s,ve,a[l]||0),s))}var m=Object(me.a)(),u=ye(),p=function(e){return(+e.toPrecision(3)).toLocaleString()};function f(e){var t=e.textAnchor,a=e.viewBox,n=e.text;return r.a.createElement("text",{x:a.x+8,y:a.y+17,fill:m.palette.text.secondary,textAnchor:t},n)}return r.a.createElement(q.f,{debounce:1},r.a.createElement(q.b,{width:0,height:400,data:c,margin:{top:10,right:30,left:0,bottom:0}},r.a.createElement(q.c,{strokeDasharray:"3 3"}),r.a.createElement(q.h,{dataKey:be,tick:{fill:m.palette.text.secondary},stroke:m.palette.text.secondary,ticks:[].concat(Object(Y.a)(G({to:t.length,steps:4}).map(Math.floor)),[t.length-1])}),r.a.createElement(q.i,{yAxisId:"left",domain:[0,Math.max.apply(Math,Object(Y.a)(t).concat([1.25*o]))],tickFormatter:p,tick:{fill:m.palette.text.secondary},stroke:m.palette.text.secondary}),r.a.createElement(q.i,{yAxisId:"right",domain:[0,+(2*a.slice(-1)[0]).toPrecision(1)],orientation:"right",tick:{fill:m.palette.text.secondary},tickFormatter:p,stroke:m.palette.text.secondary}),r.a.createElement(q.g,{content:r.a.createElement(function(e){var t=e.active,a=e.payload,n=e.label;if(t){var i=a[0].value,o=a[1].value,c=a[2].value,l=n,s=[["Price",i.toFixed(2),"DAI/tk"],["Floor",o.toFixed(2),"DAI/tk"],["Exit t.",p(c),"DAI"],["Week",l,""]];return r.a.createElement("div",{className:u.tooltip},r.a.createElement("table",null,r.a.createElement("tbody",null,s.map(function(e){var t=Object(d.a)(e,3),a=t[0],n=t[1],i=t[2];return r.a.createElement("tr",{key:a},r.a.createElement("td",null,a),r.a.createElement("td",null,n),r.a.createElement("td",null,i))}))))}return null},null)}),r.a.createElement(q.a,{isAnimationActive:!1,yAxisId:"left",type:"monotone",dataKey:xe,stroke:m.palette.primary.main,fill:m.palette.primary.main,fillOpacity:.3,strokeWidth:2}),r.a.createElement(q.a,{isAnimationActive:!1,yAxisId:"left",type:"monotone",dataKey:Ee,stroke:"#adcd2e",fill:"#adcd2e",fillOpacity:.05,strokeWidth:2}),r.a.createElement(q.e,{y:i,yAxisId:"left",stroke:m.palette.primary.main,strokeDasharray:"9 0",label:r.a.createElement(f,{text:"Hatch sale price"})}),r.a.createElement(q.e,{y:o,yAxisId:"left",stroke:m.palette.primary.main,strokeDasharray:"9 0",label:r.a.createElement(f,{text:"After hatch price"})}),r.a.createElement(q.a,{isAnimationActive:!1,yAxisId:"right",type:"monotone",dataKey:ve,stroke:"#0085ff",fill:m.palette.secondary.dark,fillOpacity:.5,strokeWidth:2}),r.a.createElement(q.d,{formatter:function(e){return r.a.createElement("span",{style:{color:m.palette.text.secondary}},e)}})))},je=a(190),Oe=a.n(je),Ce=Object(p.a)(function(e){return{container:{display:"flex",marginLeft:"6px",fontSize:"0.9rem",cursor:"pointer",transition:"opacity ease 150ms",opacity:.2,"&:hover":{opacity:.85}},popoverContainer:{padding:e.spacing(2)},paper:Object(R.a)({backgroundColor:"#384b59",maxWidth:.9*e.breakpoints.values.md},"@media screen and (max-width: ".concat(e.breakpoints.values.md,"px)"),{maxWidth:"90vw"})}});function we(e){var t=e.text,a=Ce(),n=r.a.useState(null),i=Object(d.a)(n,2),o=i[0],c=i[1];function l(){c(null)}var s=Boolean(o),m=s?"simple-popover":void 0;return r.a.createElement("div",{className:a.container},r.a.createElement(Oe.a,{onClick:function(e){c(e.currentTarget)}}),r.a.createElement(M.a,{PaperProps:{className:a.paper},id:m,open:s,anchorEl:o,onClose:l,onClick:l,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"}},r.a.createElement(b.a,{className:a.popoverContainer},t)))}var Ne=a(191),Be=(a(420),Object(p.a)(function(e){return Object(f.a)({mainContainer:{"& > div:not(:last-child)":{paddingBottom:e.spacing(3)},"& > div":{"& > div":{paddingTop:"0 !important"}},paddingBottom:e.spacing(9)},simulationContainer:{minHeight:"442px"},paper:{width:"100%",height:"100%",minHeight:310,backgroundColor:"#293640"},box:{padding:e.spacing(3,3)},boxButton:{padding:e.spacing(3,3)},boxHeader:{padding:e.spacing(3,3),height:e.spacing(10),display:"flex",alignItems:"center",borderBottom:"1px solid #313d47"},boxBorderBottom:{borderBottom:"1px solid #313d47"},initialRaise:{justifyContent:"space-between"},boxChart:{width:"100%",height:"100%",minHeight:310,maxHeight:350,padding:e.spacing(3,3),paddingRight:"5px",paddingLeft:"5px"},boxPlaceholder:{padding:e.spacing(3,3),display:"flex",height:"100%",alignItems:"center",justifyContent:"center",color:e.palette.text.secondary,opacity:.4},header:{backgroundColor:"#0b1216",color:"#f8f8f8",textAlign:"center",padding:e.spacing(3,0,16),marginBottom:-e.spacing(10)},button:{background:"linear-gradient(290deg, #1880e0, #3873d8)",color:"white"},descriptionContainer:{"& > div:not(:last-child)":{paddingBottom:e.spacing(1),marginBottom:e.spacing(1),borderBottom:"1px solid #3f5463"},"& td":{verticalAlign:"top",padding:e.spacing(.5)}},descriptionTitle:{padding:e.spacing(.5)},descriptionBody:{color:"#dbdfe4"},descriptionPadding:{padding:e.spacing(.5)}})}));var Ae=a(192),Fe=a.n(Ae),Se=a(193),Te=Object(Se.a)({palette:{type:"dark",primary:{main:"#2ecd79"},secondary:{main:"#116be0",light:"#0f8bff",dark:"#116be0"},error:{main:Fe.a.A400},background:{default:"#fff",paper:"#293640"},text:{primary:"#fff",secondary:"#9aa3ad"}},typography:{h6:{fontWeight:400}}});console.log(Te);var Re=Te;o.a.render(r.a.createElement(l.a,{theme:Re},r.a.createElement(c.a,null),r.a.createElement(function(){var e=Object(n.useState)({theta:.35,p0:.1,p1:.3,wFee:.05,d0:3e6}),t=Object(d.a)(e,2),a=t[0],i=t[1],o=a.d0,c=a.theta,l=a.p0,s=a.p1,p=a.wFee,f=Object(n.useMemo)(function(){return Object(Ne.throttle)(i,250)},[]),y=Z({d0:o,theta:c,p0:l,p1:s}),k=y.k,j=y.R0,C=y.S0,w=y.V0,N=Object(n.useState)([0]),B=Object(d.a)(N,2),A=B[0],F=B[1],S=Object(n.useState)([0]),T=Object(d.a)(S,2),R=T[0],M=T[1],I=Object(n.useState)([0]),P=Object(d.a)(I,2),D=P[0],V=P[1],H=Object(n.useState)(j),q=Object(d.a)(H,2),G=q[0],J=q[1],Y=Object(n.useState)(0),le=Object(d.a)(Y,2),me=le[0],ue=le[1],de=Object(n.useState)(0),pe=Object(d.a)(de,2),he=pe[0],be=pe[1],xe=Object(n.useState)(0),ve=Object(d.a)(xe,2),Ee=ve[0],ye=ve[1],je=Object(n.useState)(!1),Oe=Object(d.a)(je,2),Ce=Oe[0],Ae=Oe[1],Fe=Object(n.useState)(!1),Se=Object(d.a)(Fe,2),Te=Se[0],Re=Se[1];function Me(){return(Me=Object(u.a)(m.a.mark(function e(){return m.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Ae(!1),ue(0),F([0]),M([0]),be(0),e.next=3,X(0);case 3:Ae(!0);case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}Object(n.useEffect)(function(){Ae(!1)},[a]),Object(n.useEffect)(function(){var e=!0;function t(){return(t=Object(u.a)(m.a.mark(function t(){var a,n,r,i,o,c,l,s,u,d,f;return m.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:a=[j],n=[C],r=[ae({R:j,V0:w,k:k})],i=[0],o=[],c=[],l=[C],s=[],u=52,Re(!0),d=function(t){var m=ce(5,2*t+5),u=U(a),d=U(n),f=U(l),h=void 0;if(f>d)h=1;else{var g=_({S:d-f,V0:w,k:k})/u;h=Math.max(1-g,.97)}var b=ce(h,1.04),x=re({R:u,k:k,priceGrowth:b}),v=u+x,E=ie({sum:x,num:m,spread:10}),y=se(E.map(function(e){return ne({R:u,deltaR:e,V0:w,k:k})})),j=E.filter(function(e){return e<0}),O=-p*j.reduce(function(e,t){return e+t},0),N=f-oe({week:t,H:f,halflife:52,cliff:8}),B=ee({R:u,V0:w,k:k}),A=te({S:B,H:C-N,V0:w,k:k}),F=se(j);if(a.push(v),n.push(B),l.push(N),r.push(ae({R:v,V0:w,k:k})),o.push(y),c.push(F),i.push(U(i)+O),s.push(A),ue(function(e){return e+j.length}),!Ce||!e)return"break"},f=0;case 17:if(!(f<u)){t.next=24;break}if("break"!==d(f)){t.next=21;break}return t.abrupt("break",24);case 21:f++,t.next=17;break;case 24:s[s.length]=s[s.length-1],F(r),M(i),V(s),be(Q(o)),ye(Q(c)),J(U(a)),Re(!1);case 32:case"end":return t.stop()}},t)}))).apply(this,arguments)}return Ce&&function(){t.apply(this,arguments)}(),function(){e=!1}},[Ce]);var Ie=[{label:"Total reserve",description:z.totalReserve.text,value:(+G.toPrecision(3)).toLocaleString()+" DAI"},{label:"Funds generated from initial hatch",description:z.initialHatchFunds.text,value:Math.round(o*c).toLocaleString()+" DAI"},{label:"Funds generated from exit tributes (".concat(me," txs)"),description:z.exitTributes.text,value:(+U(R).toPrecision(3)).toLocaleString()+" DAI"},{label:"Average slippage (avg tx size ".concat(Math.round(Ee).toLocaleString()," DAI)"),description:z.slippage.text,value:+(100*he).toFixed(3)+"%"}],Pe=Be();return r.a.createElement(r.a.Fragment,null,r.a.createElement("header",{className:Pe.header},r.a.createElement(h.a,{fixed:!0},r.a.createElement(O,null))),r.a.createElement(h.a,{fixed:!0,className:Pe.mainContainer},r.a.createElement(v.a,{container:!0,spacing:3},r.a.createElement(v.a,{item:!0,xs:12,sm:12,md:6,lg:4},r.a.createElement(x.a,{className:Pe.paper},r.a.createElement(b.a,{className:Pe.boxHeader},r.a.createElement(g.a,{variant:"h6"},"Curve Design"),r.a.createElement(we,{text:r.a.createElement("div",{className:Pe.descriptionContainer},r.a.createElement("div",null,r.a.createElement(g.a,{className:Pe.descriptionTitle},"Parameters description:")),r.a.createElement("table",null,r.a.createElement("tbody",null,[L.theta,L.p0,L.p1,L.wFee,L.d0].map(function(e){var t=e.name,a=e.text;return r.a.createElement("tr",{key:t},r.a.createElement("td",null,r.a.createElement(g.a,null,t)),r.a.createElement("td",null,r.a.createElement(g.a,{className:Pe.descriptionBody},a)))}))))})),r.a.createElement(b.a,{className:"".concat(Pe.box," ").concat(Pe.boxBorderBottom)},r.a.createElement(K,{curveParams:a,setCurveParams:f})),r.a.createElement(b.a,{className:"".concat(Pe.boxHeader," ").concat(Pe.initialRaise)},r.a.createElement(g.a,{variant:"h6"},"Run parameters")),r.a.createElement(b.a,{className:Pe.box},r.a.createElement($,{curveParams:a,setCurveParams:f})))),r.a.createElement(v.a,{item:!0,xs:12,sm:12,md:6,lg:8},r.a.createElement(x.a,{className:Pe.paper},r.a.createElement(b.a,{className:Pe.boxHeader},r.a.createElement(g.a,{variant:"h6"},"Preview"),r.a.createElement(we,{text:r.a.createElement("div",{className:Pe.descriptionPadding},r.a.createElement(g.a,{className:Pe.descriptionBody},"Visualization of the token bonding curve analytic function on a specific range of reserve [0, 4 * R0]. This result is deterministic given the current set of parameters and will never change regardes of the campaign performance, it only shows how the price will react to reserve changes."))})),r.a.createElement(b.a,{className:Pe.boxChart},r.a.createElement(fe,{theta:c,d0:o,p0:l,p1:s}))))),r.a.createElement(v.a,{container:!0,spacing:3},r.a.createElement(v.a,{item:!0,xs:12,md:12},r.a.createElement(x.a,null,r.a.createElement(b.a,{className:Pe.boxHeader},r.a.createElement(v.a,{container:!0,direction:"row",justify:"center",alignItems:"center"},r.a.createElement(E.a,{variant:"contained",className:Pe.button,onClick:function(){return Me.apply(this,arguments)},disabled:Te},"Run simulation")))))),r.a.createElement(v.a,{container:!0,spacing:3,className:Pe.simulationContainer},Ce?r.a.createElement(r.a.Fragment,null,r.a.createElement(v.a,{item:!0,xs:12,sm:12,md:6,lg:8},r.a.createElement(x.a,{className:Pe.paper},r.a.createElement(b.a,{className:Pe.boxHeader},r.a.createElement(g.a,{variant:"h6"},"Simulation"),r.a.createElement(we,{text:r.a.createElement("div",{className:Pe.descriptionContainer},r.a.createElement("div",{className:Pe.descriptionPadding},r.a.createElement(g.a,{className:Pe.descriptionBody},"This chart shows a 52 week simulation of discrete transactions interacting with the token bonding curve. Each transaction adds or substract reserve to the system, modifying the price over time. The frequency, size and direction of each transaction is computed from a set of bounded random functions.")),r.a.createElement("table",null,r.a.createElement("tbody",null,Object.values(W).map(function(e){var t=e.name,a=e.text;return r.a.createElement("tr",{key:t},r.a.createElement("td",null,r.a.createElement(g.a,null,t)),r.a.createElement("td",null,r.a.createElement(g.a,{className:Pe.descriptionBody},a)))}))))})),r.a.createElement(b.a,{className:Pe.boxChart},r.a.createElement(ke,{priceTimeseries:A,withdrawFeeTimeseries:R,floorpriceTimeseries:D,p0:l,p1:s})))),r.a.createElement(v.a,{item:!0,xs:12,sm:12,md:6,lg:4},r.a.createElement(x.a,{className:Pe.paper},r.a.createElement(b.a,{className:Pe.boxHeader},r.a.createElement(g.a,{variant:"h6"},"Results"),r.a.createElement(we,{text:r.a.createElement("div",{className:Pe.descriptionContainer},r.a.createElement("div",null,r.a.createElement(g.a,{className:Pe.descriptionTitle},"Result parameters description:")),r.a.createElement("table",null,r.a.createElement("tbody",null,Object.values(z).map(function(e){var t=e.name,a=e.text;return r.a.createElement("tr",{key:t},r.a.createElement("td",null,r.a.createElement(g.a,null,t)),r.a.createElement("td",null,r.a.createElement(g.a,{className:Pe.descriptionBody},a)))}))))})),r.a.createElement(b.a,{className:Pe.box},r.a.createElement(ge,{resultFields:Ie}))))):r.a.createElement(v.a,{item:!0,xs:12},r.a.createElement(x.a,{className:Pe.paper},r.a.createElement(b.a,{className:Pe.boxPlaceholder},r.a.createElement(g.a,{variant:"h6"},"Run a simulation to see results")))))))},null)),document.querySelector("#root"))}},[[225,1,2]]]);
|
|
//# sourceMappingURL=main.bd95d4e1.chunk.js.map
|