# Rewards: Leaving the Rewards Contract

Removing tokens from the *`StandardRewards`* contract requires the user to indicate the program ID and the token amount. The following steps explain how to collect the data necessary to call the  `leave` function that returns the bnTokens to your wallet. Once the bnTokens are back in your wallet, you can reclaim your deposit by following the instructions in the [Withdraw Tokens](https://docs.bancor.network/guides/bancor-etherscan-guide/withdrawing-tokens) guide.&#x20;

### 1. Program ID

This step will explain how to identify the ID of the rewards program you are staked in:

* Visit *`StandardRewards`* contract [on etherscan](https://etherscan.io/address/0xb0B958398ABB0b5DB4ce4d7598Fb868f5A00f372#readProxyContract)
* Execute the *`providerProgramIds`* function (this is a Read function) with your Ethereum address:

![](https://273705617-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC9gDtGR2KNhur3c7qIJR%2Fuploads%2Fose62R42kv0a86d0YqA3%2Fimage.png?alt=media\&token=3b977ae7-2c00-4c02-bf12-87332a684aff)

`Input variable`

| Name       | Type    | Description         |
| ---------- | ------- | ------------------- |
| \_provider | address | User wallet address |

`Output response`

List of 1+ IDs to represent the different programs you are staked in

{% hint style="info" %}
Save the IDs that are returned for use in later steps.&#x20;
{% endhint %}

### 2. Identify which ID to use

{% hint style="info" %}
If you only have 1 ID ([extracted in step 1](#1.-program-id)),  skip to [step 3](#3.-available-amount).
{% endhint %}

If you are actively staked in more than 1 program, this step will explain how to identify the program ID for the rewards program you would like to unstake from

* Visit *`StandardRewards`* contract [on etherscan](https://etherscan.io/address/0xb0B958398ABB0b5DB4ce4d7598Fb868f5A00f372#readProxyContract)
* Execute the *`programs`* function (this is a Read function)

![](https://273705617-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC9gDtGR2KNhur3c7qIJR%2Fuploads%2FS7IfWZ1dTuv5HyNQfSjK%2Fimage.png?alt=media\&token=cd097203-4f09-4a16-b16f-b761620e7ab4)

`Input variable`

| Name | Type    | Description                              |
| ---- | ------- | ---------------------------------------- |
| ids  | uint256 | An array of 1 or more reward program IDs |

`Output response`

<table><thead><tr><th width="250.33333333333331">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>uint256</td><td>The unique identifier of the rewards program</td></tr><tr><td>pool</td><td>Token</td><td>The deposited token (i.e BNT, ETH, DAI, LINK) address</td></tr><tr><td>poolToken</td><td>IPoolToken</td><td>The relevant bnToken address</td></tr><tr><td>rewardsToken</td><td>Token</td><td>The address of the rewards token that is given in this program</td></tr><tr><td>isEnabled</td><td>bool</td><td>True/False indication if the program is active</td></tr><tr><td>startTime</td><td>uint32</td><td>The start time of the program</td></tr><tr><td>endTime</td><td>uint32</td><td>The end time of the program</td></tr><tr><td>rewardRate</td><td>uint256</td><td>The amount of tokens per second that are distributed</td></tr></tbody></table>

Using the output data,&#x20;

1. Identify the program with the *`pool`* token you would like to withdraw
2. Identify the program *`id`* to use in the following step

### 3. Available amount

This step will explain how to identify the number of available tokens to unstake from the contract

* Visit *`StandardRewards`* contract [on etherscan](https://etherscan.io/address/0xb0B958398ABB0b5DB4ce4d7598Fb868f5A00f372#readProxyContract)
* Execute the *`providerStake`* function (this is a Read function)

![](https://273705617-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC9gDtGR2KNhur3c7qIJR%2Fuploads%2FYiQALqLIwYOOd8FL6iQF%2Fimage.png?alt=media\&token=4784c20b-4cb8-4007-b252-40e087f752dd)

`Input variable`

| Name     | Type    | Description                                  |
| -------- | ------- | -------------------------------------------- |
| provider | address | Your wallet address                          |
| id       | uint256 | The unique identifier of the rewards program |

`Output response`

| Name   | Type    | Description                                        |
| ------ | ------- | -------------------------------------------------- |
| Amount | uint256 | The bnToken amount staked into the rewards program |

{% hint style="info" %}
Note the number returned by the function - this is the number of pool tokens you own, which you will need to input to leave the rewards contract. \
Note that this value is already returned in wei format, so you will **not** need to add zeroes to it.
{% endhint %}

### 4. Leaving the StandardRewards Contract

This step will explain how to call the`leave` function, removing your tokens from the rewards program.

* Visit *`StandardRewards`* contract [on etherscan](https://etherscan.io/address/0xb0B958398ABB0b5DB4ce4d7598Fb868f5A00f372#writeProxyContract)
* Execute the *`leave`* function (this is a Write function)

![](https://273705617-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC9gDtGR2KNhur3c7qIJR%2Fuploads%2FthC2ugLbaXIHK9URPg2g%2Fimage.png?alt=media\&token=f98ed1f8-437c-4cfe-a545-d0d2a9c8b7ee)

`Input variable`

| Name            | Type    | Description                                                                             |
| --------------- | ------- | --------------------------------------------------------------------------------------- |
| id              | uint256 | The unique identifier of the rewards program ([found in steps 1 and 2](#1.-program-id)) |
| poolTokenAmount | uint256 | The amount of bnTokens to unstake ([found in step 3](#3.-available-amount))             |

`Output`

The bnTokens will return to your wallet.&#x20;

{% hint style="info" %}
Now that once the bnTokens are in your wallet, you can follow the [Withdraw Tokens](https://docs.bancor.network/guides/bancor-etherscan-guide/withdrawing-tokens) guide.&#x20;
{% endhint %}
