Skip to content

Commit

Permalink
ft_watcher: add evm swap_layer ca
Browse files Browse the repository at this point in the history
ft_watcher: add script to watch fast_transfer manually

Signed-off-by: bingyuyap <[email protected]>
  • Loading branch information
bingyuyap committed Aug 30, 2024
1 parent 87903ab commit bdce39e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
3 changes: 2 additions & 1 deletion watcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"read-firestore": "ts-node scripts/readFirestore.ts",
"reconstruct-vaa": "ts-node scripts/reconstructVAA.ts",
"update-found-vaas": "ts-node scripts/updateFoundVAAs.ts",
"update-rows": "ts-node scripts/updateRows.ts"
"update-rows": "ts-node scripts/updateRows.ts",
"watch-ft": "ts-node scripts/watchFt.ts"
},
"dependencies": {
"@celo-tools/celo-ethers-wrapper": "^0.3.0",
Expand Down
55 changes: 55 additions & 0 deletions watcher/scripts/watchFt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// This file is for when I (@bingyuyap) needs to seed the database manually for testing
import * as dotenv from 'dotenv';
dotenv.config();

import { FTSolanaWatcher } from '../src/watchers/FTSolanaWatcher';
import { FTEVMWatcher } from '../src/watchers/FTEVMWatcher';
import { Network } from '@wormhole-foundation/sdk-base';
import { getNetwork } from '@wormhole-foundation/wormhole-monitor-common';

const network = getNetwork();
async function watchFtSolana(network: Network, fromSlot: number, toSlot: number) {
const watcher = new FTSolanaWatcher(network);
const batchSize = 1000;

for (let currentSlot = fromSlot; currentSlot <= toSlot; currentSlot += batchSize) {
const batchEndSlot = Math.min(currentSlot + batchSize - 1, toSlot);
await watcher.getFtMessagesForBlocks(currentSlot, batchEndSlot);
console.log(`Processed slots ${currentSlot} to ${batchEndSlot}`);
}
}

async function watchFt(
network: Network,
chain: 'Arbitrum' | 'Base',
fromBlock: number,
toBlock: number
) {
const watcher = new FTEVMWatcher(network, chain);
const batchSize = 1000;

for (let currentBlock = fromBlock; currentBlock <= toBlock; currentBlock += batchSize) {
const batchEndBlock = Math.min(currentBlock + batchSize - 1, toBlock);
await watcher.getFtMessagesForBlocks(currentBlock, batchEndBlock);
console.log(`Processed blocks ${currentBlock} to ${batchEndBlock}`);
}
}

const fromSlot = 321556219;
const toSlot = 321807831;

const arbitrumFromBlock = 247028328;
const arbitrumToBlock = 247037682;

const baseFromBlock = 18820795;
const baseToBlock = 18958996;

watchFt(network, 'Arbitrum', arbitrumFromBlock, arbitrumToBlock).then(() =>
console.log('Done watching ftArbitrum')
);

watchFt(network, 'Base', baseFromBlock, baseToBlock).then(() =>
console.log('Done watching ftBase')
);

watchFtSolana(network, fromSlot, toSlot).then(() => console.log('Done watching ftSolana'));
2 changes: 2 additions & 0 deletions watcher/src/fastTransfer/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ export const FAST_TRANSFER_CONTRACTS: FastTransferContractAddresses = {
Arbitrum: {
TokenRouter: '0x70287c79ee41C5D1df8259Cd68Ba0890cd389c47',
CircleBridge: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
SwapLayer: '0x4dE319b7492E791cDe47FDf12c922cF568441C43',
},
Base: {
TokenRouter: '0x70287c79ee41C5D1df8259Cd68Ba0890cd389c47',
CircleBridge: '0x1682Ae6375C4E4A97e4B583BC394c861A46D8962',
SwapLayer: '0x2Ab7BeEF955826054d03419Ee2122445Ca677eb2',
},
},
Testnet: {
Expand Down

0 comments on commit bdce39e

Please sign in to comment.