Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Circle Cross-chain USDC Transfer Protocol(CCTP)

For Circle Cross-Chain USDC Protocol supported chains, the USDC flow is going through Circle bridge contracts and its attestation service instead of cBridge or peg bridge contracts and SGN.

The following content is an integration tutorial from frontend perspective.

CCPT flow

Proxy Contracts

ChainAddress
Ethereum 10x6065a982f04f759b7d2d042d2864e569fad84214
Avalanche 431140x9744ae566c64B6B6f7F9A4dD50f7496Df6Fef990
Arbitrum One 421610x054B95b60BFFACe948Fa4548DA8eE2e212fb7C0a
Optimism 10 0x697aC93c9263346c5Ad0412F9356D5789a3AA687
Base 84530x243b40e96c6bF21511E53d85c86F6Ec982f9a879
Polygon PoS 1370xB876cc05c3C3C8ECBA65dAc4CF69CaF871F2e0DD

Also you can get the related contract addressed from cBridge gateway api

https://cbridge-prod2.celer.app/v1/circleUsdcConfig

Quote Fee

Note that the CCTP quote the fees from the proxy contract instead of the cBridge gateway APIs.

For example, bridging USDC from Ethereum to Avalanch by totalFee method.

Inputs

amount: Your bridging amount with decimal, for example, 3000000 = 30USDC

dstChid: The destination chain you wanna send, in this case is 43114

Outputs

Output data is an array of fees [fee, txFee, percFe].

fee: total fee, txFee+percFee

txFee: transaction fee

percFee: percentage fee

For this bridging mode, the bridge rate is 1.

Bridge by depositForBurn

From the front-end side, lock the USDC to source proxy contract by the method depositForBurn. Circle attestation will bridge the assets to the destination chain in a trustless way. For more details refer to this:https://developers.circle.com/stablecoin/docs/cctp-protocol-contract

Contract Parameters

FieldDes
amountBridging amount with decimal
dstChidBridging destination chain id
mintRecipientReceiver address
burnTokenUSDC token address in source chain, you can read the token address from this configuration: https://cbridge-prod2.celer.app/v1/circleUsdcConfig

Once this depositForBurn happened on the source chain, you can get the source chain Deposited event.

event Deposited(address sender, bytes32 recipient, uint64 dstChid, uint256 amount, uint256 txFee, uint256 percFee, uint64 nonce);

Searching destination transaction status

Searching the final destination chain status by the gateway API: GetTransferStatus.

The API requires a tracking field transferId for the status quering, here is an example with ether.js.

getTransferId(): string {
      return ethers.utils.solidityKeccak256(
          ["string", "address", "uint64", "uint64"],
          [
            "CircleTransfer", // fixed string
            walletAddress, // wallet address of user
            fromChainId, // source chain Id
            nonce, // can be retrived from the Deposited event
          ],
      );
    }  

API reference

Link gateway-gettransferstatus.md