https://github.com/pooltogether/merkle-distributor
https://github.com/pooltogether/merkle-distributor
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/pooltogether/merkle-distributor
- Owner: pooltogether
- License: gpl-3.0
- Created: 2021-01-15T20:10:49.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-16T21:28:19.000Z (over 5 years ago)
- Last Synced: 2025-04-22T19:11:32.940Z (about 1 year ago)
- Language: TypeScript
- Size: 16.1 MB
- Stars: 8
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @pooltogether/merkle-distributor
[](https://github.com/pooltogether/merkle-distributor/actions?query=workflow%3ATests)
[](https://github.com/pooltogether/merkle-distributor/actions?query=workflow%3ALint)
This project contains the distribution, code, and deployment scripts for the PoolTogether retroactive token claims. The BigQuery output was generated by the [Retroactive Query](https://github.com/pooltogether/retroactive-query)
# Setup
Install Dependencies
```sh
$ yarn
```
Compile Contracts
```sh
$ yarn compile
```
Run Tests
```sh
$ yarn test
```
# Verify the output from the Retroactive Query
The file `bq-results-20210202-094742-fvr9ifm390n3.json` contains the full set of rows (ordered by address ascending) of the [Retroactive Query](https://github.com/pooltogether/retroactive-query). You can follow the steps in that project to generate this file.
In this repo the file `merkle_tree.json` is generated from the BigQuery output and fed into the contract deployment script. You can generate the merkle proof file yourself using the steps below.
## Generate Merkle Proof
First pre-process the BigQuery results (the file is missing commas):
```sh
$ ts-node ./scripts/pre-process-json.ts -i bq-results-20210202-094742-fvr9ifm390n3.json > bq-results.processed.json
```
Now generate a merkle proof blob:
```sh
$ ts-node ./scripts/generate-merkle-root -i bq-results.processed.json > merkle-proof.generated.json
```
You can compare your proof to the committed proof:
```sh
$ diff merkle-proof.generated.json merkle_tree.json
```
You will not see any differences!
# Deploy the Contract
The contract deployment script consumes the `merkle_tree.json` file as the distribution. Make sure this file exists before running the deploy script.
You can deploy to rinkeby:
```sh
$ yarn deploy rinkeby
```
Or you can deploy to mainnet:
```sh
$ yarn deploy mainnet
```