oseitutunelson / foundry_Staking

Decentralized Staking and Reward Contract

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Decentralized Staking Contract

Overview

The Decentralized Staking Contract is a smart contract implemented in Solidity that allows users to stake tokens and earn rewards over a specific staking period. The contract is designed to be flexible, supporting functionalities such as depositing, withdrawing, collecting rewards, reinvesting rewards, and distributing rewards among stakers. Features

  • Staking: Users can stake tokens on the contract by calling the deposit function.
  • Withdrawal: Stakers can withdraw their staked tokens using the withdraw function.
  • Reward Collection: Stakers can collect their earned rewards using the collect function.
  • Reinvestment: Rewards can be automatically reinvested by calling the restake function.
  • Reward Distribution: The contract owner can distribute rewards among stakers using the distributeRewards function.
  • Staker Information: Staker information, including balance, deposit time, and cumulative rewards, can be retrieved using the appropriate getter functions.
  • Flexible Reward Calculation: Rewards are calculated based on the staking duration, with different rates for varying time periods.

Prerequisites

Ethereum environment with Solidity compiler version ^0.8.18.
ERC-20 token (e.g., Dec token) for staking.

Getting Started

Deploy the DecentralizedStake contract to the Ethereum blockchain, providing the ERC-20 token address during deployment.
Users can interact with the contract by depositing, withdrawing, collecting rewards, or reinvesting.
The contract owner can distribute rewards among stakers using the distributeRewards function.

About

Decentralized Staking and Reward Contract


Languages

Language:Solidity 62.6%Language:JavaScript 30.8%Language:Ruby 6.1%Language:Shell 0.2%Language:Python 0.2%Language:Makefile 0.1%Language:Nix 0.0%