https://github.com/ptcbink/solana-nft-staking
This is a reference NFT Staking Program & Client for Solana NFTs. This program is compatible with both Candy Machine v1 and Candy Machine v2 NFTs.
https://github.com/ptcbink/solana-nft-staking
anchor cargo next nft solana test-staking web3
Last synced: about 1 year ago
JSON representation
This is a reference NFT Staking Program & Client for Solana NFTs. This program is compatible with both Candy Machine v1 and Candy Machine v2 NFTs.
- Host: GitHub
- URL: https://github.com/ptcbink/solana-nft-staking
- Owner: ptcbink
- Created: 2023-09-16T12:57:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-16T12:59:33.000Z (over 2 years ago)
- Last Synced: 2025-02-15T00:33:58.321Z (over 1 year ago)
- Topics: anchor, cargo, next, nft, solana, test-staking, web3
- Language: TypeScript
- Homepage:
- Size: 42 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Test Staking Contract with Anchor
## Installation
In my case, I use WSL cause bpf-sdk of solana chain not support Windows now.
- Anchor environment should be get ready before running this project.
https://project-serum.github.io/anchor/getting-started/installation.html#install-rust
`I want to recommend for you to use latest solana cli version`
- yarn install
- please set solana provider with devnet(or mainnet)
`solana config set --url https://api.devnet.solana.com`
- anchor build
- anchor deploy
`anchor deploy --provder.cluster devnet`.
If you want to deploy on mainnet, you can use `anchor deploy --provider.cluster mainnet`
After deployed, you need to copy test_stake.json in target/idl directory to UI project(stake_poc_ui) with named idl.json
- anchor migrate
You can capture store key and list key in console and reflect them into `stakeStoreAddress`, `stakeListAddress` of utilData.js in UI project
- anchor test
Please not to test now cause after adding symbol restriction chore, it didn't be applied on test code.
- symbol restriction
If you want to change the collection name to restrict, please change the value of `SYMBOL` in lib.rs
- change reclaim time
please change the value of 300 with thing you want
```
if founded.is_some()
&& ctx.accounts.clock.unix_timestamp
< 300 + list.items.get(founded.unwrap()).unwrap().stake_time {
...
}
```