Skip to content

Commit

Permalink
updated script
Browse files Browse the repository at this point in the history
  • Loading branch information
zorixid committed May 30, 2021
1 parent d6fceca commit 3aaf94f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

![Preview](src/assets/screenshot.png)
-
![Preview](src/assets/screenshot2.png)


## Changes
- [x] Added ERC20 TestToken
Expand Down Expand Up @@ -53,25 +53,30 @@
- [x] Loaders fixed
*
- [x] Added checks and restrictions for when metamask is not connected
- [x] UI Optimised for mobiles
- [x] Production build uploaded to https://ibnz-staking.netlify.app/ for preview and test run
*
- [ ] Add clear running description








## Running instructions

* Copy project to your directory ( git clone https://github.com/ibnzUK/Token-Staking-dApp )
* Install project packages (npm install)
* Start project (npm run start)


## For Testing
* To run tests from /test/TokenStaking (truffle test)

## For Admin Use
* There are prewritten scripts for Admin use either manually or on daily, weekly basic, idealy with predefined cronjob from server.
* All scripts are located in `/scripts` folder
* To change APY % run: ```truffle exec scripts/changeAPY.js 0.137``` this script takes 1 argument (daily apy), in this provided example, admin sets `0.137` daily APY
![Preview](src/assets/screenshot2.png)
* To redistribute rewards from console, run: ```truffle exec scripts/redistribute.js``` or provide argument `custom` if you want to redistribute custom rewards
![Preview](src/assets/screenshot3.png)


mocha testing output
``` Contract: TokenStaking
Expand Down
10 changes: 0 additions & 10 deletions scripts/customRewards.js

This file was deleted.

21 changes: 17 additions & 4 deletions scripts/redistribute.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
const TokenStaking = artifacts.require('TokenStaking');

module.exports = async function(callback) {
let tokenStaking = await TokenStaking.deployed();
await tokenStaking.redistributeRewards();
console.log('--- Daily rewards have been redistributed ---');
callback();
if (process.argv[4] === 'custom') {
let tokenStaking = await TokenStaking.deployed();
await tokenStaking.customRewards();
console.log('--- Daily [custom] rewards have been redistributed ---');
callback();
} else if (!process.argv[4]) {
let tokenStaking = await TokenStaking.deployed();
await tokenStaking.redistributeRewards();
console.log('--- Daily rewards have been redistributed ---');
callback();
} else {
console.log(
'Error: Invalid argument provided, for custom reward redistribution use: truffle exec scripts/redistribute.js custom'
);
}
};

//to run script - truffle exec scripts/redistribute.js
//to run custom redistribution - truffle exec scripts/redistribute.js custom

Binary file added src/assets/screenshot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3aaf94f

Please sign in to comment.