Skip to content

feat: Add CCTP V2 bridge provider#190

Merged
mpetrunic merged 16 commits intomainfrom
cctpv2
Apr 17, 2026
Merged

feat: Add CCTP V2 bridge provider#190
mpetrunic merged 16 commits intomainfrom
cctpv2

Conversation

@wesraph
Copy link
Copy Markdown
Contributor

@wesraph wesraph commented Apr 13, 2026

Summary

Adds Circle CCTP V2 as a new cross-chain bridge provider for USDC transfers, alongside the existing CCTP V1 integration.

New contracts

  • ICCTPV2.sol — Interfaces for TokenMessengerV2 and MessageTransmitterV2
  • CCTPV2Adapter.sol — Abstract adapter with initiateTransferCCTPV2(), using standard transfer parameters (maxFee=0, minFinalityThreshold=2000 for hard finality)

Architecture

  • CCTPV2Adapter extends CCTPAdapter, reusing domainCCTP() mappings and the shared processTransferCCTP() receive logic — V1 and V2 share the same receiveMessage(bytes,bytes) signature, so the only difference on the receive side is which MessageTransmitter address to call
  • CCTPAdapter.processTransferCCTP() is parameterized to accept a messageTransmitter address instead of hardcoding V1's
  • Rebalancer and Repayer now inherit CCTPV2Adapter (instead of CCTPAdapter), gaining both V1 and V2 support
  • New Provider.CCTP_V2 enum variant in IRoute

Deployment & config

  • Constructor params extended with cctpV2TokenMessenger and cctpV2MessageTransmitter (zero-address safe for chains without V2)
  • Ethereum mainnet V2 addresses added to network.config.ts
  • Deploy scripts updated for Rebalancer, Repayer, and standalone Repayer

Tests

  • Unit tests for both initiate and process flows via CCTP V2 (mock contracts)
  • Ethereum fork tests for CCTP V1 and V2 initiateRepay, verifying DepositForBurn events from Circle's real deployed contracts

lastperson and others added 4 commits April 13, 2026 13:43
* Add USDT0 OFT adapter

* Prepare config

* Add single active legacy pool to Stage config

* Fix USDT0OFT address for Arbitrum Stage config

* Remove BSC pool configuration due to no CCTP support

* Add BSC Repayer 18 decimals tokens tolerance

* Add decimals to tokens config in Repayer

* Add more tests

