Liquidity Provider
Functions
setPriceBounds: Sets the AMM position's square-root upper and lower price bounds.
depositLiquidity: Sovereign LM function to deposit reserves into the
pool
.withdrawLiquidity: Sovereign LM function to withdraw reserves from the
pool
.Implementation of specific functions in the liquidity provider contract.
Security Model
The liquidity provider contract has complete control over depositing, withdrawing, and managing user funds in the HOT. The HOT assumes that all deposited funds belong to a single liquidity provider controlled by the
liquidityProvider
address. Individual LPs should ensure that this contract is well-audited, and cannot maliciously drain user funds.As the Liquidity Provider is a critical role with complete control over user funds, it is set as an immutable address at the time of deployment.
The Liquidity Provider is expected to have a safe rebalance function, which can manually rebalance the pool in case the reserve composition gets too skewed into one of the tokens.
The Liquidity Provider can optionally have a short Timelock before calling the
setPriceBounds
function.
Trust Assumptions
Except for the common trust assumptions around deposits and withdrawals, the liquidity provider should ensure that:
The price bounds are set appropriately so that the liquidity is concentrated to achieve the ideal balance between capital efficiency and the lowest possible inventory risk.
Highly concentrated liquidity can increase the losses from AMM swaps, as described in the malicious signer attack vector.
Liquidity Providers should implement a Timelock before calling the
setPriceBounds
function in the HOT. Without proper Timelocks, malicious price-bound attacks could become possible.setPriceBounds
is called with the proper checks so that attacks similar to the Deposit Sandwich Attack are not possible. Simply setting the_expectedSqrtSpotPriceLowerX96
and_expectedSqrtSpotPriceUpperX96
correctly while making the call should be enough to prevent the attack.
Last updated