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.

Proxy Contracts

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

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

Last updated