//

1

2

3

const API = 'https://robinhoodchain.blockscout.com/api/v2/'

// 1. the biggest holder of a pre-graduation token is its bonding curve
const top = (await (await fetch(API + 'tokens/' + TOKEN + '/holders')).json()).items[0]
const curve = top.address.hash

// 2. what is still sitting in the curve has not been bought
const bals = await (await fetch(API + 'addresses/' + curve + '/token-balances')).json()
const unsold = bals.find(b => b.token.address_hash.toLowerCase() === TOKEN.toLowerCase())
const sold = 1 - (Number(unsold.value) / 1e18) / 1e9

// 3. the same address holds what buyers paid in — ETH, or NVDA, HIMS, TSLA…