How to make USDC deposit

How to make USDC transactions on icp ?

i made this https://codesandbox.io/p/sandbox/holy-microservice-37khqy
Trying to use ercEath canister

Can anyone help build ling the minimal code

In the title you ask about USDC deposits. I assume you want to deposit USDC so that you get ckUSDC, correct? In that case, you can follow the instructions here.

If you want to make ckUSDC transactions, you simply interact with the ckUSDC ledger, using the standard ICRC-1 and ICRC-2 endpoints.

1 Like

I know this here but how to use it? I have no idea what does it says? I already read it but can’t make a code out of it. can you help me do it from the sandbox.

You have to call smart contract twice - approve and deposit methods.

  1. Create smart contract data
let method_selector = "0x095ea7b3"; // approve(address spender,uint256 value)
let helper_contract = erc20_helper_contract_address; // smart contract address
// -----method params------
let encoded_contract = helper_contract; // bytes32 format
let encoded_value = 10; // bytes32 format
// ---------------------------
let encoded_data = format!("{}{}{}", method_selector, encoded_contract, encoded_value);
  1. Create transaction data
let transaction = TxEip1559 {
        chain_id,
        nonce,
        gas_limit,
        max_fee_per_gas,
        max_priority_fee_per_gas,
        to: TxKind::Call(erc20_contract),
        value: 10,
        access_list: Default::default(),
        input: hex::decode(&encoded_data[2..]) // pass smart contract data
            .map_err(|e| format!("Invalid input data: {}", e))?.into(),
    };
  1. Sign transaction with ECDSA and send it with EVM RPC :grin:

In case you wanna get ckUSDC you can use Plug Wallet. They recently integrated all ERC-20 and BTC. There is a chance that their canister code gonna be open-source :wink:

1 Like

I think i have to

const actor = Actor.createActor(idlFactory, {
  agent: new HttpAgent({
    identity,
  }),
  canisterId,
});

but where the idlFactory come from ?

Can you write it in the sandbox because I understand no words of what you said. I am total new to this.

I would suggest you to spend some time on researching ERC-20 and ckERC-20 tokens. It’s hard to explain everything from scratch

1 Like

Hi sir.

If you’re just looking to deposit USDC and receive ckUSDC, you might be interested in ICPSwap’s ck-bridge feature. You can check it out here: