Withdraw from a farm
Withdrawing Rewards and staked tokens from a farm contract
Last updated
Withdrawing Rewards and staked tokens from a farm contract
Last updated
To withdraw from a TokensFarm contract, you must call withdraw
on the TokensFarm
smart contract.
In order to withdraw, you must first GET
the Stake ID. go to "Get Stake Ids and Stake Details" bellow
Parameters | Type | Description |
---|---|---|
To get staking info, pending amounts, and stake IDs from a TokensFarm contract, you must call getUserStakesAndPendingAmounts
on the TokensFarm
smart contract.
Parameters | Type | Description |
---|---|---|
returns:
Parameters | Type | Description |
---|---|---|
if the user has staked only once, then for in order to withdraw this particular stake, insert into the Withdraw Function the stake ID parameter: stakeID = deposits[0]
, where deposits
is the array that is returned from the getUserStakesAndPendingAmounts
function.
If a user staked multiple times, then you must call the Withdraw
function multiple times - one for each stake with the following: stakeId = deposit[0..n]
_amount
uint256
the amount the user is wish to withdraw to the farm.
stakeId
uint256
the id of the staker
user
address
the user address to get the data on
deposits
uint256[]
An array of stake Ids for each user deposit.
pendingAmount
uint256[]
An array of the amount deposited in each stake
depositeTime
uint256[]
An array of the time each staking occurred