Links

Vaults

Information on the Gamma's vault technology

Introduction

A Vault is a position manager contract. A vault has certain management functions such as rebalance, set limit position, collect fees, and reinvest earned fees.
These functions allow it to manage funds in a liquidity pool. Vaults are non-custodial in that only the depositor can withdraw funds.
Each liquidity pool, whether Public or Pro is functionally run by a Vault.
A list of active Vaults can be found here:
Gamma's vault contract refers to Hypervisor.sol, whose name is now retired

Contract

Github

Samples

Functions

Deposits

The vault contract allows liquidity providers to deposit tokens using the deposit function. The function allows for double-sided deposits to be made from any account, choosing amounts of token0, token1, and a recipient of the LP ownership shares representing ownership of the deposit.
When a vault receives a deposit, it mints a fungible LP ERC20 token representing fractional ownership in the pool. These shares are minted in proportion to the units of token1 and token0 that are provided into the pool. These tokens are transferred to the LP token account specified by the depositor.

Withdrawals

Any holder of LP tokens may initiate withdrawals by calling the withdraw function. A withdrawer specifies how many LP tokens they would like to burn in exchange for the share of the vault's underlying LP position's assets the burned tokens represented and specifies a recipient account to whom those assets should be sent.‌
Burning LP tokens release underlying assets in the ratio held by the vault. For example, a vault that has its liquidity of 20% in WETH and 80% in UNI would satisfy withdrawals by providing 20% WETH, and 80% UNI, even if the liquidity provided originally was not at that ratio.

Rebalancing

An advisor account designated by the vault deployer has the right to call the rebalance function, which modifies the vault's LP position. In the current strategy, a vault's position consists of two liquidity positions: a base position which must match the pool's current ratio of tken0 and token1 in composition, and a limit position, which contains a single asset (often what cannot be deposited in the base position due to the mechanics of concentrated liquidity). A vault's strategy consists of determining where these positions should be placed and when they should be changed in response to market conditions. During a rebalance, the advisor account provides width and placement parameters for these respective positions. It also supplies a fee recipient account.‌

Compounding

Fees

When a rebalance occurs, the base and limit positions are burned, and the fees earned from swaps over the liquidity provision ranges are collected. A fraction of these earned fees (defined by the vault deployer) can be deducted from this quantity and sent to the recipient account provided by the advisor calling the rebalance. The remaining fees are reinvested in the new, rebalanced position.
‌Vaults deduct a percentage of these fees and send the fees to a distributor account. An individual deployer may choose whichever fee schedule they wish to implement. The fee recipient account provided by the advisor account can be a smart contract, for example, allowing custom business logic to determine the final destination or management of this fraction of earned fees.