Skip to content

ratalert/ratalert-contracts

Repository files navigation

RatAlert Game

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

Resources

Audit

All contracts have been audited by CertiK, the final report has been revisioned on May 10, 2022.

Community & DAO

DAO Gnosis Safe

All funds are managed by (and can only be withdrawn to) the RatAlert DAO Gnosis Safe, a 4 of 6 multisig wallet owned by 3 co-founders & 3 community members.

  1. george-prime#7574 (co-founder)
  2. juggernod#0921 (co-founder)
  3. cap#5523 (co-founder)
  4. stepollo#0001 (community member)
  5. Cerfidus(🧽,🔱)#2350 (community member)
  6. KryptoDreamz#0921 (community member)

Contract Ownership & Timelock

All contracts are owned by an OpenZeppelin TimelockController, deployed at 0x32dd....0924. Only the RatAlert DAO Gnosis Safe is allowed to schedule and execute changes after a 48h delay.

Governance

We are currently evaluating the RatAlert governance tool and will be launching it very soon...

Forks

We encourage projects to fork our contracts. However, we ask that the RatAlert DAO receives a 10% stake in your project.

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

  • bin/ contains a Truffle CLI to interact with contracts
  • contracts/ contains all Solidity smart contract game logic
  • images/ contains all Characters & Kitchen PNGs that are being composed by the contracts
  • 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

Local VRF Coordinator

Both Mint & Claim use ChainLink VRF to fulfill requests. In order to simulate VRF locally, we use a truffle external script that listens for RandomNumberRequested events and triggers the respective rawFulfillRandomness() callback function.

By default, the VRF coordinator is not enabled. To enable, add the following line to your .env file:

LOCAL_VRF="true"

Then run a deployment using truffle migrate and start the VRF coordinator using truffle exec bin/vrf.js.

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published