From e95a33ba1f867c1a659145bced99804c4dbef57c Mon Sep 17 00:00:00 2001 From: dapplion Date: Sun, 11 Aug 2019 14:18:33 +0200 Subject: [PATCH] Apply Griff content revisions --- src/App.tsx | 41 ++++++++++++++++---------------- src/CurveDesignInputParams.tsx | 8 +++---- src/Header.tsx | 2 +- src/PriceSimulationChart.tsx | 21 +++++++++++------ src/SimulationInputParams.tsx | 2 +- src/parametersDescriptions.ts | 43 ++++++++++++++++++---------------- 6 files changed, 63 insertions(+), 54 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 95a46dd..381b5ea 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,7 +19,9 @@ import HelpText from "./HelpText"; import { parameterDescriptions, simulationParameterDescriptions, - resultParameterDescriptions + resultParameterDescriptions, + supplyVsDemandChartDescription, + simulationChartDescription } from "./parametersDescriptions"; // Utils import { getLast, getAvg, pause } from "./utils"; @@ -321,28 +323,36 @@ export default function App() { }; }, [simulationActive]); + // End results computed for chart visualization + const initialHatchFunds = d0 * theta; + const totalFundsRaisedTimeseries = withdrawFeeTimeseries.map( + x => x + initialHatchFunds + ); + const resultFields = [ { - label: `Total reserve`, + label: resultParameterDescriptions.totalReserve.name, description: resultParameterDescriptions.totalReserve.text, value: (+totalReserve.toPrecision(3)).toLocaleString() + " DAI" }, { - label: `Funds generated from initial hatch`, + label: resultParameterDescriptions.initialHatchFunds.name, description: resultParameterDescriptions.initialHatchFunds.text, value: Math.round(d0 * theta).toLocaleString() + " DAI" }, { - label: `Funds generated from exit tributes (${withdrawCount} txs)`, + label: `${ + resultParameterDescriptions.exitTributes.name + } (${withdrawCount} txs)`, description: resultParameterDescriptions.exitTributes.text, value: (+getLast(withdrawFeeTimeseries).toPrecision(3)).toLocaleString() + " DAI" }, { - label: `Average slippage (avg tx size ${Math.round( - avgTxSize - ).toLocaleString()} DAI)`, + label: `${ + resultParameterDescriptions.slippage.name + } (avg tx size ${Math.round(avgTxSize).toLocaleString()} DAI)`, description: resultParameterDescriptions.slippage.text, value: +(100 * avgSlippage).toFixed(3) + "%" } @@ -427,12 +437,7 @@ export default function App() { text={
- 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. + {supplyVsDemandChartDescription}
} @@ -482,13 +487,7 @@ export default function App() {
- 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. + {simulationChartDescription}
@@ -520,8 +519,8 @@ export default function App() { diff --git a/src/CurveDesignInputParams.tsx b/src/CurveDesignInputParams.tsx index e9f7298..1c6f0f1 100644 --- a/src/CurveDesignInputParams.tsx +++ b/src/CurveDesignInputParams.tsx @@ -42,7 +42,7 @@ export default function CurveDesignInputParams({ const inputFields: InputFieldInterface[] = [ { - label: "Allocation to funding pool", + label: parameterDescriptions.theta.name, description: parameterDescriptions.theta.text, value: theta, setter: setTheta, @@ -55,7 +55,7 @@ export default function CurveDesignInputParams({ toNum: (n: string) => parseFloat(n) * 1e-2 }, { - label: "Hatch price (DAI/token)", + label: `${parameterDescriptions.p0.name} (DAI/token)`, description: parameterDescriptions.p0.text, value: p0, setter: _setP0, @@ -67,7 +67,7 @@ export default function CurveDesignInputParams({ format: (n: number) => `$${n}` }, { - label: "Post-hatch price (DAI/token)", + label: `${parameterDescriptions.p1.name} (DAI/token)`, description: parameterDescriptions.p1.text, value: p1, setter: setP1, @@ -79,7 +79,7 @@ export default function CurveDesignInputParams({ format: (n: number) => `$${n}` }, { - label: "Exit tribute", + label: parameterDescriptions.wFee.name, description: parameterDescriptions.wFee.text, value: wFee, setter: setWFee, diff --git a/src/Header.tsx b/src/Header.tsx index e8617a2..5eeb53a 100644 --- a/src/Header.tsx +++ b/src/Header.tsx @@ -54,7 +54,7 @@ export default function Header() {
- Augmented Token Bonding Curve Design + Augmented Bonding Curve Design diff --git a/src/PriceSimulationChart.tsx b/src/PriceSimulationChart.tsx index df5ab1e..8cbbc06 100644 --- a/src/PriceSimulationChart.tsx +++ b/src/PriceSimulationChart.tsx @@ -16,8 +16,8 @@ import { linspace } from "./utils"; const keyHorizontal = "x"; const keyVerticalLeft = "Price (DAI/token)"; -const keyVerticalRight = "Total exit tributes (DAI)"; const keyVerticalLeft2 = "Floor price (DAI/token)"; +const keyVerticalRight = "Total funds raised (DAI)"; const useStyles = makeStyles((theme: Theme) => createStyles({ @@ -32,13 +32,13 @@ const useStyles = makeStyles((theme: Theme) => function PriceSimulationChart({ priceTimeseries, - withdrawFeeTimeseries, + totalFundsRaisedTimeseries, floorpriceTimeseries, p0, p1 }: { priceTimeseries: number[]; - withdrawFeeTimeseries: number[]; + totalFundsRaisedTimeseries: number[]; floorpriceTimeseries: number[]; p0: number; p1: number; @@ -55,7 +55,7 @@ function PriceSimulationChart({ [keyHorizontal]: t, [keyVerticalLeft]: priceTimeseries[t] || 0, [keyVerticalLeft2]: floorpriceTimeseries[t] || 0, - [keyVerticalRight]: withdrawFeeTimeseries[t] || 0 + [keyVerticalRight]: totalFundsRaisedTimeseries[t] || 0 }); } @@ -92,8 +92,8 @@ function PriceSimulationChart({ const weekNum = label; const toolTipData: string[][] = [ ["Price", price.toFixed(2), "DAI/tk"], - ["Floor", floor.toFixed(2), "DAI/tk"], - ["Exit t.", formatter(exit), "DAI"], + ["Floor P.", floor.toFixed(2), "DAI/tk"], + ["Funds R.", formatter(exit), "DAI"], ["Week", weekNum, ""] ]; @@ -115,6 +115,10 @@ function PriceSimulationChart({ } else return null; } + const totalFundsMin = totalFundsRaisedTimeseries[0]; + const totalFundsMax = totalFundsRaisedTimeseries.slice(-1)[0]; + const totalFundsRange = totalFundsMax - totalFundsMin; + return (