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); };