Skip to content

emersonliuuu/solmeet-9-nft-staking

Repository files navigation

SolMeet 9 NFT Staking

This is a tutorial for refactoring SDK, if you want to run it directly please checkout to final branch and run the script below.

Or you can learn more about the concept here and follow the note step by step to finish.

Setup

Run local validator

Restart local validator, and clone a useful program for creating ATA from Mainnet. See more about the program here

# run local validator
$ solana-test-validator -r -c 9tiP8yZcekzfGzSBmp7n9LaDHRjxP2w7wJj8tpPJtfG -u https://api.mainnet-beta.solana.com

open another console to confirm the setting is same as the one we are going to use later

$ solana config get

# config solana setting to target wallet and network
$ solana config set -k ~/.config/solana/id.json -u <Localnet URL>

# check balance
$ solana balance

# request airdrop
$ solana airdrop 5

$ git clone [email protected]:Dappio-emerson/solmeet-9-nft-staking.git

Install dependency and replace program key

Make sure you have replace program keys for all files below.

  1. programs/nft-rarity/src/lib.rs
  2. programs/nft-staking/src/lib.rs
  3. ts/v1/ids.ts
  4. Anchor.toml
#cd solmeet-9-nft-staking
$ yarn

# generate program key
$ anchor keys list

Run Program

Build and deploy

Build and deploy program with anchor command. Programs will deploy to localnet by default, can change the setting in Anchor.toml. Once the cluster is changed, update the endpoint in 1) migrations/0_setting.ts 2) tests/0_setting.ts corresponding to what you have changed.

$ anchor build
$ anchor deploy

Initialize State

This command is user defined script, it run all scripts under migration/initialization/ for initializing NFT mint list to Rarity Info and Initialize Pool info.

# run user defined scripts to initialize
$ anchor run initializeState

Stake with SDK v1

Run test script which implement staking with v1 SDK (ts/v1), the script is under tests/v1.

# run user defined scripts
$ anchor run testV1

Stake with SDK v1

Run test script which implement staking with v2 SDK (ts/v2), the script is under tests/v2.

# run user defined scripts
$ anchor run testV2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published