Noble CCTP Receive
CCTP enables USDC to be received on Noble from a counterparty chain. At the time of writing, the source chain can be Ethereum, Avalanche, Optimism, or Arbitrum.
High level flow
- User calls smart contract to burn the tokens on the source chain
- CCTP relayer observes finalized burn and requests Attestation from Circle Iris API
- Cirle Iris API proves burn and issues attestation
- CCTP relayer broadcasts the message and attestation to Noble
- Noble processes the CCTP BurnMessage and mints the token to the Noble recipient
Deposit For Burn
Circle's Deposit For Burn (opens in a new tab) contract includes four function parameters which are highlighted below.
function depositForBurn(
uint256 amount,
uint32 destinationDomain,
bytes32 mintRecipient,
address burnToken,
) external returns (uint64 nonce)
Let's expand on what each of these parameters means:
amount
- The amount of tokens to transfer (burned on the source chain and minted on Noble)destinationDomain
- The domain ID of the destination chain (4
for Noble)mintRecipient
- The address of the recipient on the destination chain (Noble account address - 20 bytes left padded with 12 zeroes)burnToken
- The address of the contract to burn tokens on the source chain
Encoding
Below you will find a simple script that pads & hex encodes both the destination bech32 prefix and recipient.
The highlighted lines indicate inputs you can change to your specific case.
package main
import (
"encoding/hex"
"fmt"
"github.com/cosmos/cosmos-sdk/types/bech32"
)
const address = "noble14lwerrcfzkzrv626w49pkzgna4dtga8c5x479h"
func main() {
_, rawAddress, _ := bech32.DecodeAndConvert(address)
encodedAddress := Encode(rawAddress)
fmt.Println("ENCODED ADDRESS:", encodedAddress)
}
func Encode(bz []byte) (encoded string) {
padded := make([]byte, 32)
copy(padded[32-len(bz):], bz)
return "0x" + hex.EncodeToString(padded)
}
The output of the exact script above is:
ENCODED ADDRESS: 0x000000000000000000000000afdd918f09158436695a754a1b0913ed5ab474f8
Example
To send 10 USDC from Goerli Ethereum Testnet to Noble, address noble14lwerrcfzkzrv626w49pkzgna4dtga8c5x479h
, you would call the following on the Goerli Ethereum Testnet:
depositForBurn(
0x989680, // 10000000uusdc = 10 USDC
0x4, //Noble
0x000000000000000000000000afdd918f09158436695a754a1b0913ed5ab474f8, // noble14lwerrcfzkzrv626w49pkzgna4dtga8c5x479h
0x07865c6E87B9F70255377e024ace6630C1Eaa37F, // USDC on Goerli Ethereum Testnet
)