Giter Club home page Giter Club logo

contracts's Introduction

These contracts provide a decentralized way to post bounties on questions and compete to have the best answer to win the bounty on the Ethereum network. To post a question a user most post an initial bounty. To answer a question they must add to the questions bounty. Users can also vote for the answer they believe is best, but only if their address is first approved to vote.

They were created using truffle with Ganache and tested with Remix and the Rinkeby network.

The user interface was created with React/Redux with web3.

URL

https://hrr30-enzyme-frontend.herokuapp.com/

QuestionFactory Contract

EVENTS

NewQuestion

Emitted when a new question is posted.

ONLY OWNER FUNCTIONS

setMinBounty

Sets the minimum amount needed to post a new question.

setDuration

Sets the length of time a question is live for future questions.

setAnswerFee

Sets the fee a user must pay to answer a question in future questions.

PUBLIC FUNCTIONS

getMinBounty, getDuration, getAnswerFee

Returns the current values for any future questions.

newQuestion

Creates a new question wtiht he bounty sent to the ether sent.

MODIFIERS

onlyOwner and questionOpen.

AnswerFactory Contract

EVENTS

NewAnswer

Emitted when a newAnswer is posted.

PUBLIC FUNCTIONS

createAnswer

Creates a new answer. The user must send at least the answerFee.

UpVote Contract

EVENTS

NewVote

Emitted whenever a new vote is cast.

PRIVATE FUNCTIONS

didVote

A internal view function that checks to see if a address has voted yet.

OnlyOwner Functions

giveRightToVote

Gives a ethereum address the right to vote on questions along with how much weight their vote has.

PUBLIC FUNCTIONS

upVote

Increases vote count of a question based on how much weight that ethereum address was given.

payoutWinner

Can be called anytime after the question has closed. Calculates the highest upvoted answer and pays the the sum of all the bounties for that question and it's answers out to the winner.

contracts's People

Contributors

roninjin10 avatar thedigg avatar

Watchers

 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.