\n );\n } else return null;\n }\n\n return (\n \n \n \n \n\n {/* Price time evolution */}\n \n\n {/* Capital collected from withdraw fees - AXIS */}\n \n\n } />\n\n \n \n\n }\n />\n }\n />\n\n {/* Capital collected from withdraw fees - AREA */}\n \n\n {/* }\n /> */}\n \n \n \n );\n}\n\nexport default PriceSimulationChart;\n","import React from \"react\";\nimport { makeStyles } from \"@material-ui/core/styles\";\nimport Popover from \"@material-ui/core/Popover\";\nimport Box from \"@material-ui/core/Box\";\nimport HelpIcon from \"@material-ui/icons/HelpOutline\";\n\nconst useStyles = makeStyles(theme => ({\n container: {\n display: \"flex\",\n marginLeft: \"6px\",\n fontSize: \"0.9rem\",\n cursor: \"pointer\",\n transition: \"opacity ease 150ms\",\n opacity: 0.2,\n \"&:hover\": {\n opacity: 0.85\n }\n },\n popoverContainer: {\n padding: theme.spacing(2)\n },\n paper: {\n backgroundColor: \"#384b59\",\n maxWidth: theme.breakpoints.values.md * 0.9,\n [`@media screen and (max-width: ${theme.breakpoints.values.md}px)`]: {\n maxWidth: \"90vw\"\n }\n }\n}));\n\nexport default function SimplePopover({ text }: { text: any }) {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = React.useState(null);\n\n function handleClick(e: any) {\n setAnchorEl(e.currentTarget);\n }\n\n function handleClose() {\n setAnchorEl(null);\n }\n\n const open = Boolean(anchorEl);\n const id = open ? \"simple-popover\" : undefined;\n\n return (\n
\n \n\n \n {text}\n \n
\n );\n}\n","import React, { useState, useEffect, useMemo } from \"react\";\n// Material UI\nimport { createStyles, makeStyles, Theme } from \"@material-ui/core/styles\";\nimport Container from \"@material-ui/core/Container\";\nimport Typography from \"@material-ui/core/Typography\";\nimport Box from \"@material-ui/core/Box\";\nimport Paper from \"@material-ui/core/Paper\";\nimport Grid from \"@material-ui/core/Grid\";\nimport Button from \"@material-ui/core/Button\";\n// Components\nimport Header from \"./Header\";\nimport CurveDesignInputParams from \"./CurveDesignInputParams\";\nimport SimulationInputParams from \"./SimulationInputParams\";\nimport SupplyVsDemandChart from \"./SupplyVsDemandChart\";\nimport ResultParams from \"./ResultParams\";\nimport PriceSimulationChart from \"./PriceSimulationChart\";\nimport HelpText from \"./HelpText\";\n// Utils\nimport { getLast, getAvg, pause } from \"./utils\";\nimport {\n getInitialParams,\n getPriceR,\n getMinPrice,\n getS,\n vest_tokens,\n getMinR,\n getSlippage,\n getTxDistribution,\n getDeltaR_priceGrowth,\n rv_U,\n getMedian,\n getSum\n} from \"./math\";\nimport { throttle } from \"lodash\";\n// General styles\nimport \"./app.css\";\n\nconst headerOffset = 10;\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n mainContainer: {\n \"& > div:not(:last-child)\": {\n paddingBottom: theme.spacing(3)\n },\n \"& > div\": {\n \"& > div\": {\n paddingTop: \"0 !important\"\n }\n },\n paddingBottom: theme.spacing(9)\n },\n simulationContainer: {\n minHeight: \"442px\"\n },\n paper: {\n width: \"100%\",\n height: \"100%\",\n minHeight: 310,\n backgroundColor: \"#293640\"\n },\n box: {\n padding: theme.spacing(3, 3)\n },\n boxButton: {\n padding: theme.spacing(3, 3)\n },\n boxHeader: {\n padding: theme.spacing(3, 3),\n height: theme.spacing(headerOffset),\n display: \"flex\",\n alignItems: \"center\",\n borderBottom: \"1px solid #313d47\"\n },\n boxBorderBottom: {\n borderBottom: \"1px solid #313d47\"\n },\n initialRaise: {\n justifyContent: \"space-between\"\n },\n boxChart: {\n width: \"100%\",\n height: \"100%\",\n minHeight: 310,\n maxHeight: 350,\n padding: theme.spacing(3, 3),\n // Correct the chart excessive margins\n paddingRight: \"5px\",\n paddingLeft: \"5px\"\n },\n boxPlaceholder: {\n padding: theme.spacing(3, 3),\n display: \"flex\",\n height: \"100%\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: theme.palette.text.secondary,\n opacity: 0.4\n },\n header: {\n backgroundColor: \"#0b1216\",\n color: \"#f8f8f8\",\n textAlign: \"center\",\n padding: theme.spacing(3, 0, 6 + headerOffset),\n marginBottom: -theme.spacing(headerOffset)\n },\n button: {\n // background: \"linear-gradient(290deg, #2ad179, #4ab47c)\", // Green gradient\n background: \"linear-gradient(290deg, #1880e0, #3873d8)\", // blue gradient\n color: \"white\"\n },\n // Descriptions\n descriptionContainer: {\n \"& > div:not(:last-child)\": {\n paddingBottom: theme.spacing(1),\n marginBottom: theme.spacing(1),\n borderBottom: \"1px solid #3f5463\"\n },\n \"& td\": {\n verticalAlign: \"top\",\n padding: theme.spacing(0.5)\n }\n },\n descriptionTitle: {\n fontWeight: theme.typography.fontWeightBold,\n padding: theme.spacing(0.5)\n },\n descriptionName: {\n fontWeight: theme.typography.fontWeightBold\n }\n })\n);\n\nconst parameterDescriptions = [\n {\n name: \"Initial raise\",\n text: \"Total funds raised in the hatch period of the ABC launch\"\n },\n {\n name: \"Allocation to funding pool\",\n text:\n \"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\"\n },\n {\n name: \"Hatch price\",\n text:\n \"The price paid per 'ABC token' by community members involved in hatching the project\"\n },\n {\n name: \"Post-hatch price\",\n text:\n \"The price of the 'ABC token' when the curve enters the open phase and is live for public participation\"\n },\n {\n name: \"Exit tribute\",\n text:\n \"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\"\n }\n];\n\nconst resultParameterDescriptions = [\n {\n name: \"Total reserve\",\n text:\n \"Total DAI in the smart contract reserve at the end of the simulated period\"\n },\n {\n name: \"Funds generated from initial hatch\",\n text:\n \"Fraction of the funds (theta) raised during the hatch that go directly to the cause\"\n },\n {\n name: \"Funds generated from exit tributes\",\n text:\n \"Cumulative amount of exit tributes collected from only exit /sell transactions\"\n },\n {\n name: \"Average slippage\",\n text:\n \"Average of the slippage of each transaction occured during the simulation period\"\n }\n];\n\nexport default function App() {\n const [curveParams, setCurveParams] = useState({\n theta: 0.35, // fraction allocated to reserve (.)\n p0: 0.1, // Hatch sale price p0 (DAI / token)\n p1: 0.3, // Return factor (.)\n wFee: 0.05, // friction coefficient (.)\n d0: 3e6 // Initial raise, d0 (DAI)\n });\n\n const { d0, theta, p0, p1, wFee } = curveParams;\n\n /**\n * Throttle the curve update to prevent the expensive chart\n * to re-render too often\n */\n const setCurveParamsThrottle = useMemo(\n () => throttle(setCurveParams, 250),\n []\n );\n\n // Simulation results\n const {\n k, // Invariant power kappa (.)\n R0, // Initial reserve (DAI)\n S0, // initial supply of tokens (token)\n V0 // invariant coef\n } = getInitialParams({\n d0,\n theta,\n p0,\n p1\n });\n\n const [priceTimeseries, setPriceTimeseries] = useState([0]);\n const [withdrawFeeTimeseries, setWithdrawFeeTimeseries] = useState([0]);\n const [floorpriceTimeseries, setFloorpriceTimeseries] = useState([0]);\n const [totalReserve, setTotalReserve] = useState(R0);\n const [withdrawCount, setWithdrawCount] = useState(0);\n const [avgSlippage, setAvgSlippage] = useState(0);\n const [avgTxSize, setAvgTxSize] = useState(0);\n // Simulation state variables\n const [simulationActive, setSimulationActive] = useState(false);\n const [simulationRunning, setSimulationRunning] = useState(false);\n\n useEffect(() => {\n setSimulationActive(false);\n }, [curveParams]);\n\n // #### TEST: Immediate simulation\n\n async function startSimulation() {\n // If there's a simulation already active, clear it\n clearSimulation();\n await pause(0);\n\n // Start simulation by setting it to active\n setSimulationActive(true);\n }\n\n function clearSimulation() {\n // Stop simulation\n setSimulationActive(false);\n // Clear simulation variables\n setWithdrawCount(0);\n setPriceTimeseries([0]);\n setWithdrawFeeTimeseries([0]);\n setAvgSlippage(0);\n }\n\n useEffect(() => {\n let canContinueSimulation = true;\n\n async function simulateRandomDelta() {\n const R_t: number[] = [R0];\n const S_t: number[] = [S0];\n const p_t: number[] = [getPriceR({ R: R0, V0, k })];\n const wFee_t: number[] = [0];\n const slippage_t: number[] = [];\n const avgTxSize_t: number[] = [];\n\n // hatchers tokens = S0[section added by Z]\n const H_t: number[] = [S0]; // total hatcher tokens not vested\n const floorprice_t: number[] = []; // initially the price is the floor as all tokens are hatcher tokens\n\n // Random walk\n const numSteps = 52;\n const u_min = 0.97;\n const u_max = 1.04;\n const tx_spread = 10;\n // vesting(should this be exposed in the app ?)\n const cliff = 8; // weeks before vesting starts ~2 months\n const halflife = 52; // 26 weeks, half life is ~6 months\n // percentage of the hatch tokens which vest per week(since that is our timescale in the sim)\n\n // numSteps = 52 take 8ms to run\n setSimulationRunning(true);\n for (let t = 0; t < numSteps; t++) {\n const txsWeek = rv_U(5, 2 * t + 5);\n\n const R = getLast(R_t);\n const S = getLast(S_t);\n const H = getLast(H_t);\n\n // enforce the effects of the unvested tokens not being burnable\n let u_lower;\n if (H === S) {\n u_lower = 1;\n } else {\n const R_ratio = getMinR({ S, H, V0, k }) / R;\n u_lower = Math.max(1 - R_ratio, u_min);\n }\n const priceGrowth = rv_U(u_lower, u_max);\n\n const deltaR = getDeltaR_priceGrowth({ R, k, priceGrowth });\n const R_next = R + deltaR;\n\n const txs = getTxDistribution({\n sum: deltaR,\n num: txsWeek,\n spread: tx_spread\n });\n // Compute slippage\n const slippage_txs = txs.map(txR =>\n getSlippage({ R, deltaR: txR, V0, k })\n );\n const slippage = getMedian(slippage_txs);\n\n const txsWithdraw = txs.filter(tx => tx < 0);\n const wFees = -wFee * getSum(txsWithdraw);\n // txsWithdraw.reduce((t, c) => t + c, 0);\n\n // Vest\n const delta_H = vest_tokens({ week: t, H, halflife, cliff });\n const H_next = H - delta_H;\n\n // find floor price\n const S_next = getS({ R, V0, k });\n const floorprice_next = getMinPrice({\n S: S_next,\n H: S0 - H_next,\n V0,\n k\n });\n\n const _avgTxSize = getMedian(txsWithdraw);\n\n R_t.push(R_next);\n p_t.push(getPriceR({ R: R_next, V0, k }));\n slippage_t.push(slippage);\n avgTxSize_t.push(_avgTxSize);\n wFee_t.push(getLast(wFee_t) + wFees);\n H_t.push(H_next);\n floorprice_t.push(floorprice_next);\n setWithdrawCount(c => c + txsWithdraw.length);\n\n // Stop the simulation if it's no longer active\n if (!simulationActive || !canContinueSimulation) break;\n }\n\n // floorprice_t is missing one data point\n floorprice_t[floorprice_t.length] = floorprice_t[floorprice_t.length - 1];\n\n setPriceTimeseries(p_t);\n setWithdrawFeeTimeseries(wFee_t);\n setFloorpriceTimeseries(floorprice_t);\n setAvgSlippage(getAvg(slippage_t));\n setAvgTxSize(getAvg(avgTxSize_t));\n setTotalReserve(getLast(R_t));\n\n setSimulationRunning(false);\n }\n\n if (simulationActive) simulateRandomDelta();\n // Return an \"unsubscribe\" function that halts the run\n return () => {\n canContinueSimulation = false;\n };\n }, [simulationActive]);\n\n const resultFields = [\n {\n label: `Total reserve`,\n value: (+totalReserve.toPrecision(3)).toLocaleString() + \" DAI\"\n },\n {\n label: `Funds generated from initial hatch`,\n value: Math.round(d0 * theta).toLocaleString() + \" DAI\"\n },\n {\n label: `Funds generated from exit tributes (${withdrawCount} txs)`,\n value:\n (+getLast(withdrawFeeTimeseries).toPrecision(3)).toLocaleString() +\n \" DAI\"\n },\n {\n label: `Average slippage (avg tx size ${Math.round(\n avgTxSize\n ).toLocaleString()} DAI)`,\n value: +(100 * avgSlippage).toFixed(3) + \"%\"\n }\n ];\n\n const classes = useStyles();\n\n return (\n <>\n \n \n \n \n \n\n \n \n \n \n \n Curve Design\n \n
\n \n Parameters description:\n \n
\n
\n \n {parameterDescriptions.map(({ name, text }) => (\n
\n
\n \n {name}\n \n
\n
\n {text}\n
\n
\n ))}\n \n
\n \n }\n />\n \n\n \n \n \n\n \n Run parameters\n \n\n \n \n \n \n \n\n \n \n \n Preview\n \n Visualization of the token bonding curve analytic function\n on a specific range of reserve [0, 4 * R0]. This result is\n deterministic given the current set of parameters and will\n never change regardes of the campaign performance, it only\n shows how the price will react to reserve changes.\n \n }\n />\n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n\n \n {simulationActive ? (\n <>\n \n \n \n Simulation\n \n This chart shows a 52 week simulation of discrete\n transactions interacting with the token bonding curve.\n Each transaction adds or substract reserve to the\n system, modifying the price over time. The frequency,\n size and direction of each transaction is computed\n from a set of bounded random functions.\n \n }\n />\n \n\n \n \n \n \n \n\n \n \n \n Results\n \n
\n \n Result parameters description:\n \n
\n
\n \n {resultParameterDescriptions.map(\n ({ name, text }) => (\n
\n
\n \n {name}\n \n
\n
\n {text}\n
\n
\n )\n )}\n \n
\n \n }\n />\n \n\n \n \n \n \n \n >\n ) : (\n \n \n \n \n Run a simulation to see results\n \n \n \n \n )}\n \n \n >\n );\n}\n","import red from \"@material-ui/core/colors/red\";\nimport { createMuiTheme } from \"@material-ui/core/styles\";\n\n// A custom theme for this app\nconst theme = createMuiTheme({\n palette: {\n type: \"dark\",\n primary: {\n main: \"#2ecd79\"\n },\n secondary: {\n main: \"#116be0\",\n light: \"#0f8bff\",\n dark: \"#116be0\"\n },\n error: {\n main: red.A400\n },\n background: {\n default: \"#fff\",\n paper: \"#293640\"\n },\n text: {\n primary: \"#fff\",\n secondary: \"#9aa3ad\"\n }\n },\n typography: {\n h6: {\n fontWeight: 400\n }\n }\n});\n\nconsole.log(theme);\n\nexport default theme;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport CssBaseline from '@material-ui/core/CssBaseline';\nimport { ThemeProvider } from '@material-ui/styles';\nimport App from './App';\nimport theme from './theme';\n\nReactDOM.render(\n \n {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}\n \n \n ,\n document.querySelector('#root'),\n);\n"],"sourceRoot":""}
\ No newline at end of file
diff --git a/static/js/main.d4e37a2e.chunk.js b/static/js/main.d4e37a2e.chunk.js
new file mode 100644
index 0000000..9d50e67
--- /dev/null
+++ b/static/js/main.d4e37a2e.chunk.js
@@ -0,0 +1,2 @@
+(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(13),o=a.n(i),c=a(462),l=a(461),s=a(65),m=a.n(s),u=a(118),d=a(14),p=a(422),f=a(467),h=a(460),g=a(423),b=a(464),x=a(459),v=a(458),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),N=a(192),w=a(463),A=a(175),B=a.n(A),S=a(7),F=a(468),R=Object(S.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}})(F.a),M=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 I(e){var t=e.inputRef,a=e.onChange,n=e.prefix,i=e.suffix,o=Object(N.a)(e,["inputRef","onChange","prefix","suffix"]);return r.a.createElement(B.a,Object.assign({},o,{getInputRef:t,onValueChange:function(e){a({target:{value:e.value}})},thousandSeparator:!0,prefix:n,suffix:i}))}function T(e){var t=e.inputFields,a=e.onChangeCommited,n=M();return r.a.createElement("div",{className:n.listBoxContainer},t.map(function(e){var t=e.label,i=e.value,o=e.setter,c=e.min,l=e.max,s=e.step,m=e.prefix,u=e.suffix,d=e.secondaryColor,p=e.format,f=e.toText,h=e.toNum;function b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;isNaN(e)&&(e=0),e>l?e=l:ee*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)",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",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(T,{inputFields:j,onChangeCommited:function(){a(function(e){return Object(C.a)({},e,{theta:c,p0:u,p1:g,wFee:E})})}})}function D(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)",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(T,{inputFields:s,onChangeCommited:function(){a(function(e){return Object(C.a)({},e,{d0:c})})}})}var V=a(23),H=a(15);function L(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 W(e,t){for(var a=[],n=(e[e.length-1]-e[0])/t,r=e[0];r1||r<0)&&(r=ae(e,t)),r*=t-e,r+=e}function ne(e){var t=Math.floor(e.length/2),a=Object(q.a)(e).sort(function(e,t){return e-t});return e.length%2!==0?a[t]:(a[t-1]+a[t])/2}var re=a(193),ie="x",oe="Supply (tokens) / Reserve (DAI)",ce=Object(p.a)(function(e){return Object(f.a)({tooltip:{border:"1px solid #313d47",backgroundColor:"#384b59",padding:e.spacing(1),color:"#c7ccd2"}})});var le=function(e){for(var t=e.theta,a=G({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(V.a)(E,ie,y),Object(V.a)(E,oe,s(y)),E))}var k=Object(re.a)(),j=ce(),O=function(e){return(+(e/g).toPrecision(2)).toLocaleString()};return r.a.createElement(H.f,{debounce:1},r.a.createElement(H.b,{width:0,height:400,data:x,margin:{top:10,right:30,left:0,bottom:0}},r.a.createElement(H.c,{strokeDasharray:"3 3"}),r.a.createElement(H.h,{interval:24,dataKey:ie,tickFormatter:O,unit:b,tick:{fill:k.palette.text.secondary},stroke:k.palette.text.secondary}),r.a.createElement(H.i,{interval:"preserveStartEnd",ticks:W(x.map(function(e){return e[oe]}),3),tickFormatter:O,unit:b,tick:{fill:k.palette.text.secondary},domain:[0,s(m)],stroke:k.palette.text.secondary}),r.a.createElement(H.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=X({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(H.a,{isAnimationActive:!1,type:"monotone",dataKey:oe,stroke:k.palette.primary.main,fill:k.palette.primary.main,fillOpacity:.3,strokeWidth:2}),r.a.createElement(H.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(H.d,{formatter:function(e){return r.a.createElement("span",{style:{color:k.palette.text.secondary}},e)}})))},se=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 me(e){var t=e.resultFields,a=se();return r.a.createElement("div",{className:a.listBoxContainer},t.map(function(e){var t=e.label,n=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(g.a,{id:t,gutterBottom:!0},t)),r.a.createElement(v.a,{item:!0,xs:4,className:a.centerContainer},r.a.createElement(g.a,{gutterBottom:!0},n)))}))}var ue="x",de="Price (DAI/token)",pe="Total exit tributes (DAI)",fe="Floor price (DAI/token)",he=Object(p.a)(function(e){return Object(f.a)({tooltip:{border:"1px solid #313d47",backgroundColor:"#384b59",padding:e.spacing(1),color:"#c7ccd2"}})});var ge=function(e){for(var t=e.priceTimeseries,a=e.withdrawFeeTimeseries,n=e.floorpriceTimeseries,i=e.p0,o=e.p1,c=[],l=0;l 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:{fontWeight:e.typography.fontWeightBold,padding:e.spacing(.5)},descriptionName:{fontWeight:e.typography.fontWeightBold},descriptionPadding:{padding:e.spacing(.5)}})})),Oe=[{name:"Initial raise",text:"Total funds raised in the hatch period of the ABC launch"},{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"},{name:"Hatch price",text:"The price paid per 'ABC token' by community members involved in hatching the project"},{name:"Post-hatch price",text:"The price of the 'ABC token' when the curve enters the open phase and is live for public participation"},{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"}],Ce=[{name:"Price",text:"Price of the token over time."},{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"},{name:"Total exit tributes",text:"Cumulative sum of exit tributes collected from only exit /sell transactions"}],Ne=[{name:"Total reserve",text:"Total DAI in the smart contract reserve at the end of the simulated period"},{name:"Funds generated from initial hatch",text:"Fraction of the funds (theta) raised during the hatch that go directly to the cause (analytic result)"},{name:"Funds generated from exit tributes",text:"Cumulative sum of exit tributes collected from only exit /sell transactions"},{name:"Average slippage",text:"Average of the slippage of each transaction occured during the simulation period"}];var we=a(190),Ae=a.n(we),Be=a(191),Se=Object(Be.a)({palette:{type:"dark",primary:{main:"#2ecd79"},secondary:{main:"#116be0",light:"#0f8bff",dark:"#116be0"},error:{main:Ae.a.A400},background:{default:"#fff",paper:"#293640"},text:{primary:"#fff",secondary:"#9aa3ad"}},typography:{h6:{fontWeight:400}}});console.log(Se);var Fe=Se;o.a.render(r.a.createElement(l.a,{theme:Fe},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(ke.throttle)(i,250)},[]),y=G({d0:o,theta:c,p0:l,p1:s}),k=y.k,j=y.R0,C=y.S0,N=y.V0,w=Object(n.useState)([0]),A=Object(d.a)(w,2),B=A[0],S=A[1],F=Object(n.useState)([0]),R=Object(d.a)(F,2),M=R[0],I=R[1],T=Object(n.useState)([0]),V=Object(d.a)(T,2),H=V[0],L=V[1],W=Object(n.useState)(j),q=Object(d.a)(W,2),ae=q[0],re=q[1],ie=Object(n.useState)(0),oe=Object(d.a)(ie,2),ce=oe[0],se=oe[1],ue=Object(n.useState)(0),de=Object(d.a)(ue,2),pe=de[0],fe=de[1],he=Object(n.useState)(0),be=Object(d.a)(he,2),xe=be[0],ve=be[1],Ee=Object(n.useState)(!1),we=Object(d.a)(Ee,2),Ae=we[0],Be=we[1],Se=Object(n.useState)(!1),Fe=Object(d.a)(Se,2),Re=Fe[0],Me=Fe[1];function Ie(){return(Ie=Object(u.a)(m.a.mark(function e(){return m.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Be(!1),se(0),S([0]),I([0]),fe(0),e.next=3,$(0);case 3:Be(!0);case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}Object(n.useEffect)(function(){Be(!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=[X({R:j,V0:N,k:k})],i=[0],o=[],c=[],l=[C],s=[],u=52,Me(!0),d=function(t){var m=te(5,2*t+5),u=z(a),d=z(n),f=z(l),h=void 0;if(f>d)h=1;else{var g=J({S:d-f,V0:N,k:k})/u;h=Math.max(1-g,.97)}var b=te(h,1.04),x=Z({R:u,k:k,priceGrowth:b}),v=u+x,E=_({sum:x,num:m,spread:10}),y=ne(E.map(function(e){return Y({R:u,deltaR:e,V0:N,k:k})})),j=E.filter(function(e){return e<0}),O=-p*j.reduce(function(e,t){return e+t},0),w=f-ee({week:t,H:f,halflife:52,cliff:8}),A=U({R:u,V0:N,k:k}),B=Q({S:A,H:C-w,V0:N,k:k}),S=ne(j);if(a.push(v),n.push(A),l.push(w),r.push(X({R:v,V0:N,k:k})),o.push(y),c.push(S),i.push(z(i)+O),s.push(B),se(function(e){return e+j.length}),!Ae||!e)return"break"},f=0;case 17:if(!(f div:not(:last-child)","paddingBottom","borderBottom","listBox","& > div","& p","paddingRight","slider","secondaryColor","light","NumberFormatCustom","props","inputRef","onChange","prefix","suffix","other","Object","objectWithoutProperties","number_format_default","assign","getInputRef","onValueChange","values","target","value","thousandSeparator","InputParams","_ref","inputFields","onChangeCommited","map","_ref2","label","setter","min","max","step","format","toText","toNum","sanitizeInput","num","arguments","length","undefined","isNaN","Grid","key","container","item","xs","id","gutterBottom","TextField","e","parseFloat","InputProps","inputComponent","disableUnderline","inputProps","PrettoSlider","concat","valueLabelDisplay","aria-label","defaultValue","_","newValue","Number","onChangeCommitted","valueLabelFormat","replace","CurveDesignInputParams","curveParams","setCurveParams","_useState","useState","_useState2","slicedToArray","theta","setTheta","_useState3","_useState4","p0","setP0","_useState5","_useState6","p1","setP1","_useState7","_useState8","wFee","setWFee","useEffect","maxReturnRate","n","Math","round","String","toFixed","newP0","params","objectSpread","d0","setD0","floor","linspace","_ref$from","from","to","steps","arr","x","push","getLinspaceTicks","data","desiredPoints","getLast","getAvg","reduce","t","c","abs","pause","ms","Promise","r","setTimeout","getInitialParams","k","R0","S0","V0","pow","getR","S","getS","_ref3","R","getMinPrice","_ref4","H","myP","getPriceR","_ref5","getSlippage","_ref6","deltaR","realizedPrice","spotPrice","getDeltaR_priceGrowth","_ref7","priceGrowth","getTxDistribution","_ref8","sum","mean","off","spread","i","randn_bm","vest_tokens","_ref9","week","halflife","cliff","rv_U","random","u","v","sqrt","log","cos","PI","getMedian","mid","nums","toConsumableArray","sort","b","keyHorizontal","keyVertical","tooltip","padding","SupplyVsDemandChart","_getInitialParams","R0_round","f","biggest","scaling","unit","_data$push","defineProperty","useTheme","formatter","toPrecision","toLocaleString","es6","debounce","right","bottom","strokeDasharray","interval","dataKey","tickFormatter","tick","fill","stroke","ticks","d","domain","content","payload","supply","reserve","price","toolTipData","name","isAnimationActive","type","fillOpacity","strokeWidth","textAnchor","viewBox","y","style","ResultParams","resultFields","keyVerticalLeft","keyVerticalRight","keyVerticalLeft2","PriceSimulationChart","priceTimeseries","withdrawFeeTimeseries","floorpriceTimeseries","ReferenceLabel","yAxisId","apply","slice","orientation","exit","weekNum","dark","cursor","transition","&:hover","popoverContainer","paper","maxWidth","breakpoints","md","SimplePopover","_React$useState","React","_React$useState2","anchorEl","setAnchorEl","handleClose","open","Boolean","HelpOutline_default","onClick","currentTarget","Popover","PaperProps","onClose","anchorOrigin","vertical","horizontal","transformOrigin","Box","mainContainer","paddingTop","simulationContainer","minHeight","box","boxButton","boxHeader","boxBorderBottom","initialRaise","boxChart","maxHeight","paddingLeft","boxPlaceholder","header","textAlign","button","background","descriptionContainer","& td","descriptionTitle","typography","fontWeightBold","descriptionName","descriptionPadding","parameterDescriptions","simulationParameterDescriptions","resultParameterDescriptions","createMuiTheme","error","red","A400","default","h6","console","ReactDOM","render","ThemeProvider","CssBaseline","setCurveParamsThrottle","useMemo","throttle","setPriceTimeseries","setWithdrawFeeTimeseries","setFloorpriceTimeseries","_useState9","_useState10","totalReserve","setTotalReserve","_useState11","_useState12","withdrawCount","setWithdrawCount","_useState13","_useState14","avgSlippage","setAvgSlippage","_useState15","_useState16","avgTxSize","setAvgTxSize","_useState17","_useState18","simulationActive","setSimulationActive","_useState19","_useState20","simulationRunning","setSimulationRunning","_startSimulation","asyncToGenerator","regenerator_default","mark","_callee2","wrap","_context2","prev","next","stop","this","canContinueSimulation","_simulateRandomDelta","_callee","R_t","S_t","p_t","wFee_t","slippage_t","avgTxSize_t","H_t","floorprice_t","numSteps","_loop","_context","txsWeek","u_lower","R_ratio","R_next","txs","slippage","txR","txsWithdraw","filter","tx","wFees","H_next","S_next","floorprice_next","_avgTxSize","abrupt","simulateRandomDelta","Container","fixed","sm","lg","Paper","SimulationInputParams_CurveDesignInputParams","src_SupplyVsDemandChart","direction","justify","Button","disabled","src_PriceSimulationChart","document","querySelector"],"mappings":"uUAKMA,EACJ,0GAEIC,EAAYC,YAAW,SAACC,GAAD,OAC3BC,YAAa,CACXC,MAAO,GAGPC,SAAU,CACRC,MAAOJ,EAAMK,QAAQC,KAAKC,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,sBACtBjU,EAAAC,EAAAC,cAAA,WACEF,EAAAC,EAAAC,cAACK,EAAA,EAAD,CAAYH,UAAWL,GAAQoU,kBAA/B,mCAIFnU,EAAAC,EAAAC,cAAA,aACEF,EAAAC,EAAAC,cAAA,aACGwU,GAA4B1Q,IAC3B,SAAA0G,GAAA,IAAGgF,EAAHhF,EAAGgF,KAAMlR,EAATkM,EAASlM,KAAT,OACEwB,EAAAC,EAAAC,cAAA,MAAI+E,IAAKyK,GACP1P,EAAAC,EAAAC,cAAA,UACEF,EAAAC,EAAAC,cAACK,EAAA,EAAD,CACEH,UAAWL,GAAQuU,iBAElB5E,IAGL1P,EAAAC,EAAAC,cAAA,UACEF,EAAAC,EAAAC,cAACK,EAAA,EAAD,KAAa/B,aAYjCwB,EAAAC,EAAAC,cAAC6S,EAAA,EAAD,CAAK3S,UAAWL,GAAQqT,KACtBpT,EAAAC,EAAAC,cAACiQ,GAAD,CAAcC,aAAcA,SAMpCpQ,EAAAC,EAAAC,cAAC8E,EAAA,EAAD,CAAMG,MAAI,EAACC,GAAI,IACbpF,EAAAC,EAAAC,cAACga,EAAA,EAAD,CAAO9Z,UAAWL,GAAQyR,OACxBxR,EAAAC,EAAAC,cAAC6S,EAAA,EAAD,CAAK3S,UAAWL,GAAQ6T,gBACtB5T,EAAAC,EAAAC,cAACK,EAAA,EAAD,CAAYC,QAAQ,MAApB,0CE3mBd,OAEFka,SAASC,cAAc","file":"static/js/main.d4e37a2e.chunk.js","sourcesContent":["import React from \"react\";\nimport { createStyles, makeStyles, Theme } from \"@material-ui/core/styles\";\nimport Link from \"@material-ui/core/Link\";\nimport Typography from \"@material-ui/core/Typography\";\n\nconst cadCadLink =\n \"https://medium.com/block-science/cadcad-filling-a-critical-gap-in-open-source-data-science-fcd0d3faa8ed\";\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n title: {\n // color: theme.palette.text.secondary,\n },\n subtitle: {\n color: theme.palette.text.secondary,\n margin: theme.spacing(3, 0, 0)\n },\n subsubtitle: {\n color: theme.palette.text.secondary,\n opacity: 0.6\n },\n lightBulb: {\n verticalAlign: \"middle\",\n marginRight: theme.spacing(1)\n },\n link: {\n color: theme.palette.primary.main\n },\n logoContainer: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n marginBottom: theme.spacing(4)\n },\n logo: {\n width: \"25px\",\n marginRight: \"4px\"\n },\n logoText: {\n display: \"inline\",\n fontSize: \"1.1rem\",\n fontWeight: 500\n }\n })\n);\n\nexport default function Header() {\n const classes = useStyles();\n return (\n <>\n
\n );\n } else return null;\n }\n\n return (\n \n \n \n \n\n {/* Price time evolution */}\n \n\n {/* Capital collected from withdraw fees - AXIS */}\n \n\n } />\n\n \n \n\n }\n />\n }\n />\n\n {/* Capital collected from withdraw fees - AREA */}\n \n\n {/* }\n /> */}\n \n \n \n );\n}\n\nexport default PriceSimulationChart;\n","import React from \"react\";\nimport { makeStyles } from \"@material-ui/core/styles\";\nimport Popover from \"@material-ui/core/Popover\";\nimport Box from \"@material-ui/core/Box\";\nimport HelpIcon from \"@material-ui/icons/HelpOutline\";\n\nconst useStyles = makeStyles(theme => ({\n container: {\n display: \"flex\",\n marginLeft: \"6px\",\n fontSize: \"0.9rem\",\n cursor: \"pointer\",\n transition: \"opacity ease 150ms\",\n opacity: 0.2,\n \"&:hover\": {\n opacity: 0.85\n }\n },\n popoverContainer: {\n padding: theme.spacing(2)\n },\n paper: {\n backgroundColor: \"#384b59\",\n maxWidth: theme.breakpoints.values.md * 0.9,\n [`@media screen and (max-width: ${theme.breakpoints.values.md}px)`]: {\n maxWidth: \"90vw\"\n }\n }\n}));\n\nexport default function SimplePopover({ text }: { text: any }) {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = React.useState(null);\n\n function handleClick(e: any) {\n setAnchorEl(e.currentTarget);\n }\n\n function handleClose() {\n setAnchorEl(null);\n }\n\n const open = Boolean(anchorEl);\n const id = open ? \"simple-popover\" : undefined;\n\n return (\n
\n \n\n \n {text}\n \n
\n );\n}\n","import React, { useState, useEffect, useMemo } from \"react\";\n// Material UI\nimport { createStyles, makeStyles, Theme } from \"@material-ui/core/styles\";\nimport Container from \"@material-ui/core/Container\";\nimport Typography from \"@material-ui/core/Typography\";\nimport Box from \"@material-ui/core/Box\";\nimport Paper from \"@material-ui/core/Paper\";\nimport Grid from \"@material-ui/core/Grid\";\nimport Button from \"@material-ui/core/Button\";\n// Components\nimport Header from \"./Header\";\nimport CurveDesignInputParams from \"./CurveDesignInputParams\";\nimport SimulationInputParams from \"./SimulationInputParams\";\nimport SupplyVsDemandChart from \"./SupplyVsDemandChart\";\nimport ResultParams from \"./ResultParams\";\nimport PriceSimulationChart from \"./PriceSimulationChart\";\nimport HelpText from \"./HelpText\";\n// Utils\nimport { getLast, getAvg, pause } from \"./utils\";\nimport {\n getInitialParams,\n getPriceR,\n getMinPrice,\n getS,\n vest_tokens,\n getR,\n getSlippage,\n getTxDistribution,\n getDeltaR_priceGrowth,\n rv_U,\n getMedian,\n getSum\n} from \"./math\";\nimport { throttle } from \"lodash\";\n// General styles\nimport \"./app.css\";\n\nconst headerOffset = 10;\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n mainContainer: {\n \"& > div:not(:last-child)\": {\n paddingBottom: theme.spacing(3)\n },\n \"& > div\": {\n \"& > div\": {\n paddingTop: \"0 !important\"\n }\n },\n paddingBottom: theme.spacing(9)\n },\n simulationContainer: {\n minHeight: \"442px\"\n },\n paper: {\n width: \"100%\",\n height: \"100%\",\n minHeight: 310,\n backgroundColor: \"#293640\"\n },\n box: {\n padding: theme.spacing(3, 3)\n },\n boxButton: {\n padding: theme.spacing(3, 3)\n },\n boxHeader: {\n padding: theme.spacing(3, 3),\n height: theme.spacing(headerOffset),\n display: \"flex\",\n alignItems: \"center\",\n borderBottom: \"1px solid #313d47\"\n },\n boxBorderBottom: {\n borderBottom: \"1px solid #313d47\"\n },\n initialRaise: {\n justifyContent: \"space-between\"\n },\n boxChart: {\n width: \"100%\",\n height: \"100%\",\n minHeight: 310,\n maxHeight: 350,\n padding: theme.spacing(3, 3),\n // Correct the chart excessive margins\n paddingRight: \"5px\",\n paddingLeft: \"5px\"\n },\n boxPlaceholder: {\n padding: theme.spacing(3, 3),\n display: \"flex\",\n height: \"100%\",\n alignItems: \"center\",\n justifyContent: \"center\",\n color: theme.palette.text.secondary,\n opacity: 0.4\n },\n header: {\n backgroundColor: \"#0b1216\",\n color: \"#f8f8f8\",\n textAlign: \"center\",\n padding: theme.spacing(3, 0, 6 + headerOffset),\n marginBottom: -theme.spacing(headerOffset)\n },\n button: {\n // background: \"linear-gradient(290deg, #2ad179, #4ab47c)\", // Green gradient\n background: \"linear-gradient(290deg, #1880e0, #3873d8)\", // blue gradient\n color: \"white\"\n },\n // Descriptions\n descriptionContainer: {\n \"& > div:not(:last-child)\": {\n paddingBottom: theme.spacing(1),\n marginBottom: theme.spacing(1),\n borderBottom: \"1px solid #3f5463\"\n },\n \"& td\": {\n verticalAlign: \"top\",\n padding: theme.spacing(0.5)\n }\n },\n descriptionTitle: {\n fontWeight: theme.typography.fontWeightBold,\n padding: theme.spacing(0.5)\n },\n descriptionName: {\n fontWeight: theme.typography.fontWeightBold\n },\n descriptionPadding: {\n padding: theme.spacing(0.5)\n }\n })\n);\n\nconst parameterDescriptions = [\n {\n name: \"Initial raise\",\n text: \"Total funds raised in the hatch period of the ABC launch\"\n },\n {\n name: \"Allocation to funding pool\",\n text:\n \"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\"\n },\n {\n name: \"Hatch price\",\n text:\n \"The price paid per 'ABC token' by community members involved in hatching the project\"\n },\n {\n name: \"Post-hatch price\",\n text:\n \"The price of the 'ABC token' when the curve enters the open phase and is live for public participation\"\n },\n {\n name: \"Exit tribute\",\n text:\n \"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\"\n }\n];\n\nconst simulationParameterDescriptions = [\n {\n name: \"Price\",\n text: \"Price of the token over time.\"\n },\n {\n name: \"Floor price\",\n text:\n \"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\"\n },\n {\n name: \"Total exit tributes\",\n text:\n \"Cumulative sum of exit tributes collected from only exit /sell transactions\"\n }\n];\n\nconst resultParameterDescriptions = [\n {\n name: \"Total reserve\",\n text:\n \"Total DAI in the smart contract reserve at the end of the simulated period\"\n },\n {\n name: \"Funds generated from initial hatch\",\n text:\n \"Fraction of the funds (theta) raised during the hatch that go directly to the cause (analytic result)\"\n },\n {\n name: \"Funds generated from exit tributes\",\n text:\n \"Cumulative sum of exit tributes collected from only exit /sell transactions\"\n },\n {\n name: \"Average slippage\",\n text:\n \"Average of the slippage of each transaction occured during the simulation period\"\n }\n];\n\nexport default function App() {\n const [curveParams, setCurveParams] = useState({\n theta: 0.35, // fraction allocated to reserve (.)\n p0: 0.1, // Hatch sale price p0 (DAI / token)\n p1: 0.3, // Return factor (.)\n wFee: 0.05, // friction coefficient (.)\n d0: 3e6 // Initial raise, d0 (DAI)\n });\n\n const { d0, theta, p0, p1, wFee } = curveParams;\n\n /**\n * Throttle the curve update to prevent the expensive chart\n * to re-render too often\n */\n const setCurveParamsThrottle = useMemo(\n () => throttle(setCurveParams, 250),\n []\n );\n\n // Simulation results\n const {\n k, // Invariant power kappa (.)\n R0, // Initial reserve (DAI)\n S0, // initial supply of tokens (token)\n V0 // invariant coef\n } = getInitialParams({\n d0,\n theta,\n p0,\n p1\n });\n\n const [priceTimeseries, setPriceTimeseries] = useState([0]);\n const [withdrawFeeTimeseries, setWithdrawFeeTimeseries] = useState([0]);\n const [floorpriceTimeseries, setFloorpriceTimeseries] = useState([0]);\n const [totalReserve, setTotalReserve] = useState(R0);\n const [withdrawCount, setWithdrawCount] = useState(0);\n const [avgSlippage, setAvgSlippage] = useState(0);\n const [avgTxSize, setAvgTxSize] = useState(0);\n // Simulation state variables\n const [simulationActive, setSimulationActive] = useState(false);\n const [simulationRunning, setSimulationRunning] = useState(false);\n\n useEffect(() => {\n setSimulationActive(false);\n }, [curveParams]);\n\n // #### TEST: Immediate simulation\n\n async function startSimulation() {\n // If there's a simulation already active, clear it\n clearSimulation();\n await pause(0);\n\n // Start simulation by setting it to active\n setSimulationActive(true);\n }\n\n function clearSimulation() {\n // Stop simulation\n setSimulationActive(false);\n // Clear simulation variables\n setWithdrawCount(0);\n setPriceTimeseries([0]);\n setWithdrawFeeTimeseries([0]);\n setAvgSlippage(0);\n }\n\n useEffect(() => {\n let canContinueSimulation = true;\n\n async function simulateRandomDelta() {\n const R_t: number[] = [R0];\n const S_t: number[] = [S0];\n const p_t: number[] = [getPriceR({ R: R0, V0, k })];\n const wFee_t: number[] = [0];\n const slippage_t: number[] = [];\n const avgTxSize_t: number[] = [];\n\n // hatchers tokens = S0[section added by Z]\n const H_t: number[] = [S0]; // total hatcher tokens not vested\n const floorprice_t: number[] = []; // initially the price is the floor as all tokens are hatcher tokens\n\n // Random walk\n const numSteps = 52;\n const u_min = 0.97;\n const u_max = 1.04;\n const tx_spread = 10;\n // vesting(should this be exposed in the app ?)\n const cliff = 8; // weeks before vesting starts ~2 months\n const halflife = 52; // 26 weeks, half life is ~6 months\n // percentage of the hatch tokens which vest per week(since that is our timescale in the sim)\n\n // numSteps = 52 take 8ms to run\n setSimulationRunning(true);\n for (let t = 0; t < numSteps; t++) {\n const txsWeek = rv_U(5, 2 * t + 5);\n\n const R = getLast(R_t);\n const S = getLast(S_t);\n const H = getLast(H_t);\n\n // enforce the effects of the unvested tokens not being burnable\n let u_lower;\n if (H > S) {\n u_lower = 1;\n } else {\n // compute the reserve if all that supply is burned\n const R_ratio = getR({ S: S - H, V0, k }) / R;\n u_lower = Math.max(1 - R_ratio, u_min);\n }\n const priceGrowth = rv_U(u_lower, u_max);\n\n const deltaR = getDeltaR_priceGrowth({ R, k, priceGrowth });\n const R_next = R + deltaR;\n\n const txs = getTxDistribution({\n sum: deltaR,\n num: txsWeek,\n spread: tx_spread\n });\n // Compute slippage\n const slippage_txs = txs.map(txR =>\n getSlippage({ R, deltaR: txR, V0, k })\n );\n const slippage = getMedian(slippage_txs);\n\n const txsWithdraw = txs.filter(tx => tx < 0);\n const wFees = -wFee * getSum(txsWithdraw);\n // txsWithdraw.reduce((t, c) => t + c, 0);\n\n // Vest\n const delta_H = vest_tokens({ week: t, H, halflife, cliff });\n const H_next = H - delta_H;\n\n // find floor price\n const S_next = getS({ R, V0, k });\n const floorprice_next = getMinPrice({\n S: S_next,\n H: S0 - H_next,\n V0,\n k\n });\n\n const _avgTxSize = getMedian(txsWithdraw);\n\n R_t.push(R_next);\n S_t.push(S_next);\n H_t.push(H_next);\n p_t.push(getPriceR({ R: R_next, V0, k }));\n slippage_t.push(slippage);\n avgTxSize_t.push(_avgTxSize);\n wFee_t.push(getLast(wFee_t) + wFees);\n\n floorprice_t.push(floorprice_next);\n setWithdrawCount(c => c + txsWithdraw.length);\n\n // Stop the simulation if it's no longer active\n if (!simulationActive || !canContinueSimulation) break;\n }\n\n // floorprice_t is missing one data point\n floorprice_t[floorprice_t.length] = floorprice_t[floorprice_t.length - 1];\n\n setPriceTimeseries(p_t);\n setWithdrawFeeTimeseries(wFee_t);\n setFloorpriceTimeseries(floorprice_t);\n setAvgSlippage(getAvg(slippage_t));\n setAvgTxSize(getAvg(avgTxSize_t));\n setTotalReserve(getLast(R_t));\n\n setSimulationRunning(false);\n }\n\n if (simulationActive) simulateRandomDelta();\n // Return an \"unsubscribe\" function that halts the run\n return () => {\n canContinueSimulation = false;\n };\n }, [simulationActive]);\n\n const resultFields = [\n {\n label: `Total reserve`,\n value: (+totalReserve.toPrecision(3)).toLocaleString() + \" DAI\"\n },\n {\n label: `Funds generated from initial hatch`,\n value: Math.round(d0 * theta).toLocaleString() + \" DAI\"\n },\n {\n label: `Funds generated from exit tributes (${withdrawCount} txs)`,\n value:\n (+getLast(withdrawFeeTimeseries).toPrecision(3)).toLocaleString() +\n \" DAI\"\n },\n {\n label: `Average slippage (avg tx size ${Math.round(\n avgTxSize\n ).toLocaleString()} DAI)`,\n value: +(100 * avgSlippage).toFixed(3) + \"%\"\n }\n ];\n\n const classes = useStyles();\n\n return (\n <>\n \n \n \n \n \n\n \n \n \n \n \n Curve Design\n \n
\n \n Parameters description:\n \n
\n
\n \n {parameterDescriptions.map(({ name, text }) => (\n
\n
\n \n {name}\n \n
\n
\n {text}\n
\n
\n ))}\n \n
\n \n }\n />\n \n\n \n \n \n\n \n Run parameters\n \n\n \n \n \n \n \n\n \n \n \n Preview\n \n \n Visualization of the token bonding curve analytic\n function on a specific range of reserve [0, 4 * R0].\n This result is deterministic given the current set of\n parameters and will never change regardes of the\n campaign performance, it only shows how the price will\n react to reserve changes.\n \n \n }\n />\n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n\n \n {simulationActive ? (\n <>\n \n \n \n Simulation\n \n
\n \n This chart shows a 52 week simulation of discrete\n transactions interacting with the token bonding\n curve. Each transaction adds or substract reserve\n to the system, modifying the price over time. The\n frequency, size and direction of each transaction\n is computed from a set of bounded random\n functions.\n \n
\n\n
\n \n {simulationParameterDescriptions.map(\n ({ name, text }) => (\n