Skip to content

bitcoin-derby-core/core-dao-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Core Network Staking Smart Contract

Overview

This smart contract enables staking on the Core network, allowing users to stake Y tokens and earn X tokens as rewards based on a predefined locking period. A reward pool is preloaded with X tokens, which are distributed to stakers according to their stake amount and duration.

Features

  • Secure & Efficient Staking: Users can stake Y tokens and earn X token rewards.
  • Preloaded Reward Pool: Rewards are sourced from a preloaded pool.
  • Time-Based Rewards: Rewards are distributed based on the staking duration.
  • Fair Distribution: Users receive rewards proportional to their stake and lock period.
  • Optimized for Gas Efficiency: Designed to minimize transaction costs on the Core network.

How It Works

  1. Reward Pool Funding: The contract owner deposits X tokens into the reward pool.
  2. User Staking: Users stake Y tokens and choose a locking period.
  3. Reward Calculation: Rewards are calculated based on the stake amount and duration.
  4. Claiming Rewards: Users can withdraw their stake and claim earned rewards after the locking period.
  5. Contract Security: Ensures fair distribution and prevents manipulation.

Deployment

To deploy the contract:

  1. Compile the smart contract using a Solidity-compatible IDE or Hardhat.
  2. Deploy it on the Core network using a Web3 provider.
  3. Fund the reward pool with X tokens.
  4. Interact with the contract using a frontend or direct Web3 calls.

Usage

Staking

Users can stake their Y tokens by calling:

stake(uint256 amount, uint256 lockPeriod)
  • amount: Number of Y tokens to stake.
  • lockPeriod: Duration in seconds for locking the stake.

Claiming Rewards

After the lock period, users can claim their rewards:

claimRewards()

This will transfer the earned X tokens to the user’s wallet.

Security Considerations

  • Smart Contract Audits: Ensure the contract is thoroughly reviewed before deployment.
  • Fair Reward Distribution: Prevents unfair advantage to early stakers.
  • Gas Optimization: Transactions are optimized to minimize fees.

License

This project is released under the MIT License.

README.me

To ensure this documentation remains up-to-date, please refer to the README.me file for the latest instructions, updates, and usage guidelines.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published