Pre Requisites

To understand ALM, you need to understand what are liquidity pool , yield farming, automated market makers

What is an ALM?

Active liquidity management (ALM) are strategies that actively adjust the liquidity parameters on behalf of the liquidity pool.  As an ALM program, Gamma’s smart contracts automatically manage the prices ranges, rebalances assets, and reinvest the fees earns for optimal yields.

Example: You want to invest your money into uniswap v3, so the ALM auto adjusts your positions to give you more yield

How does a typical ALM work?

ALM is essentially a mixture of two modular components:

1. Hypervisor/factory contract (ERC-4626)

  • The Liquidity Manager contract that interacts directly with the DEX Liquidity Pool 

  • A Uniswap position manager contract (called a hypervisor for Gamma, factory vault for Rivera and the factory contract for Defiedge), which contains a set of functions that are able to be called by an active manager or rebalancing contract.

  • The hypervisor functions include rebalancing ranges, depositing liquidity, collecting and re-investing fees, and redeeming LP tokens for the underlying assets.

  • When the user deposits their token into a hypervisor, a fungible ERC-20 liquidity provider token is minted, which represents their fractional ownership of the pool. If they want to withdraw tokens from the pool, the LP token is burned.  

  • The hypervisor structure allows for multiple parties to pool their tokens into a single actively-managed position.

  • One challenge with directly providing liquidity on some AMMs like Uniswap is that they require an exact 50/50 pair of two tokens.  

  • The hypervisor structure allows for LPs to deposit dual-sided token combinations that are not precisely in 50/50 proportions. This is achieved through an innovative base and limit position structure. The base position matches the pool’s ratio of tokens, while the limit position contains a single asset.  

  • Ultimately, the hypervisor performs functions on behalf of the LPs, such as setting position ranges, rebalancing, collecting and reinvesting the fees earned.

2. The Supervisor/Rebalancer/Strategy manager

  • The supervisor contract then employs the asset management strategy for the hypervisor. The supervisor periodically calls the rebalance function to adjust the LP position on the AMM. 
  • The rebalance function is a crucial part of the process because it’s where the impermanent loss of the position is realised.

Good example of how liquidity is actively managed on top of Uniswap v3: https://www.gelato.network/blog/liquidity-management-on-uniswap-v3