Skip to content

Commit

Permalink
load DAO info in daos/memberOf formula
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Apr 20, 2024
1 parent 73c85eb commit 127754a
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/data/formulas/wallet/daos.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Op } from 'sequelize'

import { WalletFormula } from '@/core'
import { ContractInfo } from '@/data/types'

import { info } from '../contract'
import { config, votingModule } from '../contract/daoCore/base'
import { proposalCount } from '../contract/daoCore/proposals'

export const memberOf: WalletFormula<
{
dao: string
info: ContractInfo
votingModule: string
config: any
proposalCount: number
Expand Down Expand Up @@ -165,22 +168,25 @@ export const memberOf: WalletFormula<
const daoStates = await Promise.all(
daos.map((daoAddress) =>
Promise.all([
info.compute({ ...env, contractAddress: daoAddress }),
config.compute({ ...env, contractAddress: daoAddress }),
votingModule.compute({ ...env, contractAddress: daoAddress }),
proposalCount.compute({ ...env, contractAddress: daoAddress }),
])
)
)

return daoStates.flatMap(([config, votingModule, proposalCount], index) =>
config && votingModule
? {
dao: daos[index],
config,
votingModule,
proposalCount: proposalCount || 0,
}
: []
return daoStates.flatMap(
([info, config, votingModule, proposalCount], index) =>
info && config && votingModule
? {
dao: daos[index],
info,
config,
votingModule,
proposalCount: proposalCount || 0,
}
: []
)
},
}
Expand Down

0 comments on commit 127754a

Please sign in to comment.