Use the ckSepoliaETH minter canister (jzenf-aiaaa-aaaar-qaa7q-cai) to mint ckSepoliaETH. You need ckSepoliaETH before you can deposit Sepolia USDC and mint ckUSDC.
Finally, we'll use the ckSepoliaETH minter canister again to convert ckSepoliaETH into ckUSDC. You can use the get_minter_info method on the minter canister dashboard to retrieve all supported ckERC20 tokens.
The existing ckETH minter is responsible for handling ERC-20 deposits and withdrawal requests
We reuse the ckETH minter to deal with ckERC-20 because a ckERC-20 withdrawal involves issuing an Ethereum transaction where the transaction fee is paid by the sender in ETH (ETH is needed to pay for ERC-20 transfers)
The ERC-20 deposit flow is similar to the ckETH deposit flow in that deposits will transit via a helper smart contract to be able to bind an Ethereum transaction with an IC principal.
The ERC-20 → ckERC-20 flow involves the following steps:
The user submits an Ethereum transaction calling the approve function of the ERC-20 smart contract to allow the helper smart contract address to use some of the user’s funds. The approve function can be invoked directly on the contract’s Etherscan page after connecting any of Web3-capable wallets.
The user calls the minter helper contract deposit method of the helper smart contract (just as approve this method can be called from contract’s Etherscan page) specifying
The ERC-20 smart contract address. This identifies the ERC-20 token being deposited.
The amount of ERC-20 tokens being deposited.
The IC principal to which the amount of ckERC-20 should be minted.
The helper smart contract does the following steps within the same Ethereum transaction
Call transferFrom on the ERC-20 smart contract to transfer the given amount of ERC-20 tokens from the user’s address to the minter’s address. (This requires that the smart contract’s address was previously approved as in step 2).
Emits the ReceiveErc20(address,address,uint,bytes32) event
I) The first address argument is the ERC-20 smart contract Ethereum address.
II) The second address argument is the source Ethereum address.
III) The uint argument is the deposit value.
IV) The bytes32 argument encodes the receiver of ckERC20 on the IC.
The scrapping of the logs will be done as in ckETH, meaning that ckETH minter executes the following steps on a timer:
Query the latest finalized block number using the eth_getBlockByNumber RPC endpoint. If the finalized block number hasn’t changed since the last timer execution, skip the rest of the timer logic.
Use the eth_getLogs RPC endpoint to fetch the helper smart contract logs from the previous finalized block number to the block number obtained at the previous step. The response is an array of events, where each event includes in particular the transaction hash transactionHash and the log entry index logIndex. Parse ReceiveEth events contained in the logs.
For each new event, if the transactionHash was not seen before (minter keeps track of minted transactions), check that the sender of the transaction is not on the blocklist and mint ckERC20 and include the transaction hash and the log entry index in the ckERC-20 mint transaction memo (ICRC-1 ledger feature). Add the transactionHash to the list of seen transactions kept by the minter. If the sender of the transaction was a blocked address, then the minter does not mint ckERC20, but still marks the transaction hash as seen.
Example 1. Deposit of Sepolia USDC → ckSepoliaUSDC:
Implementation of ckUSDC Payments:
Here's the link to the official documentation: Link
Here's the dashboard for ckUSDC canister: Link
Documentation on how to use ckUSDC token in dApps: Link
Testing purposes: We'll be implementing the sepolia version of ckUSDC for now. Link
Faucet for obtaining sepolia USDC - Link
Use the ckSepoliaETH minter canister (jzenf-aiaaa-aaaar-qaa7q-cai) to mint ckSepoliaETH. You need ckSepoliaETH before you can deposit Sepolia USDC and mint ckUSDC.
Finally, we'll use the ckSepoliaETH minter canister again to convert ckSepoliaETH into ckUSDC. You can use the get_minter_info method on the minter canister dashboard to retrieve all supported ckERC20 tokens.
Full instructions in the ckETH GitHub.
Dfinity Forum discussion
Implementation walkthrough: Obtain sepolia USDC from the faucet - Link
Sepolia USDC contract address - Link
ckSepoliaUSDC helper contract - Link
Official documentation of cKERC-20 on GitHub - Link
(New) ckERC-20 Helper Smart Contract - Link
Please note that you can also invoke the get_minter_info 18 on the Sepolia minter dashboard to get all ids and ckERC20 tokens supported.
ckERC-20 GitHub Documentation - Link
ckUSDC Links: ckUSDC Helper Contract (Ethereum) - Link
USDC Ethereum Mainnet Contract - Link
Important things to note from the documentation:
The ERC-20 → ckERC-20 flow involves the following steps:
The user submits an Ethereum transaction calling the approve function of the ERC-20 smart contract to allow the helper smart contract address to use some of the user’s funds. The approve function can be invoked directly on the contract’s Etherscan page after connecting any of Web3-capable wallets.
The user calls the minter helper contract deposit method of the helper smart contract (just as approve this method can be called from contract’s Etherscan page) specifying
The helper smart contract does the following steps within the same Ethereum transaction
The scrapping of the logs will be done as in ckETH, meaning that ckETH minter executes the following steps on a timer:
Query the latest finalized block number using the
eth_getBlockByNumber
RPC endpoint. If the finalized block number hasn’t changed since the last timer execution, skip the rest of the timer logic.Use the
eth_getLogs
RPC endpoint to fetch the helper smart contract logs from the previous finalized block number to the block number obtained at the previous step. The response is an array of events, where each event includes in particular the transaction hashtransactionHash
and the log entry index logIndex. Parse ReceiveEth events contained in the logs.For each new event, if the
transactionHash
was not seen before (minter keeps track of minted transactions), check that the sender of the transaction is not on the blocklist and mint ckERC20 and include the transaction hash and the log entry index in the ckERC-20 mint transaction memo (ICRC-1 ledger feature). Add thetransactionHash
to the list of seen transactions kept by the minter. If the sender of the transaction was a blocked address, then the minter does not mint ckERC20, but still marks the transaction hash as seen.Example 1. Deposit of Sepolia USDC → ckSepoliaUSDC: