🏭Factory

Factory contract is the main contract of the protocol. It is used to create vault proxies and serves as registry.

View Methods

countVault

function countVault() external view returns (uint256)

Returns the number of vaults from the factory.

Return Value:

TypeDescription

uint256

number of vaults

getWhitelistedTokens

function getWhitelistedTokens() external view returns (address[] memory)

Returns a list of all whitelisted token addresses.

Return Value:

TypeDescription

address[]

addresses of whitelisted tokens

getFeesReceiver

function getFeesReceiver(uint256 _feeType) external view returns (address)

Returns the address of the fees receiver.

Call Parameters:

NameTypeDescription

_feeType

uint256

0 corresponds to managementFeesReceiver

Return Value:

TypeDescription

address

address of the fees receivercreateVault

isTokenWhitelisted

function isTokenWhitelisted(address _token) public view returns (bool)

Checks if a token is whitelisted.

Call Parameters:

NameTypeDescription

_tokens

address

token's address to check

Return Value:

TypeDescription

bool

returns true if the address of the token is whitelisted

getFactoryState

function getFactoryState()
    external
    view
    returns (
        address[] memory,
        address,
        address,
        address,
        address,
        address
    )

Returns all parameters from the factory.

Return Values:

TypeDescription

address[]

addresses of the vaults

address

address of the fees manager

address

address of the access manager

address

address of the harvester

address

address of the proxy

address

address of the router

getVaultState

function getVaultState(address _vault)
    external
    view
    returns (
        VLib.Token[] memory vTokens,
        VLib.ConstantProps memory constantProps,
        VLib.HistoryProps memory historyProps,
        VLib.ConfigProps memory configProps,
        VLib.FeesProps memory feesProps,
        VLib.SecurityProps memory securityProps,
        uint256[] memory balances,
        uint256[] memory positions,
        uint256 vvl,
        uint256 sharePrice,
        uint256[2] memory ongoingFees
    )

Returns the parameters of a vault.

Call Parameters:

NameTypeDescription

_vault

address

address of the vault

Return Values:

NameTypeDescription

vTokens

VLib.Token[]

list of the tokens managed by the vault

constantProps

VLib.constantProps

constant parameters from the vault

historyProps

VLib.HistoryProps

previous parameters

configProps

VLib.ConfigProps

main configuration parameters from the vault

feesProps

VLib.FeesProps

fees parameter from the vault

securityProps

VLib.securityProps

security parameter from the vault

balances

uint256

amount of each assets in the vault

positions

uint256

positions from the vaults

vvl

uint256

vault's TVL

sharePrice

uint256

share price

ongoingFees

uint256[2]

amount of management and performance fees to harvest

getVaultOngoingFees

function getVaultOngoingFees(address _vault) 
    external 
    view 
    returns (
        uint256 ongoingManagementFees, 
        uint256 ongoingPerformanceFees
    )

Returns the amount of fees to harvest according to a vault address.

Call Parameters:

NameTypeDescription

_vault

address

address of the vault

Return Values:

NameTypeDescription

ongoingManagementFees

uint256

amount of management fees to harvest

ongoingPerformanceFees

uint256

amount of performance fees to harvest

getShareState

function getShareState(address _vault)
    external
    view
    returns (
        address share,
        string memory name,
        string memory symbol,
        uint8 decimals,
        uint256 supply,
        bool transferable
    )

Returns the share parameters from a vault according to its address.

Call Parameters:

NameTypeDescription

_vault

address

address of the vault

Return Values:

NameTypeDescription

share

address

address of vault's share

name

string

name of the vault's share

symbol

string

symbol of vault's share

decimals

uint8

vault's share decimals

supply

uint256

vault's share supply

transferable

bool

vault's share transferability

getUserShareState

function getUserShareState(address _vault, address _user)
    external
    view
    returns (
        address share,
        uint256 balance,
        uint256 allowanceToVault
    )

Returns user's share information according to the vault's address and the user address.

Call Parameters:

NameTypeDescription

_vault

address

address of the vault

_user

address

address of the user

Return Values:

NameTypeDescription

share

address

address of vault's share

balance

uint256

amount of share in user's wallet

allowanceToVault

uint256

allowance between the user and the vault

getRolesPerVault

function getRolesPerVault(address _vault)
    external
    view
    returns (
        bytes32[3] memory,
        address[] memory,
        address[] memory,
        address[] memory
    )

Returns the roles names and the addresses of the admins, strategists and harvesters according to a vault address.

Call Parameters:

NameTypeDescription

_vault

address

address of the vault

Return Values:

TypeDescription

bytes32[3]

list of roles names

address[]

list of admins addresses

address[]

list of strategists addresses

address[]

list of harvesters addresses

Write Methods

createVault

function createVault(
    address[] calldata _tokensAddresses,
    VLib.CreationProps calldata _creationProps,
    VLib.FeesProps calldata _feesProps,
    VLib.SecurityProps calldata _securityProps
) external

Creates a vault with the parameters requested.

This method can only be called by address with VAULT_CREATOR_ROLE.

Call Parameters:

NameTypeDescription

_tokensAddresses

address[]

all manageable assets

_creationProps

VLib.CreationProps

main vault information

_feesProps

VLib.FeesProps

fees parameters

_securityProps

VLib.SecurityProps

security parameters

setAccessManager

function setAccessManager(address _newAccesslolManager) external

Settles the new AccessManager.

This method can only be called by the contract owner.

Call Parameters:

NameTypeDescription

_newAccessManager

address

address of the new AccessManager

setFeesManager

function setFeesManager(address _newFeesManager) external

Settles the new FeesManager.

This method can only be called by the contract owner.

Call Parameters:

NameTypeDescription

_newFeesManager

address

address of the new FeesManager

setHarvester

function setHarvester(address _newHarvester) external

Settles the new Harvester.

This method can only be called by the contract owner.

Call Parameters:

NameTypeDescription

_newHarvester

address

address of the new Harvester

setSwapContracts

function setSwapContracts(address _newSwapRouter, address _newSwapProxy) external

Settles the new aggregator proxy and router.

This method can only be called by the contract owner.

Call Parameters:

NameTypeDescription

_newSwapRouter

address

address of the new router

_newSwapProxy

address

address of the new proxy

setSwapAdapter

function setSwapAdapter(address _newSwapAdapter) external

Settles the new swap adapter.

This method can only be called by the contract owner.

Call Parameters:

NameTypeDescription

_newSwapAdapter

address

address of the new swap adapter

addTokenAndPriceFeedsToWL

function addTokensAndPriceFeedsToWL(
    address[] calldata _tokens, 
    address[] calldata _priceFeeds
) external

Whitelists a tokens and their oracles for vaults.

This method can only be called by the contract owner.

Call Parameters:

NameTypeDescription

_token

address[]

list of tokens addresses to whitelist

_priceFeeds

address[]

list token's oracle addresses to whitelist

removeTokensFromWhitelist

function removeTokensFromWhitelist(address[] calldata _tokens) external

Removes tokens and their oracles from the whitelist.

This method can only be called by the contract owner.

Parameters:

NameTypeDescription

_tokens

address[]

list of tokens addresses to remove

Last updated