diff --git a/package.json b/package.json index b660273..ea719be 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@oclif/core": "^2.8.5", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^3.0.1", - "@pooltogether/v5-utils-js": "0.0.1-beta.24", + "@pooltogether/v5-utils-js": "file:.yalc/@pooltogether/v5-utils-js", "ajv": "^8.10.0", "ethers": "^5.7.2", "graphql": "^16.3.0", @@ -76,4 +76,4 @@ "oclif" ], "types": "dist/index.d.ts" -} \ No newline at end of file +} diff --git a/src/commands/compute/drawPrizes.ts b/src/commands/compute/drawPrizes.ts index ec07d7d..e86168c 100644 --- a/src/commands/compute/drawPrizes.ts +++ b/src/commands/compute/drawPrizes.ts @@ -3,7 +3,7 @@ import { Provider } from "@ethersproject/providers"; import { Command, Flags } from "@oclif/core"; import { downloadContractsBlob, - getTierPrizeAmounts, + getPrizePoolInfo, computeDrawWinners, Claim, } from "@pooltogether/v5-utils-js"; @@ -18,6 +18,7 @@ import { sumPrizeAmounts, mapTierPrizeAmountsToString, addTierPrizeAmountsToClaims, + TierPrizeAmounts, } from "../../lib/utils/prizeAmounts"; interface TiersContext { @@ -106,13 +107,12 @@ export default class DrawPrizes extends Command { /* -------------------------------------------------- */ // Find out how much each tier won const contracts = await downloadContractsBlob(Number(chainId)); - // const tierPrizeAmounts = await getTierPrizeAmounts(readProvider, contracts, tiersRangeArray); - const tierPrizeAmounts = { - "0": BigNumber.from(2), - "1": BigNumber.from(4), - "2": BigNumber.from(8), - "3": BigNumber.from(16), - }; + const prizePoolInfo = await getPrizePoolInfo(readProvider, contracts); + + const tierPrizeAmounts: TierPrizeAmounts = {}; + Object.entries(prizePoolInfo.tierPrizeData).forEach( + (tier) => (tierPrizeAmounts[tier[0]] = tier[1].amount) + ); const filterAutoClaimDisabled = false; const claims: Claim[] = await computeDrawWinners( diff --git a/src/lib/utils/prizeAmounts.ts b/src/lib/utils/prizeAmounts.ts index 9c527b3..9cdb658 100644 --- a/src/lib/utils/prizeAmounts.ts +++ b/src/lib/utils/prizeAmounts.ts @@ -1,5 +1,9 @@ import { BigNumber } from '@ethersproject/bignumber' -import { TierPrizeAmounts, Claim } from '@pooltogether/v5-utils-js' +import { Claim } from '@pooltogether/v5-utils-js' + +export interface TierPrizeAmounts { + [tier: string]: BigNumber; +} interface amountsAsString { [key: string]: string;