diff --git a/api/_exclusivity/index.ts b/api/_exclusivity/index.ts index 747f1b98f..df197556b 100644 --- a/api/_exclusivity/index.ts +++ b/api/_exclusivity/index.ts @@ -8,7 +8,7 @@ type BigNumber = ethers.BigNumber; const { parseUnits } = ethers.utils; const { ZERO_ADDRESS, CHAIN_IDs } = sdk.constants; const { fixedPointAdjustment: fixedPoint } = sdk.utils; -const REORG_CHAINS = [CHAIN_IDs.MAINNET, CHAIN_IDs.POLYGON, CHAIN_IDs.SCROLL]; +// const REORG_CHAINS = [CHAIN_IDs.MAINNET, CHAIN_IDs.POLYGON, CHAIN_IDs.SCROLL]; /** * Select a specific relayer exclusivity strategy to apply. @@ -58,11 +58,10 @@ export async function selectExclusiveRelayer( ); if (relayers.length > 0) { - // Only get the latest block if we are doing an exclusive relay and on a chain which re-orgs. - if (REORG_CHAINS.includes(originChainId)) { - const currentBlock = await getCachedLatestBlock(originChainId); - exclusivityPeriodSec += currentBlock.timestamp; - } + // if (REORG_CHAINS.includes(originChainId)) { + // const currentBlock = await getCachedLatestBlock(originChainId); + // exclusivityPeriodSec += currentBlock.timestamp; + // } exclusiveRelayer = selectorFn(relayers); exclusivityPeriod = diff --git a/src/views/Bridge/hooks/useBridgeAction/factory.ts b/src/views/Bridge/hooks/useBridgeAction/factory.ts index c67fdd39c..78c2a2ecd 100644 --- a/src/views/Bridge/hooks/useBridgeAction/factory.ts +++ b/src/views/Bridge/hooks/useBridgeAction/factory.ts @@ -124,6 +124,15 @@ export function createBridgeActionHook(strategy: BridgeActionStrategy) { ampli.depositNetworkMismatch(networkMismatchProperties); }); }; + + // Before sending, fetch a new timestamp if it's on Mainnet or Polygon and use that for + // the exclusivity + const REORG_CHAIN_IDS = [1, 137, 534352]; + if (REORG_CHAIN_IDS.includes(frozenDepositArgs.fromChain)) { + const currTimestampInSeconds = Math.floor(Date.now() / 1000); + frozenDepositArgs.exclusivityDeadline = + currTimestampInSeconds + frozenDepositArgs.exclusivityDeadline; + } const txHash = await strategy.sendDepositTx({ depositArgs: frozenDepositArgs, transferQuote: frozenTransferQuote,