Code Monkey home page Code Monkey logo

erc20-staking's Introduction

ERC20 Stacking Smart Contract

This Project is deployed on the Rinkeby testnet

ERC20 Token (Flayer Token) address: 0x9930712D3e191D1a0CcaCb7b9AF6bD2CEc8Fdf4F

Staking contract address: 0xF6153245966B81C42eD6fF49Df5AD9502e7a2ce8

Usage

Before running any command, make sure to install dependencies:

npm install

Compile

Compile the smart contracts with Hardhat:

npx hardhat compile

Test

Run the tests:

npx hardhat test

Deploy

deploy contract to netowrk:

npx hardhat run --network rinkeby scripts/deploy.js

stacking smart contract will be created after the creation of ERC20 token (Flayer), because the Staking smart contract paremeters in its contructor to define the token.

constructor(FlayerToken _tokenAddress) {}

functions need to call before stacking

approve(address spender, uint256 amount)

this function is used to approve contract address to spend on behalf of user.

The function takes the following arguments:

  • spender: This is the address of the spender to whom the approval rights should be given or revoked from the approver.
  • amount: This is amount of tokens can be spend.

How to stake

In stacking smart contract function stakeToken() is used to stake the ERC20 token.

this function has following arguments:

  • uint256 _amount : It is the token amount user want stake.

How to Unstake NFT

The unStakeToken() function is used to complete the process of unstaking

This function calculated price and mint it to the reciepient address.

erc20-staking's People

Contributors

mohitchandel avatar

Stargazers

ZENGO-ETH avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.