Lend Assets
Depositing USDC for Lending
To deposit USDC into cUSDC directly, you may use the deposit() function present in all cToken contracts using the following arguments:
Type
Name
Instruction
uint256
assets
The amount in assets to deposit.
address
receiver
The address that will receive the cToken shares.
Below is a full implementation:
// Get the cUSDC contract with signer
const cUSDC = new ethers.Contract(ADDRESSES.CUSDC, CTOKEN_ABI, signer);
// Get the USDC contract with signer
const usdc = new ethers.Contract(ADDRESSES.USDC, ERC20_ABI, signer);
// Format amount (USDC has 6 decimals)
const depositAmount = ethers.utils.parseUnits("1000", 6); // 1000 USDC
// Approve eUSDC to spend USDC
await usdc.approve(ADDRESSES.CUSDC, depositAmount);
// Deposit USDC for lending
await cUSDC.deposit(depositAmount, userAddress);When you deposit USDC into cUSDC:
Your USDC tokens are transferred to the cToken contract.
You receive cUSDC tokens representing your lending position.
Your USDC becomes available for borrowers to borrow (subject to their collateral).
As borrowers pay interest, the exchange rate between cUSDC and USDC increases.
When you redeem your cUSDC tokens later, you receive your original USDC plus accrued interest.
Last updated