* Address comments
… Bsc. (#189)

* Add USDT0 OFT adapter

* Prepare config

* Add single active legacy pool to Stage config

* Fix USDT0OFT address for Arbitrum Stage config

* Remove BSC pool configuration due to no CCTP support

* Add BSC Repayer 18 decimals tokens tolerance

* Add decimals to tokens config in Repayer

* Add more tests

* Address comments

* Reinforce scripts, add deploy artifacts

* Fix nonce manager in deploy.ts

* Fix lint
@wesraph wesraph marked this pull request as draft April 13, 2026 16:31
@wesraph wesraph linked an issue Apr 14, 2026 that may be closed by this pull request
wesraph added 2 commits April 14, 2026 12:48
- Add cctpV2TokenMessenger/cctpV2MessageTransmitter zero-address args
  to 3 Repayer deploy calls in test/Repayer.ts (Everclear mock, BSC)
- Break long event ABI strings and route arrays in fork test to stay
  within 120-char eslint max-len limit
wesraph added 3 commits April 14, 2026 15:10
# Conflicts:
#	contracts/Repayer.sol
#	test/Repayer.ts
- Add require(CCTP_V2_TOKEN_MESSENGER != address(0)) in
  initiateTransferCCTPV2 for a clear revert on unconfigured chains
- Add CCTPV2 config for Avalanche, OP Mainnet, Arbitrum One, Base,
  Polygon Mainnet, and Unichain (Ethereum was already configured)
…ncer

- Add initiateRepay and processRepay tests for CCTP V2 in Repayer
- Add zero-address revert test for CCTP V2 in Rebalancer
- Deploy V2 mock contracts in Repayer test fixture
- Update coverage baseline (lines 99.60%, branches 91.45%)
wesraph added 2 commits April 14, 2026 17:01
…test coverage

- Expose CCTP_V2_TOKEN_MESSENGER / CCTP_V2_MESSAGE_TRANSMITTER as public for parity with V1
- Add processTransferCCTPV2 helper that guards against an unset V2 transmitter
- Cover native-currency, non-USDC, and both zero-address paths for CCTP V2
- Backfill InvalidLength / ZeroAddress branches in setRoute tests
@wesraph wesraph marked this pull request as ready for review April 16, 2026 14:03
@wesraph wesraph marked this pull request as draft April 16, 2026 14:03
@wesraph wesraph marked this pull request as ready for review April 16, 2026 14:45
@wesraph wesraph requested review from lastperson and mpetrunic April 16, 2026 14:46
lastperson
lastperson previously approved these changes Apr 17, 2026
Copy link
Copy Markdown
Collaborator

@lastperson lastperson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestions.
Well done!

Comment thread contracts/utils/CCTPV2Adapter.sol Outdated
Comment thread specific-fork-test/ethereum/Repayer.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Circle CCTP V2 as an additional cross-chain bridge provider for USDC transfers, extending the existing CCTP V1-based flows in Repayer and Rebalancer.

Changes:

  • Introduces a new CCTPV2Adapter and ICCTPV2 interfaces, and extends route/provider enums to include CCTP_V2.
  • Refactors shared CCTP receive logic (processTransferCCTP) to accept a transmitter address so it can be reused by both V1 and V2.
  • Updates deployment/upgrade scripts, network configuration, and unit + fork tests to cover CCTP V2 initiation and processing.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated no comments.

Show a summary per file
File Description
contracts/utils/CCTPV2Adapter.sol New adapter implementing CCTP V2 initiation + receive processing via shared CCTP helper.
contracts/interfaces/ICCTPV2.sol Adds V2 interfaces for TokenMessengerV2 (subset) and MessageTransmitterV2.
contracts/utils/CCTPAdapter.sol Refactors processTransferCCTP to accept a messageTransmitter address for V1/V2 reuse.
contracts/interfaces/IRoute.sol Extends Provider enum with CCTP_V2.
contracts/Repayer.sol Switches inheritance to CCTPV2Adapter and adds Provider.CCTP_V2 support for initiate/process.
contracts/Rebalancer.sol Switches inheritance to CCTPV2Adapter and adds Provider.CCTP_V2 support for initiate/process.
contracts/testing/TestCCTPV2.sol Adds V2 mock messenger/transmitter used by unit tests.
contracts/testing/TestRepayer.sol Updates constructor passthrough to include new CCTP V2 constructor params.
contracts/testing/TestRebalancer.sol Updates constructor passthrough to include new CCTP V2 constructor params.
test/Repayer.ts Updates fixtures/route expectations and adds unit tests for CCTP V2 initiate/process + zero-address cases.
test/Rebalancer.ts Updates fixtures/route expectations and adds unit tests for CCTP V2 initiate/process + zero-address cases.
specific-fork-test/ethereum/Repayer.ts Adds fork coverage for CCTP V1 and V2 initiation by asserting Circle DepositForBurn events.
specific-fork-test/ethereum/RepayerUSDT0.ts Updates Repayer constructor arg list to include new trailing CCTP V2 params.
specific-fork-test/ethereum/RepayerGnosisOmnibridge.ts Updates Repayer constructor arg list to include new trailing CCTP V2 params.
specific-fork-test/arbitrum/RepayerUSDT0.ts Updates Repayer constructor arg list to include new trailing CCTP V2 params.
specific-fork-test/polygon/RepayerUSDT0.ts Updates Repayer constructor arg list to include new trailing CCTP V2 params.
specific-fork-test/unichain/RepayerUSDT0.ts Updates Repayer constructor arg list to include new trailing CCTP V2 params.
specific-fork-test/gnosis/RepayerGnosisOmnibridge.ts Updates Repayer constructor arg list to include new trailing CCTP V2 params.
scripts/common.ts Adds numeric mapping for CCTP_V2 provider ID for Solidity/TS interop.
network.config.ts Adds CCTPV2 config shape and populates V2 addresses on supported networks.
scripts/deploy.ts Extends deploy flow to pass CCTP V2 messenger/transmitter constructor params.
scripts/deployRepayer.ts Extends Repayer deployment args to include CCTP V2 config (zero-address defaulted).
scripts/deployStandaloneRepayer.ts Extends standalone Repayer deployment args to include CCTP V2 config (zero-address defaulted).
scripts/upgradeRepayer.ts Extends Repayer upgrade deployment args and defaults config.CCTPV2 when missing.
scripts/upgradeRebalancer.ts Extends Rebalancer upgrade deployment args and defaults config.CCTPV2 when missing.
coverage-baseline.json Updates baseline coverage metrics after adding tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mpetrunic
mpetrunic previously approved these changes Apr 17, 2026
@wesraph wesraph dismissed stale reviews from mpetrunic and lastperson via 9057004 April 17, 2026 09:01
@wesraph wesraph requested review from lastperson and mpetrunic April 17, 2026 09:07
@mpetrunic mpetrunic merged commit 0d48ecd into main Apr 17, 2026
5 of 6 checks passed
@mpetrunic mpetrunic deleted the cctpv2 branch April 17, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CCTPV2 bridge adapter

4 participants