Skip to content

leanonchain/solidity-challenge

 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 73.1%
  • Solidity 26.9%