AlphaProVault

The contract that manages liquidity, and processes deposits and withdrawals.

deposit

function deposit(
        uint256 amount0Desired,
        uint256 amount1Desired,
        uint256 amount0Min,
        uint256 amount1Min,
        address to
)
        external
        override
        nonReentrant
        returns (uint256 shares, uint256 amount0, uint256 amount1)

Deposit tokens in proportion to the vault's current holdings. These tokens will remain in the vault, and are not used for liquidity until the next rebalance.

Parameters:

Returns:

withdraw

function withdraw(
    uint256 shares,
    uint256 amount0Min,
    uint256 amount1Min,
    address to
) 
    external
    override
    nonReentrant
    returns (uint256 amount0, uint256 amount1)

Withdraws tokens in proportion to the vault's current holdings and the fees earned by the vault.

Parameters:

Returns:

rebalance

function rebalance() external override nonReentrant

Updates the vault's positions. Anyone can call rebalance, unless the vault manager calls setRebalanceDelegate to nominate a specific wallet to rebalance.

checkCanRebalance

function checkCanRebalance() public view override

Check whether the vault can rebalance. Revert with an error code if it cannot.

getTwap

function getTwap() public view returns (int24)

Fetches the time-weighted average price in ticks from Uniswap pool.

Returns:

getTotalAmounts

function getTotalAmounts() 
    public 
    view override 
    returns (uint256 total0, uint256 total1)

Calculates the vault's total holdings of token0 and token1 - ie how much of each token the vault would hold if it withdrew all its liquidity from Uniswap. Includes owed fees but excludes the proportion of fees that will be paid to the protocol and vault manager.

Returns:

getBalance0

function getBalance0() public view override returns (uint256)

The amount of unused token0 held by the vault.

Returns:

getBalance1

function getBalance1() public view override returns (uint256)

The amount of unused token1 held by the vault.

Returns:

collectProtocol

collectProtocol(address to) external

Collects all the uncollected protocol fees accrued by the vault. Can only be called by Charm Governance.

Parameters:

collectManager

collectManager(address to) external onlyManager

Collects all the uncollected manager fees accrued by the vault. Can only be called by the vault manager.

Parameters:

sweep

function sweep(
    IERC20Upgradeable token
    uint256 amount
    address to
) 
    external onlyManager 

Removes tokens accidentally sent to this vault. Can only be called by the vault manager.

Parameters:

setBaseThreshold

function setBaseThreshold(int24 _baseThreshold) external onlyManager

Setting the baseThreshold. Can only be called by the vault manager.

Parameters:

setLimitThreshold

function setLimitThreshold(int24 _baseThreshold) external onlyManager

Setting the limitThreshold. Can only be called by the vault manager.

Parameters:

setFullRangeWeight

function setFullRangeWeight(uint256 _fullRangeWeight) external onlyManager

Setting the fullRangeWeight . Can only be called by the vault manager.

Parameters:

setPeriod

function setPeriod(uint256 _period) external onlyManager

Setting the rebalancing period. Can only be called by the vault manager.

Parameters:

setMinTickMove

function setMinTickMove(int24 _minTickMove) external onlyManager

Setting the minimum tick movement between rebalance. Can only be called by the vault manager.

Parameters:

setTwapDuration

function setTwapDuration(uint32 _twapDuration) external onlyManager

Setting the Security Parameter to calculate the TWAP. Can only be called by the vault manager.

Parameters:

setMaxTwapDeviation

function setMaxTwapDeviation(int24 _maxTwapDeviation) external onlyManagersol

Setting the Security Parameter that determines the maximum TWAP deviation. Can only be called by the vault manager.

Parameters:

setMaxTotalSupply

function setMaxTotalSupply(uint256 _maxTotalSupply) external onlyManager

Setting the Information Parameter that determines a vault's maximum capacity. Can only be called by the vault manager.

Parameters:

emergencyBurn

function emergencyBurn(
    int24 tickLower,
    int24 tickUpper,
    uint128 liquidity
) 
    external onlyManager 

Removes the vault's liquidity in a given range. Can only be called by the vault manager.

Parameters:

setManager

function setManager(address _manager) external onlyManager

The first step to change a vault's manager. Can only called by the vault manager.

Parameters:

acceptManager

function acceptManager() external

The second step to change a vault manager. Can only be called by the address assigned to _manager.

State Changes:

setManagerFee

function setManagerFee(uint256 _pendingManagerFee) external onlyManager 

Setting a fee for the vault manager, as a % of fees received from Uniswap. Can only be called by the vault manager.

Parameters:

setRebalanceDelegate

function setRebalanceDelegate(address _rebalanceDelegate) external onlyManager

Switch on/off private rebalancing. Can only be called by the vault manager.

Parameters:

Getter functions for public variables

Getter functions are automatically generated for the following public variables:

Pool Variables

Vault Variables

Protocol Variables

Strategy Variables

Security Variables

Gas Optimization Variables

Vault Manager Variables

Last updated