V2 Mining Functions

Get Pool Information

sub_pool

function sub_pool().call()
  • Description: Retrieve the address of the fixed mining pool.

  • Contract: Gauge

  • Parameters: None

  • Return Value: Address of the mining pool

  • Example: Retrieve the mining pool address for USDDOLD 2pool LP (USDDOLD+USDT)

const gauge_con = await tronWeb.contract(gaugeabi, gauge_addr)
const subpool_ = await gauge_con.sub_pool().call()
console.log(tronWeb.address.fromHex(subpool_))
  • Retrun

TUgVp8FzZcFLHwruuncXaQo2js5Ym2GqSj

earned

function earned(
    address account,
).call()
  • Description: Retrieve the amount of flexible (non-locked) rewards earned by a user.

  • Contract: Farm (staking)

  • Parameters:

Parameter Name
Type
Description

account

address

Address of the user

  • Return Value: Amount of earned flexible rewards

  • Example:Check the flexible rewards in the USDDOLD 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_)

Execute Exchange

deposit(flexible)

function deposit(
    uint256 _value,
).call()
  • Description: Deposit tokens into the gauge (staking) pool

  • Contract: Gauge

  • Parameters:

Parameter Name
Type
Description

_value

uint256

Amount to deposit

  • Return:hash

  • Example:Deposit into the USDDOLD 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_)

deposit(fixed)

function deposit(
    uint256 _value,
    address addr,
    uint256 _lock_duration,
).call()
  • Description: Deposit tokens into the gauge (staking) pool

  • Contract: Gauge

  • Parameters:

Parameter Name
Type
Description

_value

uint256

Amount to deposit

addr

address

Address of the user

_lock_duration

uint256

Deposit period, measured in seconds

  • Return:hash

  • Example:Deposit into the USDDOLD 2pool LP (USDDOLD+USDT) mining pool for a fixed term of 30 days

const gauge_con = await tronWeb.contract(gaugeabi, gauge_addr)
const deposit_ = await gauge_con.deposit(100, self_address, 259200).send() //259200 = 30 days
console.log(deposit_)

withdraw

function withdraw(
    uint256 _value,
).call()
  • Description: Withdraw tokens from the gauge (staking) pool

  • Contract: Gauge

  • Parameters:

Parameter Name
Type
Description

_value

uint256

Amount to withdraw

  • Retrun:hash

  • Example:Withdraw from the USDDOLD 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