From 7ccb47d9896e63e3cc1bd8956f9128018c366e76 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Thu, 5 Aug 2021 10:01:05 -0300 Subject: [PATCH] Quick hack fixes for london mainnet --- src/special/london/BlockRow.tsx | 13 +++++-------- src/special/london/Blocks.tsx | 9 ++++++--- src/special/london/chart.ts | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/special/london/BlockRow.tsx b/src/special/london/BlockRow.tsx index 83efb0f..6683c75 100644 --- a/src/special/london/BlockRow.tsx +++ b/src/special/london/BlockRow.tsx @@ -21,7 +21,7 @@ const BlockRow: React.FC = ({ now, block, baseFeeDelta }) => { const totalReward = block.blockReward.add(netFeeReward ?? 0); return ( -
+
@@ -41,21 +41,18 @@ const BlockRow: React.FC = ({ now, block, baseFeeDelta }) => {
- {block.baseFeePerGas?.toString()} wei + {block.baseFeePerGas?.div(1e9).toString()} Gwei
{ethers.utils.commify(ethers.utils.formatEther(totalReward))} Ether
-
+
{ethers.utils.commify( - ethers.utils.formatUnits( - block.gasUsed.mul(block.baseFeePerGas!).toString(), - 9 - ) + ethers.utils.formatEther(block.gasUsed.mul(block.baseFeePerGas!)) )}{" "} - Gwei + ETH
diff --git a/src/special/london/Blocks.tsx b/src/special/london/Blocks.tsx index 7d580d9..ab1a152 100644 --- a/src/special/london/Blocks.tsx +++ b/src/special/london/Blocks.tsx @@ -125,7 +125,7 @@ const Blocks: React.FC = ({ latestBlock, targetBlockNumber }) => {
-
+
@@ -146,7 +146,7 @@ const Blocks: React.FC = ({ latestBlock, targetBlockNumber }) => { Rewards
-
+
@@ -176,7 +176,10 @@ const Blocks: React.FC = ({ latestBlock, targetBlockNumber }) => { block={b} baseFeeDelta={ i < all.length - 1 - ? b.baseFeePerGas!.sub(all[i + 1].baseFeePerGas!).toNumber() + ? b + .baseFeePerGas!.sub(all[i + 1].baseFeePerGas!) + .div(1e9) + .toNumber() : 0 } /> diff --git a/src/special/london/chart.ts b/src/special/london/chart.ts index de37edb..4ce3de1 100644 --- a/src/special/london/chart.ts +++ b/src/special/london/chart.ts @@ -25,7 +25,7 @@ export const burntFeesChartOptions: ChartOptions = { text: "Burnt fees", }, ticks: { - callback: (v) => `${v} Gwei`, + callback: (v) => `${(v as number) / 1e9} ETH`, }, }, yBaseFee: { @@ -36,7 +36,7 @@ export const burntFeesChartOptions: ChartOptions = { text: "Base fee", }, ticks: { - callback: (v) => `${v} wei`, + callback: (v) => `${(v as number) / 1e9} Gwei`, }, grid: { drawOnChartArea: false, @@ -51,7 +51,7 @@ export const burntFeesChartData = (blocks: ExtendedBlock[]): ChartData => ({ { label: "Burnt fees (Gwei)", data: blocks - .map((b) => b.gasUsed.mul(b.baseFeePerGas!).toNumber() / 1e9) + .map((b) => b.gasUsed.mul(b.baseFeePerGas!).div(1e9).toNumber()) .reverse(), fill: true, backgroundColor: "#FDBA7470", @@ -103,7 +103,7 @@ export const gasChartOptions: ChartOptions = { text: "Base fee", }, ticks: { - callback: (v) => `${v} wei`, + callback: (v) => `${(v as number) / 1e9} Gwei`, }, grid: { drawOnChartArea: false,