Deposit and Join
Last updated
Last updated
This section outlines the process to deposit tokens into a Bancor liquidity pool and join the rewards program in a single transaction.
This process reduces gas costs and ensures your tokens are earning the maximum available yield.
In order for the contract to interact with the tokens in your wallet and perform the transaction, an Approval
must be set first for the contract.
Visit the relevant token contract. This can be found on Etherscan by searching for the token ticker, or by clicking the Etherscan link on Coingecko token pages. For example: | |
Connect your wallet as explained in "Using Etherscan"
Execute the Approve
function (this is a Write function)
_spender
_value
Click Write
to sign the Approve
in your wallet
In order to join the latest rewards program, you first need to identify the token's program ID.
Visit the StandardRewards
contract
Execute the latestProgramId
function (this is a Read function)
Input variable
pool
Token
The address of the token you wish to deposit
Output response
id
uint256
The unique identifier for the latest program available for the input token
Now that you know the program ID and have the approval in place, you are ready to deposit your tokens into the Bancor pool and rewards contracts.
Execute the depositAndJoin function, with the id you received from the first step, and the number of tokens you wish to deposit.
Execute the depositAndJoin
function (this is a Write function)
depositAndJoin
uint256
Note: IF ETH, indicate the ETH amount in full units (10.5 ETH should be indicated as 10.5) For any other token, this should be set to 0
id
uint256
tokenAmount
uint256
Once executed successfully, the following will happen:
Your tokens will be deposited into the Bancor pool
The protocol will generate bnTokens that represent your position in the pool, and automatically stake them into the rewards contract
The address of the StandardRewards
The amount you would like to approve (it can be identical or larger than the amount you wish to deposit, BUT NOT LESS) in WEI
format as
Some pools might be in deficit which might effect the ability to withdraw the full amount you have deposited ().
Visit the StandardRewards
contract
The unique identifier for the latest program available for the input token (extracted in )
The token (i.e BNT, ETH, DAI, LINK) amount you would like to deposit (using WEI
format )