IKyberStaking
interface IKyberStaking
is IEpochUtils imports IEpochUtils
Source: IKyberStaking.sol
INDEX
Delegated
Deposited
Withdraw
deposit
delegate
withdraw
getStakerData
getLatestStakerData
getStakerRawData
REFERENCE
Events
Delegated
Event for logging the delegation to a representative.
event Delegated(address staker, address representative, uint256 epoch, bool isDelegated)
Parameter | Type | Description |
---|---|---|
staker | address | staker's address |
representative | address | representative's address delegated to |
epoch | uint256 | epoch number where delegation happens |
isDelegated | bool | true if staker has delegated to a new representative, otherwise false |
Signature: 0xfbb976ae5268347766b726bd1edba29af0fe16f9c505fbd3b9a10cb6d00cfa3d
Deposited
Event for logging the deposit of KNC into the staking contract.
event Deposited(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 deposited in twei |
Signature: 0x1599c0fcf897af5babc2bfcf707f5dc050f841b044d97c3251ecec35b9abf80b
Withdraw
Event for logging the withdrawal of KNC from the staking contract.
event Withdraw(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: 0x9da6493a92039daf47d1f2d7a782299c5994c6323eb1e972f69c432089ec52bf
Functions
deposit
Deposit and stake KNC.
function deposit(uint256 amount) external
Parameter | Type | Description |
---|---|---|
amount | uint256 | amount of KNC to deposit in twei |
delegate
Sets the delegation to a representative, and only takes effect on the next epoch
function delegate(address dAddr) external
Parameter | Type | Description |
---|---|---|
dAddr | address | representative's address to delegate to |
withdraw
Unstakes and withdraws KNC from the staking contract.
function withdraw(uint256 amount) external
Parameter | Type | Description |
---|---|---|
amount | uint256 | amount of KNC to withdraw in twei |
getStakerData
Iterates through all the epochs and returns the staker data up to current epoch + 1.
function getStakerData(address staker, uint256 epoch) external 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
getLatestStakerData
Returns the staker data for the latest epoch.
function getLatestStakerData(address staker) external 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
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 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