An AMM with concentrated liquidity for pools of 2, 3, or 10,000 stablecoins, based on Paradigm’s Orbital paper.
Are we orbital yet?
No. But our north star is to get there.
- O(1) bookkeeping
- Closed-form within-segment quote/simulation
- Virtual reserves & floors
- Boundary math
- Tick guard for downward crossings
- Visualization of the entire paper (I'm working on this rn and should be out soon)
- Full multi-tick traversal
- Explicit consolidation state
- Global torus-invariant solver
- More tests (also fuzz tests)
- Gas profiling & optimizations (haven't really optimized anything yet)
forge-stdSolady
IPoolMetadata.sol- HoldsTokenConfigstruct and signatures for view functions.IPoolEvents.sol- Holds events that will be emitted by the Pool.IPoolErrors.sol- Holds errors used by the Pool.IPool.sol- Extends the previous 3 interfaces and holds function signatures for non-view functions.
WadScale.sol- Handles scaling to and from WAD.TickBitmap.sol- Handles storing and traversing of ticks in a bitmap. Based onLibBitfrom Solady.TickNav.sol- Exposes higher level functions to traverse through ticks.OrbitalMath.sol- Core math: closed-form segment quotes, invariant updates, and tick guards.
PoolStorage.sol- Abstract contract that holds state variables for the Pool.Pool.sol- Core Pool smart contract that extendsIPoolandPoolStorage.
- Foundry installed
git clone https://github.com/aadeexyz/orbital.git
cd orbital
forge installforge testDeterministic vectors are included (segment quotes, boundary crossings, tick helpers). Property tests & fuzzing are WIP.
Note
Some tests started out as AI-generated scaffolds and are being reviewed and extended with invariant checks.
| File | Tests | Passing |
|---|---|---|
| WadScale.t.sol | 9 | ✅ |
| TickBitmap.t.sol | 12 | ✅ |
| TickNav.t.sol | 7 | ✅ |
| OrbitalMath.t.sol | 14 | ✅ |
| Pool.t.sol | 17 | ✅ |
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Make sure you are using Solidity version ^0.8.30
- Ensure all tests pass (you can modify existing tests if they feel wrong over time)
- Submit a pull request
- Make sure the pull request details what you've added
- Follow Solidity style guide
- Please don't dump everything in the same file
This software is experimental and unaudited, and is provided on an 'as is' and 'as available' basis. We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.