Community VCS
CommunityVCS is a staking strategy that manages many CommunityVault contracts by tracking the balance of each and moving tokens in and out of them.
View Functions
Section titled âView FunctionsâReturns the token this strategy supports
function token() external view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| token | address | Address of token |
canDeposit
Section titled âcanDepositâReturns the available deposit room for this strategy
function canDeposit() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| depositRoom | uint256 | Amount that can be deposited |
canWithdraw
Section titled âcanWithdrawâReturns the available withdrawal room for this strategy
function canWithdraw() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| withdrawalRoom | uint256 | Amount that can be withdrawn |
pendingFees
Section titled âpendingFeesâReturns the total amount of fees that will be paid on the next call to updateDeposits
function pendingFees() external view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| totalFees | uint256 | Amount of tokens to be paid as fees |
getTotalDeposits
Section titled âgetTotalDepositsâReturns the total amount of deposits in this strategy
function getTotalDeposits() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| totalDeposits | uint256 | Total amount of tokens deposited |
getMaxDeposits
Section titled âgetMaxDepositsâReturns the maximum amount of tokens this strategy can hold
Accounts for total current deposits + current additional vault space + current space in the Chainlink
function getMaxDeposits() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| maxDeposits | uint256 | Maximum token deposits |
getMinDeposits
Section titled âgetMinDepositsâReturns the minimum amount of tokens that must remain in this strategy
function getMinDeposits() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| minDeposits | uint256 | Minimum token deposits |
checkUpkeep
Section titled âcheckUpkeepâReturns whether a new batch of vaults should be deployed
function checkUpkeep(bytes) external view returns (bool, bytes)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| upkeepNeeded | bool | Whether a new batch of vaults should be deployed |
getDepositChange
Section titled âgetDepositChangeâReturns the deposit change since the last call to updateDeposits (ignores stakes/withdraws)
function getDepositChange() public view returns (int256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| depositChange | int256 | Change in total token deposits |
getVaults
Section titled âgetVaultsâReturns a list of all vaults controlled by this contract
function getVaults() external view returns (address[] memory)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaults | address[] | List of vault addresses |
getVaultDepositLimits
Section titled âgetVaultDepositLimitsâReturns the vault deposit limits
function getVaultDepositLimits() public view returns (uint256, uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| minDeposits | uint256 | minimum amount of deposits that a vault can hold |
| maxDeposits | uint256 | maximum amount of deposits that a vault can hold |
vaultImplementation
Section titled âvaultImplementationâReturns the address of the vault implementation contract this strategy will use for new vaults
function vaultImplementation() external view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaultImplementation | address | Address of vault implementation contract |
vaultDeploymentThreshold
Section titled âvaultDeploymentThresholdâReturns the minimum number of non-full vaults before a new batch is deployed
function vaultDeploymentThreshold() external view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaultDeploymentThreshold | uint256 | Vault deployment threshold |
vaultDeploymentAmount
Section titled âvaultDeploymentAmountâReturns the amount of vaults to deploy when threshold is met
function vaultDeploymentAmount() external view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaultDeploymentAmount | uint256 | number of vaults |
getFees
Section titled âgetFeesâReturns a list of all fees
function getFees() external view returns (struct VaultControllerStrategy.Fee[])Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| fees | struct VaultControllerStrategy.Fee[] | List of fees |
stakeController
Section titled âstakeControllerâReturns the address of the Chainlink staking contract
function stakeController() external view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| stakeController | address | address of staking contract |
Write Functions
Section titled âWrite Functionsâdeposit
Section titled âdepositâDeposits tokens from the staking pool into vaults
function deposit(uint256 _amount, bytes _data) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _amount | uint256 | Amount to deposit |
| _data | bytes | Encoded vault deposit order |
withdraw
Section titled âwithdrawâWithdraws tokens from vaults and sends them to the staking pool
function withdraw(uint256 _amount, bytes _data) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _amount | uint256 | Amount to withdraw |
| _data | bytes | Encoded vault withdrawal order |
performUpkeep
Section titled âperformUpkeepâDeploys a new batch of vaults
function performUpkeep(bytes _performData) externaladdVaults
Section titled âaddVaultsâDeploys a new batch of vaults
function addVaults(uint256 _numVaults) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _numVaults | uint256 | Number of vaults to deploy |
updateDeposits
Section titled âupdateDepositsâUpdates the total deposit amount for reward distribution and calculates applicable fees
function updateDeposits() external returns (address[] receivers, uint256[] amounts)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| receivers | address[] | List of fee receivers |
| amounts | uint256[] | List of fee amounts |
updateVaultGroups
Section titled âupdateVaultGroupsâExecutes a vault group update
Re-unbonds all vaults in the current vault group and increments the current vault group
function updateVaultGroups(uint256[] _curGroupVaultsToUnbond, uint256 _curGroupTotalDepositRoom, uint256 _nextGroup,uint256 _nextGroupTotalUnbonded) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _curGroupVaultsToUnbond | uint256[] | list of vaults to unbond in current vault group |
| _curGroupTotalDepositRoom | uint256[] | total deposit room across all vaults in current vault group |
| _nextGroup | uint256[] | index of next vault group |
| _nextGroupTotalUnbonded | uint256[] | total unbonded across all vaults in next vault group |
upgradeVaults
Section titled âupgradeVaultsâUpgrades vaults to a new implementation contract
function upgradeVaults(uint256 _startIndex, uint256 _numVaults, bytes _data) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _startIndex | uint256 | Index of first vault to upgrade |
| _numVaults | uint256 | Number of vaults to upgrade starting at _startIndex |
| _data | bytes | Optional encoded function call to be executed after upgrade |
setWithdrawalIndexes
Section titled âsetWithdrawalIndexesâManually sets the withdrawal index for each vault group
function setWithdrawalIndexes(uint64 _withdrawalIndexes) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _withdrawalIndexes | uint64[] | list of withdrawal indexes for each vault group |
Adds a new fee
function addFee(address _receiver, uint256 _feeBasisPoints) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _receiver | address | Address of fee receiver |
| _feeBasisPoints | uint256 | Fee in basis points |
updateFee
Section titled âupdateFeeâUpdates an existing fee
function updateFee(uint256 _index, address _receiver, uint256 _feeBasisPoints) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _index | uint256 | Index of fee |
| _receiver | address | Address of fee receiver |
| _feeBasisPoints | uint256 | Fee in basis points |
setVaultDeploymentParams
Section titled âsetVaultDeploymentParamsâSets the vault deployment parameters
function setVaultDeploymentParams(uint256 _vaultDeploymentThreshold, uint256 _vaultDeploymentAmount) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultDeploymentThreshold | uint256 | Minimum number of non-full vaults before a new batch is deployed |
| _vaultDeploymentAmount_ | uint256 | Amount of vaults to deploy when threshold is met |
setVaultImplementation
Section titled âsetVaultImplementationâSets a new vault implementation contract to be used when deploying/upgrading vaults
function setVaultImplementation(address _vaultImplementation) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultImplementation | address | Address of implementation contract |
setMaxDepositSizeBP
Section titled âsetMaxDepositSizeBPâSets the basis point amount of the remaing deposit room in the Chainlink staking contract
that can be deposited at once
function setMaxDepositSizeBP(uint256 _maxDeposits) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _maxDepositSizeBP | uint256 | Maximum basis point deposit size |