💎Vault

Vault contract is used to protect funds and perform swaps.

Types

ActionType

enum ActionType {
    DEPOSIT,
    REBALANCE,
    REDEEM
}

SwapDataExecution

struct SwapDataExecution {
    ActionType action;
    bytes[] swapTxs;
    uint256[] tokenBalancesBefore;
    uint256[] currentPositions;
    uint256 shareOrBaseTokenAmount;
    uint256 totalShareSupply;
}

View Methods

getConstantProps

function getConstantProps() external view virtual returns (VLib.ConstantProps memory)

Returns the Constant properties of the vault.

Refer to the VLib's data structure for more information

getHistoryProps

function getHistoryProps() external view virtual returns (VLib.HistoryProps memory)

Returns the History properties of the vault.

Refer to the VLib's data structure for more information

getConfigProps

function getConfigProps() external view virtual returns (VLib.ConfigProps memory) 

Returns the Config properties of the vault.

Refer to the VLib's data structure for more information

getFeesProps

function getFeesProps() external view virtual returns (VLib.FeesProps memory)

Returns the Fees properties of the vault.

Refer to the VLib's data structure for more information

getSecurityProps

function getSecurityProps() external view virtual returns (VLib.SecurityProps memory)

Returns the Security properties of the vault.

Refer to the VLib's data structure for more information

tokensLength

function tokensLength() public view virtual returns (uint256)

Returns the number of different tokens in the vault.

Return Value:

getLatestPrice

function getLatestPrice(address _priceFeed) public view virtual returns (uint256) 

Returns the last price of a chainlink price feed.

Call Parameters:

Return Value:

getVaultBalances

function getVaultBalances() public view virtual returns (uint256[] memory balances)

Returns the balances of each assets of the vault.

Return Value:

getVaultStatus

function getVaultStatus()
    public
    view
    returns (
        uint256[] memory positions,
        uint256 vvl,
        uint256 sharePrice
    )

Returns the status of the vault.

Return Values:

getManagementFees

function getManagementFees() public view returns (uint256 toMint, uint256 sharePrice)

Returns the amount of management fees to harvest.

Return Values:

getPerformanceFees

function getPerformanceFees()

Returns the amount of performance fees to harvest.

Return Values:

Write Methods

deposit

function deposit(uint256 _baseTokenAmountIn, bytes[] calldata _swapTxs) external

Deposits an amount of base token in the vault.

Call Parameters:

redeem

function redeem(uint256 _amountIn, bytes[] calldata _swapTxs) external

Redeems an amount from the vault and receive in the same currency as deposit.

Call Parameters:

redeemEach

function redeemEach(uint256 _amountIn) external

Redeems each parts of the assets in proportion to the shares burned.

Call Parameters:

redeemForced

function redeemForced(address _user, uint256 _amountIn) external

Redeems each parts of the assets in proportion to the shares burned to a user.

This method can only be called by address with DEFAULT_ADMIN_ROLE.

Call Parameters:

rebalance

function rebalance(uint256[] memory _signals, bytes[] calldata _swapTxs) external

Rebalances the vault.

This method can only be called by address with STRATEGIST_ROLE.

Call Parameters:

harvestManagementFees

function harvestManagementFees() external

Mints share in proportion of management fees, based on current fees ratio and last withdraw timestamp.

This method can only be called by address with STRATEGIST_ROLE.

harvestPerformanceFees

function harvestPerformanceFees() external

Mints share in proportion of performance fees, based on current fees ratio and last withdraw timestamp.

This method can only be called by address with STRATEGIST_ROLE.

approveForSwap

function approveForSwap(uint256[] memory _amounts) public

Modifies approvals for assets managed by the vault.

This method can only be called by address with DEFAULT_ADMIN_ROLE.

Call Parameters:

addVaultAsset

function addVaultAsset(address _token) external

Adds a new asset to the vault.

This method can only be called by address with STRATEGIST_ROLE.

Call Parameters:

setShareTransferability

function setShareTransferability(bool _status) external

Settles the new share transferability status.

This method can only be called by address with DEFAULT_ADMIN_ROLE.

Call Parameters:

setConfigProps

function setConfigProps(VLib.ConfigProps memory _configProps) public

Settles ConfigProps.

Refer to the VLib's data structure for more information. Only callable by the admin.

This method can only be called by address with DEFAULT_ADMIN_ROLE.

setSecurityProps

function setSecurityProps(VLib.SecurityProps memory _securityProps) public

Settles SecurityProps.

Refer to the VLib's data structure for more information.

This method can only be called by address with DEFAULT_ADMIN_ROLE.

setFeesProps

function setFeesProps(VLib.FeesProps memory _feesProps) public

Settles FeesProps.

Refer to the VLib's data structure for more information

This method can only be called by address with DEFAULT_ADMIN_ROLE.

Last updated