This repository contains the core Solidity smart contracts for Ekubo Protocol, the most gas efficient and extensible automated market maker (AMM) for the Ethereum Virtual Machine.
Ekubo Protocol is a suite of Smart Contracts providing comprehensive AMM infrastructure, including the following features:
- Configurable pool types: There are multiple ways to configure the base pool:
- Concentrated Liquidity: Many positions provide liquidity within different price ranges and are efficiently aggregated
- Stableswap: Many positions provide liquidity within the same price range
- Full range: Many positions provide liquidity from the minimum to maximum price
- Extensions: Modular architecture enabling unique pool behavior through extensions
- TWAMM: Time-Weighted Average Market Maker enabling on-chain dollar cost averaging
- Oracle: Enables tracking historical prices for any token pair
- MEVCapture: Collects additional fee revenue based on trading activity
- Flash Accounting: All operations are settled only when necessary
- NFT Positions: Liquidity positions and DCA Orders are represented as non-fungible tokens
This is the multi-chain ownerless and permissionless contract that enables all the functionality of Ekubo Protocol. Each pool has its own separate state in the singleton, but aggregation across pools is made efficient via flash accounting and extensive gas optimization.
Core.sol: The singleton contract that stores all the state for the AMM and holds all the tokens
These contracts manage positions in the Ekubo Protocol Core contract
Positions.sol: NFT-based liquidity position managementOrders.sol: TWAMM order management as NFTs
These are useful for integrating or extending the functionality of Ekubo Protocol.
BaseLocker.sol: Abstract base for contracts interacting with the flash accountantBaseExtension.sol: Contains default handlers for all the extension methodsBaseNonfungibleToken.sol: Base NFT implementation with access controlBasePositions.sol: Base NFT Positions contract implementation with abstract methods for determining the protocol fee to collectFlashAccountant.sol: Manages flash loans and token accountingExposedStorage.sol: Provides access to internal storage for external queries
Router.sol: High-level interface for swapping with multi-hop and splitting supportMEVCaptureRouter.sol: Extension of the Router that also supports the MEV Capture pools
extensions/Oracle.sol: Price oracle functionalityextensions/TWAMM.sol: Time-Weighted Average Market Maker implementationextensions/MEVCapture.sol: MEV capture and redistribution mechanism
Incentives.sol: Enables efficiently delivering multiple airdropsRevenueBuybacks.sol: Uses DCA orders to push revenue into buybacks of a specific tokenPositionsOwner.sol: Permissionlessly transfers collected revenue from a Positions contract to the Revenue Buybacks contractTokenWrapper.sol: Vested token implementation that tightly integrates with Ekubo Protocol for cheaper swapsTokenWrapperFactory.sol: Factory for deploying the TokenWrapper contract
This project uses the Ekubo DAO Shared Revenue License 1.0 (ekubo-license-v1.eth).
You can use, modify, and build on this code — as long as you share 50% of any protocol revenue from your deployed or derivative version (“Royalty Bearing Work”) with Ekubo DAO each quarter.
- Must include this license or the line: “Licensed under the Ekubo DAO Shared Revenue License 1.0 at ekubo-license-v1.eth.”
- Failing to pay or comply automatically ends the license.
- Ekubo DAO can update payment details or revenue definitions through governance.
- Software is provided as-is, with no warranties.
See the full license.
- Website: ekubo.org
- Documentation: docs.ekubo.org
- Discord: discord.ekubo.org
- Twitter: @EkuboProtocol