Algebra Integral
HomepageSocialsIntegrate
  • Overview / FAQ
    • 💡What is Algebra?
    • 🫂The Algebra Ecosystem
    • 🧑‍🔬Algebra Integral
    • 📚Glossary
    • 🪙Tokenomics
    • 📱Social Media & Links
    • 👨‍🎨Brand Assets
    • Partners
      • Algebra V1.0
        • QuickSwap Polygon
        • ZyberSwap
        • Thena
        • StellaSwap
        • QuickSwap Dogechain
        • SkullSwap
        • UbeSwap
        • Litx
      • Algebra V1.9
        • Camelot
        • Lynex
        • Swapbased
        • Synthswap
        • Zyberswap Optimism
        • Hercules
      • Integral 1.0
        • Swapsicle Telos
        • Swapsicle Mantle
        • Kim
        • Fenix
        • Blade
        • SilverSwap Fantom
        • Horizon
        • Glyph Exchange
        • SilverSwap Sonic
        • SwapX
        • Bulla
      • Integral 1.1
        • Scribe
      • Integral 1.2
        • Fibonacci
        • Voltage
        • Henjin
        • Wasabee
        • Holiverse
        • MorFi
        • StellaSwap
        • QuickSwap Soneium
  • Algebra Integral / Technical Reference
    • ℹ️Intro
    • 🔍Audits
    • 🏗️Integration Process
      • Specification and API of contracts
        • Algebra Pool
        • Algebra Factory
        • Swap Router
        • Nonfungible Position Manager
        • Quoter
        • QuoterV2
        • TickLens
      • Interaction with pools
        • Getting data from pools
      • Subgraphs and analytics
        • Examples of queries
      • Technical Guides
        • Intro
        • Swaps
          • Single swaps
          • Multihop swaps
        • Providing liquidity
          • Setting up your contract
          • Mint a new position
          • Collect fees
          • Decrease liquidity
          • Increase liquidity
          • Final Contract
        • Flashloans
          • Setting up your contract
          • Calling flash
          • Flash callback
          • Final contract
      • Migration from UniswapV3
    • 🖲️Core Logic
      • Pool overview
      • Swap calculation
      • Liquidity and positions
      • Ticks
        • Ticks search tree
      • Reserves
      • Flash
      • Plugins
      • AlgebraFactory and roles
    • 🧩Plugins
      • Overview
      • Adaptive Fee
      • Sliding Fee
      • Whitelist Discount Fee
      • Safety Switch
      • Position Limit Orders
      • Managed Swap Fee
      • FAQ
    • 📖Guides
      • 🔨Plugin Development
      • 🔬Plugin Testing
      • ☄️Plugin Deployment
    • ⬆️Changes V1
    • ⬆️Changes V1.1
    • ⬆️Changes v1.2
  • ⬆️Changes v1.2.1
  • Algebra V1 / Technical Reference
    • 🔏Contracts
      • API Reference v1.0
        • V1.0 - Core
          • AlgebraFactory
          • AlgebraPool
          • AlgebraPoolDeployer
          • DataStorage
          • DataStorageOperator
          • IAlgebraFactory
          • IAlgebraFlashCallback
          • IAlgebraMintCallback
          • IAlgebraPoolActions
          • IAlgebraPoolDeployer
          • IAlgebraPoolDerivedState
          • IAlgebraPoolEvents
          • IAlgebraPoolImmutables
          • IAlgebraPoolPermissionedActions
          • IAlgebraPoolState
          • IAlgebraSwapCallback
          • IAlgebraVirtualPool
          • IDataStorageOperator
          • IERC20Minimal
          • PoolImmutables
          • PoolState
        • V1.0 - Periphery
          • AlgebraInterfaceMulticall
          • ERC20
          • ERC20Permit
          • ERC165
          • ERC721
          • ERC721Permit
          • IAlgebraMintCallback
          • IAlgebraFactory
          • IAlgebraPoolDerivedState
          • IAlgebraPoolActions
          • IAlgebraPoolEvents
          • IAlgebraPoolImmutables
          • IAlgebraPoolPermissionedActions
          • IAlgebraPoolState
          • IAlgebraSwapCallback
          • IERC20
          • IDataStorageOperator
          • IERC20Metadata
          • IERC20Permit
          • IERC20PermitAllowed
          • IERC165
          • IERC721
          • IERC721Enumerable
          • IERC721Metadata
          • IERC721Permit
          • IERC721Receiver
          • IERC1271
          • IMulticall
          • INonfungiblePositionManager
          • INonfungibleTokenPositionDescriptor
          • IPeripheryImmutableState
          • IPeripheryPayments
          • IPeripheryPaymentsWithFee
          • IPoolInitializer
          • IQuoter
          • IQuoterV2
          • ISelfPermit
          • ISwapRouter
          • ITickLens
          • IUniswapV2Pair
          • IV3Migrator
          • IWNativeToken
          • LiquidityManagement
          • Multicall
          • NFTDescriptor
          • NonfungiblePositionManager
          • NonfungibleTokenPositionDescriptor
          • PeripheryImmutableState
          • PeripheryPayments
          • PeripheryPaymentsWithFee
          • PoolInitializer
          • Quoter
          • QuoterV2
          • SwapRouter
          • SelfPermit
          • TickLens
          • V3Migrator
        • V1.0 - Tokenomics
          • AlgebraEternalFarming
          • AlgebraFarming
          • AlgebraIncentiveFarming
          • AlgebraLimitFarming
          • AlgebraTokenStaking
          • AlgebraVault
          • AlgebraVirtualPoolBase
          • ERC20
          • ERC165
          • ERC721
          • ERC721Permit
          • EternalVirtualPool
          • FarmingCenter
          • FarmingCenterVault
          • FreezableToken
          • IAlgebraEternalFarming
          • IAlgebraEternalVirtualPool
          • IAlgebraFactory
          • IAlgebraFarming
          • IAlgebraIncentiveFarming
          • IAlgebraIncentiveVirtualPool
          • IAlgebraLimitFarming
          • IAlgebraLimitVirtualPool
          • IAlgebraPoolActions
          • IAlgebraPoolDeployer
          • IAlgebraPoolDerivedState
          • IAlgebraPoolEvents
          • IAlgebraPoolImmutables
          • IAlgebraPoolPermissionedActions
          • IAlgebraPoolState
          • IAlgebraSwapCallback
          • IAlgebraVirtualPool
          • IAlgebraVirtualPoolBase
          • IDataStorageOperator
          • IERC20
          • IERC20Minimal
          • IERC165
          • IERC721
          • IERC721Enumerable
          • IERC721Metadata
          • IERC721Permit
          • IERC721Receiver
          • IERC1271
          • IFarmingCenter
          • IFarmingCenterVault
          • IMulticall
          • IncentiveVirtualPool
          • INonfungiblePositionManager
          • IPeripheryPayments
          • IPeripheryImmutableState
          • IPoolInitializer
          • ISwapRouter
          • IWNativeToken
          • LimitVirtualPool
          • Multicall
          • PeripheryPayments
      • API Reference v1.9
        • V1.9 - Core
          • AlgebraFactory
          • AlgebraPool
          • AlgebraPoolDeployer
          • DataStorage
          • DataStorageOperator
          • IAlgebraFactory
          • IAlgebraFlashCallback
          • IAlgebraMintCallback
          • IAlgebraPoolActions
          • IAlgebraPoolDeployer
          • IAlgebraPoolDerivedState
          • IAlgebraPoolEvents
          • IAlgebraPoolImmutables
          • IAlgebraPoolPermissionedActions
          • IAlgebraPoolState
          • IAlgebraSwapCallback
          • IAlgebraVirtualPool
          • IDataStorageOperator
          • IERC20Minimal
          • PoolImmutables
          • PoolState
        • V1.9 - Periphery
          • ERC721Permit
          • AlgebraInterfaceMulticall
          • IERC20Metadata
          • IERC20PermitAllowed
          • IERC721Permit
          • IERC1271
          • IMulticall
          • INonfungiblePositionManager
          • INonfungibleTokenPositionDescriptor
          • IPeripheryImmutableState
          • IPeripheryPayments
          • IPeripheryPaymentsWithFee
          • IPoolInitializer
          • IQuoter
          • IQuoterV2
          • ISelfPermit
          • ISwapRouter
          • ITickLens
          • IV3Migrator
          • IWNativeToken
          • LiquidityManagement
          • Multicall
          • NFTDescriptor
          • NonfungiblePositionManager
          • NonfungibleTokenPositionDescriptor
          • PeripheryImmutableState
          • PeripheryPayments
          • PoolInitializer
          • PeripheryPaymentsWithFee
          • Quoter
          • QuoterV2
          • SelfPermit
          • SwapRouter
          • TickLens
          • V3Migrator
        • V1.9 - Tokenomics
          • AlgebraFarming
          • AlgebraEternalFarming
          • AlgebraLimitFarming
          • AlgebraTokenStaking
          • AlgebraVault
          • AlgebraVirtualPoolBase
          • ERC20
          • EternalVirtualPool
          • FarmingCenter
          • FarmingCenterVault
          • FreezableToken
          • IAlgebraEternalFarming
          • IAlgebraEternalVirtualPool
          • IAlgebraFarming
          • IAlgebraLimitFarming
          • IAlgebraLimitVirtualPool
          • IAlgebraVirtualPoolBase
          • IERC20Minimal
          • IFarmingCenter
          • IFarmingCenterVault
          • LimitVirtualPool
          • PeripheryPayments
      • API Reference v1.9 - Directional Fees
        • V1.9 (Directional Fees) - Core
          • AlgebraFactory
          • AlgebraPool
          • AlgebraPoolDeployer
          • DataStorage
          • DataStorageOperator
          • IAlgebraFactory
          • IAlgebraFlashCallback
          • IAlgebraMintCallback
          • IAlgebraPoolActions
          • IAlgebraPoolDeployer
          • IAlgebraPoolDerivedState
          • IAlgebraPoolEvents
          • IAlgebraPoolImmutables
          • IAlgebraPoolPermissionedActions
          • IAlgebraSwapCallback
          • IAlgebraPoolState
          • IAlgebraVirtualPool
          • IDataStorageOperator
          • IERC20Minimal
          • PoolImmutables
          • PoolState
        • V1.9 (Directional Fees) - Periphery
          • AlgebraInterfaceMulticall
          • ERC721Permit
          • IERC20Metadata
          • IERC20PermitAllowed
          • IERC721Permit
          • IERC1271
          • IMulticall
          • INonfungiblePositionManager
          • INonfungibleTokenPositionDescriptor
          • IPeripheryImmutableState
          • IPeripheryPayments
          • IPeripheryPaymentsWithFee
          • IPoolInitializer
          • IQuoter
          • IQuoterV2
          • ISelfPermit
          • ISwapRouter
          • ITickLens
          • IV3Migrator
          • IWNativeToken
          • LiquidityManagement
          • Multicall
          • NFTDescriptor
          • NonfungiblePositionManager
          • NonfungibleTokenPositionDescriptor
          • PeripheryImmutableState
          • PeripheryPayments
          • PeripheryPaymentsWithFee
          • PoolInitializer
          • Quoter
          • QuoterV2
          • SelfPermit
          • SwapRouter
          • TickLens
          • V3Migrator
        • V1.9 (Directional Fees) - Tokenomics
          • AlgebraFarming
          • AlgebraEternalFarming
          • AlgebraLimitFarming
          • AlgebraTokenStaking
          • AlgebraVault
          • AlgebraVirtualPoolBase
          • ERC20
          • EternalVirtualPool
          • FarmingCenter
          • FarmingCenterVault
          • FreezableToken
          • IAlgebraEternalFarming
          • IAlgebraEternalVirtualPool
          • IAlgebraFarming
          • IAlgebraLimitVirtualPool
          • IAlgebraLimitFarming
          • IAlgebraVirtualPoolBase
          • IERC20Minimal
          • IFarmingCenterVault
          • IFarmingCenter
          • LimitVirtualPool
          • PeripheryPayments
      • API Reference v2.0
        • V2.0 - Core
          • AlgebraCommunityVault
          • AlgebraFactory
          • AlgebraFeeConfiguration
          • AlgebraPool
          • AlgebraPoolBase
          • AlgebraPoolDeployer
          • DataStorage
          • DataStorageOperator
          • DerivedState
          • IAlgebraFactory
          • IAlgebraFlashCallback
          • IAlgebraMintCallback
          • IAlgebraPoolActions
          • IAlgebraPoolDeployer
          • IAlgebraPoolDerivedState
          • IAlgebraPoolErrors
          • IAlgebraPoolEvents
          • IAlgebraPoolImmutables
          • IAlgebraPoolPermissionedActions
          • IAlgebraPoolState
          • IAlgebraSwapCallback
          • IAlgebraVirtualPool
          • IDataStorageOperator
          • IERC20Minimal
          • Positions
          • ReservesManager
        • V2.0 - Periphery
          • AlgebraInterfaceMulticall
          • ERC721Permit
          • IERC20Metadata
          • IERC20PermitAllowed
          • IERC721Permit
          • IERC1271
          • ILimitOrderManager
          • IMulticall
          • INonfungiblePositionManager
          • INonfungibleTokenPositionDescriptor
          • IPeripheryImmutableState
          • IPeripheryPayments
          • IPeripheryPaymentsWithFee
          • IPoolInitializer
          • IPositionFollower
          • IQuoter
          • IQuoterV2
          • ISelfPermit
          • ISwapRouter
          • ITickLens
          • IV3Migrator
          • IWNativeToken
          • LimitOrderManagement
          • LimitOrderManager
          • LiquidityManagement
          • Multicall
          • NFTDescriptor
          • NonfungiblePositionManager
          • NonfungibleTokenPositionDescriptor
          • PeripheryImmutableState
          • PeripheryPayments
          • PeripheryPaymentsWithFee
          • PoolInitializer
          • Quoter
          • QuoterV2
          • SelfPermit
          • SwapRouter
          • TickLens
          • V3Migrator
        • V2.0 - Tokenomics
          • AlgebraEternalFarming
          • EternalVirtualPool
          • FarmingCenter
          • IAccessControl
          • IAlgebraEternalFarming
          • IAlgebraEternalVirtualPool
          • IFarmingCenter
          • IncentiveKey
          • VirtualTickStructure
      • API Reference v2.0 - Directional Fees
        • V2.0 (Directional Fees) - Core
          • AlgebraCommunityVault
          • AlgebraFactory
          • AlgebraFeeConfiguration
          • AlgebraPool
          • AlgebraPoolBase
          • AlgebraPoolDeployer
          • DataStorage
          • DataStorageOperator
          • DerivedState
          • IAlgebraFactory
          • IAlgebraFlashCallback
          • IAlgebraMintCallback
          • IAlgebraPoolActions
          • IAlgebraPoolDeployer
          • IAlgebraPoolDerivedState
          • IAlgebraPoolErrors
          • IAlgebraPoolEvents
          • IAlgebraPoolImmutables
          • IAlgebraPoolPermissionedActions
          • IAlgebraPoolState
          • IAlgebraSwapCallback
          • IAlgebraVirtualPool
          • IDataStorageOperator
          • IERC20Minimal
          • Positions
          • ReservesManager
        • V2.0 (Directional Fees) - Periphery
          • AlgebraInterfaceMulticall
          • ERC721Permit
          • IERC20Metadata
          • IERC20PermitAllowed
          • IERC721Permit
          • IERC1271
          • ILimitOrderManager
          • IMulticall
          • INonfungiblePositionManager
          • INonfungibleTokenPositionDescriptor
          • IPeripheryImmutableState
          • IPeripheryPayments
          • IPeripheryPaymentsWithFee
          • IPoolInitializer
          • IPositionFollower
          • IQuoter
          • IQuoterV2
          • ISelfPermit
          • ISwapRouter
          • ITickLens
          • IV3Migrator
          • IWNativeToken
          • LimitOrderManagement
          • LimitOrderManager
          • LiquidityManagement
          • Multicall
          • NFTDescriptor
          • NonfungiblePositionManager
          • NonfungibleTokenPositionDescriptor
          • PeripheryImmutableState
          • PeripheryPayments
          • PeripheryPaymentsWithFee
          • PoolInitializer
          • QuoterV2
          • Quoter
          • SelfPermit
          • SwapRouter
          • TickLens
          • V3Migrator
        • V2.0 (Directional Fees) - Tokenomics
          • AlgebraEternalFarming
          • EternalVirtualPool
          • FarmingCenter
          • IAccessControl
          • IAlgebraEternalFarming
          • IAlgebraEternalVirtualPool
          • IFarmingCenter
          • IncentiveKey
          • VirtualTickStructure
      • Adaptive Fee
        • Adaptive Fee
        • How to set up specific formula behaviour
        • How to tweak formula behaviour
      • Contracts Setup
        • Deployment
          • Contracts Deployment
          • Deployment Scripts
        • Misc
          • POOL_INIT_CODE_HASH
          • Code Audits
          • Deployment Addresses
      • The Algebra Guides
        • Flash Integrations
          • The Full Contract
          • Calling Flash
          • Flash Callback
          • Inheritance constructor
        • Liquidity Mining
          • Liquidity Mining Overview
        • Providing Liquidity
          • Collecting fees
          • Decrease liquidity
          • Increase Liquidity Within The Current Range
          • Mint a new position
          • Set up your contract
          • The full contract
        • Swaps
          • Multihop swaps
          • Single swaps
    • 📊Subgraph
      • Query Examples
        • Query Examples
      • GraphQL Schema
        • Farming GraphQL Schema
        • Algebra GraphQL Schema
      • Subgraph Setup
        • Subgraph Settings
        • Subgraph Deployment
    • 🖥️Frontend
      • Admin Panel
        • Contracts
          • Admin Panel
          • Changing Subgraph
        • Eternal Farmings
          • Create Eternal Farming
          • Managing Eternal Farming
        • Limit Farmings
          • Create Limit Farming
    • ⚙️Backend
      • Backend Setup
    • ⛑️Guides
      • Step by Step Deployment
  • Other
    • 📦Archived Documentation
    • ❗Link Awareness Notice
