45 lines
1.3 KiB
Markdown
45 lines
1.3 KiB
Markdown
# 10: Imbalance Fees (StableSurge)
|
|
|
|
## Source
|
|
- **Protocol**: Balancer V3
|
|
- **Files**: `StableSurgeHook.sol`, `StableSurgeMedianMath.sol`
|
|
- **Repo**: `balancer/balancer-v3-monorepo`
|
|
|
|
## Rationale for MYCO
|
|
|
|
The bonding surface should incentivize balanced reserve composition. Imbalance fees make it expensive to deposit assets that worsen the reserve balance, and cheap (or free) to deposit scarce assets.
|
|
|
|
For MYCO:
|
|
1. Discourages depositing only the cheapest/most abundant reserve asset
|
|
2. Creates economic incentive to maintain target reserve ratios
|
|
3. Generates fee revenue for the treasury when users unbalance the reserve
|
|
4. Complements reserve tranching (soft incentive vs. hard safety check)
|
|
|
|
## Formula
|
|
|
|
**Imbalance metric:**
|
|
```
|
|
imbalance = sum(|balance_i - median|) / sum(balance_i)
|
|
```
|
|
|
|
**Surge fee:**
|
|
```
|
|
if imbalance_after > threshold AND imbalance_after > imbalance_before:
|
|
excess = (imbalance_after - threshold) / (1 - threshold)
|
|
fee = static_fee + (surge_rate - static_fee) * min(excess, 1)
|
|
else:
|
|
fee = static_fee
|
|
```
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Default | Effect |
|
|
|-----------|---------|--------|
|
|
| static_fee | 0.3% | Base fee for balanced operations |
|
|
| surge_fee_rate | 5% | Maximum fee for heavily unbalancing operations |
|
|
| threshold | 20% | Imbalance level at which surge begins |
|
|
|
|
## Implementation
|
|
|
|
See `src/primitives/imbalance_fees.py`
|