Skip to content

Commit

Permalink
Do it
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos committed Jan 26, 2024
1 parent aeb122a commit d073768
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions frontend/pages/api/v1/cmc/supply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default async function handlerSupply(
res.setHeader('Cache-Control', 'max-age=0, s-maxage=3600')
res.status(200).send((await getTotalSupply(tokenProgram)).toString(false))
} else if (q === 'circulatingSupply') {
const configAccountData = await getConfig(stakingProgram)
const allStakeAccounts = await getAllStakeAccounts(RPC_URL)

const allMetadataAccounts = await getAllMetadataAccounts(
Expand All @@ -61,13 +62,11 @@ export default async function handlerSupply(
allStakeAccounts
)

const configAccountData = await getConfig(stakingProgram)

const totalLockedAmount = allMetadataAccounts.reduce(
(total: PythBalance, account: any, index: number) => {
return total.add(
allCustodyAccounts[index]?.amount && account.lock
? new PythBalance(allCustodyAccounts[index]!.amount).min(
allCustodyAccounts[index].amount && account.lock
? new PythBalance(allCustodyAccounts[index].amount).min(
getCurrentlyLockedAmount(account, configAccountData)
)
: PythBalance.zero()
Expand Down

0 comments on commit d073768

Please sign in to comment.