This project deploys fyUSDC and fycKES tokens to the Celo blockchain using the Yield Protocol's fyToken standard.
fyTokens (Fixed Yield Tokens) are are zero coupon bonds that:
- Can be minted by depositing underlying tokens
- Have a fixed maturity date
- Can be redeemed for underlying tokens after maturity
- Represent a claim on future yield
- Node.js (v18+)
- Foundry (for building contracts)
- Celo wallet with CELO for gas fees
- USDC and cKES tokens on Celo (for testing)
# Install Node.js dependencies
npm install
# Install Foundry dependencies
forge installforge buildCreate a .env file:
# Your private key (keep this secret!)
PRIVATE_KEY=0x1234567890abcdef...
# Celo RPC URL (already configured)
MAINNET_RPC=https://celo-mainnet.g.alchemy.com/v2/iEvFoBNkDPH_RVLLuPZTn# Deploy using Foundry
forge script script/DeployCelo.s.sol --rpc-url https://celo-mainnet.g.alchemy.com/v2/iEvFoBNkDPH_RVLLuPZTn --broadcast --verify# Deploy using Viem
npm run deploy-
Join Contracts - Handle deposits/withdrawals of underlying tokens
USDC Join- For USDC depositscKES Join- For cKES deposits
-
fyTokens - The main yield tokens
fyUSDC- Fixed yield USDC tokenfycKES- Fixed yield cKES token
-
Permissions - Set up access control between contracts
After deployment, you'll get addresses for:
- USDC Join contract
- cKES Join contract
- fyUSDC token
- fycKES token
Save these addresses! You'll need them for interactions.
// Approve spending
await usdc.approve(fyUSDC.address, amount);
// Mint fyUSDC
await fyUSDC.mintWithUnderlying(receiver, amount);// Redeem for underlying
await fyUSDC.redeem(receiver, fyTokenAmount);// Check fyToken balance
const balance = await fyUSDC.balanceOf(account);
// Check underlying balance
const underlyingBalance = await usdc.balanceOf(account);forge testBefore deploying to mainnet, test on Alfajores:
# Set testnet RPC
export MAINNET_RPC="https://alfajores-forno.celo-testnet.org"
# Run tests
forge testThe current deployment uses a mock oracle (0x0000...). For production:
- Deploy a real oracle that provides yield rates
- Update the oracle address in the fyToken contracts
- Ensure oracle security and reliability
- fyTokens are created with 1 year maturity
- Before maturity: Can mint/redeem at 1:1 rate
- After maturity: Can redeem for underlying + accrued yield
Celo has different gas characteristics than Ethereum:
- Optimize for Celo's gas model
- Test gas usage thoroughly
- Consider batch operations for efficiency
- Private Key Security - Never commit private keys
- Oracle Security - Use trusted oracle implementations
- Access Control - Review all permissions carefully
- Audit - Consider professional audit before mainnet
- "Invalid maturity" - Ensure maturity is in the future
- "Insufficient balance" - Check token balances and approvals
- "Unauthorized" - Verify contract permissions are set correctly
- Check contract logs for detailed error messages
- Verify all contract addresses are correct
- Ensure sufficient CELO for gas fees
After successful deployment:
- Test basic functionality - Mint, check balances, redeem
- Integrate with DeFi protocols - Add liquidity to pools
- Build yield strategies - Create automated yield farming
- Community engagement - Share your fyTokens with the Celo community
MIT License - See LICENSE file for details.
Happy DeFi-ing on Celo! 🌾