link staking contracts
OperatorVCS: Chainlink Node Operator Staking Strategy
OperatorVCS is a staking strategy that manages many OperatorVault 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 |
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
function getVaults() external view returns (contract IVault[])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 |
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 |
operatorRewardPercentage
Section titled âoperatorRewardPercentageâReturns the basis point amount of an operatorâs earned rewards that they receive
function operatorRewardPercentage() external viewReturn Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| operatorRewardPercentage | uint256 | Basis point operator reward percentage |
getOperatorRewards
Section titled âgetOperatorRewardsâReturns the total unclaimed operator rewards
function getOperatorRewards() external view returns (uint256, uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| unclaimedOperatorRewards | uint256 | Total unclaimed operator rewards |
| availableRewards | uint256 | Total available operator rewards |
getVaultRemovalQueue
Section titled âgetVaultRemovalQueueâReturns a list of all vaults queued for removal
function getVaultRemovalQueue() external view returns (address[])Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| queue | address[] | List of vaults queued for removal |
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 |
onTokenTransfer
Section titled âonTokenTransferâERC677 implementation to receive operator rewards
function onTokenTransfer(address, uint256, bytes) externalwithdrawOperatorRewards
Section titled âwithdrawOperatorRewardsâUsed by vaults to withdraw operator rewards
function withdrawOperatorRewards(address _receiver, uint256 _amount) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _receiver | address | Address to receive rewards |
| _amount | uint256 | Amount to withdraw |
updateDeposits
Section titled âupdateDepositsâUpdates deposit accounting and calculates fees on newly earned rewards
function updateDeposits(bytes _data) external returns (uint256 depositChange, address[] receivers, uint256[] amounts)Parameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _data | bytes | Encoded min amount of rewards required to claim (set 0 to skip reward claiming) |
Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| depositChange | uint256 | change in deposits since last update |
| 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 |
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 |
addVault
Section titled âaddVaultâDeploys a new vault
function addVault(address _operator) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _operator | address | Address of operator that the vault represents |
queueVaultRemoval
Section titled âqueueVaultRemovalâQueues a vault for removal
A vault can only be queued for removal if the operator has been removed from the Chainlink staking contract
function queueVaultRemoval(uint256 _index) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _index | uint256 | Index of vault |
removeVault
Section titled âremoveVaultâRemoves a vault that has been queued for removal
function removeVault(uint256 _queueIndex) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _queueIndex | uint256 | Index of vault in removal queue |
updateVaultGroupAccounting
Section titled âupdateVaultGroupAccountingâUpdates accounting for any number of vault groups
Used to correct minor accounting errors that result from the removal or slashing of operators in the Chainlink staking contract
function updateVaultGroupAccounting( uint256[] _vaultGroups, uint256[] _totalDepositRoom, uint256 _totalUnbonded, uint256 _vaultMaxDeposits ) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultGroups | uint256[] | list of vault groups to update |
| _totalDepositRoom | uint256[] | list of totalDepositRoom corresponding to list of vault groups |
| _totalUnbonded | uint256 | total amount currently unbonded |
| _vaultMaxDeposits | uint256 | vault deposit limit as defined in Chainlink staking contract |
setOperator
Section titled âsetOperatorâSets a vaultâs operator address
function setOperator(uint256 _index, address _operator) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _index | uint256 | Index of vault |
| _operator | address | Address of operator that the vault represents |
setRewardsReceiver
Section titled âsetRewardsReceiverâSets the address authorized to claim rewards for a vault
function setRewardsReceiver(address _rewardsReceiver) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _operator | address | Address of rewards receiver for vault |
setOperatorRewardPercentage
Section titled âsetOperatorRewardPercentageâSets the basis point amount of an operatorâs earned rewards that they receive
function setOperatorRewardPercentage(uint256 _operatorRewardPercentage) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _operatorRewardPercentage | uint256 | Basis point operator reward percentage |