https://github.com/generationsoftware/pt-v5-rng-contracts
PoolTogether RNG Service
https://github.com/generationsoftware/pt-v5-rng-contracts
pooltogether solidity
Last synced: 8 months ago
JSON representation
PoolTogether RNG Service
- Host: GitHub
- URL: https://github.com/generationsoftware/pt-v5-rng-contracts
- Owner: GenerationSoftware
- License: gpl-3.0
- Created: 2023-07-11T20:08:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-16T01:12:33.000Z (almost 2 years ago)
- Last Synced: 2025-06-05T17:47:10.883Z (8 months ago)
- Topics: pooltogether, solidity
- Language: TypeScript
- Homepage:
- Size: 945 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PoolTogether Prize Savings Protocol - RNG Service

[](https://coveralls.io/github/pooltogether/pooltogether-rng-contracts?branch=master)
[](https://docs.openzeppelin.com/)
[](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