Skip to content

Commit

Permalink
update to use tier prize amounts from getPrizePoolInfo call)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckbergeron committed Jun 28, 2023
1 parent c6a4eda commit bcecb60
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -76,4 +76,4 @@
"oclif"
],
"types": "dist/index.d.ts"
}
}
16 changes: 8 additions & 8 deletions src/commands/compute/drawPrizes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -18,6 +18,7 @@ import {
sumPrizeAmounts,
mapTierPrizeAmountsToString,
addTierPrizeAmountsToClaims,
TierPrizeAmounts,
} from "../../lib/utils/prizeAmounts";

interface TiersContext {
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 5 additions & 1 deletion src/lib/utils/prizeAmounts.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit bcecb60

Please sign in to comment.