Skip to content

Rusted2361/Ft-Staking-Solana

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Token Staking Contract

This repository contains the smart contract and client-side tools for creating and staking tokens in a staking vault.

Token Creation

  1. Create Token:

    spl-token create-token --decimals
  2. Create Token Account:

    spl-token create-account <token>
  3. Mint Tokens:

    spl-token mint <token>

Contract Configuration

  1. Admin Key Pair:

    • Add your key pair public key as the controller of the vault generation in the contract.
  2. Reward Mint:

    • Add the token that the contract holds and gives as a reward.

Deploy Contract

  1. Compile:

    cargo build-bpf
  2. Deploy Contract:

    solana program deploy /ft_staking/ft_stake_contract/target/deploy/staking.so

Client Side

  1. Edit and Compile Client Side:

    • Change the program_id.
    • Change the reward_mint.
  2. Vault Generation (Client Side):

    a. Generate Vault Address (with Admin Key Pair): bash staking-tokens-client generate_vault_address -e dev -s <keypair.json> --min_lock_period <seconds>

    b. Stake Tokens: bash staking-tokens-client stake -s <keypair.json> -e dev -a <token-amount> -l 2

    c. Unstake Tokens: bash staking-tokens-client unstake -s <keypair.json> -e dev

Note: Replace placeholders such as <token>, <keypair.json>, <token-amount>, etc., with actual values.

About

Rust Smart Contract for Solana using Clap for CLI, and Solana Libraries to write contract core logic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages