{% hint style="warning" %}
You are referring to the Legacy
version of KyberSwap docs.
For the most updated information, please refer to:
Classic
Elastic
Limit Order
Aggregator
{% endhint %}
is IERC20, ReentrancyGuard, IKyberStaking, IKyberDao, EpochUtils\ imports IKyberStaking, EpochUtils, ReentrancyGuard
Source: KyberStaking.sol
INDEX
<AUTOGENERATED_TABLE_OF_CONTENTS>
REFERENCE
Events
WithdrawDataUpdateFailed
Event for logging the failed withdrawal of KNC from the staking contract.
event WithdrawDataUpdateFailed(uint256 curEpoch, address staker, uint256 amount) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | curEpoch
| uint256 | current epoch number where KNC was deposited | | staker
| address | staker's address | | amount
| uint256 | amount of KNC withdrawn in twei | Signature: 0xa412eef5316d3cbf9e2b4ba3d1cf3e482b40dc8946fd919b7f5053450fa621fb
\
Functions
delegate
Sets the delegation to a representative, and only takes effect on the next epoch
function delegate(address newRepresentative) external override | Parameter | Type | Description | | --------- |:-----:|:-----------:| | dAddr
| address | representative's address to delegate to |
### `deposit` Deposit and stake KNC. ___ function __deposit__(uint256 amount) external override | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `amount` | uint256 | amount of KNC to deposit in twei |
### `withdraw` Unstakes and withdraws KNC from the staking contract. ___ function __withdraw__(uint256 amount) external override nonReentrant | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `amount` | uint256 | amount of KNC to withdraw in twei |
### `getStakerRawData` Returns the raw staker data up to current epoch + 1. Returns 0 values if staker data is uninitialized. ___ function __getStakerRawData__(address staker, uint256 epoch) external view override returns (uint256 stake, uint256 delegatedStake, address representative) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `staker` | address | staker's address | | `epoch` | uint256 | epoch number to get staker raw data |
Returns:\ stake - total amount of KNC staked in twei delegatedStake - amount of KNC delegated to the staker's address in twei representative - if the staker is delegating, this shows the address he is delegating to
### `getStake` Get staked amount up to current epoch + 1. ___ function __getStake__(address staker, uint256 epoch) external view returns (uint256) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `staker` | address | staker's address | | `epoch` | uint256 | epoch number to get the staked amount | **Returns:**\ Staked amount in KNC token wei at epoch
### `getDelegatedStake` Get delegated staked amount up to current epoch + 1. ___ function __getDelegatedStake__(address staker, uint256 epoch) external view returns (uint256) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `staker` | address | staker's address | | `epoch` | uint256 | epoch number to get the delegated staked amount | **Returns:**\ Delegated staked amount in KNC token wei at epoch
### `getRepresentative` Get representative of a staker up to current epoch + 1. ___ function __getRepresentative__(address staker, uint256 epoch) external view returns (address) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `staker` | address | staker's address | | `epoch` | uint256 | epoch number to get the representative | **Returns:**\ Representative's address at epoch
### `getStakerData` Iterates through all the epochs and returns the staker data up to current epoch + 1. ___ function __getStakerData__(address staker, uint256 epoch) external view override returns (uint256 stake, uint256 delegatedStake, address representative) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `staker` | address | staker's address | | `epoch` | uint256 | epoch number to start iterating from to get staker data | **Returns:**\ stake - total amount of KNC staked in twei delegatedStake - amount of KNC delegated to the staker's address in twei representative - if the staker is delegating, this shows the address he is delegating to
### `getLatestRepresentative` Get representative of a staker up at the latest epoch. ___ function __getLatestRepresentative__(address staker) external view returns (address) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `staker` | address | staker's address | **Returns:**\ Representative at the latest epoch
### `getLatestDelegatedStake` Get latest delegated staked amount. ___ function __getLatestDelegatedStake__(address staker) external view returns (uint256) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `staker` | address | staker's address | **Returns:**\ Delegated staked amount in KNC token wei latest epoch
### `getLatestStakeBalance` Get staked amount at the latest epoch. ___ function __getLatestStakeBalance__(address staker) external view returns (uint256) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `staker` | address | staker's address | **Returns:**\ Staked amount in KNC token wei at latest epoch
### `getLatestStakerData` Iterates through all the epochs until the latest epoch and returns the staker data. ___ function __getLatestStakerData__(address staker) external view override returns (uint256 stake, uint256 delegatedStake, address representative) | Parameter | Type | Description | | --------- |:-----:|:-----------:| | `staker` | address | staker's address | **Returns:**\ stake - total amount of KNC staked in twei delegatedStake - amount of KNC delegated to the staker's address in twei representative - if the staker is delegating, this shows the address he is delegating to