Powered by GitBook
On this page
  • Definition of liquidity
  • Liquidity position
  • Fee distribution between liquidity positions
  1. Algebra Integral / Technical Reference
  2. Core Logic

Liquidity and positions

PreviousSwap calculationNextTicks

Relevant and important files:

  • base/Positions.sol

  • libraries/LiquidityMath.sol

  • libraries/TickManagement.sol

Definition of liquidity

As stated in , the internal state of the AMM Algebra at any moment is determined by two values:

P\sqrt PP​ - the root of the current price of token1 relative to token0.

LLL - liquidity.

A change in the current price in the pool (via swaps) entails the movement of tokens from / to the pool, with the number of tokens depending on a coefficient called liquidity. Formulas linking token deltas, price change and liquidity value:

ΔP=ΔY/L\Delta \sqrt P = \Delta Y / LΔP​=ΔY/L

Δ1/P=ΔX/L\Delta 1 / \sqrt P = \Delta X / LΔ1/P​=ΔX/L

Thus, the liquidity LLL can be defined as a coefficient that determines the "speed" of price change when tokens are swapped. Change of P\sqrt PP​ (or 1/P1 / \sqrt P1/P​, depending on the direction of swap) is inversely proportional to liquidity. This means that the greater the liquidity, the more tokens need to be swapped to move the price by a given value.

