Giter VIP home page Giter VIP logo

buidler-console's Introduction

PoolTogether Buidler Console

Easily interact with PoolTogether contracts using a node repl.

This project is a basic Buidler project that users Ethers.js and includes the PoolTogether contracts.

Setup

First clone the repository then run:

$ yarn

Copy over .envrc.example to .envrc

$ cp .envrc.example .envrc

Make sure to update the enviroment variables with suitable values. You'll want to administer any pools you create, so be sure to use a mnemonic that you used to create a prize pool.

Now enable the env vars using direnv

$ direnv allow

Console

Load up the Buidler console. It will connect to Rinkeby by default:

$ buidler console

Grab the Contract loader helpers:

> const { poolAt, singleRandomWinnerAt, erc20At } = require('./loaders')

These helpers will instantiate Ethers.js Contract objects.

Now let's start talking a pool that was created using the Prize Pool Builder:

> pool = await poolAt('0xe6D68A3295Ba8ce28B5F21cBCEc562c804DF6e5F')

Let's also connect to its prize strategy:

> prizeStrategy = await singleRandomWinnerAt('0xed7E59eFffF107E0424931D76bE2De6cF42E6F73')

If you've configured the mnemonic in the envrc to be the owner of the pool and strategy, you can configure them now!

External ERC20 Award

The Single Random Winner can award (almost) any tokens held by the Prize Pool to the winner. Let's award Compound Rinkeby Dai to the winner.

In the Buidler console, add Dai (Compound Rinkeby version) as an external ERC20 award to the strategy:

> await ps.addExternalErc20Award('0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa')

Now transfer 50 Dai to the prize pool:

> dai = await erc20At('0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa')
> await dai.transfer(pool.address, ethers.utils.parseEther('50'))

Next time the prize strategy awards the prize, it'll also give away 50 dai!

buidler-console's People

Contributors

asselstine avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.