Skip to content

A simple ERC20 token implementation, which users can stake their tokens and earn rewards.

Notifications You must be signed in to change notification settings

preston4896/solidity-challenge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

challenge

create and deploy (locally) an ERC20 token and a staking contract that will distribute rewards to stakers over time. No need for an app or UI. You can reuse published or open source code, but you must indicate the source and what you have modified.

User journey

An account with some balance of the tokens can deposit them into the staking contract (which also has the tokens and distributes them over time). As the time goes by and blocks are being produced, this user should accumulate more of the tokens and can claim the rewards and withdraw the deposit.

RewardToken.sol

this contract defines an ERC20 token that will be used for staking/rewards. The owner should be able to mint the token.

Staker.sol

this contract will get deployed with some tokens minted for the distribution to the stakers. And then, according to a schedule, allocate the reward tokens to addresses that deposited those tokens into the contract. The schedule is up to you, but you could say that every block 100 tokens are being distributed; then you'd take the allocated tokens and divide by the total balance of the deposited tokens so each depositor get's proportional share of the rewards. Ultimately, a user will deposit some tokens and later will be able to withdraw the principal amount plus the earned rewards. The following functions must be implemented: deposit(), withdraw()

Scoring criteria

  • launch ERC20 token
  • implement reward allocation logic
  • safe deposit/withdraw functions (avoid common attack vectors)

Smart Contract Deployed on Goerli Testnet!

Check it out on Etherscan: https://goerli.etherscan.io/address/0x4Bf49Ca68f8A3C649dB15C9a23554145747eC77c

About

A simple ERC20 token implementation, which users can stake their tokens and earn rewards.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 58.6%
  • Solidity 41.4%