Integration Cookbook

This page provides walkthroughs for various integration scenarios to suit your needs.

  1. More coming soon


🅿️ Parking Your Users' Idle Funds in Curvance

Objectives:

  • Safely park user idle funds in Curvance markets.

  • Let your platform retrieve those funds via delegated actions.

One time setup (per cToken market)

The user calls cUSDC.setDelegateApproval(<yourPlatformAddress>, true), delegating your platform's address as the delegate.

Optionally: To reduce the total amount of transactions even further, from your app, call approve in the idle asset to allow the Curvance cToken to spend.

Note: Users can mass-revoke all delegates anytime via the approval index.

Depositing idle funds

From your platform: source USDC (e.g., transferred to you by the user) and call cUSDC.deposit(assets, <userAddress>).

Note: deposits pull USDC from the caller (msg.sender), not the receiver.

Retrieving funds on demand

Call cUSDC.redeemFor(shares, <yourPlatformAddress>, <userAddress>) to redeem the user's cUSDC shares and receive USDC.

Redeeming cTokens does not require ERC20 approval.

Practical tips

  • Use previews (previewDeposit(), previewRedeem()) client-side for UX estimates.

  • Pauses/caps may limit deposits/redemptions; handle errors gracefully.

  • Security: delegation lets your platform act for users; encourage users to delegate only trusted contracts and remind them they can revoke instantly via approval index.


🧺 Include a Curvance Market in Your Vault

Objectives:

  • Mint cTokens to your vault.

  • Redeem cTokens to rebalance/withdraw

Mint cTokens when users mint vault shares

  1. Approve cToken to spend the underlying ERC20 from your vault.

  2. Call cToken.deposit() from your contract, with its address as the recipient.

Redeem cTokens to rebalance (if applicable) / or withdraw user funds

Call cToken.redeem() if redeeming in shares, or cToken.withdraw() if redeeming in underlying.

Redeeming cTokens does not require ERC20 approval.


Last updated