base is domain 6 (#3471)

* base is domain 6

* explicit CCTP domain to name mapping
This commit is contained in:
derpy-duck 2023-10-30 14:25:40 -04:00 committed by GitHub
parent b708f5ac5b
commit ae1e4b32e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

View File

@ -242,10 +242,13 @@ export const getWormscanAPI = (_network: Network) => {
}
};
export const CCTP_DOMAIN_TO_NAME = [
"ethereum",
"avalanche",
"optimism",
"arbitrum",
"base",
];
export const getNameFromCCTPDomain = (
domain: number
): ChainName | undefined => {
if (domain === 0) return "ethereum";
else if (domain === 1) return "avalanche";
else if (domain === 2) return "optimism";
else if (domain === 3) return "arbitrum";
else if (domain === 6) return "base";
else return undefined;
};

View File

@ -16,7 +16,7 @@ import {
getWormholeRelayerAddress,
getCircleAPI,
getWormscanAPI,
CCTP_DOMAIN_TO_NAME,
getNameFromCCTPDomain,
} from "../consts";
import {
parseWormholeRelayerPayloadType,
@ -82,9 +82,9 @@ export function printChain(chainId: number) {
}
export function printCCTPDomain(domain: number) {
if (domain >= CCTP_DOMAIN_TO_NAME.length)
if (getNameFromCCTPDomain(domain) === undefined)
throw Error(`Invalid cctp domain: ${domain}`);
return `${CCTP_DOMAIN_TO_NAME[domain]} (Domain ${domain})`;
return `${getNameFromCCTPDomain(domain)} (Domain ${domain})`;
}
export const estimatedAttestationTimeInSeconds = (
@ -536,7 +536,7 @@ export async function getCCTPMessageLogURL(
);
const MessageSentTopic = ethers.utils.keccak256("MessageSent(bytes)");
try {
if (CCTP_DOMAIN_TO_NAME[cctpKey.domain] === sourceChain) {
if (getNameFromCCTPDomain(cctpKey.domain) === sourceChain) {
const cctpLogFilter = (log: ethers.providers.Log) => {
return (
log.topics[0] === DepositForBurnTopic &&