Giter Site home page Giter Site logo

decentral-ee / viral-aave-save-game Goto Github PK

View Code? Open in Web Editor NEW

This project forked from miohtama/viral-aave-save-game

0.0 1.0 0.0 528 KB

A blockchain game where punctual penny savers are rewarded

License: MIT License

HTML 4.72% CSS 1.36% JavaScript 45.73% Solidity 48.18%

viral-aave-save-game's Introduction

Viral Saving Game

Try to save DAI 9.90 every week for one year. Earn more interest by inviting friends. If you drop out in the middle you lose your interest and it is distributed to everyone who make it to the end.

Referral system

The game makes saving viral.

  • Each friend you refer gives you 10% of their interest

  • Each friend of a friend gives you 1% of their interest

How does it work

  • Any deposited DAI is converted to interest earning aDAI on Aave Protocol

  • All interested is hold by the viral bank smart contract

  • Interested is distributed to the players who make it at the end of the game

  • You get extra interest bonus for friend referrals who you brought to the game

  • Any players who drop out in the middle of game lose their interest and it is distributed to the players who make it to the end

Smart contract usage

Starting the game as a player

You need to have a referral from somebody to get in the game on the first round.

User needs to do the following to start the game

  • Have 9.90 DAI balance in their wallet

  • Have referring player address

  • approve() the ViralBank contract for DAI token transfers

  • Do a transaction to startGame()

Playing the game

One week is one round.

Every week the user has to

  • Have 9.90 DAI in their wallet

  • Do a transaction to buyInToRound()

Status and stats

  • getGameState() tells you what is the current state of the game

  • getPlayerState(address) tells if an address is playing, dropped out or successfully finished the game

  • getTotalAccuredInterest() tells the total DAI prize pot at the moment

Wallet integration

There is vDAI faux ERC-20 token.

  • Add ViralBank address as a token in your wallet

  • Token balance shows your accrued interest balance

Frontend

Frontend is a different repo.

Internals

Based on Drizzle box.

Developing

Install Truffle.

npm install -g truffle

Install Ganache for having a local dev Ethereum network.

npm install -g ganache ganache-cli

Compile contracts

truffle compile

This will pull Solidity compiled 0.5 from DockerHub and compile the smart contracts using Dockerized compiler.

Start dev env in one terminal

truffle develop

Then install and start the React app.

cd app
npm start

Deployment

First setup .env file:

KOVAN_MNEMONIC="xxx yyy"
KOVAN_PROVIDER_URL=https://kovan.infura.io/v3/your_key

MAINNET_MNEMONIC="xxx yyy"
MAINNET_PROVIDER_URL=https://mainnet.infura.io/v3/your_key
MAINNET_GAS_PRICE=3000000000

# you can get this from etherscan website
ETHERSCAN_API_KEY=your_key

To deploy and verify the code

$ npx truffle --network kovan exec scripts/deploy.js
Using network 'kovan'.

network:  kovan
ViralBank.new: started
ViralBank.new: done, gas used 0x2713e2, gas price 20 Gwei
bank address 0x9Eb6a33451643A564049f6D65b077E3308717b54
$ npx truffle run --network kovan etherscan ViralBank@0x9Eb6a33451643A564049f6D65b077E3308717b54
Verifying ViralBank@0x9Eb6a33451643A564049f6D65b077E3308717b54
Pass - Verified: https://kovan.etherscan.io/address/0x9Eb6a33451643A564049f6D65b077E3308717b54#contracts
Successfully verified 1 contract(s).

Mint test tokens

master $ npx truffle --network kovan exec scripts/mint-tokens.js
Using network 'kovan'.

network:  kovan
token.mint 100: started
token.mint 100: done, gas used 50436, gas price 20 Gwei

Addresses

Kovan

viral-aave-save-game's People

Contributors

miohtama avatar hellwolf avatar

Watchers

James Cloos 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.