Skip to content
Open
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
RPC_PROVIDER_URLS_42161: ${{ secrets.RPC_PROVIDER_URLS_42161 }}
RPC_PROVIDER_URLS_999: ${{ secrets.RPC_PROVIDER_URLS_999 }}
RPC_PROVIDER_URLS_34268394551451: ${{ secrets.RPC_PROVIDER_URLS_34268394551451 }}
RPC_PROVIDER_URLS_1: ${{ secrets.RPC_PROVIDER_URLS_1 }}
run: |
# Safely append the secret, prefixed with a newline.
# This prevents file corruption.
Expand All @@ -41,6 +42,7 @@ jobs:
printf '\n%s\n' "RPC_PROVIDER_URLS_42161=$RPC_PROVIDER_URLS_42161" >> .env.test
printf '\n%s\n' "RPC_PROVIDER_URLS_999=$RPC_PROVIDER_URLS_999" >> .env.test
printf '\n%s\n' "RPC_PROVIDER_URLS_34268394551451=$RPC_PROVIDER_URLS_34268394551451" >> .env.test
printf '\n%s\n' "RPC_PROVIDER_URLS_1=$RPC_PROVIDER_URLS_1" >> .env.test
- name: Run tests using docker
run: pnpm test:e2e:docker
build:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ const WHITELISTED_FINALIZERS = [
"0x72adB07A487f38321b6665c02D289C413610B081",
"0x49066b9c4a68e0942f77989e78d9e27f78a67ce7b165cafd101a477a148058fd",
"0x1c709Fd0Db6A6B877Ddb19ae3D485B7b4ADD879f", // CCTPHyperEVMSponsoredCCTPDstPeriphery
"0x5616194d65638086a3191B1fEF436f503ff329eC", // CCTPDstPeriphery Mainnet
];

