Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.77 KB

README.md

File metadata and controls

58 lines (40 loc) · 1.77 KB

Contracts

RewardToken.sol

Mintable ERC20 token with properties of withdrawalFee and rewardRate for an Staking contract.

Features (owner)

  • Mintable.
  • Withdrawal fee modifiable and can be enabled/disabled.
  • RewardRate modifiable. Can also be disabled setting to 0.

Staker.sol

Staking contract which receives and rewards with the same tokens.

Features

  • In deployment can set the startBlock.
  • User can deposit multiple times.
  • Withdraw send all the staked tokens and reward to the user.

Deployed contracts

Contracts deployed to https://testnet.bscscan.com/

Tools

Instructions

Compile and test

  1. Clone repo: git clone https://github.com/leanonchain/solidity-challenge.git
  2. Install dependencies: yarn
  3. Compile: npx hardhat compile
  4. Test: npx hardhat test

Deploy

  1. Create .env file with:
BSC_TESTNET_RPC = ""
BSC_TESTNET_API_KEY = ""
PRIVATE_KEY = ""
  1. npx hardhat run --network bsc_testnet scripts/deploy.js

To-do real case / with more time

  • Testing refactor with typescript and remove redundant code.
  • Harvest function and partial withdraw. This could be easily implemented but as I understood the requirements was for a withdraw function of all the staked tokens.