From f0c291f671cfe5b81b2f567ee7701a73edb79095 Mon Sep 17 00:00:00 2001 From: jeff <113397187+cyberhorsey@users.noreply.github.com> Date: Sat, 15 Apr 2023 16:20:25 +0900 Subject: [PATCH] fix(status-page): Status page slots (#13605) --- packages/status-page/src/utils/getAvailableSlots.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/status-page/src/utils/getAvailableSlots.ts b/packages/status-page/src/utils/getAvailableSlots.ts index 6aaa5a41047..777792a2bbb 100644 --- a/packages/status-page/src/utils/getAvailableSlots.ts +++ b/packages/status-page/src/utils/getAvailableSlots.ts @@ -1,5 +1,6 @@ import { Contract, ethers } from "ethers"; import TaikoL1 from "../constants/abi/TaikoL1"; +import { getConfig } from "./getConfig"; export const getAvailableSlots = async ( provider: ethers.providers.JsonRpcProvider, @@ -7,8 +8,10 @@ export const getAvailableSlots = async ( ): Promise => { const contract: Contract = new Contract(contractAddress, TaikoL1, provider); const stateVariables = await contract.getStateVariables(); + const config = await getConfig(provider, contractAddress); + const nextBlockId = stateVariables.nextBlockId; const latestVerifiedId = stateVariables.latestVerifiedId; const pendingBlocks = nextBlockId - latestVerifiedId - 1; - return Math.abs(pendingBlocks - 2048); + return Math.abs(pendingBlocks - config.maxNumBlocks); };