Liquidity position

Algebra Integral is based on the concept of concentrated liquidity. This means that users can provide their tokens as liquidity for swaps at a certain price range. The following describes what this means and how the value of liquidity is related to tokens.

A liquidity position in Algebra Integral is an entity defined by the following parameters:

  1. Position owner

  2. Lower tick - the tick corresponding to the lowest price at which the liquidity of this position can be used

  3. The upper tick is the tick corresponding to the highest price at which the liquidity of this position can be used

Note that during the upward price movement (oneToZero) the pool buys token1 (Y) and sells token0 (X). On the other hand, during the downward price movement (zeroToOne) the pool buys token0 and sells token1.

Correlation between the liquidity value and the amount of tokens

Fee distribution between liquidity positions

Two accumulators of the following form are used for this purpose:

During swap, each iteration of the main loop holds the commission in the input token and increments the value of the corresponding accumulator.

The corresponding values of accumulators increment are recorded in the position when it was created, let's call them:

Then the amount of tokens that correspond to the share of the fees for a liquidity position can be calculated at any time:

ΔL\Delta LΔL - liquidity value associated with this position

The liquidity value associated with the position ΔL\Delta LΔL adds to the global liquidity value when the position becomes active (price inside the specified tick range) and subtracted from the global liquidity value when the position becomes inactive (price outside the specified tick range). These changes take place during the on the crossing of position-related .

