A Looping Mechanism to Maximize Yield and Guarantee Safer Returns
This repository contains my implementation of the VedaVault strategy — a stHYPE looping vault built as part of an assignment from Anthias Labs.
The goal was to create a fully on-chain vault that loops user deposits to maximize yield while maintaining safety and transparency. Inspired by Boring Vault, I expanded the design to include better parameter checks, sanitizer logic, monitoring tools, and a clear separation between on-chain and off-chain responsibilities.
Here’s the exact assignment:
Build a vault that accepts
wHYPE, stakes it tostHYPE, and loops that collateral in Felix markets to maximize yield. The vault should borrowHYPE, wrap it, and repeat the loop until reaching a safe collateral ratio.
- Accept user deposits in wHYPE
- Stake those into stHYPE
- Supply
stHYPEas collateral on Felix - Borrow
HYPE, rewrap intowHYPE, and repeat
I broke the entire on-chain logic into 4 modular phases:
- The user calls
deposit()with theirwHYPE - I transfer the tokens in, verify with sanitizers
- I mint a receipt token (
vvHYPE) back to the user — representing their share
- I call
Overseer.mint()to convertwHYPEtostHYPE - The staked tokens are held by the vault
- I send the
stHYPEto Felix as collateral - I borrow
HYPEbased on a safe LTV - I wrap that borrowed
HYPEback intowHYPE
- I repeat Steps 2 & 3 until the loop hits a threshold (defined by me or by automation)
- This compounds the deposit into a much larger yield-generating position
To keep everything healthy and safe, I built off-chain scripts to:
- Monitor vault deposits (both HYPE and USD value)
- Track total stHYPE supplied to Felix
- Track outstanding HYPE borrowed
- Calculate yield (APY) over time
I designed this in a way that it could easily be plugged into automation platforms like Gelato or Chainlink Keepers.
This is the main entry point for the user. It handles:
- Deposits
- Staking into Overseer
- Borrowing from Felix
- Token issuance (vvHYPE)
- Withdrawals (burning vvHYPE)
Used to stake wHYPE into stHYPE. I don’t own this; I just call it.
I abstracted some key validations into a reusable contract. It includes:
onlyEOA— blocks contract interactionsonlyWhitelisted— lets me allow/deny specific users or bots- Parameter validators (
checkOverseerAddress, etc.)
An ERC20 vault token that I mint 1:1 to wHYPE deposits.
Users hold this token as proof of their vault share and can burn it to withdraw.
I plan to add a custom oracle that dynamically computes vault share prices. Initially, 1 vvHYPE = 1 wHYPE, but this will shift as looping and yield kick in.
To keep everything smooth, the off-chain components do:
- Auto-reinvestment when collateral space opens
- Health checks on LTV ratios
- Emitting events to analytics dashboards (via Supabase + Ponder)
- Alerting + logging
Here’s what’s fully working and tested:
- User deposits
wHYPE - Vault mints
vvHYPE - Funds are staked into
stHYPE - Borrowing and re-wrapping logic is ready
- Merkle proofs are generated for event logs
- Vault monitoring dashboard is wired up
- Solidity 0.8.x
- OpenZeppelin Contracts
- Supabase — Vault monitoring database
- Ponder — Indexing events from the chain
- Felix Protocol — For lending/borrowing
- stHYPE Protocol — For staking
