Git Product home page Git Product logo

fakemon's Introduction

Fakemon

A pokemon type turn-based battle game on-chain.

Deployed on Goerli testnet.

Features

  • User registration, user will get 50 tokens and 1 NFT
  • User can mint new NFT for 5 tokens each
  • User can create new gyms, each NFT can be used only once
  • User can fight with gyms created by other users
  • (For now, NFTs are automatically healed)

Upcoming features

  • Battle history + No of wins
  • Battle entry fee + Winning reward
  • Close gym (Would free up staked NFTs)
  • Buying token
  • Dynamic NFT stats
  • Healing using tokens, and better tokenomics
  • Playing game without using metamask (using meta transactions)
  • Onchain metadata for all Fakemons + generative art

How to run locally

First

  • Clone .env.example file with the name .env and add details.
  • Then start hardhat network npx hardhat node
  • Then deploy the contracts npm run deploy
  • Then start the frontend cd frontend && npm start

Then

  • Import few accounts from hardhat network into metamask to interact with the webapp.
  • You need to "Reset account" in metamask each time you restart the local blockchain.

Extras

  • To test contracts npm test

Deployment

Confusion regarding "hardhat" vs "localhost"

For local development we are using Hardhat network. But for the deployment script we are using --network localhost which can create confusions.

Hardhat network comes in two modes - hardhat (in-process blockchain which is used for testing and running tasks if not specified any network) and localhost (standalone background process which is used to connect with wallets and FE app).

After deployment the script will copy newly deployed contract address and ABI into FE directory under /frontend/src/artifacts/${networkName}. We will save in "hardhat" folder for local development instead of "localhost".

TLDR: For network name, we are using "hardhat" everywhere except deployment script.

Deployment process

  • There are 2 contracts here: Token (Fmon.sol) and Game (Fakemon.sol)
  • You need to deploy Token first, then Game contract, and then transfer ownership of Token contract to Game contract. As Game contract mints new tokens for users, and no outsiders should be able to do that.

fakemon's People

Contributors

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