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

watcher: add sepolia #205

Merged
merged 1 commit into from
Feb 13, 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
1 change: 1 addition & 0 deletions watcher/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const RPCS_BY_CHAIN: { [key in Environment]: { [key in ChainName]?: strin
base: process.env.BASE_RPC,
sei: process.env.SEI_RPC,
wormchain: process.env.WORMCHAIN_RPC,
sepolia: process.env.SEPOLIA_RPC,
},
['devnet']: {},
};
Expand Down
1 change: 1 addition & 0 deletions watcher/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const supportedChains: ChainName[] =
'base',
'sei',
// 'wormchain',
'sepolia',
]
: [
// This is the list of chains supported in MAINNET.
Expand Down
10 changes: 8 additions & 2 deletions watcher/src/watchers/EVMWatcher.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Implementation__factory } from '@certusone/wormhole-sdk/lib/cjs/ethers-contracts/factories/Implementation__factory';
import { CONTRACTS, EVMChainName } from '@certusone/wormhole-sdk/lib/cjs/utils/consts';
import { CONTRACTS, Contracts, EVMChainName } from '@certusone/wormhole-sdk/lib/cjs/utils/consts';
import { Log } from '@ethersproject/abstract-provider';
import axios from 'axios';
import { BigNumber } from 'ethers';
Expand Down Expand Up @@ -206,7 +206,13 @@ export class EVMWatcher extends Watcher {
}

async getMessagesForBlocks(fromBlock: number, toBlock: number): Promise<VaasByBlock> {
const address = CONTRACTS.MAINNET[this.chain].core;
const contracts: Contracts =
this.network === 'mainnet'
? CONTRACTS.MAINNET[this.chain]
: this.network === 'testnet'
? CONTRACTS.TESTNET[this.chain]
: CONTRACTS.DEVNET[this.chain];
const address = contracts.core;
if (!address) {
throw new Error(`Core contract not defined for ${this.chain}`);
}
Expand Down
1 change: 1 addition & 0 deletions watcher/src/watchers/Watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class Watcher {
fromBlock = toBlock;
}
retry = 0;
this.logger.debug(`fromBlock = ${fromBlock}, toBlock = ${toBlock}`);
await sleep(TIMEOUT);
} catch (e) {
// skip attempting to fetch messages until getting the finalized block succeeds
Expand Down
2 changes: 2 additions & 0 deletions watcher/src/watchers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export function makeFinalizedWatcher(network: Environment, chainName: ChainName)
return new SuiWatcher(network);
} else if (chainName === 'wormchain') {
return new WormchainWatcher(network);
} else if (chainName === 'sepolia' && network === 'testnet') {
return new EVMWatcher(network, chainName, 'finalized');
} else {
throw new Error(`Attempted to create finalized watcher for unsupported chain ${chainName}`);
}
Expand Down
Loading