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

use fill deadline buffer from env #1344

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
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
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
Loading