Skip to content

Simple gamification (player versus contract & pvp ) examples for token owner websites to encourage deflation mechanisms

License

Notifications You must be signed in to change notification settings

3550-CE/CENG_3550

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CENG_3550

Development environment

ethereum, ethereumjs, truffle, webpack, react, solidity

Starter Files

https://www.trufflesuite.com/boxes/react

How to run development?

In the main folder(be sure you already downloaded truffle), run:

truffle develop

After truffle develop, first, run "compile". Then "migrate".

compile
migrate

Go "client/" directory with cd client and if there is no node_modules/ folder, run npm install. Then:

npm run start

Deflationary Approaches with the Help of Gamification

Game

Cheat Sheet

> msg.data (bytes): complete calldata
> msg.gas (uint): remaining gas - deprecated in version 0.4.21 and to be replaced by gasleft()
> msg.sender (address): sender of the message (current call)
> msg.sig (bytes4): first four bytes of the calldata (i.e. function identifier)
> msg.value (uint): number of wei sent with the message

Game 1 - Coin Flip ( Single Player )

First game we created is simple coin flip, which gives the user 50% chance to double their bet. As owner of the contract, we have to fund our contract manually. Basically contract owner is always betting against the user. Contract owner can receive the extra fee paid by users to interact and use it to burn more tokens. (Some mainnets pay that extra fee to owners to encourage more burn. e.g BSC)

  • Game Contract
  • Contract owner can withdraw the fund whenever they please
  • Security improvements

flow screenshot

Game 2 - Rock Paper Scissors ( Two Players )

Contract owner is Player 1. During deploy section, contract owner should set the bet. Player 2 will join if they can afford the same amount as bet. After betting section is done, Player 1 will their move. Player 2 can only play after Player1.

  • paper beats the rock

  • rock beats the scissors

  • scissors beats the paper

  • Game Contract

  • Time limit to prevent abuse

  • Security improvements

About

Simple gamification (player versus contract & pvp ) examples for token owner websites to encourage deflation mechanisms

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published