Skip to content

Commit

Permalink
use fill deadline buffer from env (#1344)
Browse files Browse the repository at this point in the history
* use fill deadline buffer from env

* remove log

Co-authored-by: Dong-Ha Kim <[email protected]>

---------

Co-authored-by: Dong-Ha Kim <[email protected]>
  • Loading branch information
gsteenkamp89 and dohaki authored Dec 23, 2024
1 parent 0dfe7fb commit d2e6d7d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/utils/bridge.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ethers, BigNumber } from "ethers";
import {
ChainId,
DEFAULT_FILL_DEADLINE_BUFFER_SECONDS,
fixedPointAdjustment,
referrerDelimiterHex,
} from "./constants";
Expand Down Expand Up @@ -424,14 +425,12 @@ export async function getSpokePoolAndVerifier({
}

async function getFillDeadline(spokePool: SpokePool): Promise<number> {
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(
Expand Down
2 changes: 2 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d2e6d7d

Please sign in to comment.