Fix react warnings
This commit is contained in:
parent
7494952661
commit
f17679e651
|
|
@ -7,7 +7,6 @@ import Box from "@material-ui/core/Box";
|
||||||
import Paper from "@material-ui/core/Paper";
|
import Paper from "@material-ui/core/Paper";
|
||||||
import Grid from "@material-ui/core/Grid";
|
import Grid from "@material-ui/core/Grid";
|
||||||
import Button from "@material-ui/core/Button";
|
import Button from "@material-ui/core/Button";
|
||||||
import Fade from "@material-ui/core/Fade";
|
|
||||||
// Components
|
// Components
|
||||||
import Header from "./Header";
|
import Header from "./Header";
|
||||||
import InputParams from "./InputParams";
|
import InputParams from "./InputParams";
|
||||||
|
|
@ -193,7 +192,7 @@ export default function App() {
|
||||||
const {
|
const {
|
||||||
k, // Invariant power kappa (.)
|
k, // Invariant power kappa (.)
|
||||||
R0, // Initial reserve (DAI)
|
R0, // Initial reserve (DAI)
|
||||||
S0, // initial supply of tokens (token)
|
// S0, // initial supply of tokens (token)
|
||||||
V0 // invariant coef
|
V0 // invariant coef
|
||||||
} = getInitialParams({
|
} = getInitialParams({
|
||||||
d0,
|
d0,
|
||||||
|
|
@ -239,6 +238,7 @@ export default function App() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let canContinueSimulation = true;
|
let canContinueSimulation = true;
|
||||||
|
|
||||||
async function simulateRandomDelta() {
|
async function simulateRandomDelta() {
|
||||||
const R_t: number[] = [R0];
|
const R_t: number[] = [R0];
|
||||||
const p_t: number[] = [getPriceR({ R: R0, V0, k })];
|
const p_t: number[] = [getPriceR({ R: R0, V0, k })];
|
||||||
|
|
@ -287,9 +287,6 @@ export default function App() {
|
||||||
setAvgTxSize(getAvg(avgTxSize_t));
|
setAvgTxSize(getAvg(avgTxSize_t));
|
||||||
setTotalReserve(getLast(R_t));
|
setTotalReserve(getLast(R_t));
|
||||||
|
|
||||||
// Make this run non-UI blocking
|
|
||||||
await pause(5);
|
|
||||||
|
|
||||||
setSimulationRunning(false);
|
setSimulationRunning(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState, useEffect, useMemo } from "react";
|
import React, { useState } from "react";
|
||||||
import {
|
import {
|
||||||
createStyles,
|
createStyles,
|
||||||
makeStyles,
|
makeStyles,
|
||||||
|
|
@ -9,10 +9,7 @@ import Typography from "@material-ui/core/Typography";
|
||||||
import Slider from "@material-ui/core/Slider";
|
import Slider from "@material-ui/core/Slider";
|
||||||
import Grid from "@material-ui/core/Grid";
|
import Grid from "@material-ui/core/Grid";
|
||||||
import TextField from "@material-ui/core/TextField";
|
import TextField from "@material-ui/core/TextField";
|
||||||
import InputLabel from "@material-ui/core/InputLabel";
|
|
||||||
import InputAdornment from "@material-ui/core/InputAdornment";
|
|
||||||
import NumberFormat from "react-number-format";
|
import NumberFormat from "react-number-format";
|
||||||
import { throttle } from "lodash";
|
|
||||||
|
|
||||||
const PrettoSlider = withStyles({
|
const PrettoSlider = withStyles({
|
||||||
root: {
|
root: {
|
||||||
|
|
@ -122,6 +119,12 @@ export default function InputParams({
|
||||||
const [p1, setP1] = useState(0.3); // Return factor (.)
|
const [p1, setP1] = useState(0.3); // Return factor (.)
|
||||||
const [wFee, setWFee] = useState(0.05); // friction coefficient (.)
|
const [wFee, setWFee] = useState(0.05); // friction coefficient (.)
|
||||||
|
|
||||||
|
function _setP0(newP0: number) {
|
||||||
|
setP0(newP0);
|
||||||
|
if (p1 < newP0) setP1(newP0);
|
||||||
|
else if (p1 > newP0 * maxReturnRate) setP1(newP0 * maxReturnRate);
|
||||||
|
}
|
||||||
|
|
||||||
function setParentCurveParams() {
|
function setParentCurveParams() {
|
||||||
setCurveParams({ d0, theta, p0, p1, wFee });
|
setCurveParams({ d0, theta, p0, p1, wFee });
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +175,7 @@ export default function InputParams({
|
||||||
{
|
{
|
||||||
label: "Hatch price",
|
label: "Hatch price",
|
||||||
value: p0,
|
value: p0,
|
||||||
setter: setP0,
|
setter: _setP0,
|
||||||
min: 0.01,
|
min: 0.01,
|
||||||
max: 1,
|
max: 1,
|
||||||
step: 0.01,
|
step: 0.01,
|
||||||
|
|
@ -210,11 +213,6 @@ export default function InputParams({
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (p1 < p0) setP1(p0);
|
|
||||||
else if (p1 > p0 * maxReturnRate) setP1(p0 * maxReturnRate);
|
|
||||||
}, [p0]);
|
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import { getAvg } from "./utils";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes the initial params given the "user friendly" params:
|
* Computes the initial params given the "user friendly" params:
|
||||||
* - Initial raise, `d0` (DAI)
|
* - Initial raise, `d0` (DAI)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue