livepeer / protocol

Livepeer protocol
MIT License
152 stars 45 forks source link

polling: Add PollCreator and Poll contracts #373

Closed yondonfu closed 4 years ago

yondonfu commented 4 years ago

Add PollCreator and Poll contracts as described in the polling application backend spec

Fixes #374

coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 1334


Totals Coverage Status
Change from base Build 1296: 0.0%
Covered Lines: 711
Relevant Lines: 711

💛 - Coveralls
kyriediculous commented 4 years ago

d96750a replaces yes() and no() with vote(uint256 _choiceID), analogous for the event Vote(address indexed voter, uint256 choiceID)

kyriediculous commented 4 years ago

rebased !

On Mon, Apr 20, 2020 at 4:09 PM Yondon Fu notifications@github.com wrote:

@yondonfu commented on this pull request.

Changes look good - let's rebase

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/livepeer/protocol/pull/373#pullrequestreview-396488748, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJZZWVFC2TXGUA4KT3KXBDRNRJQ5ANCNFSM4LLRWAIQ .

kyriediculous commented 4 years ago

fixed in 528fda2 , will squash on merge

On Mon, Apr 20, 2020 at 7:55 PM Yondon Fu notifications@github.com wrote:

@yondonfu commented on this pull request.

In contracts/polling/PollCreator.sol https://github.com/livepeer/protocol/pull/373#discussion_r411574761:

@@ -0,0 +1,53 @@ +pragma solidity ^0.5.11; + +import "./Poll.sol"; +import "../token/ILivepeerToken.sol"; + + +contract PollCreator {

  • // TODO: Update these values
  • uint256 public constant QUORUM = 20;
  • uint256 public constant THRESHOLD = 50;
  • uint256 public constant POLL_PERIOD = 10 * 5760;
  • uint256 public constant POLL_CREATION_COST = 100 * 1 ether;
  • ILivepeerToken public token;
  • uint256 public pollCreationCost;

Let's remove this since it is unused.

In test/unit/PollCreator.js https://github.com/livepeer/protocol/pull/373#discussion_r411576641:

+ +const PollCreator = artifacts.require("PollCreator") +const GenericMock = artifacts.require("GenericMock") + +const QUORUM = 20 +const THRESHOLD = 50 +const POLL_PERIOD = 10 * 5760 + +contract("PollCreator", accounts => {

  • let fixture
  • let token
  • let pollCreator
  • before(async () => {
  • fixture = new Fixture(web3)
  • token = await GenericMock.new("LivepeerToken")

The GenericMock constructor shouldn't accept any arguments (but I guess JS doesn't complain about that and they're just ignored)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/livepeer/protocol/pull/373#pullrequestreview-396680554, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJZZWUFHTR4NQMDJTGLLALRNSEBDANCNFSM4LLRWAIQ .