File tree 1 file changed +4
-3
lines changed
platforms/evm/protocols/portico/src
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -385,17 +385,18 @@ export class EvmPorticoBridge<
385
385
386
386
// Check if the swap succeeded or failed
387
387
// NOTE: If we can't find the event, assume the swap succeeded
388
- const tokenBridge = this . tokenBridge . tokenBridge ;
388
+ const { tokenBridge } = this . tokenBridge ;
389
389
const filter = tokenBridge . filters . TransferRedeemed (
390
390
toChainId ( vaa . emitterChain ) ,
391
391
vaa . emitterAddress . toString ( ) ,
392
392
vaa . sequence ,
393
393
) ;
394
394
395
- // Search for the event in the last 15 minutes
395
+ // Search for the event in the last 15 minutes or 5000 blocks (whichever is smaller)
396
396
const latestBlock = await EvmPlatform . getLatestBlock ( this . provider ) ;
397
397
const blockTime = finality . blockTime . get ( this . chain ) ! ;
398
- const fromBlock = latestBlock - Math . floor ( ( 15 * 60 * 1000 ) / blockTime ) ;
398
+ const fromBlock =
399
+ latestBlock - Math . min ( 5000 , Math . floor ( ( 15 * 60 * 1000 ) / blockTime ) ) ;
399
400
400
401
const logs = await tokenBridge
401
402
. queryFilter ( filter , fromBlock , latestBlock )
You can’t perform that action at this time.
0 commit comments