Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pooltogether/merkle-distributor


https://github.com/pooltogether/merkle-distributor

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# @pooltogether/merkle-distributor

[![Tests](https://github.com/pooltogether/merkle-distributor/workflows/Tests/badge.svg)](https://github.com/pooltogether/merkle-distributor/actions?query=workflow%3ATests)
[![Lint](https://github.com/pooltogether/merkle-distributor/workflows/Lint/badge.svg)](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
```