Withdraw Liquidity

A Liquidity Module can withdraw liquidity from the sovereignVault by calling the withdrawalLiquidity function on the Sovereign Pool. This is only true for the case where sovereignVault is the pool itself. Otherwise the sovereignVault must implement its own function for withdrawing liquidity.

/**
        @notice Withdraw liquidity from this pool to an ALM Position.
        @dev Only callable by ALM Position.
        @param _amount0 Amount of token0 reserves to withdraw.
        @param _amount1 Amount of token1 reserves to withdraw.
        @param _recipient Address of recipient.
        @param _verificationContext Bytes containing verfication data required in case of permissioned pool.
     */
    function withdrawLiquidity(
        uint256 _amount0,
        uint256 _amount1,
        address _sender,
        address _recipient,
        bytes calldata _verificationContext
    ) external override nonReentrant onlyALM
  • This function can only be called by the Liquidity Module.

  • Liquidity Module is allowed to withdraw any amount of token0 or token1 from the pool, as long as it is less than the current reserves.

  • If the pool contains a verifierModule, _sender and _verificationContext would be checked for validity before accepting a withdrawal.

  • This function supports rebase tokens.

  • This function is disabled if reserves are meant to be stored outside of the pool (sovereignVault is not the pool).

  • No pool-level role can pause withdrawals.

Control Flow of a Withdrawal

userLiquidity Module → Sovereign Pool’s withdrawLiquidity.

The Liquidity Module is free to decide how to interface with users and account for withdrawals internally. Funds are transferred to the recipient specified by the Liquidity Module.

Last updated