SUN.io Docs
SUN.ioSunPump
  • SUN.io Overview
    • Get Started(TRON)
      • Create a Wallet
      • TRON Network Token Standards
      • Connect Your Wallet to SUN.io
    • Risks
    • Whitepaper
    • Terms of Service
    • Privacy Policy
    • Announcement
  • GET START
    • Exchange
      • Token Swaps
        • How to authorize a token?
        • How to exchange tokens?
        • How to check my recent transaction history?
        • How to view 24h price trend of a pair ?
      • Stablecoin Pool
        • Stablecoin pool overview
        • How to swap stablecoins?
        • How to provide liquidity for a stablecoin pool?
        • How to withdraw liquidity from a stablecoin pool?
        • How to check the liquidity you have provided?
      • Smart Router
      • Trading Fee
        • Claim Fee Rewards
      • Liquidity Pool
        • How to create a trading pair?
        • How to add liquidity?
        • How to remove liquidity?
        • How to calculate the ratio of tokens to be added to/removed from the pool?
        • How to record a new token?
        • What's the initial price for creating a fund pool?
      • Token Lists
    • Mining Pool
      • Mining Rules of SUN.io
      • How to participate in liquidity mining?
      • How to earn liquidity mining rewards?
      • How to exit liquidity mining?
      • How to calculate the boost rate of LP mining pool?
      • How to lock SUN?
      • How to vote?
      • How to reset votes?
      • Intelligent Boost Mining Pool
        • How to participate in Fixed Staking?
        • How to stake more assets in Fixed Staking?
        • How to extend duration in Fixed Staking?
        • How to make an early withdrawal in Fixed Staking?
        • How to claim rewards in Fixed Staking?
      • Farm
      • Ended Farming Pools
    • SunPump
      • 🌞 How to Participate?
      • 🚀 How to Launch?
      • 💡 Token Details
      • 👤 Personal Profile
      • 🏦 Service Fees
      • How to Use DLive Streaming on SunPump
    • SunPump Referral
      • How to Join
      • Rules
      • FAQ
    • PSM
      • How to swap between USDD and other stablecoins at 1:1 ratio in PSM?
    • Tokenomics
      • SUN Tokenomics
        • Buyback & Burning of the SUN Token
      • veSUN
      • Airdrop
  • GOVERNANCE
    • SUN DAO Governance
    • Participating Governance
      • Proposal
        • SUN DAO Forum
        • How to get more votes?
        • Create Proposal
        • How to vote on the SUN DAO?
        • SUN DAO proposal
      • Governance Rights
        • Weight
        • veSUN
  • DEVELOPERS
    • Swap
      • StableSwap Overview
        • Curve Contract
        • Curve Functions
      • SunSwap Overview
        • SunSwap V1
          • V1 Contract
          • V1 Functions
        • SunSwap V2
          • V2 Contract
          • V2 Functions
      • SunSwap V3 Overview
        • V3 Contract
        • V3 Functions
      • Smart Router
        • Contract
        • Calculation Service
        • Exchange Functions
        • Detailed Development Steps
    • Mining
      • Smart Mining V1
        • V1 Mining Pool Contract
        • V1 Mining Pool Functions
      • Smart Mining V2
      • Governance Mining
    • Sunpump
      • Sunpump Contracts
      • Sunpump Functions
    • Github
    • Contracts and ABIs
  • FAQ
    • How to use Sun.io in TronLink Mobile?
    • How is price determined?
    • What tokens are supported for swap?
    • Why does my exchange fail?
    • Detailed Explanation of SUN.io Platform Energy Subsidies
Powered by GitBook
On this page
  • Get Pool Information
  • reward_contract
  • earned
  • Execute Exchange
  • deposit
  • withdraw
  1. DEVELOPERS
  2. Mining
  3. Smart Mining V1

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:

Parameter Name
Type
Description

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:

Parameter Name
Type
Description

_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:

Parameter Name
Type
Description

_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).

PreviousV1 Mining Pool ContractNextSmart Mining V2

Last updated 1 day ago