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
      • 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
      • Smart Mining V2
      • Governance Mining
    • Sunpump
      • Sunpump Contracts
    • 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
  • Contract Addresses
  • Interacting with Contracts
  1. DEVELOPERS
  2. Swap
  3. SunSwap Overview
  4. SunSwap V2

V2 Contract

Contract Addresses

Chain
Address

Factory

TRON

TKWJdrQkqHisa1X8HUdHEfREvTzw4pMAaY

NILE

THomLGMLhAjMecQf9FQjbZ8a1RtwsZLrGE

Router

TRON

TXF1xDbVGdxFGbovmmmXvBGu8ZiE3Lq4mR

NILE

TMn1qrmYUMSTXo9babrJLzepKZoPC7M6Sy

Interacting with Contracts

After initializing a TronWeb instance, it is very convenient to interact with contracts online.

Initialize TronWeb Example

const TronWeb = require("tronweb")
const privateKey = process.env.PRIVATE_KEY
const apiKey = process.env.API_KEY
var tronWeb = new TronWeb({
  fullHost: "https://api.trongrid.io",
  headers: { "TRON-PRO-API-KEY": apiKey },
  privateKey: privateKey,
})

PreviousSunSwap V2NextV2 Functions

Last updated 1 day ago