> For the complete documentation index, see [llms.txt](https://docs.kyberswap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kyberswap.com/reference/legacy/api-abi/core-smart-contracts/ikyberstaking.md).

# IKyberStaking

{% hint style="warning" %}
You are referring to the **`Legacy`** version of KyberSwap docs.

For the most updated information, please refer to:

* [**`Classic`**](https://github.com/KyberNetwork/kyberswap-documentation/blob/main/reference/legacy/api-abi/core-smart-contracts/broken-reference/README.md)
* [**`Elastic`**](/reference/legacy/kyberswap-elastic.md)
* [**`Limit Order`**](/kyberswap-solutions/limit-order.md)
* [**`Aggregator`**](/kyberswap-solutions/kyberswap-aggregator.md)
  {% endhint %}

## interface IKyberStaking

is [IEpochUtils](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-iepochutils.md) imports [IEpochUtils](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-iepochutils.md)

*Source*: [IKyberStaking.sol](https://github.com/KyberNetwork/smart-contracts/blob/master/contracts/sol6/Dao/IKyberStaking.sol)

***

### INDEX[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikyberstaking#index) <a href="#index" id="index"></a>

\<AUTOGENERATED\_TABLE\_OF\_CONTENTS>

### REFERENCE[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikyberstaking#reference) <a href="#reference" id="reference"></a>

#### Events[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikyberstaking#events) <a href="#events" id="events"></a>

#### `Delegated`[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikyberstaking#delegated) <a href="#delegated" id="delegated"></a>

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`[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikyberstaking#deposited) <a href="#deposited" id="deposited"></a>

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`[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikyberstaking#withdraw) <a href="#withdraw" id="withdraw"></a>

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[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikyberstaking#functions) <a href="#functions" id="functions"></a>

#### `deposit`[​](https://docs.kyberswap.com/Legacy/api-abi/core-smart-contracts/api_abi-ikyberstaking#deposit) <a href="#deposit" id="deposit"></a>

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kyberswap.com/reference/legacy/api-abi/core-smart-contracts/ikyberstaking.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
