Skip to content

Commit

Permalink
merge testnet51 into main / bring in the latest production deploy code
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckbergeron committed Apr 22, 2024
2 parents 1a1e2ef + 74498d8 commit b468d73
Show file tree
Hide file tree
Showing 21 changed files with 3,435 additions and 2,394 deletions.
6 changes: 0 additions & 6 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
export ETHEREUM_MAINNET_RPC_URL=''
export OPTIMISM_MAINNET_RPC_URL=''

export ETHEREUM_GOERLI_RPC_URL=''
export OPTIMISM_GOERLI_RPC_URL=''

export ARBITRUM_SEPOLIA_RPC_URL=''
export OPTIMISM_SEPOLIA_RPC_URL=''

1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

10 changes: 0 additions & 10 deletions .prettierignore

This file was deleted.

123 changes: 93 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,132 @@

### CLI

The `@generationsoftware/pt-v5-cli` [node module package](https://www.npmjs.com/package/@generationsoftware/pt-v5-cli) is a Node command line interface (CLI) to interact with the **PoolTogether V5 protocol**. The CLI uses the `v5-autotasks-library` modules to fetch and run calculations/computations for essential PoolTogether V5 tasks.
The `@generationsoftware/pt-v5-cli` [node module package](https://www.npmjs.com/package/@generationsoftware/pt-v5-cli) is a Node command line interface (CLI) to interact with the **PoolTogether V5 protocol**. The CLI uses the `pt-v5-utils-js` package to fetch and run calculations/computations for essential PoolTogether V5 tasks.

Primary CLI Commands (help)

```sh
npx @generationsoftware/pt-v5-cli help compute drawPrizes
npx @generationsoftware/pt-v5-cli help utils vaultAccounts
npx @generationsoftware/pt-v5-cli help utils concatWinners
```

# ⌨️ CLI Installation

<!-- usage -->

```sh-session
$ npm install -g @generationsoftware/pt-v5-cli
$ ptv5 COMMAND
running command...
$ ptv5 (--version)
@generationsoftware/pt-v5-cli/1.0.9 darwin-arm64 node-v18.16.0
@generationsoftware/pt-v5-cli/1.1.1 darwin-arm64 node-v18.17.0
$ ptv5 --help [COMMAND]
USAGE
$ ptv5 COMMAND
...
```

<!-- usagestop -->

# Commands

## Compute Draw Prizes
## Compute Vault Accounts

```sh-session
ptv5 utils vaultAccounts
```

Computes the previous draw's depositors with a non-zero balance for a PrizePool to a target output directory.

JSON is in the format required by the [@GenerationSoftware/foundry-winner-calc](https://github.com/@GenerationSoftware/foundry-winner-calc) repo to quickly winners.

Simply pass a `chainId`, `prizePool` and `outDir` to compute and locally save the results.

```
USAGE
$ ptv5 utils vaultAccounts --chainId 1 --outDir ./temp --prizePool '0xdd4d117723C257CEe402285D3aCF218E9A8236E1'
DESCRIPTION
Computes the previous draw's depositors with a non-zero balance for a PrizePool to a target output directory.
EXAMPLES
$ ptv5 utils vaultAccounts --chainId 1 --prizePool 0x0000000000000000000000000000000000000000 --outDir ./temp
Running utils:vaultAccounts on chainId: 1
```

## Vaults Files ([vaultAddress].json)

```json
{
"chainId": 10,
"prizePoolAddress": "0xe32e5E1c5f0c80bD26Def2d0EA5008C107000d6A",
"vaultAddress": "0xf0B19f02c63d51B69563A2b675e0160e1C34397C",
"userAddresses": [
"0x07967251f6db5f9d095119379bd8fc4fce60b3e1",
"0x084039db4e3c6775eabfc59cbd3725d3d9a6d752"
// ...
]
}
```

## Status File (status.json)

```json
{
"status": "LOADING",
"createdAt": "11"
}
```

### Success

```json
{
"status": "SUCCESS",
"createdAt": 1693423691768,
"updatedAt": 1693423805132,
"runtime": 114,
"meta": {
"numVaults": 7,
"numTiers": 3,
"numPrizeIndices": 21,
"numAccounts": 3830
}
}
```

### Failure

```json
{
"status": "FAILURE",
"createdAt": "11",
"updatedAt": "33",
"runtime": "22",
"error": "ErrorCode"
}
```

## Concat Winners

```sh-session
ptv5 compute drawPrizes
ptv5 utils concatWinners
```

Computes the previous draw's prizes for a PrizePool to a target output directory.
Receives all of the winners by vault JSON files created by the [foundry-winner-calc](https://github.com/GenerationSoftware/foundry-winner-calc?tab=readme-ov-file) tool and ties them into one winners.json file. Therefore is dependent on `foundry-winner-calc` running prior to concatWinners being run.

Simply pass a `chainId`, `prizePool` and `outDir` to compute and locally save the results.

```
USAGE
$ ptv5 compute drawPrizes --chainId 1 --outDir ./temp --prizePool '0xdd4d117723C257CEe402285D3aCF218E9A8236E1'
$ ptv5 utils concatWinners --chainId 1 --outDir ./temp --prizePool '0xdd4d117723C257CEe402285D3aCF218E9A8236E1'
DESCRIPTION
Computes the previous draw's prizes for a PrizePool to a target output directory.
Ingests foundry-winner-calc output files and ties them into one winners.json file.
EXAMPLES
$ ptv5 compute drawPrizes --chainId 1 --prizePool 0x0000000000000000000000000000000000000000 --outDir ./temp
Running compute:drawPrizes on chainId: 1
$ ptv5 utils concatWinners --chainId 1 --prizePool 0x0000000000000000000000000000000000000000 --outDir ./temp
Running utils:concatWinners on chainId: 1
```

## Prizes File (prizes.json)
Expand Down Expand Up @@ -100,24 +180,7 @@ EXAMPLES
"numVaults": 7,
"numTiers": 3,
"numPrizeIndices": 21,
"numAccounts": 3830,
"numPrizes": 21,
"prizePoolReserve": "431450369493570544008",
"amountsTotal": "318001330964753848953",
"tierPrizeAmounts": {
"0": "271304907889060131200",
"1": "45062486366179690039",
"2": "1633936709514027714"
},
"vaultPortions": {
"0x0410cae69dd01f58224d54881648e35c6cb874fa": "12491920408565",
"0x0bfe04201c496a9994b920deb6087a60bdadfbbb": "973235150974337855",
"0x4b7a2e1a70ea05523542c9189fa51b133884f321": "232229504251603",
"0x9e11c3d53a68c07f6d839e5d89a94052753cedcb": "5916502876505634",
"0xb9a647d3391b939cb49b44d3c5e93c63d96ad4a4": "9173734225780914",
"0xe2ef926250b0e8a07578d76d9f57e5092340a6fa": "11429890498715426",
"0xffb08a9ffc360806be7ef8cf815c1274ef92cea9": "0"
}
"numAccounts": 3830
}
}
```
Expand Down Expand Up @@ -160,8 +223,8 @@ DESCRIPTION

### Using the tool in dev

You can test the CLI while developing by using the following, with whichever chain / prizePool flags you want to test with:
You can test the CLI while developing by using the following, with whichever chain & prizePool flags you want to test with:

```
./bin/run.js compute drawPrizes --chainId 80001 -o ./temp -p '0xA32C8f94191c9295634f0034eb2b0e2749e77974'
./bin/run.js utils vaultAccounts --chainId 80001 -o ./temp -p '0xA32C8f94191c9295634f0034eb2b0e2749e77974'
```
17 changes: 0 additions & 17 deletions bin/dev

This file was deleted.

5 changes: 5 additions & 0 deletions bin/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning

import { execute } from "@oclif/core";

await execute({ development: true, dir: import.meta.url });
5 changes: 0 additions & 5 deletions bin/run

This file was deleted.

5 changes: 5 additions & 0 deletions bin/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

import { execute } from "@oclif/core";

await execute({ dir: import.meta.url });
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
"url": "https://github.com/generationsoftware"
},
"license": "MIT",
"version": "1.0.9",
"version": "1.1.1",
"repository": "https://github.com/generationsoftware/pt-v5-cli",
"homepage": "https://github.com/generationsoftware/pt-v5-cli",
"bugs": "https://github.com/generationsoftware/pt-v5-cli/issues",
"type": "module",
"main": "dist/index.js",
"files": [
"/bin",
Expand All @@ -18,15 +19,13 @@
"/oclif.manifest.json"
],
"bin": {
"ptv5": "./bin/run"
"ptv5": "./bin/run.js"
},
"scripts": {
"build": "shx rm -rf dist && tsc",
"prepack": "oclif manifest && oclif readme",
"postpack": "shx rm -f oclif.manifest.json",
"build": "shx rm -rf dist && tsc && yarn manifest",
"manifest": "oclif manifest",
"version": "oclif readme && git add README.md",
"_ptv5": "./bin/run"
"_ptv5": "./bin/run.js"
},
"engines": {
"node": ">=12.0.0"
Expand All @@ -37,28 +36,30 @@
"@ethersproject/bignumber": "^5.5.0",
"@ethersproject/contracts": "^5.5.0",
"@ethersproject/providers": "^5.5.3",
"@generationsoftware/pt-v5-utils-js": "1.0.10",
"@oclif/core": "^2.8.5",
"@oclif/plugin-help": "^5",
"@oclif/plugin-plugins": "^3.0.1",
"@generationsoftware/pt-v5-utils-js": "^1.1.2",
"@oclif/core": "^3",
"@oclif/plugin-help": "^6",
"@oclif/plugin-plugins": "^4",
"ajv": "^8.10.0",
"ethers": "^5.7.2",
"graphql": "^16.3.0",
"graphql-request": "^4.0.0",
"lodash": "^4.17.0",
"lodash.pickby": "^4.6.0",
"piscina": "^3.2.0",
"spawn-promise": "^0.1.8",
"yarn": "^1.22.19"
},
"devDependencies": {
"@oclif/test": "^2.3.20",
"@oclif/test": "^3",
"@pooltogether/evm-chains-extended": "^0.6.4-beta.1",
"@types/chai": "^4",
"@types/mocha": "^9.0.0",
"@types/node": "^16.9.4",
"chai": "^4",
"globby": "^11",
"mocha": "^9",
"oclif": "^3.9.0",
"oclif": "^4",
"shx": "^0.3.3",
"ts-node": "^10.2.1",
"tslib": "^2.3.1",
Expand Down
Loading

0 comments on commit b468d73

Please sign in to comment.