# @upsidecomp/upsidecomp-contracts-bankless-core

> Upside x BanklessDAO - No-Loss NFT Giveaways

Latest version **1.0.2** (published 2021-10-06) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @upsidecomp/upsidecomp-contracts-bankless-core
pnpm add @upsidecomp/upsidecomp-contracts-bankless-core
yarn add @upsidecomp/upsidecomp-contracts-bankless-core
bun add @upsidecomp/upsidecomp-contracts-bankless-core
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-10-06 |
| First published | 2021-08-21 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 5.1 MB |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | upsidecomp |

## Links

- npm: https://www.npmjs.com/package/@upsidecomp/upsidecomp-contracts-bankless-core
- npm.io page: https://npm.io/package/@upsidecomp/upsidecomp-contracts-bankless-core

## Dependencies (9)

- [deploy-eip-1820](https://npm.io/package/deploy-eip-1820.md) 1.0.0
- [hardhat-gas-reporter](https://npm.io/package/hardhat-gas-reporter.md) ^1.0.4
- [@pooltogether/fixed-point](https://npm.io/package/@pooltogether/fixed-point.md) 1.0.0-beta.2
- [sortition-sum-tree-factory](https://npm.io/package/sortition-sum-tree-factory.md) 0.1.0
- [@openzeppelin/contracts-upgradeable](https://npm.io/package/@openzeppelin/contracts-upgradeable.md) 3.4.0
- [@pooltogether/uniform-random-number](https://npm.io/package/@pooltogether/uniform-random-number.md) 1.0.0-beta.1
- [@pooltogether/pooltogether-contracts](https://npm.io/package/@pooltogether/pooltogether-contracts.md) ^3.4.4
- [@pooltogether/yield-source-interface](https://npm.io/package/@pooltogether/yield-source-interface.md) ^1.0.1
- [@pooltogether/pooltogether-rng-contracts](https://npm.io/package/@pooltogether/pooltogether-rng-contracts.md) 1.0.0

## Recent versions

- 1.0.2 (latest) — 2021-10-06
- 1.0.1 — 2021-08-21

## README

# Upside x BanklessDAO - No-Loss NFT Giveaways

[Upside Protocol](https://www.upsidecomp.com/): No-Loss NFT Giveaways

# Setup

This project is available as an NPM package:

```bash
$ yarn add @upsidecomp-contracts-bankless
```

# Usage

## Artifacts

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

```javascript
const BanklessPoolBuilder = require('@upsidecomp/upsidecomp-contracts-bankless-core/deployments/rinkeby/BanklessPoolBuilder.json')
const {
  abi,
  address,
  receipt
 } = BanklessPoolBuilder
```

## ABIs

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

For example, to pull in the PrizePool ABI:

```javascript
const BanklessPrizePool = require('@upsidecomp/upsidecomp-contracts-bankless-core/abis/BanklessPrizePool.json')
```

# Development

First clone this repository and enter the directory.

Install dependencies:

```
$ yarn
```

We use [direnv](https://direnv.net/) to manage environment variables.  You'll likely need to install it.

# Testing

We use [Hardhat](https://hardhat.dev) and [hardhat-deploy](https://github.com/wighawag/hardhat-deploy)

To run unit & integration tests:

```sh
$ yarn test
```

To run coverage:

```sh
$ yarn coverage
```

To run fuzz tests:

```sh
$ yarn echidna
```

# Fork Testing

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

```sh
$ yarn start-fork
```

Setup account impersonation and transfer eth:

```sh
$ ./scripts/setup.sh
```

# Deployment

## Deploy Locally

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

```bash
$ yarn start
```

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

## Connect Locally

Start up a [Hardhat Console](https://hardhat.dev/guides/hardhat-console.html):

```bash
$ hardhat console --network localhost
```

Now you can load up the deployed contracts using [hardhat-deploy](https://github.com/wighawag/hardhat-deploy):

```javascript
> await deployments.all()
```

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

```javascript
> let signers = await ethers.getSigners()
```

Let's mint some Dai for ourselves:

```javascript
> 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](https://direnv.net/docs/installation.html)

```
$ direnv allow
```

Now deploy to a network like so:

```
$ yarn deploy rinkeby
```

It will update the `deployments/` dir.

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