Rebalancing
Rebalancing is how SAM moves the pool toward the best-yielding mix. It is permissionless: anyone can trigger it, and the entire allocation is computed on-chain from each protocol’s measured APR. No one chooses the split by hand, and no single protocol can be over-filled.
The idea
Section titled “The idea”Think of every protocol plus the idle buffer as a set of buckets. SAM works out a target for each protocol from its yield, then moves liquidity from over-target buckets to under-target ones: deploying spare idle, moving funds directly protocol-to-protocol, and topping the idle buffer back up if it ran low.
Step 1: what’s available to spread
Section titled “Step 1: what’s available to spread”A fraction of the vault is always held liquid as the idle buffer:
Everything above the buffer is the pool to spread across protocols:
Step 2: each protocol’s target
Section titled “Step 2: each protocol’s target”Targets are proportional to learned APR, so a higher-yielding protocol gets more capital:
(If no protocol has learned an APR yet, the pool is split evenly instead.)
That APR-weighted want is then capped two ways:
- Exposure cap so no single protocol takes more than a fixed share of the pool:
- Depth cap so a protocol never receives more than a fraction of its reserve’s currently
withdrawable cash. Here
depthᵢis the reserve’s available (unborrowed) liquidity (total supplied minus total borrowed), so this keeps the vault inside the market’s exit capacity. It never becomes a position it could not later withdraw, and if a reserve’s available cash shrinks the cap shrinks with it, pulling the vault back on the next rebalance.
The final target is the smallest of the three:
A protocol holding more than its target has releasable supply supplyᵢ = max(0, currentᵢ − targetᵢ).
Step 3: move toward the targets
Section titled “Step 3: move toward the targets”For each protocol below its target, SAM funds the shortfall in order:
- From idle, deploy spare idle (above the buffer) into the protocol.
- From over-target protocols, move funds directly from a protocol that has releasable supply into the one that needs it (idle is never touched for this).
Then, if the idle buffer is below its target, SAM reclaims leftover over-target supply back into idle until the buffer is refilled.
Worked example
Section titled “Worked example”Two protocols, 5% idle buffer, 70% exposure cap, a pool of 1_000:
- Protocol A APR
4%, Protocol B APR12%. - Weights: A =
4/16 = 25%, B =12/16 = 75%. - Raw targets: A =
250, B =750. The exposure cap is700, so B is capped: target B =700, target A =250. (The remainder stays available and is handled on the next tick.) - If B’s reserve only held, say,
1_200of withdrawable cash, its depth cap (50% × 1_200 = 600) would bind first and lower target B to600, leaving the rest in idle or A. - SAM deploys idle and/or moves funds so A holds ~
250and B holds ~700.
If B later harvests a reward that lifts its measured APR, its weight rises, its target rises to the cap, and the next rebalance shifts more of the pool into B, automatically.
What a rebalance cannot do
Section titled “What a rebalance cannot do”A rebalance only ever moves funds between registered protocols and the idle buffer. The amounts are computed on-chain and the funds are handed straight to the protocol connectors, the person who triggered the rebalance cannot redirect any of it to themselves. Triggering a rebalance is a keeper/janitor action, not a privileged one.