Skip to content

Commit

Permalink
FT: add more mainnet chains
Browse files Browse the repository at this point in the history
  • Loading branch information
panoel committed Feb 26, 2025
1 parent 1bf6a32 commit 1218137
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 24 deletions.
4 changes: 4 additions & 0 deletions common/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ export const INITIAL_FT_DEPLOYMENT_BLOCK_BY_NETWORK_AND_CHAIN: NetworkChainBlock
['Mainnet']: {
Solana: '285350104',
Arbitrum: '245882390',
Avalanche: '55500000',
Base: '18956026',
Ethereum: '21630000',
Optimism: '130500000',
Polygon: '66500000',
},
['Testnet']: {
Solana: '302162456',
Expand Down
30 changes: 28 additions & 2 deletions watcher/src/fastTransfer/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,31 @@ export const FAST_TRANSFER_CONTRACTS: FastTransferContractAddresses = {
CircleBridge: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
SwapLayer: '0x4dE319b7492E791cDe47FDf12c922cF568441C43',
},
Avalanche: {
TokenRouter: '0x70287c79ee41C5D1df8259Cd68Ba0890cd389c47',
CircleBridge: '0x6b25532e1060ce10cc3b0a99e5683b91bfde6982',
SwapLayer: '',
},
Base: {
TokenRouter: '0x70287c79ee41C5D1df8259Cd68Ba0890cd389c47',
CircleBridge: '0x1682Ae6375C4E4A97e4B583BC394c861A46D8962',
SwapLayer: '0x2Ab7BeEF955826054d03419Ee2122445Ca677eb2',
},
Ethereum: {
TokenRouter: '0x70287c79ee41C5D1df8259Cd68Ba0890cd389c47',
CircleBridge: '0xbd3fa81b58ba92a82136038b25adec7066af3155',
SwapLayer: '',
},
Optimism: {
TokenRouter: '0x70287c79ee41C5D1df8259Cd68Ba0890cd389c47',
CircleBridge: '0x2B4069517957735bE00ceE0fadAE88a26365528f',
SwapLayer: '',
},
Polygon: {
TokenRouter: '0x70287c79ee41C5D1df8259Cd68Ba0890cd389c47',
CircleBridge: '0x9daF8c91AEFAE50b9c0E69629D3F6Ca40cA3B3FE',
SwapLayer: '',
},
},
Testnet: {
Solana: {
Expand All @@ -78,11 +98,17 @@ export const FAST_TRANSFER_CONTRACTS: FastTransferContractAddresses = {
};

// Separate testnet and mainnet chains
export type FTEVMMainnetChain = 'Arbitrum' | 'Base';
export type FTEVMMainnetChain = 'Arbitrum' | 'Base' | 'Ethereum' | 'Optimism' | 'Polygon';
export type FTEVMTestnetChain = 'ArbitrumSepolia' | 'OptimismSepolia';
export type FTEVMChain = FTEVMMainnetChain | FTEVMTestnetChain;

export const FTEVMMainnetChains: FTEVMMainnetChain[] = ['Arbitrum', 'Base'];
export const FTEVMMainnetChains: FTEVMMainnetChain[] = [
'Arbitrum',
'Base',
'Ethereum',
'Optimism',
'Polygon',
];
export const FTEVMTestnetChains: FTEVMTestnetChain[] = ['ArbitrumSepolia', 'OptimismSepolia'];

export const isFTEVMChain = (chain: Chain, network: Network): chain is FTEVMChain => {
Expand Down
47 changes: 25 additions & 22 deletions watcher/src/watchers/FTEVMWatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,27 +371,26 @@ export class FTEVMWatcher extends Watcher {
if (!rpc) {
throw new Error(`${this.chain} RPC is not defined!`);
}
const result = (
await axios.post(
rpc,
[
{
jsonrpc: '2.0',
id: 1,
method: 'eth_getLogs',
params: [
{
fromBlock: `0x${fromBlock.toString(16)}`,
toBlock: `0x${toBlock.toString(16)}`,
address,
topics,
},
],
},
],
AXIOS_CONFIG_JSON
)
)?.data?.[0]?.result;
const baseResult = await axios.post(
rpc,
[
{
jsonrpc: '2.0',
id: 1,
method: 'eth_getLogs',
params: [
{
fromBlock: `0x${fromBlock.toString(16)}`,
toBlock: `0x${toBlock.toString(16)}`,
address,
topics,
},
],
},
],
AXIOS_CONFIG_JSON
);
const result = baseResult?.data?.[0]?.result;
if (result) {
// Convert to Ethers compatible type
return result.map((l: Log) => ({
Expand All @@ -401,7 +400,11 @@ export class FTEVMWatcher extends Watcher {
logIndex: BigNumber.from(l.logIndex).toNumber(),
}));
}
throw new Error(`Unable to parse result of eth_getLogs for ${fromBlock}-${toBlock} on ${rpc}`);
throw new Error(
`Unable to parse result of eth_getLogs for ${fromBlock}-${toBlock} on ${rpc} with result ${JSON.stringify(
baseResult.data
)}`
);
}

normalizeAddress(address: string): string {
Expand Down

0 comments on commit 1218137

Please sign in to comment.