Thus, the value ΔL \Delta LΔL must ensure the fulfillment of the formulas from the section on the price range defined by the upper and lower tick of the position. Then the correlation between the number of tokens and ΔL \Delta LΔL can be obtained as follows. Let:

Ptop\sqrt P_{top}P​top​ - the price root value corresponding to the upper tick of the position.

Pbottom\sqrt P_{bottom}P​bottom​ - the price root value corresponding to the lower tick of the position.

Pcurrent\sqrt P_{current}P​current​ - the current value of the price root in the pool.

This means that a liquidity position must, on the one hand, provide enough token0 for the sale to move the price up to the Ptop\sqrt P_{top}P​top​, and, on the other hand, provide for sale a sufficient amount of token1 to move the price to Pbottom\sqrt P_{bottom}P​bottom​ .

ТThen we can express the correlation between the number of tokens and ΔL \Delta LΔL, if Pcurrent\sqrt P_{current}P​current​ is inside the price range of the position:

ΔX=−(1/Ptop−1/Pcurrent)∗ΔL\Delta X = - (1 / \sqrt P_{top} - 1 / \sqrt P_{current}) * \Delta LΔX=−(1/P​top​−1/P​current​)∗ΔL

ΔY=−(Pbottom−Pcurrent)∗ΔL\Delta Y = - (\sqrt P_{bottom} - \sqrt P_{current}) * \Delta LΔY=−(P​bottom​−P​current​)∗ΔL

