GithubHelp home page GithubHelp logo

jaredborders / 2x Goto Github PK

View Code? Open in Web Editor NEW
10.0 4.0 5.0 48.49 MB

2X is a decentralized application (dApp) that allows users to wager ether in a 1v1 winner-take-all gamble

Home Page: https://github.com/JaredBorders/2X/deployments/activity_log?environment=github-pages

HTML 2.64% JavaScript 79.08% Solidity 18.28%
wager-ether dapp-allowing-participants hardhat

2x's Introduction

MakeWagerDemo ChallengeWagerDemo

2X is a decentralized application (dApp) that allows users to wager ether in a 1v1 winner-take-all gamble. Verified randomness provided via Chainlink VRF and professional security analysis provided via Consensys MythX. Currently only available on Kovan network.

Motivation

Create a lean, user-friendly application that lets users safely wager varying amounts of ether by relying on randomness provided via Chainlink VRF and the proven security Ethereum provides as a platform

  1. Create, deploy, and test Ethereum smart contracts to local, test, and mainnet
  2. Make use of Oracles to fetch off-chain data
  3. Seamlessly connect smart contracts to front-ends built in React

Technology

Getting Started

  1. Clone this repository
git clone https://github.com/JaredBorders/2X 
  1. Install the dependencies
yarn
  1. Create a .env file in the root directory of your project. Add these environment-specific variables on new lines in the form of NAME=VALUE:
  • PRIVATE_KEY={YOUR_KEY_FROM_METAMASK}
  • INFURA_KOVAN_NETWORK={SEE_HERE}
  1. Deploy the contract (WagerFactory) to the Kovan network.
npx hardhat run scripts/deploy.js --network kovan
  1. Once the script finishes deploying the WagerFactory, it will log the address of where the contract was deployed to. Update src/pages/Splash.js with this value. (see wagerFactoryAddress)

  2. Add LINK token to the RandomNumberConsumer contract. (The public state variable stored in the WagerFactory (randomNumberConsumerAddress) records the address of the RandomNumberConsumer contract)

  3. Run the app

yarn start
  1. Any changes made to any of the contracts will require you to recompile them. To recompile
npx hardhat compile
  1. Don't forget to update src/pages/Splash.js with the current address if you redeploy your WagerFactory!

Adding LINK to the RandomNumberConsumer

  1. Copy the WagerFactory address logged after running the deploy script
npx hardhat run scripts/deploy.js --network kovan
npx hardhat console --network kovan 
const Factory = await ethers.getContractFactory("WagerFactory")
const factory = await Factory.attach("ADDRESS_LOGGED_FROM_DEPLOY_SCRIPT")
await factory.randomNumberConsumerAddress()
  1. After getting LINK from a faucet, send it to the address factory.randomNumberConsumerAddress() returns

TODO

  • After wager has expired, automatically send eth back to wagerer. (May be problematic given that it costs gas to both create & remove wager)
  • Further contract testing is always welcome

How to Contribute?

Read this guide first, check TODO list, and don't hesitate to reach out!

2x's People

Contributors

austinrobinsondev avatar jaredborders avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.