Cubazaar is a smart contract system for issuing synthetic receipt tokens on top of real assets (like USDC), and earning yield on them through a compounding vault. It's built with Solidity and Foundry, and designed to be minimal, precise, and DeFi-composable.
At its core, Cubazaar lets you:
- Deposit an asset (e.g. USDC) and receive a 1:1 synthetic receipt token (e.g. snUSD)
- Stake that receipt token in a vault that earns compound interest over time
- Withdraw later with your accrued yield, and redeem back to the original asset
There's also a curator layer — authorized addresses that can pull liquidity out of the vault to deploy into yield strategies. A core safety feature ensures curators must put up their own capital before touching user funds — acting as a financial guarantee that they won't act recklessly.
User Deposit (USDC)
│
▼
┌─────────┐
│ PSM │ ← 1:1 mint / redeem (Peg Stability Module)
└────┬────┘
│ ReceiptToken (ERC20)
▼
┌──────────────┐
│ StakingVault │ ← ERC4626 vault with compound interest
└──────────────┘
│ Shares
▼
Redeem → ReceiptToken → PSM → USDC + yield
Contracts:
| Contract | What it does |
|---|---|
Factory.sol |
Deploys a full PSM + ReceiptToken + StakingVault set in one call |
PSM.sol |
Accepts underlying assets, mints/redeems receipt tokens 1:1 |
StakingVault.sol |
ERC4626 vault that compounds yield on staked receipt tokens |
ReceiptToken.sol |
ERC20 synthetic token with role-gated minting and burning |
Curatable.sol |
Inheritable base contract — gives vaults curator-managed withdrawal with built-in user protection |
The vault accumulates yield using a 4-term Taylor series approximation — the same approach used by Aave — allowing precise per-second compounding without overflows:
CompoundFactor ≈ 1 + r·t + (r²·t²)/2 + (r³·t³)/6
All math is done in RAY precision (1e27) to minimize rounding loss.
StakingVault implements the ERC4626 tokenized vault standard, making it compatible with any protocol that aggregates vaults (like Yearn, or frontend dashboards). Share-to-asset conversion automatically reflects the compound factor.
Curatable.sol is an inheritable base contract that PSM (and any future vault) extends. It introduces a curator role: trusted addresses authorized to pull funds out of the vault and deploy them into external yield strategies.
The critical safety feature is a mandatory capital deposit before any withdrawal:
- When a curator calls
withdraw(amount), they must simultaneously deposit 2% of that amount from their own wallet into the contract as collateral - That 2% is locked and sits separate from user funds — it cannot be used to cover the withdrawal itself
- It is only returned to the curator once they fully
refill()the funds they took out - If the curator never refills (e.g. a strategy goes bad), their deposited capital remains locked in the contract as partial compensation for affected users
Curator wants to withdraw 100,000 USDC
→ Must deposit 2,000 USDC of their own capital first
→ 100,000 USDC goes to curator's strategy
→ 2,000 USDC locked in contract
Curator refills 100,000 USDC back
→ 2,000 USDC returned to curator
Curator never refills
→ 2,000 USDC stays locked as user protection
- Call
Factory.create(underlyingToken, name, symbol)— deploys all three contracts wired together - User calls
PSM.mint(amount)— deposits USDC, receives receipt tokens 1:1 - User deposits receipt tokens into
StakingVault— receives vault shares - Over time,
compoundFactorAccumgrows based on the configured annual rate - User redeems shares → more receipt tokens than deposited (the yield)
- User calls
PSM.redeem(amount)→ gets back USDC + yield
MIT