This repository includes the codes for a staking platform project for Score Milk (https://scoremilk.com/).
This project contains three contracts:
- A staking contract (in file contracts/StakingRewards.sol)
- A minter contract (in file contracts/Minter.sol)
- A bunch of ERC-721 NFT contracts (in files contracts/NFT*.sol)
This repository is implemented with Solidity on top of an Ethereum framework. The actual deployment of the contracts will happen to the Tron network - the deployment settings in this repository will not be valid for Tron.
- Solidity 0.5.x for contracts
- Hardhat for local execution and test environment
- Chai/Mocha/Waffle/Ethers for unit tests
The contracts are documented in detail in the contracts folder.
To deploy the contracts, you need to do the following things:
- Have your staking token ready
- Deploy the staking contract
- Deploy the minter contract
- Deploy the three NFT contracts
- Set the NFT addresses in the minter contract
There is an example deployment script in scripts/deploy.js. If you have Hardhat installed, you can run it (locally) with: * npx hardhat run scripts/deploy.js --network hardhat*.
If the contracts need to be verified in some external service it's easiest to first create a flattened file of all of the contracts. This can be done with Hardhat: npx hardhat flatten > flat.sol.txt (not using the direct .sol suffix because it would cause conflicting contract names).
All of the written contracts are covered with automated unit tests. You can browse the tests in the test folder, and you can run them with Hardhat: npx hardhat test