43 lines
1.3 KiB
Markdown
43 lines
1.3 KiB
Markdown
# 09: Flow Dampening
|
|
|
|
## Source
|
|
- **Protocol**: Gyroscope GYD
|
|
- **Files**: `Flow.sol`
|
|
- **Repo**: `gyrostable/gyd-core`
|
|
|
|
## Rationale for MYCO
|
|
|
|
Bank runs are the existential threat to any bonding curve. If all holders try to redeem simultaneously, early redeemers drain the reserve and late redeemers get nothing. Flow dampening prevents this by tracking recent outflows and applying progressive penalties.
|
|
|
|
For MYCO:
|
|
1. Protects against coordinated sell-offs
|
|
2. Makes the redemption path predictable (not first-come-first-served)
|
|
3. Integrates with both the P-AMM (reducing redemption rate) and imbalance fees (increasing costs)
|
|
4. The exponential memory parameter is a single governance knob: closer to 1 = more conservative
|
|
|
|
## Formula
|
|
|
|
```
|
|
flow(t) = flow(t-1) * memory^(dt) + new_flow
|
|
```
|
|
|
|
The memory parameter (∈ (0,1)) controls decay speed:
|
|
- memory = 0.999: ~1000 time units to decay by 63%
|
|
- memory = 0.99: ~100 time units to decay by 63%
|
|
- memory = 0.9: ~10 time units to decay by 63%
|
|
|
|
Half-life: `t_half = -ln(2) / ln(memory)`
|
|
|
|
## Penalty Function
|
|
|
|
When flow exceeds the threshold:
|
|
```
|
|
penalty_multiplier = max(0.1, 1 - ((ratio - threshold/2) / (threshold * 1.5))²)
|
|
```
|
|
|
|
This multiplier is applied to redemption amounts, effectively slowing outflows when they're too rapid.
|
|
|
|
## Implementation
|
|
|
|
See `src/primitives/flow_dampening.py`
|