From 977783b0bcf5e2adb3dab05961a8fcdae33135ee Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Thu, 5 Aug 2021 14:54:25 -0300 Subject: [PATCH 1/2] Fix duplicate minus signal --- src/special/london/Blip.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/special/london/Blip.tsx b/src/special/london/Blip.tsx index 4a6d489..377a1d9 100644 --- a/src/special/london/Blip.tsx +++ b/src/special/london/Blip.tsx @@ -23,7 +23,7 @@ const Blip: React.FC = ({ value }) => { value > 0 ? "text-green-500" : "text-red-500" } text-3xl`} > - {value > 0 ? `+${value}` : `-${value}`} + {value > 0 ? `+${value}` : `${value}`} )} From 6e52bf562707bca86304358059e920ac802a37f6 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Thu, 5 Aug 2021 15:19:44 -0300 Subject: [PATCH 2/2] Small fixes for rounding errors on london dashboard --- src/special/london/BlockRow.tsx | 10 ++++++++-- src/special/london/Blocks.tsx | 15 ++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/special/london/BlockRow.tsx b/src/special/london/BlockRow.tsx index 1f01e28..f8da89c 100644 --- a/src/special/london/BlockRow.tsx +++ b/src/special/london/BlockRow.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { ethers } from "ethers"; +import { ethers, FixedNumber } from "ethers"; import BlockLink from "../../components/BlockLink"; import TimestampAge from "../../components/TimestampAge"; import { ExtendedBlock } from "../../useErigonHooks"; @@ -41,7 +41,13 @@ const BlockRow: React.FC = ({ now, block, baseFeeDelta }) => {
- {block.baseFeePerGas?.div(1e9).toString()} Gwei + + {FixedNumber.from(block.baseFeePerGas) + .divUnsafe(FixedNumber.from(1e9)) + .round(0) + .toUnsafeFloat()}{" "} + Gwei +
diff --git a/src/special/london/Blocks.tsx b/src/special/london/Blocks.tsx index ab1a152..a07cfe6 100644 --- a/src/special/london/Blocks.tsx +++ b/src/special/london/Blocks.tsx @@ -5,7 +5,7 @@ import React, { useMemo, useCallback, } from "react"; -import { ethers } from "ethers"; +import { ethers, FixedNumber } from "ethers"; import { Line } from "react-chartjs-2"; import { Transition } from "@headlessui/react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -176,10 +176,15 @@ const Blocks: React.FC = ({ latestBlock, targetBlockNumber }) => { block={b} baseFeeDelta={ i < all.length - 1 - ? b - .baseFeePerGas!.sub(all[i + 1].baseFeePerGas!) - .div(1e9) - .toNumber() + ? FixedNumber.from(b.baseFeePerGas!) + .divUnsafe(FixedNumber.from(1e9)) + .round(0) + .subUnsafe( + FixedNumber.from(all[i + 1].baseFeePerGas!) + .divUnsafe(FixedNumber.from(1e9)) + .round(0) + ) + .toUnsafeFloat() : 0 } />