Ramarti / EMI-ETHOnline2021

Entry for HackMoney Hackaton
0 stars 1 forks source link

Current bot Script is missing UNI #5

Open MadeofTin opened 3 years ago

MadeofTin commented 3 years ago

Maybe we need to sort the list by market cap first?

Looks like it may be going in alphabetical order, but it needs to go in Descending order by marketcap.

MadeofTin commented 3 years ago

Hmmm this should be doing it? so maybe something else.

async function getTokensWithMarketcap(tokens) {
  const marketCapped = await Promise.all(
    tokens.map(async (token) => {
      token.marketCap = await getMarketCapForAddress(token.id, token.symbol)
      return token
    })
  )
  return marketCapped.sort((prev, next) => prev.marketCap >= next.marketCap).slice(0, MAX_TOKENS)
}