Skip to content

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.

Returns the token this strategy supports

function token() external view returns (address)
Name Type Description
token address Address of token

Returns the available deposit room for this strategy

function canDeposit() public view returns (uint256)
Name Type Description
depositRoom uint256 Amount that can be deposited

Returns the available withdrawal room for this strategy

function canWithdraw() public view returns (uint256)
Name Type Description
withdrawalRoom uint256 Amount that can be withdrawn

Returns the total amount of fees that will be paid on the next call to updateDeposits

function pendingFees() external view returns (uint256)
Name Type Description
totalFees uint256 Amount of tokens to be paid as fees

Returns the total amount of deposits in this strategy

function getTotalDeposits() public view returns (uint256)
Name Type Description
totalDeposits uint256 Total amount of tokens deposited

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)
Name Type Description
maxDeposits uint256 Maximum token deposits

Returns the minimum amount of tokens that must remain in this strategy

function getMinDeposits() public view returns (uint256)
Name Type Description
minDeposits uint256 Minimum token deposits

Returns whether a new batch of vaults should be deployed

function checkUpkeep(bytes) external view returns (bool, bytes)
Name Type Description
upkeepNeeded bool Whether a new batch of vaults should be deployed

Returns the deposit change since the last call to updateDeposits (ignores stakes/withdraws)

function getDepositChange() public view returns (int256)
Name Type Description
depositChange int256 Change in total token deposits

Returns a list of all vaults controlled by this contract

function getVaults() external view returns (address[] memory)
Name Type Description
vaults address[] List of vault addresses

Returns the vault deposit limits

function getVaultDepositLimits() public view returns (uint256, uint256)
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

Returns the address of the vault implementation contract this strategy will use for new vaults

function vaultImplementation() external view returns (address)
Name Type Description
vaultImplementation address Address of vault implementation contract

Returns the minimum number of non-full vaults before a new batch is deployed

function vaultDeploymentThreshold() external view returns (uint256)
Name Type Description
vaultDeploymentThreshold uint256 Vault deployment threshold

Returns the amount of vaults to deploy when threshold is met

function vaultDeploymentAmount() external view returns (uint256)
Name Type Description
vaultDeploymentAmount uint256 number of vaults

Returns a list of all fees

function getFees() external view returns (struct VaultControllerStrategy.Fee[])
Name Type Description
fees struct VaultControllerStrategy.Fee[] List of fees

Returns the address of the Chainlink staking contract

function stakeController() external view returns (address)
Name Type Description
stakeController address address of staking contract

Deposits tokens from the staking pool into vaults

function deposit(uint256 _amount, bytes _data) external
Name Type Description
_amount uint256 Amount to deposit
_data bytes Encoded vault deposit order

Withdraws tokens from vaults and sends them to the staking pool

function withdraw(uint256 _amount, bytes _data) external
Name Type Description
_amount uint256 Amount to withdraw
_data bytes Encoded vault withdrawal order

Deploys a new batch of vaults

function performUpkeep(bytes _performData) external

Deploys a new batch of vaults

function addVaults(uint256 _numVaults) external
Name Type Description
_numVaults uint256 Number of vaults to deploy

Updates the total deposit amount for reward distribution and calculates applicable fees

function updateDeposits() external returns (address[] receivers, uint256[] amounts)
Name Type Description
receivers address[] List of fee receivers
amounts uint256[] List of fee amounts

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) external
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

Upgrades vaults to a new implementation contract

function upgradeVaults(uint256 _startIndex, uint256 _numVaults, bytes _data) external
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

Manually sets the withdrawal index for each vault group

function setWithdrawalIndexes(uint64 _withdrawalIndexes) external
Name Type Description
_withdrawalIndexes uint64[] list of withdrawal indexes for each vault group

Adds a new fee

function addFee(address _receiver, uint256 _feeBasisPoints) external
Name Type Description
_receiver address Address of fee receiver
_feeBasisPoints uint256 Fee in basis points

Updates an existing fee

function updateFee(uint256 _index, address _receiver, uint256 _feeBasisPoints) external
Name Type Description
_index uint256 Index of fee
_receiver address Address of fee receiver
_feeBasisPoints uint256 Fee in basis points

Sets the vault deployment parameters

function setVaultDeploymentParams(uint256 _vaultDeploymentThreshold, uint256 _vaultDeploymentAmount) external
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

Sets a new vault implementation contract to be used when deploying/upgrading vaults

function setVaultImplementation(address _vaultImplementation) external
Name Type Description
_vaultImplementation address Address of implementation contract

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) external
Name Type Description
_maxDepositSizeBP uint256 Maximum basis point deposit size