Skip to content

ratalert/ratalert-dao

Repository files navigation

RatAlert DAO

The NFT game that lets you #train2earn higher rewards from your characters! Powered by the Polygon l2 blockchain.

This repository contains the Solidity smart contracts of the DAO.

Resources

Development

Initial Setup

  • Make sure you have Truffle installed globally: npm install -g truffle.

  • Optional: Create a .env file in the project root directory, run npx mnemonics and add the seed phrase in a new line:

    MNEMONIC="your twelve word seed phrase"
    TIMELOCK_MIN_DELAY="0" # Disable timelock in tests
    
  • Run npm install

Repository Structure

  • contracts/ contains all Solidity smart contract game logic
  • test/ contains the Mocha test suite
  • config.js contains the contract configuration

Run The Tests

  1. Run a local development blockchain in a separate tab: truffle develop
  2. Run the test suite: truffle test

Local Development

  1. Run a local development blockchain in a separate tab: truffle develop
  2. Optional: Compile the contracts truffle compile
  3. Deploy the contracts locally: truffle migrate
  4. Interact with them using the console: truffle console

Configuration

Each environment uses its own .env file:

  • .env for development & tests
  • .env.test for private integration testing
  • .env.beta for public beta testing
  • .env.main for the public live game

All contract configuration is in config.js but references the env variables from the respective .env file. This is where you make overrides.

Deployment

  1. Choose an environment to deploy
  2. Optional: Create new mnemonics npx mnemonics and add them to the respective .env file
  3. Get the first account address. In the console, run web3.eth.getAccounts() and copy the first address
  4. Fund this address with 0.5 MATIC using the faucet in Mumbai testnet
  5. Deploy the contracts: truffle migrate --network <network>
  6. Get the contract addresses: truffle network
  7. Fund the Claim & Mint contracts with LINK using the faucet in Mumbai testnet

RatAlert DAO

All contracts that carry game mechanics are upgradeable. The idea behind this is to enable the RatAlert DAO to agree upon and change parameters of the game if required.

Testnet Faucets

Rinkeby

Mumbai