• Stars
    star
    364
  • Rank 117,101 (Top 3 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PoolTogether prize-linked savings game Solidity smart contracts.

PoolTogether Brand


PoolTogether Prize Savings Protocol

<PoolTogether> Coverage Status built-with openzeppelin

The PoolTogether Prize Savings Protocol Ethereum smart contracts.

For an overview of the concepts and API please see the documentation

Setup

This project is available as an NPM package:

$ yarn add @pooltogether/pooltogether-contracts

Usage

Artifacts

There are deployment artifacts available in the deployments/ directory. For example, to pull in the PoolWithMultipleWinnersBuilder artifact:

const PoolWithMultipleWinnersBuilder = require('@pooltogether/pooltogether-contracts/deployments/rinkeby/PoolWithMultipleWinnersBuilder.json')
const {
  abi, 
  address, 
  receipt
 } = PoolWithMultipleWinnersBuilder

ABIs

Application Binary Interfaces for all PoolTogether contracts and related contracts are available in the abis/ directory.

For example, to pull in the PrizePool ABI:

const PrizePool = require('@pooltogether/pooltogether-contracts/abis/PrizePool.json')

Development

First clone this repository and enter the directory.

Install dependencies:

$ yarn

We use direnv to manage environment variables. You'll likely need to install it.

Testing

We use Hardhat and hardhat-deploy

To run unit & integration tests:

$ yarn test

To run coverage:

$ yarn coverage

To run fuzz tests:

$ yarn echidna

Fork Testing

Ensure your environment variables are set up. Make sure your Alchemy URL is set. Now start a local fork:

$ yarn start-fork

Setup account impersonation and transfer eth:

$ ./scripts/setup.sh

Deployment

Deploy Locally

Start a local node and deploy the top-level contracts:

$ yarn start

NOTE: When you run this command it will reset the local blockchain.

Connect Locally

Start up a Hardhat Console:

$ hardhat console --network localhost

Now you can load up the deployed contracts using hardhat-deploy:

> await deployments.all()

If you want to send transactions, you can get the signers like so:

> let signers = await ethers.getSigners()

Let's mint some Dai for ourselves:

> let dai = await ethers.getContractAt('ERC20Mintable', (await deployments.get('Dai')).address, signers[0])
> await dai.mint(signers[0]._address, ethers.utils.parseEther('10000'))
> ethers.utils.formatEther(await dai.balanceOf(signers[0]._address))

Deploy to Live Networks

Copy over .envrc.example to .envrc

$ cp .envrc.example .envrc

Make sure to update the enviroment variables with suitable values.

Now enable the env vars using direnv

$ direnv allow

Now deploy to a network like so:

$ yarn deploy rinkeby

It will update the deployments/ dir.

More Repositories

1

v4-core

Core contracts for PoolTogether v4 🌊 πŸ†
TypeScript
198
star
2

etherplex

TypeScript
64
star
3

pooltogether-community-ui

UI to use when creating your own custom pools, prize strategies or as reference code for integrating your own pools.
JavaScript
45
star
4

loot-box

Loot Boxes are Ethereum smart contracts that can be traded like NFTs and plundered by the owner
Solidity
36
star
5

pooltogether-pool-builder-ui

UI to easily build new PoolTogether pools.
JavaScript
34
star
6

ERC5164

EIP-5164 implementation
Solidity
29
star
7

Pooly-Minters

All the wallets that minted the Pooly NFTs to support PoolTogether Inc's defense. The best wallets in all of crypto 🦜
27
star
8

v4-ui

PoolTogether's V4 app.
TypeScript
26
star
9

v4-mainnet

PoolTogether V4 USDC PrizePool
TypeScript
23
star
10

pooltogether-rng-contracts

PoolTogether RNG Service
TypeScript
20
star
11

tightbeam

Makes talking to Ethereum easy. Ethers.js bindings for Apollo Client.
TypeScript
18
star
12

pooltogether-pod-contracts

PoolTogether Pods: Combine your tickets together to pool your chances to win!
JavaScript
17
star
13

v4-client-js

JS library with a simplified interface for interacting with PoolTogether V4 deployments.
TypeScript
16
star
14

pooltogether-subgraph-v3

Subgraph currently hosted on The Graph network for reading existing PoolTogether smart contract data.
TypeScript
14
star
15

pooltogether-subgraph

PoolTogether subgraph for the Graph Protocol
TypeScript
13
star
16

uniform-random-number

Eliminates modulo bias for Solidity smart contracts.
JavaScript
13
star
17

aave-yield-source

Integration with Aave Protocol as a Yield Source
TypeScript
12
star
18

documentation

Documentation published at https://docs.pooltogether.com/ on how to use the new PoolTogether protocol.
12
star
19

pooltogetherjs

PoolTogether Client JavaScript library
JavaScript
11
star
20

v4-docs

PoolTogether V4 Documentation
JavaScript
11
star
21

pooltogether--brand-assets

Logos, styleguides, etc. for PoolTogether
11
star
22

governance

Governance contracts for the PoolTogether Protocol
Solidity
11
star
23

foundry-template

Template to kickstart a Foundry project
Solidity
10
star
24

pooltogether.com

PoolTogether landing page.
TypeScript
10
star
25

oz-console

JavaScript
10
star
26

yield-source-interface

Solidity
10
star
27

ethdenver-graphql-workshop

9
star
28

v5-liquidator

Solidity
9
star
29

v4-periphery

PoolTogether V4 Periphery Smart Contracts
TypeScript
9
star
30

sortition-sum-tree-factory

TypeScript
9
star
31

pooltogether-contracts-mock

Mock setup for the PoolTogether contracts
JavaScript
8
star
32

pods-v3-contracts

Contracts for Pods (for v3 of the protocol)
JavaScript
8
star
33

pooltogether-hooks

TypeScript
8
star
34

wallet-connection

PoolTogether WAGMI wrapper with extra utilities!
TypeScript
7
star
35

pods-frontend

PoolTogether Pods frontend code
JavaScript
7
star
36

merkle-distributor

TypeScript
7
star
37

badger-yield-source

Solidity
7
star
38

pooltogether-client-monorepo

Apps and packages for the PoolTogether Hyperstructure.
TypeScript
6
star
39

v4-draw-results

Periodically runs the draw-calculator-cli and stores the results. Also the data source of the Netlify hosted Prizes API.
6
star
40

multichain-gov-proposal-spec

Governance Spec
6
star
41

v4-cli

PoolTogether V4 Command Line Interface
TypeScript
6
star
42

fixed-point

Solidity
5
star
43

pooltogether-api-monorepo

JavaScript
5
star
44

v4-testnet

TypeScript
5
star
45

swappable-yield-source

Wraps any PoolTogether Yield Source and adds the ability to swap between any PoolTogether Yield Source
TypeScript
5
star
46

keep-beacon-test

Test integration with Keep Network's Random Beacon
Solidity
5
star
47

v4-twab-delegator

Contract to delegate chances of winning to multiple delegatees
TypeScript
5
star
48

current-pool-data

Programmatically get constants data (ie. contract addresses, etc) for specific versions of the PoolTogether protocol.
JavaScript
5
star
49

discord-webhook-bot--eth-events

Listens for PrizePoolCreated ethereum events and sends info to a Discord channel on each creation
JavaScript
5
star
50

evm-chains-extended

provides metadata for networkIDs and chainIDs - but also includes blockExplorerUrls, etc.
TypeScript
5
star
51

draw-calculators-js

Stateless Typescript library for the v4 Draw Calculator
TypeScript
5
star
52

pooltogether-pods-ui

Browser Interface for the Pods Smart Contract
TypeScript
5
star
53

v4-utils-js

Javascript Utility Library for PoolTogether V4 off-chain calculations, computations and core logic.
TypeScript
5
star
54

pooltogether-landing-site

JavaScript
5
star
55

defender-autotask-template

Template repository to kickstart an OpenZeppelin Defender autotask
TypeScript
4
star
56

true-winner-calculation

A dapp that calculates the true winner of Pool #2: https://etherscan.io/address/0x4Fc604536134Dc64718800361eCbca0df6cBfE08
JavaScript
4
star
57

pooltogether-token-list

PoolTogether Uniswap Token List
JavaScript
4
star
58

ethonline-workshop

4
star
59

liquidator-simulation

JavaScript
4
star
60

pooltogetherjs-example-dapp

A simple app showing how to use the PoolTogetherJS v2 library
JavaScript
4
star
61

pooltogether-utilities

Shared utility functions
TypeScript
4
star
62

twab-subgraph

Subgraph to track user's twab over time
TypeScript
4
star
63

v4-admin-dashboard

The PoolTogether V4 Admin Dashboard simplifies reading and writing to the V4 protocol smart contracts.
TypeScript
4
star
64

pooltogether-contracts-template

Template opinionated repo to setup contract projects
JavaScript
4
star
65

v5-vrgda-claimer-simulation

JavaScript
4
star
66

governance-ui

TypeScript
4
star
67

v5-vault

Solidity
3
star
68

v5-testnet

Solidity
3
star
69

twab-rewards-subgraph

Subgraph to track promotions from the TWAB Rewards contract.
TypeScript
3
star
70

loot-box-subgraph

Subgraph for Loot Box
TypeScript
3
star
71

subgraph-cli-stats

JavaScript
3
star
72

ring-buffer-lib

Solidity
3
star
73

pooltogether-subgraph-events

TypeScript
3
star
74

pooltogether-skeleton-ui

A skeleton UI for quickly starting frontend projects
JavaScript
3
star
75

aave-v3-yield-source

Aave V3 Yield Source
TypeScript
3
star
76

v3-ui

V3 UI
CSS
3
star
77

v4-testnet-autotask

JavaScript
3
star
78

custom-prize-strategy

Solidity
3
star
79

nfts

Metadata for any NFTs we generate
JavaScript
3
star
80

pooltogether-react-components

React UI components for PoolTogether.
TypeScript
3
star
81

dapp-core

JavaScript
3
star
82

owner-manager-contracts

Abstract smart contract for the common manager-or-owner permissioned function modifier
TypeScript
3
star
83

v4-timelocks

Timelock contracts for v4 contracts
TypeScript
3
star
84

buidler-console

A project that makes interacting with on-chain pools much easier
JavaScript
3
star
85

pooltogether-evm-bridge

Implementation of a EVM to EVM bridge for execution of governance proposals
Solidity
3
star
86

v4-twab-delegator-js

TypeScript
3
star
87

v5-prize-pool

Solidity
3
star
88

pooltogether-marketing-site-v3

v3 explainer site for the PoolTogether protocol.
JavaScript
3
star
89

Gitcoin_Grants_Round_9_Bounties

PoolTogether's bounties for Gitcoin Grants Round 9 Hackathon
3
star
90

user-docs

2
star
91

v4-testnet-beacon-autotask

JavaScript
2
star
92

blockhash-analysis-simulation

JavaScript
2
star
93

defender-autotask-link-balance

JavaScript
2
star
94

pooltogether-proxy-factory-package

Typescript package to utilize the Generic Minimal Proxy Factory
TypeScript
2
star
95

v5-draw-results

Periodically runs the v5-cli and stores draw results. Also the data source of the Netlify hosted Prizes API.
2
star
96

v4-autotasks

Monorepo regrouping OpenZeppelin Defender autotasks for V4
TypeScript
2
star
97

prize-chunker

JavaScript
2
star
98

token-listener-interface

The PoolTogether V3 Token Listener Interface
Solidity
2
star
99

pooltogether-proxy-factory

Generic Proxy Factory for deploying proxies across different networks
TypeScript
2
star
100

tightbeam-workshop-app

JavaScript
2
star