Withdraw from a farm
Withdrawing Rewards and staked tokens from a farm contract
Withdraw
To withdraw from a TokensFarm contract, you must call withdraw
on the TokensFarm
smart contract.
Parameters
Type
Description
_amount
uint256
the amount the user is wish to withdraw to the farm.
stakeId
uint256
the id of the staker
Get Stake Ids and Stake Details
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
user
address
the user address to get the data on
returns:
Parameters
Type
Description
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
Example script for withdrawing
Last updated
Was this helpful?