🤩Introduction
Last updated
Last updated
Automated market makers (AMMs) are agents that pool liquidity and make it available to traders according to an algorithm. Constant function market makers (CFMMs), a broad class of AMMs of which XNX is a member, have seen widespread use in the con-text of decentralized finance, where they are typically implemented as smart contracts that trade tokens on a permissionless blockchain
CFMMs as they are implemented today are often capital inefficient. In the constant product market maker formula used by v1 and v2, only a fraction of the assets in the pool are available at a given price. This is inefficient, particularly when assets are expected to trade close to a particular price at all times.
Prior attempts to address this capital efficiency issue, such as Curve and YieldSpace, have involved building pools that use different functions to describe the relation between reserves. This requires all liquidity providers in a given pool to adhere to a single formula, and could result in liquidity fragmentation if liquidity providers want to provide liquidity within different price ranges.
In this paper, we present XNX v3, a novel AMM that gives liquidity providers more control over the price ranges in which their capital is used, with limited effect on liquidity fragmentation and gas inefficiency. This design does not depend on any shared assumption about the price behavior of the tokens. XNX v3 is based on the same constant product reserves curve as earlier versions, but offers several significant new features:
• Concentrated Liquidity: Liquidity providers (LPs) are given the ability to concentrate their liquidity by “bounding" it within an arbitrary price range. This improves the pool’s capital efficiency and allows LPs to approximate their pre-ferred reserves curve, while still being efficiently aggregated with the rest of the pool. We describe this feature and its implementation.
• Flexible Fees: The swap fee is no longer locked at 0.30%. Rather, the fee tier for each pool (of which there can be multiple per asset pair) is set on initialization. The initially supported fee tiers are 0.05%, 0.30%, and 1%. XNX governance is able to add additional values to this set.
• Protocol Fee Governance: XNX governance has more flexibility in setting the fraction of swap fees collected by the protocol.
• Improved Price Oracle: XNX v3 provides a way for users to query recent price accumulator values, thus avoiding the need to checkpoint the accumulator value at the exact beginning and end of the period for which a TWAP is being measured.
• Liquidity Oracle: The contracts expose a time-weighted average liquidity oracle.
The XNX v2 core contracts are non-upgradeable by de-sign, so XNX v3 is implemented as an entirely new set of contracts, available here. The XNX v3 core contracts are also non-upgradeable, with some parameters controlled by governance as described.