V1 Mining Pool Functions
Get Pool Information
reward_contract
function reward_contract().call()
Description: Retrieve the address of the flexible (non-locked) reward pool.
Contract: Gauge contract
Parameters: None
Return Value: Address of the reward pool
Example: Retrieve the reward pool address for Old 2pool LP (USDDOLD + USDT)
const gauge_con = await tronWeb.contract(gaugeabi, gauge_addr)
const reward_contract_ = await gauge_con.reward_contract().call()
console.log(tronWeb.address.fromHex(reward_contract_))
Retrun
TKJGWYvH4fEa5BLgnpRtnVbKq1u2fhG57V
earned
function earned(
address account,
).call()
Description: Retrieve the amount of flexible (non-locked) rewards earned by a user.
Contract: Farm (staking) contract
Parameters:
account
address
Address of the user
Return Value: Amount of earned flexible rewards
Example:Check the flexible rewards in the Old 2pool LP (USDDOLD + USDT) farm
const farm_con = await tronWeb.contract(farmabi, farm_addr)
const earned_ = await farm_con.earned(self_address).call()
console.log(earned_.toString())
Execute Exchange
deposit
function deposit(
uint256 _value,
).call()
Description: Deposit tokens into the gauge (staking) pool
Contract: Gauge contract
Parameters:
_value
uint256
Amount to deposit
Return:hash
Example:Deposit into the Old 2pool LP (USDDOLD + USDT) gauge pool
const gauge_con = await tronWeb.contract(gaugeabi, gauge_addr)
const deposit_ = await gauge_con.deposit(100).send()
console.log(deposit_)
withdraw
function withdraw(
uint256 _value,
).call()
Description: Withdraw tokens from the gauge (staking) pool
Contract Called: Gauge contract
Parameters:
_value
uint256
Amount to withdraw
Retrun:hash
Example:Withdraw from the Old 2pool LP (USDDOLD + USDT) gauge pool
const gauge_con = await tronWeb.contract(gaugeabi, gauge_addr)
const withdraw_ = await gauge_con.withdraw(50).send() //withdraw(0) 领取所有奖励包括质押奖励和治理奖励
console.log(withdraw_)
Note: To withdraw all rewards including both staking and governance rewards, use withdraw(0).
Last updated