Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(status-page): use ttko from env #13998

Merged
merged 2 commits into from
Jun 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions packages/status-page/src/utils/buildStatusIndicators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import { getQueuedTransactions } from "./getQueuedTransactions";
import type { initConfig } from "./initConfig";
import { watchHeaderSynced } from "./watchHeaderSynced";
import axios from "axios";
import { getConfig } from "./getConfig";
import { getStateVariables } from "./getStateVariables";
import TaikoL2 from "../constants/abi/TaikoL2";

export async function buildStatusIndicators(
config: ReturnType<typeof initConfig>,
Expand Down Expand Up @@ -206,13 +204,14 @@ export async function buildStatusIndicators(
header: "ETH Deposits",
intervalInMs: 20000,
colorFunc: (value: Status) => {
if (BigNumber.from(value).eq(0)) {
return "green";
} else if (BigNumber.from(value).lt(32)) {
return "yellow";
} else {
return "red";
}
// if (BigNumber.from(value).eq(0)) {
// return "green";
// } else if (BigNumber.from(value).lt(32)) {
// return "yellow";
// } else {
// return "red";
// }
return "green";
},
tooltip: "The number of pending ETH deposits for L1 => L2",
},
Expand Down Expand Up @@ -296,7 +295,9 @@ export async function buildStatusIndicators(
provider
);
const fee = await contract.getBlockFee();
return `${ethers.utils.formatUnits(fee, decimals)} TKO`;
return `${ethers.utils.formatUnits(fee, decimals)} ${
config.feeTokenSymbol
}`;
},
watchStatusFunc: null,
provider: config.l1Provider,
Expand Down Expand Up @@ -328,7 +329,7 @@ export async function buildStatusIndicators(
);

if (!events || events.length === 0) {
return `0 TKO`;
return `0 ${config.feeTokenSymbol}`;
}

const event = events[events.length - 1].args as any as {
Expand All @@ -338,7 +339,7 @@ export async function buildStatusIndicators(
return `${ethers.utils.formatUnits(
event.reward.toString(),
decimals
)} TKO`;
)} ${config.feeTokenSymbol}`;
},
watchStatusFunc: async (
provider: ethers.providers.JsonRpcProvider,
Expand All @@ -348,7 +349,9 @@ export async function buildStatusIndicators(
const contract = new Contract(address, TaikoL1, provider);
const listener = (id, blockHash, reward, ...args) => {
onEvent(
`${ethers.utils.formatUnits(reward.toString(), decimals)} TKO`
`${ethers.utils.formatUnits(reward.toString(), decimals)} ${
config.feeTokenSymbol
}`
);
};
contract.on("BlockVerified", listener);
Expand Down Expand Up @@ -497,7 +500,7 @@ export async function buildStatusIndicators(
return `${ethers.utils.formatUnits(
resp.data.averageProofReward,
decimals
)} TKO`;
)} ${config.feeTokenSymbol}`;
},
colorFunc: function (status: Status) {
return "green";
Expand Down