Skip to content

Commit

Permalink
fixed other top stakers
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Nov 21, 2024
1 parent d0a644e commit e851747
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/formulas/formulas/contract/voting/daoVotingCw20Staked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ export const topStakers: ContractFormula<
const totalVotingPower = Number(
await totalPower.compute({
...env,
// Make sure to not pass height to totalPower in case it was passed to
// this formula.
// Make sure to not pass height in case it was passed to this formula.
args: {},
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,13 @@ export const topStakers: ContractFormula<
.slice(0, limitNum)

// Get total power.
const totalVotingPower = Number(await totalPower.compute(env))
const totalVotingPower = Number(
await totalPower.compute({
...env,
// Make sure to not pass height in case it was passed to this formula.
args: {},
})
)

// Compute voting power for each staker.
const stakers = nftBalances.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,13 @@ export const topStakers: ContractFormula<Staker[]> = {
const allStakers = await listStakers.compute(env)

// Get total power.
const totalVotingPower = Number(await totalPower.compute(env))
const totalVotingPower = Number(
await totalPower.compute({
...env,
// Make sure to not pass height in case it was passed to this formula.
args: {},
})
)

// Compute voting power for each staker.
const stakers = allStakers
Expand Down
8 changes: 7 additions & 1 deletion src/formulas/formulas/contract/voting/daoVotingOnftStaked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,13 @@ export const topStakers: ContractFormula<
.slice(0, limitNum)

// Get total power.
const totalVotingPower = Number(await totalPower.compute(env))
const totalVotingPower = Number(
await totalPower.compute({
...env,
// Make sure to not pass height in case it was passed to this formula.
args: {},
})
)

// Compute voting power for each staker.
const stakers = nftBalances.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,13 @@ export const topStakers: ContractFormula<Staker[]> = {
const { stakers: allStakers } = await listStakers.compute(env)

// Get total power.
const totalVotingPower = Number(await totalPower.compute(env))
const totalVotingPower = Number(
await totalPower.compute({
...env,
// Make sure to not pass height in case it was passed to this formula.
args: {},
})
)

// Compute voting power for each staker.
const stakers = allStakers
Expand Down

0 comments on commit e851747

Please sign in to comment.