Skip to content

feat: Add stCELO earn hook with positions, shortcuts, ABI, and tests #753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

onyedikachi-david
Copy link

Fixes: #591

Add earn hook for stCELO

Overview

This PR adds support for stCELO (https://app.stcelo.xyz/) in Valora's Earn feature through the hooks platform. While stCELO is already supported as an ERC20 token, this implementation enables it as an earn opportunity with deposit and withdraw capabilities.

Implementation Details

  • Added stCELO hook in src/apps/stcelo/ with the following components:
    • positions.ts: Core hook implementation that provides:
      • Position definitions for both mainnet and Alfajores testnet
      • Exchange rate and TVL information
      • Detailed display properties including risks and safety levels
      • 3-day unstaking period warning
    • shortcuts.ts: Implements deposit and withdraw shortcuts
    • abis/stcelo.ts: Contract ABI definitions for required functions
    • positions.test.ts: Comprehensive unit tests

Key Features

  1. Liquid Staking: Users can stake CELO while maintaining liquidity through stCELO
  2. Yield Tracking: Displays variable staking APY from Celo epoch rewards
  3. Safety Information:
    • Non-custodial protocol
    • No principal slashing risk
    • 3-day withdrawal period (liquidity risk)
  4. User Actions:
    • Deposit (stake) CELO
    • Withdraw (unstake) stCELO
    • View current exchange rate and TVL

Testing

  • Unit tests cover:
    • Position definitions for both networks
    • Error handling for unsupported networks
    • Contract interactions (exchange rate, total assets)
    • Token information validation

Notes

  • The stCELO contract doesn't implement the symbol() function, but this is handled gracefully in the hook implementation
  • APY is reflected through the increasing stCELO:CELO exchange rate rather than explicit rewards

@jeanregisser
Copy link
Member

jeanregisser commented Jan 29, 2025

Amazing, thanks so much for your contribution @onyedikachi-david! 🙌
I'm gonna review it in the next couple of days!

@silasbw
Copy link
Contributor

silasbw commented Jan 29, 2025

+1 this is awesome. Excited to get it into production!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add earn hook for stCELO
3 participants