Commit 361435e
authored
Merge pull request #22 from olujimiAdebakin/feature/AFPU_MODEL
Executive Summary
This PR fundamentally redesigns the funding rate mechanism by implementing the Accumulated Funding Per Unit (AFPU) model. This architectural change eliminates per-trader iteration, reducing gas costs from O(n) to O(1) and enabling the protocol to scale from hundreds to millions of active positions.
Key Metrics:
Gas Reduction: 99% reduction at scale (from ~10M to ~50K gas for 1,000 traders)
Scalability: Removes theoretical limit on concurrent positions
Precision: Maintains per-second funding accuracy
Standard: Adopts battle-tested model used by dYdX, GMX, and other leading protocols23 files changed
Lines changed: 9056 additions & 1398 deletions
File tree
- docs/architecture
- src
- access
- core
- data
- oracles
- trading
- engines
- fees
- interfaces
- libraries/structs
- security
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments