My public ETH address to receive NFT certificate: 0xcc44de3f360216B65130A124C716D7AA98407BCb
Project is deployed and running at https://cmayorgaconsensys.surge.sh/
Video screencast is available at https://www.loom.com/share/e8b002ad9bf8400885d0ebc7f1782d34
The project is a simple farming system where the user can stake his CONS tokens to receive CARLOS tokens as rewards.
I used well know libraries from openzeppelin both for contracts and for unit tests. To simplify libraries have been flattened using truffle-flattener in one unique file to make it readable.
We will start distributing 69000 CARLOS tokens as reward, and will reduce this amount 5% each week, when rewards fall below 0 the function setFarmingFinished is executed and farm is finished.
User can stake, unstake, claim rewards and exit at any time.
A system daemon will execute the python script at folder rewards_node_daemon and will notifyReward with that amount weekly
This script receives the CONSReward smart contract owner address and its private key as parameters to execute the notifyReward function.
Contract has been tested using Consensys MythX.io Deep scan services throught VSCode-Extension, detecting 0 high, 0 Medium and 20 low vulnerabilities.
We will use Ropsten as network to do the tests
We need a serie of contracts and tokens to execute our project, we will verify all to use etherscan.io web3 functions as defined in deployed_address.md
cd frontend
yarn
yarn start
If you want to run weekly daemon to notifyRewards you need to have a server and run with crontab the python script at folder rewards_node_daemon
Also you can execute that function throught etherscan verified contract with proper owner account
Farm won't start until you execute notifyReward first time, otherwise your transaction will revert with "Farm not started" error.
npm install --global surge
cd frontend
yarn build
cd build
cp index.html 200.html
surge
Tests will run several checks with several accounts doing stake, unstake, claim and exits and getting rewards accordly to the time staked.
cd smartcontracts
yarn ganache-cli
(This will run ganache-cli with 10 funded accounts)
in other terminal run:
yarn test
(or yarn test-win
if you are using windows)
https://github.com/cmayorga/blockchain-developer-bootcamp-final-project/blob/main/testresults.txt