Giter Club home page Giter Club logo

stacking_vld's Introduction

Stacking project with Hardhat

Try running some of the following tasks:

npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts

Staking Contract

This is a Ethereum staking contract allowing users to stake their tokens for a specified duration and earn interest. The contract uses variable interest rates depending on the staking duration.

Features

  • Allows users to stake their tokens for a specified duration.
  • Offers variable interest rates depending on the staking duration.
  • Allows users to unstake their tokens after the stake has expired.
  • Enables users to withdraw their earnings.
  • Allows the contract owner to disable/enable the contract.
  • Enables the contract owner to set the interest rate for a specified duration.
  • Provides a function to process expired stakes and add earnings to users' accounts.

Usage

Staking tokens

Users can stake their tokens by calling the stake(uint256 durationIndex) function with the index of the desired staking duration. The available staking durations are 30 days, 60 days, and 90 days.

Unstaking tokens

After a stake has expired, users can unstake their tokens by calling the unstake(uint256 stakeId) function with the ID of the stake they want to unstake.

Withdrawing earnings

Users can withdraw their earnings by calling the withdrawEarnings() function.

Disabling and enabling the contract

The contract owner can disable the contract by calling the disable() function and enable it by calling the enable() function.

Setting interest rates

The contract owner can set the interest rate for a specified duration by calling the setInterestRate(uint256 durationIndex, uint256 interestRate) function.

Processing expired stakes

The contract owner can process expired stakes and add earnings to users' accounts by calling the getExpiredStakes() function.

Viewing stake information

Users can view their stakes by calling the getStakes(address user) function with their Ethereum address as the parameter.

Security

The contract includes modifiers to ensure that only the contract owner can call specific functions and that the contract is enabled before allowing users to interact with it.

stacking_vld's People

Contributors

gregcrn avatar

Stargazers

Felix Ippolitov 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.