# @pooltogether/pooltogether-rng-contracts

> PoolTogether RNG Service Smart Contracts

Latest version **1.5.3** (published 2023-03-09) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @pooltogether/pooltogether-rng-contracts
pnpm add @pooltogether/pooltogether-rng-contracts
yarn add @pooltogether/pooltogether-rng-contracts
bun add @pooltogether/pooltogether-rng-contracts
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.3 |
| Published | 2023-03-09 |
| First published | 2020-07-17 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | PoolTogether, Inc. |
| Maintainers | asselstine, chuckbergeron, dylandesrosier, pierrick |

## Links

- npm: https://www.npmjs.com/package/@pooltogether/pooltogether-rng-contracts
- npm.io page: https://npm.io/package/@pooltogether/pooltogether-rng-contracts

## Dependencies (1)

- [@pooltogether/owner-manager-contracts](https://npm.io/package/@pooltogether/owner-manager-contracts.md) 1.1.0

## Recent versions

- 1.5.3 (latest) — 2023-03-09
- 1.5.2-beta.1 (beta) — 2023-01-02
- 1.5.2 — 2023-01-02
- 1.5.1 — 2022-04-04
- 1.5.0 — 2022-03-17
- 1.4.0 — 2021-09-06
- 1.3.1 — 2021-09-06
- 1.3.0 — 2021-08-24
- 1.2.0 — 2021-05-07
- 1.1.2 — 2021-03-29
- 1.1.1 — 2021-03-16
- 1.1.0 — 2021-02-15
- 1.0.0 — 2020-10-21
- 1.0.0-alpha.9 — 2020-10-11
- 1.0.0-alpha.8 — 2020-10-10
- … 3 more at https://npm.io/package/@pooltogether/pooltogether-rng-contracts/versions

## README

# PoolTogether Prize Savings Protocol - RNG Service

![Tests](https://github.com/pooltogether/pooltogether-rng-contracts/actions/workflows/main.yml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/pooltogether/pooltogether-rng-contracts/badge.svg?branch=master)](https://coveralls.io/github/pooltogether/pooltogether-rng-contracts?branch=master)
[![built-with openzeppelin](https://img.shields.io/badge/built%20with-OpenZeppelin-3677FF)](https://docs.openzeppelin.com/)
[![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html)

The [PoolTogether](https://www.pooltogether.com/) Prize Savings Protocol Ethereum smart contracts.

See the [documentation](https://v4.docs.pooltogether.com)

# Deployments

- [Ethereum](https://v4.docs.pooltogether.com/protocol/deployments/rng#ethereum)
- [Polygon](https://v4.docs.pooltogether.com/protocol/deployments/rng#polygon)

# RNG contracts in this repository
- [RNGBlockhash](/contracts/RNGBlockhash.sol)
- [RNGChainlink](/contracts/RNGChainlink.sol)
- [RNGChainlinkV2](/contracts/RNGChainlinkV2.sol)

# External RNG contracts
- [RNGWitnet](https://github.com/drcpu-github/rng-witnet-pooltogether)

The RNGWitnet contract is a custom-built solution to request a [random number](https://docs.witnet.io/smart-contracts/witnet-randomness-oracle) from the [Witnet oracle](https://witnet.io/). It is hosted in a separate repository as it is built using the Python-based Brownie development suite.

# Setup

Install Dependencies

```sh
$ yarn
```

Copy over .envrc.example to .envrc

```sh
$ cp .envrc.example .envrc
```

Make sure to update the enviroment variables with suitable values.

Now enable the env vars using [direnv](https://direnv.net/docs/installation.html)

```sh
$ direnv allow
```

# Interacting using Hardhat Console

You can interact with the contract using the buidler console:

```sh
$ npx hardhat console --network [network]
```

Then you can interact with deployed contracts:

```javascript
> const signer = (await ethers.getSigners())[0]
> const d = await deployments.all()
> const chainlink = await ethers.getContractAt('RNGChainlink', d.RNGChainlink.address, signer)
> const link = await ethers.getContractAt('IERC20', (await chainlink.getLink()), signer)
```

# Deploying

You can deploy using the deploy script:

```sh
$ yarn deploy [network]
```

Where [network] can be `mainnet`, `rinkeby`, `ropsten`, or `kovan`.

Now you should verify the contracts on Etherscan:

```sh
$ yarn etherscan-verify [network]
```

The network option is the same as above.

# Development

Verify Codebase (hint + test)

```sh
$ yarn verify
```

Run Static Code Analysis

```sh
$ yarn hint
```

Run Tests

```sh
$ yarn test
```

Run Coverage

```sh
$ yarn coverage
```

Run Gas Report

```sh
$ yarn gas
```

Start Local TestRPC & Deploy

```sh
$ yarn start
```

Deploy to an Ethereum Network

---
_Source: https://npm.io/package/@pooltogether/pooltogether-rng-contracts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
