Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/microgift/solana-nft-staking-test
Solana NFT staking project with anchor framework
https://github.com/microgift/solana-nft-staking-test
anchor nft solana staking
Last synced: about 16 hours ago
JSON representation
Solana NFT staking project with anchor framework
- Host: GitHub
- URL: https://github.com/microgift/solana-nft-staking-test
- Owner: microgift
- Created: 2023-03-07T08:31:30.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-01T11:33:00.000Z (over 1 year ago)
- Last Synced: 2025-01-03T01:37:18.891Z (7 days ago)
- Topics: anchor, nft, solana, staking
- Language: TypeScript
- Homepage:
- Size: 67.4 KB
- Stars: 3
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
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 migrateYou 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 {
...
}
```