// Convert whitelisted finalizers to bytes32 format for comparison with destinationCaller
Expand Down Expand Up @@ -186,7 +187,7 @@ export class CCTPIndexerDataHandler implements IndexerDataHandler {
const timeToStoreEvents = performance.now();

const sponsoredCCTPDstPeripheryAddress =
getSponsoredCCTPDstPeripheryAddress();
SPONSORED_CCTP_DST_PERIPHERY_ADDRESS[this.chainId];

if (!sponsoredCCTPDstPeripheryAddress) {
this.logger.debug({
Expand Down Expand Up @@ -222,7 +223,7 @@ export class CCTPIndexerDataHandler implements IndexerDataHandler {
const sponsoredCCTPSrcPeripheryAddress =
getSponsoredCCTPSrcPeripheryAddress(this.chainId);
const sponsoredCCTPDstPeripheryAddress =
getSponsoredCCTPDstPeripheryAddress();
getSponsoredCCTPDstPeripheryAddress(this.chainId);

const tokenMessengerAddress =
this.chainId in TEST_NETWORKS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ describe("CCTPIndexerDataHandler", () => {

beforeEach(async () => {
dataSource = await getTestDataSource();
cctpRepository = new CCTPRepository(dataSource, logger);

logger = {
debug: sinon.spy(),
info: sinon.spy(),
warn: sinon.spy(),
error: sinon.spy(),
} as unknown as Logger;

cctpRepository = new CCTPRepository(dataSource, logger);
});

afterEach(async () => {
Expand Down Expand Up @@ -475,4 +475,79 @@ describe("CCTPIndexerDataHandler", () => {
// We check that it is a valid date object, rather than a specific ms timestamp
expect(savedEvent!.blockTimestamp).to.be.instanceOf(Date);
}).timeout(10000);

it("should fetch burn and sponsored burn events to Lighter", async () => {
// https://arbiscan.io/tx/0x2f866714d04523775153be07f0680ae6c3f28f08af8fa574317e2d16e826aa54
const transactionHash =
"0xef55d3110094488b943525fd6609e7918328009168e661658b5fb858434b78a0";
const blockNumber = 411671197;
setupTestForChainId(CHAIN_IDs.ARBITRUM);

// We need to stub the contract address as the event we are fetching is exclusive to this address and the contract address can change with bumps of the across contracts beta package
stubContractUtils(
"SponsoredCCTPSrcPeriphery",
"0xAA4958EFa0Cf6DdD87e354a90785f1D7291a82c7",
CHAIN_IDs.ARBITRUM,
);
const blockRange: BlockRange = {
from: blockNumber,
to: blockNumber,
};
await handler.processBlockRange(blockRange, blockNumber);

const sponsoredDepositForBurnRepository = dataSource.getRepository(
entities.SponsoredDepositForBurn,
);
const savedSponsoredEvent = await sponsoredDepositForBurnRepository.findOne(
{
where: { transactionHash: transactionHash },
},
);
const depositForBurnRepository = dataSource.getRepository(
entities.DepositForBurn,
);
const savedBurnEvent = await depositForBurnRepository.findOne({
where: { transactionHash: transactionHash },
});
expect(savedBurnEvent).to.exist;
expect(savedBurnEvent!.transactionHash).to.equal(transactionHash);
expect(savedBurnEvent!.blockNumber).to.equal(blockNumber);
expect(savedSponsoredEvent).to.exist;
expect(savedSponsoredEvent!.transactionHash).to.equal(transactionHash);
expect(savedSponsoredEvent!.blockNumber).to.equal(blockNumber);
}).timeout(10000);

it("should fetch mint events on Lighter", async () => {
const transactionHash =
"0x347753987aac08486f047b47795c7e2d874cfbecfbba1869146177e54a2e9095";
const blockNumber = 24021731;
setupTestForChainId(CHAIN_IDs.MAINNET);

const blockRange: BlockRange = {
from: blockNumber,
to: blockNumber,
};
await handler.processBlockRange(blockRange, blockNumber);

const messageReceivedRepository = dataSource.getRepository(
entities.MessageReceived,
);
const savedMessageReceivedEvent = await messageReceivedRepository.findOne({
where: { transactionHash: transactionHash },
});
const mintAndWithdrawRepository = dataSource.getRepository(
entities.MintAndWithdraw,
);
const savedMintEvent = await mintAndWithdrawRepository.findOne({
where: { transactionHash: transactionHash },
});
expect(savedMintEvent).to.exist;
expect(savedMintEvent!.transactionHash).to.equal(transactionHash);
expect(savedMintEvent!.blockNumber).to.equal(blockNumber);
expect(savedMessageReceivedEvent).to.exist;
expect(savedMessageReceivedEvent!.transactionHash).to.equal(
transactionHash,
);
expect(savedMessageReceivedEvent!.blockNumber).to.equal(blockNumber);
}).timeout(10000);
});
4 changes: 2 additions & 2 deletions packages/indexer/src/tests/utils.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ describe("Beta Contract Accessors (using provided JSON)", () => {
expect(utils.isValidEvmAddress(result!.toLowerCase())).to.be.true;
});

it("should return undefined if accessed on a chain where it doesn't exist (e.g., Mainnet 1)", () => {
expect(getSponsoredCCTPDstPeripheryAddress(1)).to.be.undefined;
it("should return undefined if accessed on a chain where it doesn't exist (e.g., Arbitrum 42161)", () => {
expect(getSponsoredCCTPDstPeripheryAddress(42161)).to.be.undefined;
});
});

Expand Down
8 changes: 7 additions & 1 deletion packages/indexer/src/utils/contractUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,13 @@ function getBetaContractAddress(
*/
export const getSponsoredCCTPDstPeripheryAddress = (
chainId: number = CHAIN_IDs.HYPEREVM,
) => getBetaContractAddress("SponsoredCCTPDstPeriphery", chainId);
) => {
if (chainId === CHAIN_IDs.MAINNET) {
// Temporary until deployments are added to the contracts package
return "0x5616194d65638086a3191B1fEF436f503ff329eC";
}
return getBetaContractAddress("SponsoredCCTPDstPeriphery", chainId);
};

/**
* Gets the Sponsored CCTP Source Periphery address.
Expand Down