LBVault (Incl. Native)

LBVault is the keeper of the funds; It is the only entry and exit point into the strategy.

LBVault.sol - Exists to facilitate non-AVAX pairs; LBVaultNative.sol is for any AVAX pair. When integrating this is an important note to make.

The Vaults are our automated liquidity vaults, keeping the mission in mind of optimising DEX liquidity the focus is on easily allowing managers to deploy strategies and LPers to deploy capital into these vaults.

The capabilities of these vaults are the following:

  • ERC20 wrapper for Trader Joe Dex V2 LP Positions

  • Allow for the keeper role to control the LP range (through the strategy)

  • Allow for the keeper role to re-range the total position (through the strategy)

  • Fully Fungible

Owner Role: The Owner of the LBVault contracts should be set to the SteakHut multisig address for any potential whitelisting to occur. (SteakHut MultiSig 3/4 - 0xD316d2AA04d71Fd1E332437b0Cb5d261FD2F99AE). This should only be completed after all setup occurs.

Tracking of Positions

When liquidity is added to the vault, SteakHut LB vault tokens are minted and credited to the provider.

Inversely, SteakHut LB tokens can be burned to redeem that proportion of the pool's V2 position liquidity and fees earned.

SteakHut LB tokens represent proportional ownership (or "shares") of the underlying JOE Dex V2 position.

Deposit Funds into the System

Depositing funds into the system is called using the below function. (Native AVAX version is also available under the depositAVAXPair() function, the user must pass the correct msg.value to correspond with the amounts otherwise tx will revert)

AmountX and AmountY are the amounts of funds that the user is willing to deposit into the system whilst amountXMin and AmountYMin are the minimum amount of tokens that the user is happy to receive due to the conversion ratio).

It is important to note that when depositing funds are not automatically put to work in the strategy.

Only a 'keeper' may call the earn() function in order to put the funds to work. However, only if the current bin range and strategy parameters are maintained.

    /// @notice primary entrypoint of funds into the system. users deposit with this function
    /// into the vault. The vault is then in charge of sending funds into the strategy.
    /// funds stay idle in the strategy until earn() is called and valid parameters
    /// @notice Deposits tokens in proportion to the vault's current holdings.
    /// @param amountX amount of tokenX to deposit
    /// @param amountY amount of tokenY to deposit
    /// @param amountXMin miniumum amount of tokenX to deposit due to ratio
    /// @param amountYMin miniumum amount of tokenY to deposit due to ratio
    /// @return shares minted to the depositor
    /// @return amountXActual amount token X accepted as deposit
    /// @return amountYActual amount token Y accepted as deposit
    function deposit(
        uint256 amountX,
        uint256 amountY,
        uint256 amountXMin,
        uint256 amountYMin
    )
        public
        nonReentrant
        returns (uint256 shares, uint256 amountXActual, uint256 amountYActual)
    

Withdraw Funds from the System

To remove funds from the system withdraw shall be called. The input argument will be the number of shares that the user wishes to be removed from the system.

This will return the underlying tokens in the same ratio as currently used in the strategy. It is important to note that this won't necessarily be the same ratio that was placed into the vault due to the underlying changes in the live liquidity.

Should a user wish to withdraw all of the shares, there is a helper function also available under withdrawAll().

    /// @notice primary exit point of funds from the system. users withdraw using this function.
    /// @param _shares amount of shares to withdraw from the system
    /// @return amountX the amount of token X removed
    /// @return amountY the amount of token Y removed
    function withdraw(
        uint256 _shares
    ) public nonReentrant returns (uint256 amountX, uint256 amountY) {

Last updated