Integration Cookbook
This page provides walkthroughs for various integration scenarios to suit your needs.
More coming soon
To minimize the risk of bad debt and potential loss of funds, deposit user funds exclusively into conservative markets with low-risk profiles.
🅿️ 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.
Depositing idle funds
From your platform: source USDC (e.g., transferred to you by the user) and call cUSDC.deposit(assets, <userAddress>).
Retrieving funds on demand
Call cUSDC.redeemFor(shares, <yourPlatformAddress>, <userAddress>) to redeem the user's cUSDC shares and receive USDC.
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
Approve cToken to spend the underlying ERC20 from your vault.
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.
Last updated