Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Contracts Overview

These docs describe the production Set & Forgetti contract system.

Three-Layer Architecture

S&F uses a clean separation of concerns across three contract layers:

┌─────────────────────────────────────────────────────────────────────┐
│                         USER ACTIONS                                │
│         deposit → stake shares → claim rewards → withdraw           │
└─────────────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────────┐
│  LAYER 1: SFVault (ERC-4626)                                        │
│  ─────────────────────────────                                      │
│  • Accepts kitchen token deposits                                   │
│  • Mints vault shares to depositors                                 │
│  • Routes assets to strategy                                        │
│  • Handles profit unlock (anti-sandwich)                            │
└─────────────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────────┐
│  LAYER 2: Strategy (Beradrome)                                      │
│  ─────────────────────────────                                      │
│  • Stakes assets in external protocols                              │
│  • Executes harvests (BGT + other rewards)                          │
│  • Converts yield to target reward token                            │
│  • Notifies MultiRewards of new rewards                             │
└─────────────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────────┐
│  LAYER 3: MultiRewards                                              │
│  ─────────────────────────────                                      │
│  • Stakes vault shares from users                                   │
│  • Distributes rewards proportionally                               │
│  • Processes badge-based fee rebates                                │
│  • Supports multiple reward tokens                                  │
└─────────────────────────────────────────────────────────────────────┘

Contract Roles

ContractPrimary RoleUser Interaction
SFVaultAsset custody & share accountingDeposit/withdraw kitchen tokens
StrategyYield generation & harvestingNone (keeper-operated)
MultiRewardsReward distributionStake shares, claim rewards
BgtConverterBGT wrapper mintingNone (internal helper)

User Flow

Deposit

User deposits kitchen tokens into SFVault and receives vault shares. Assets are automatically staked into the strategy.

// Deposit 100 kitchen tokens, receive vault shares
vault.deposit(100e18, userAddress);

Stake Shares

User stakes vault shares in MultiRewards to become eligible for rewards.

// Stake all vault shares
multiRewards.stake(vaultShareBalance);

Earn Rewards

Keepers periodically harvest yield through the Strategy. Rewards are converted and distributed to stakers proportionally.

Claim & Withdraw

Claim rewards anytime. Withdraw principal anytime (even when deposits are paused).

// Claim accumulated rewards
multiRewards.getReward();
 
// Withdraw kitchen tokens
vault.withdraw(amount, userAddress, userAddress);

Contract Details