Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pooltogether/true-winner-calculation
A dapp that calculates the true winner of Pool #2: https://etherscan.io/address/0x4Fc604536134Dc64718800361eCbca0df6cBfE08
https://github.com/pooltogether/true-winner-calculation
Last synced: about 2 months ago
JSON representation
A dapp that calculates the true winner of Pool #2: https://etherscan.io/address/0x4Fc604536134Dc64718800361eCbca0df6cBfE08
- Host: GitHub
- URL: https://github.com/pooltogether/true-winner-calculation
- Owner: pooltogether
- Created: 2019-07-18T00:10:03.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T04:54:52.000Z (about 2 years ago)
- Last Synced: 2024-04-23T21:42:41.116Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 997 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PoolTogether Double Winner Calculation
After PoolTogether was launched, a flaw was discovered in the smart contracts. The flaw lead to there being two winners. It is explained in more detail in the [article here](https://medium.com/pooltogether/randomness-selection-vulnerability-in-pool-2-9fb328688680).
Because the "true" winner was lost over time, this contract re-creates the selection state in order to calculate the true winner of the pool.
The broken Pool in question is located at [0x4Fc604536134Dc64718800361eCbca0df6cBfE08](https://etherscan.io/address/0x4Fc604536134Dc64718800361eCbca0df6cBfE08). You'll notice under the read contract section it lists the winner as being `0xbF63f97613f796E1dE3446e64b529C79E5cc40b2`. This winner was calculated incorrectly, as far as we intended. The true winner we intended is `0x2A1049062c6Cfd69bd38fbaf3b0559DF1DBbc92c`. You can calculate it yourself using the instructions below.
# Setup
Clone the repo and then install deps:
```
$ yarn
```Copy over .envrc and allow [direnv](https://direnv.net/):
```
$ cp .envrc.example .envrc
$ direnv allow
```Start `ganache-cli`:
```
$ yarn start
```Note: if you changed the mnemonic, you should update the ADMIN_ADDRESS variable in `.envrc` with another address (I use the second address listed when `ganache-cli` starts).
Now start a new zos session:
```
$ yarn session
```Push out the local contracts:
```
$ zos push
```Migrate the contracts and bootstrap the data:
```
$ yarn migrate
```To see what data is bootstrapped, have a look at the migrations.
# Verifying
Once the migrations are complete, you'll notice the last two output lines are the true winner and the false winner. The true winner will receive the correct funds.