Skip to content

Commit

Permalink
Fix "stats by dao" calculations (solana-labs#1385)
Browse files Browse the repository at this point in the history
  • Loading branch information
nramadas authored Feb 6, 2023
1 parent 48ff717 commit b781a01
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions hub/components/GlobalStats/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,19 @@ export async function fetchData(
for (const governanceAddress of governanceAddrs) {
// Check governance owned token accounts
try {
const solWalletPk = await getNativeTreasuryAddress(
realm.programId,
governanceAddress,
);
const tokenAccounts = await getTokenAmount(
connection,
governanceAddress,
);
for (const tokenAccount of tokenAccounts.filter(
(ta) => !ta.account.amount.isZero(),
)) {
const moreTokenAccounts = await getTokenAmount(connection, solWalletPk);

for (const tokenAccount of tokenAccounts
.concat(moreTokenAccounts)
.filter((ta) => !ta.account.amount.isZero())) {
updateTokenAmount(
tokenAccount.account.mint,
tokenAccount.account.amount,
Expand Down

0 comments on commit b781a01

Please sign in to comment.