IfPcurrent\sqrt P_{current}P​current​ is not inside the position's price range, the amount of tokens associated with the position must cover price movement in one direction only (depending on the position of the current price).

If the current price is higher than the upper price of the position ( Pcurrent≥Ptop\sqrt P_{current} \ge \sqrt P_{top} P​current​≥P​top​):

ΔX=0\Delta X = 0ΔX=0

ΔY=−(Ptop−Pbottom)∗ΔL\Delta Y = - ( \sqrt P_{top} - \sqrt P_{bottom}) * \Delta LΔY=−(P​top​−P​bottom​)∗ΔL

If the current price is below the price range of the position ( Pcurrent<Pbottom\sqrt P_{current} \lt \sqrt P_{bottom} P​current​<P​bottom​ ):

ΔX=−(1/Ptop−1/Pbottom)∗ΔL\Delta X = - (1 / \sqrt P_{top} - 1 / \sqrt P_{bottom}) * \Delta LΔX=−(1/P​top​−1/P​bottom​)∗ΔL

ΔY=0\Delta Y = 0ΔY=0

Thus, when creating a position with the given ΔL\Delta LΔL, Ptop\sqrt P_{top}P​top​, Pbottom\sqrt P_{bottom}P​bottom​ user must provide ΔX\Delta XΔXtoken0 and ΔY\Delta YΔYtoken1, calculated according to the above formulas taking into account the current price in the pool.

