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.
All contracts have been audited by CertiK, the final report has been revisioned on May 10, 2022.
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.
- george-prime#7574 (co-founder)
- juggernod#0921 (co-founder)
- cap#5523 (co-founder)
- stepollo#0001 (community member)
- Cerfidus(🧽,🔱)#2350 (community member)
- KryptoDreamz#0921 (community member)
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.
We are currently evaluating the RatAlert governance tool and will be launching it very soon...
We encourage projects to fork our contracts. However, we ask that the RatAlert DAO receives a 10% stake in your project.
-
Make sure you have Truffle installed globally:
npm install -g truffle
. -
Optional: Create a
.env
file in the project root directory, runnpx 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
- 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 a local development blockchain in a separate tab:
truffle develop
- Run the test suite:
truffle test
- Run a local development blockchain in a separate tab:
truffle develop
- Optional: Compile the contracts
truffle compile
- Deploy the contracts locally:
truffle migrate
- Interact with them using the console:
truffle console
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
.
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.
- Choose an environment to deploy
- Optional: Create new mnemonics
npx mnemonics
and add them to the respective .env file - Get the first account address. In the console, run
web3.eth.getAccounts()
and copy the first address - Fund this address with 0.5 MATIC using the faucet in Mumbai testnet
- Deploy the contracts:
truffle migrate --network <network>
- Get the contract addresses:
truffle network
- Fund the Claim & Mint contracts with LINK using the faucet in Mumbai testnet
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.