From d2e6d7d46b74357ee467b981b386f4eb41c8d95f Mon Sep 17 00:00:00 2001 From: Gerhard Steenkamp <51655063+gsteenkamp89@users.noreply.github.com> Date: Mon, 23 Dec 2024 14:32:14 +0200 Subject: [PATCH] use fill deadline buffer from env (#1344) * use fill deadline buffer from env * remove log Co-authored-by: Dong-Ha Kim --------- Co-authored-by: Dong-Ha Kim --- src/utils/bridge.ts | 15 +++++++-------- src/utils/constants.ts | 2 ++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/utils/bridge.ts b/src/utils/bridge.ts index ead10f840..c2b5acd7b 100644 --- a/src/utils/bridge.ts +++ b/src/utils/bridge.ts @@ -1,6 +1,7 @@ import { ethers, BigNumber } from "ethers"; import { ChainId, + DEFAULT_FILL_DEADLINE_BUFFER_SECONDS, fixedPointAdjustment, referrerDelimiterHex, } from "./constants"; @@ -424,14 +425,12 @@ export async function getSpokePoolAndVerifier({ } async function getFillDeadline(spokePool: SpokePool): Promise { - const calls = [ - spokePool.interface.encodeFunctionData("getCurrentTime"), - spokePool.interface.encodeFunctionData("fillDeadlineBuffer"), - ]; - - const [currentTime, fillDeadlineBuffer] = - await spokePool.callStatic.multicall(calls); - return Number(currentTime) + Number(fillDeadlineBuffer); + const fillDeadlineBuffer = Number( + process.env.FILL_DEADLINE_BUFFER_SECONDS ?? + DEFAULT_FILL_DEADLINE_BUFFER_SECONDS + ); + const currentTime = await spokePool.callStatic.getCurrentTime(); + return Number(currentTime) + fillDeadlineBuffer; } async function _tagRefAndSignTx( diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 670193481..109211330 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -549,3 +549,5 @@ export const defaultSwapSlippage = Number( export const indexerApiBaseUrl = process.env.REACT_APP_INDEXER_BASE_URL || undefined; + +export const DEFAULT_FILL_DEADLINE_BUFFER_SECONDS = 2.5 * 60 * 60; // 2.5 hours