On the other hand, when withdrawing liquidity, the user should receiveΔX\Delta XΔXtoken0 and ΔY\Delta YΔYtoken1, also calculated using the same formulas considering the current price and the change in ΔL\Delta LΔL.

For , the pool deducts a fee that is allocated to the currently active liquidity positions (positions whose liquidity is used for the swap).

totalFeeGrowthToken0=∑Famountx/LtotalFeeGrowthToken0 = \sum F^x_{amount} / LtotalFeeGrowthToken0=∑Famountx​/L

totalFeeGrowthToken1=∑Famounty/LtotalFeeGrowthToken1 = \sum F^y_{amount} / LtotalFeeGrowthToken1=∑Famounty​/L

where Famount{x,y}F^{\{x, y\}}_{amount}Famount{x,y}​ - the collected amount of fees in token0 or token1, LLL - the current global value of the fee.

Thanks to this mechanism, it is easy to calculate the share of fees due to each liquidity position. With the help of the ticks mechanism, it is possible to know at any moment what parts of accumulators were added at the moment when the price was between two given ticks. The definition of accumulator increments within the tick range is described in more detail in .

innerFeeGrowthToken0oldinnerFeeGrowthToken0_{old}innerFeeGrowthToken0old​ - accumulator increment for token0 that occurred between specified ticks

innerFeeGrowthToken1oldinnerFeeGrowthToken1_{old}innerFeeGrowthToken1old​ - accumulator increment for token1 that occurred between specified ticks

Δfeesx=ΔL∗(innerFeeGrowthToken0new−innerFeeGrowthToken0old)\Delta fees_x = \Delta L *(innerFeeGrowthToken0_{new} - innerFeeGrowthToken0_{old})Δfeesx​=ΔL∗(innerFeeGrowthToken0new​−innerFeeGrowthToken0old​)

Δfeesy=ΔL∗(innerFeeGrowthToken1new−innerFeeGrowthToken1old)\Delta fees_y = \Delta L *(innerFeeGrowthToken1_{new} - innerFeeGrowthToken1_{old})Δfeesy​=ΔL∗(innerFeeGrowthToken1new​−innerFeeGrowthToken1old​)

This is followed by an update of innerFeeGrowthToken0oldinnerFeeGrowthToken0_{old}innerFeeGrowthToken0old​ and innerFeeGrowthToken1oldinnerFeeGrowthToken1_{old}innerFeeGrowthToken1old​

🖲️
swaps
the article about ticks
the article about swap calculations
swap
ticks
liquidity definition