LogoLogo
  • About Bancor Network
    • Bancor V3
    • Bancor Basics
      • About Bancor
      • What Can I Do With Bancor?
      • Liquidity Pools
      • Single-Side Liquidity
      • Why Use Bancor?
      • Resources
    • Resources for DAOs
      • Token Whitelisting Requirements
      • Liquidity Mining
        • Auto Compounding Rewards
          • How Auto Compounding Rewards work
          • How to Create an Auto Compounding Rewards Program
          • Custom Rewards Programs
        • Dual Liquidity Mining
        • Standard (External) Rewards
    • Security & Audits
      • Multisig Rights
      • Oracles
      • DAO MSIG Intervention Policy
  • Contracts & Functions
    • Contracts
    • Write Functions
      • Transaction Prerequisites
        • approve() / allowance()
      • Trading
        • tradeBySourceAmount()
        • tradeByTargetAmount()
        • Trading Troubleshooting
      • Adding Liquidity
        • deposit()
        • depositFor()
        • Deposit Troubleshooting
        • depositAndJoin()
      • Removing Liquidity
        • Initiating Cooldown
          • initWithdrawal()
        • withdraw()
        • cancelWithdrawal()
        • Withdraw Troubleshooting
      • Flashloan
        • flashLoan()
        • Flashloan Troubleshooting
      • Migrating Liquidity to v3
        • Migrating Bancor positions to v3
          • migratePositions()
          • migratePoolTokens()
          • Errors and Troubleshooting
        • Migrating from Uniswap v2
          • migrateUniswapV2Position()
        • Migrating from Sushiswap
          • migrateSushiSwapV1Position()
      • Rewards
        • join()
        • stakeRewards()
        • autoProcessRewards()
        • claimRewards()
        • leave()
      • Surplus migration
        • withdrawPOL()
      • Network Fees
        • burnNetworkFees()
    • Read Functions
      • Rewards
        • Standard rewards
          • Identify if a program exists
            • Auto Compounding
            • Standard Rewards
          • programIds()
          • programs()
          • providerProgramIds()
          • pendingRewards()
          • latestProgramId()
          • isProgramActive()
          • isProgramEnabled()
          • providerStake()
          • programStake()
          • providerRewards()
        • Auto compounding rewards
          • bnToken balance
          • isProgramActive()
          • isProgramPaused()
          • pools()
          • program()
          • programs()
      • Liquidity Pool Details
        • liquidityPools()
        • isPoolValid()
        • isPoolStable()
        • tradingLiquidity()
        • depositingEnabled()
        • poolFundingLimit()
      • Trades
        • tradeOutputBySourceAmount()
        • tradeInputByTargetAmount()
        • tradingEnabled()
        • tradingFeePMM()
      • Withdrawals
        • isReadyForWithdrawal()
        • withdrawalRequest()
        • withdrawalAmounts()
        • withdrawalRequestIds()
        • withdrawalRequestCount()
        • lockDuration()
      • Pool Token Information
        • poolToken()
        • collectionByPool()
        • poolTokenToUnderlying()
        • underlyingToPoolToken()
      • Vortex
        • pendingNetworkFeeAmount()
        • minNetworkFeeBurn()
      • Surplus whitelist
        • protectedTokenWhitelist()
    • Data & Events
      • General Data
        • contextId
      • Trading Data
        • event TokensTraded()
      • Liquidity Data
        • TotalLiquidityUpdated()
        • TradingLiquidityUpdated()
        • TokensDeposited()
        • TokensWithdrawn()
        • WithdrawalInitiated()
        • WithdrawalCancelled()
        • WithdrawalCompleted()
        • LockDurationUpdated()
        • Cross AMM Migration Data
          • UniswapV2PositionMigrated()
          • SushiswapV1PositionMigrated()
      • Flashloan Data
        • FlashLoanCompleted()
        • FlashLoanFeePPMUpdated()
      • Rewards
        • Staking and Unstaking
          • Event ProviderJoined()
          • Event ProviderLeft()
        • Claiming and Restaking Rewards
          • Event RewardsClaimed()
          • Event RewardsStaked()
  • Developer Guides
    • Bancor Vortex Burner
    • Bancor Etherscan Guide
      • Etherscan Basics
      • Deposit
      • Deposit and Join
      • Rewards: Joining Standard Rewards
      • Rewards: Stake & Claim
      • Rewards: Leaving the Rewards Contract
      • Withdrawing Tokens
        • Initiating the Withdrawal
        • Completing the Withdrawal
      • Migrating V2.1 Positions
      • Rewards: Auto Compounding Rewards Distribution
    • REST API
      • API Reference
      • DLT Identifier
Powered by GitBook
On this page
  • 1. Program ID
  • 2. Identify which ID to use
  • 3. Available amount
  • 4. Leaving the StandardRewards Contract
  1. Developer Guides
  2. Bancor Etherscan Guide

Rewards: Leaving the Rewards Contract

PreviousRewards: Stake & ClaimNextWithdrawing Tokens

Last updated 3 years ago

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 guide.

1. Program ID

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

  • Visit StandardRewards contract

  • Execute the providerProgramIds function (this is a Read function) with your Ethereum address:

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

Save the IDs that are returned for use in later steps.

2. Identify which ID to use

If you only have 1 ID (), skip to .

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

  • Execute the programs function (this is a Read function)

Input variable

Name
Type
Description

ids

uint256

An array of 1 or more reward program IDs

Output response

Name
Type
Description

id

uint256

The unique identifier of the rewards program

pool

Token

The deposited token (i.e BNT, ETH, DAI, LINK) address

poolToken

IPoolToken

The relevant bnToken address

rewardsToken

Token

The address of the rewards token that is given in this program

isEnabled

bool

True/False indication if the program is active

startTime

uint32

The start time of the program

endTime

uint32

The end time of the program

rewardRate

uint256

The amount of tokens per second that are distributed

Using the output data,

  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

  • Execute the providerStake function (this is a Read function)

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

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.

4. Leaving the StandardRewards Contract

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

  • Execute the leave function (this is a Write function)

Input variable

Name
Type
Description

id

uint256

poolTokenAmount

uint256

Output

The bnTokens will return to your wallet.

Visit StandardRewards contract

Visit StandardRewards contract

The unique identifier of the rewards program ()

The amount of bnTokens to unstake ()

Now that once the bnTokens are in your wallet, you can follow the guide.

on etherscan
on etherscan
Withdraw Tokens
found in steps 1 and 2
found in step 3
Withdraw Tokens
on etherscan
extracted in step 1
step 3
on etherscan