# Buyback

# fetchBuyBackTotal

To get LON cumulative buyback amount and cumulative mint amount

# Code sample:

const buyback = new Buyback(chainId)
const buybackTotal = await buyback.fetchBuyBackTotal()

# Response:

{
  totalTreasuryAmount: '3841744000000000000000',
  totalLonStakingAmount: '12001379250600638496397',
  totalMintedAmount: '15843123250600638496397'
}

# getBuybackFee

To get Tokenlon current fee balance, current miner fee expenses in ETH, and historical accumulated fees

# Code sample:

const buyback = new Buyback(chainId)
const buybackFee = await buyback.getBuybackFee()

# Response:

{
  currentFeeUsd: 75802.232839,
  gasFeeEth: 1414.250863413723,
  historicalFeeUsd: 40178.17807336579
}

# getBuybackInterval

To get LON buyback interval

# Parameters:

Name Type
provider AbstractProvider

# Code sample:

const buyback = new Buyback(chainId)
const buybackInterval = await buyback.getBuybackInterval(ethers.provider)

# Response:

3600

# getContractFeeBalanceLists

To get a list records the balance of all fees collected by Tokenlon protocols

# Code sample:

const buyback = new Buyback(chainId)
const contractFeeList = await buyback.getContractFeeBalanceLists()

# Response:

{
  buybackInterval: 3600,
  tokens: [
    {
      address: '0x6da0e6abd44175f50c563cd8b860dd988a7c3433',
      symbol: 'LON',
      name: 'LON',
      logo: 'https://v2-cdn-dev.token.im/app-production/tokens/icons/LON.png',
      decimal: 18,
      enable: true,
      minBuy: '100000000000000000',
      maxBuy: '400000000000000000000',
      lFactor: 0,
      rFactor: 40,
      block: 5743282,
      lastTimeBuyBack: 1635218570,
      amount: '22963089904485267380618',
      usdPrice: 2.76,
      usdValue: 63378.128135000006,
      rateLON: 1,
      exchangeLONAmount: 22963.08990398551,
      balances: [Array]
    },
    ...
  ]
}