This project implements an staking mechanism using the Anchor framework on Solana. Users can stake their Native Sol,NFTs and SPL Token to earn rewards, and the system manages the staking process, including initialization, staking, unstaking, and claiming rewards.
The project includes functionality to freeze NFTs during the staking process. When an NFT is staked, it is temporarily frozen to prevent any transfers or modifications until the user unstakes it. This ensures that the NFT remains secure while it is being staked.
- Freeze NFT: The
freezefunction is called when an NFT is staked, locking it in place. - Thaw NFT: The
thawfunction can be called to unlock the NFT when it is unstaked.
The project includes functionality to Transfer SOL during the staking process. When an SOL is staked, it is temporarily Transferred to Stake account PDA and is locked to prevent any transfers or modifications until the user unstakes it.
- Stake SOl: The
transferfunction is called when SOL is staked, Transferring it in Staking Account PDA. - Unstake SOL: The
closefunction can be called to withdraw the SOL when it is unstaked.
The project includes functionality to Transfer SPL Token during the staking process. When an SPL Token is staked, it is temporarily Transferred to ATA of Stake account PDA and is locked to prevent any transfers or modifications until the user unstakes it.
- Stake SPL Token: The
transfer_checkedfunction is called when SPL Token is staked, Transferring it in Staking Account PDA's ATA Account. - Unstake SPL Token: The
transfer_checkedfunction can be called to withdraw the SOL when it is unstaked.
To install the necessary dependencies, run the following command:
yarn installor
npm installTo build the project, use:
anchor buildTo run tests, use:
anchor testTo deploy the project, use the following command:
anchor deployTo earn extra yield Asset must be locked for certain peroode otherwise flexible staking where you can unstake at any periode of time earn constant benefits only
Staking Periode must be greater that min_stake_periode of 60 sec