/crypto-wars-solidity

CryptoWars is the first strategy game to fully run on smart contracts. Build your village, summon your army, protect your e11 tokens and attack your enemies to steal theirs.

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

Crypto Wars

Build Status Coverage Status Join the chat at https://gitter.im/e11-io/crypto-wars-solidity

This repository holds all the smart contracts that are going to be used on the game Crypto Wars.

Requirements

Installation

  1. Install truffle and an ethereum client. For local development, try EthereumJS TestRPC.

    npm install -g truffle
    npm install -g ganache-cli
    truffle version
    # Truffle v4.1.11 (core: 4.1.11)
    # Solidity v0.4.24 (solc-js)
  2. Install dependencies.

    npm i # or yarn
  3. Compile the contracts.

    truffle compile
  4. Run the tests.

    npm run test
  5. Run test coverage.

    npm run coverage
  6. Run local testrpc.

    npm run rpc
  7. Migrate the contracts.

    truffle migrate
  8. a. Run the web app locally.

    npm run start # to use your local RPC network
    # Open http://localhost:4200 on your favorite web3 browser
    # Remember to switch your network on Metamask to localhost 8545
  9. b. To run the web app with the PoA e11 (311) network.

    • Console 1:
    ./scripts/full-node.sh # this will create a local full node of the e11 Proof of Authority chain (311)
    • Console 2:
    npm run start:poa # this will start the angular server with the PoA environment.
    # Remember to switch your network on Metamask to http://localhost:8311

Lastly open http://localhost:4200 and on Metamask connect to http://localhost:8311

How to migrate new contracts into e11 (311) PoA network

  • truffle migrate --network=e11

How to send e11 and ether to contributors

  • Duplicate the file src/scripts/contributors.sample.json and name it contributors.json

    • Add all the accounts you want to send to
    • Set the amount of ether and e11 you want to send
  • truffle exec ./scripts/send-testnet-tokens.js --network=e11

NOTE: This project is still a WIP, we encourage you to create a Pull Request and to participate in the ongoing discussions here.