Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vladmeer/pnft-staking-dynamic
Pnft staking in solana with force unlocking by update authority
https://github.com/vladmeer/pnft-staking-dynamic
pnft solana
Last synced: 20 days ago
JSON representation
Pnft staking in solana with force unlocking by update authority
- Host: GitHub
- URL: https://github.com/vladmeer/pnft-staking-dynamic
- Owner: vladmeer
- Created: 2024-06-22T19:36:15.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-11-30T00:47:46.000Z (about 1 month ago)
- Last Synced: 2024-11-30T01:25:37.048Z (about 1 month ago)
- Topics: pnft, solana
- Language: TypeScript
- Homepage:
- Size: 178 KB
- Stars: 19
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pnft-Staking-Contract
## Install Dependencies
- Install `node` and `yarn`
- Install `script` as global command
- Confirm the solana wallet preparation. ex: `key.json`## Usage
- Main script source for all functionality is here: `/lib/script.ts`
- Program account types are declared here: `/lib/types.ts`Able to test the script functions working in this way.
- Change commands properly in the main functions of the `script.ts` file to call the other functions
- Run `yarn script` with parameters# Features
## How to deploy this program?
First of all, you have to git clone in your PC.
In the folder `staking`, in the terminal1. `yarn`
2. `anchor build`
In the last sentence you can see:```
To deploy this program:
$ solana program deploy ./target/deploy/staking.so
The program address will default to this keypair (override with --program-id):
./target/deploy/staking-keypair.json
```3. `solana-keygen pubkey ./target/deploy/staking.json`
4. You can get the pubkey of the `program ID : ex."5N...x6k"`
5. Please add this pubkey to the lib.rs
`declare_id!("5N...x6k");`
6. Please add this pubkey to the Anchor.toml
`staking = "5N...x6k"`
7. `anchor build` again
8. `solana program deploy ./target/deploy/staking.so`
Then, you can enjoy this program## How to use?
### A Project Admin
First of all, open the directory and `yarn`
#### Initialize project
```js
yarn script init
```As soon as after deploy program, admin need to initialize and should \
deposit reward token to vault if reward enabled#### Get global pool info
```js
yarn script status
```Check the global pool info and reward vault balance
#### Update reward thresholds as Admin
- Transfer admin authority
```js
yarn script change-admin -n
```- Active / Disable reward
```js
yarn script change-reward-enable -n
```
To enable reward, set the reward_enable to 1. else set it 0- Change reward token mint
```js
yarn script change-reward-mint -m
```- Change daily reward rate
```js
yarn script change-reward-per-day -n
```
Reward per day should be token amount in decimal expected to receive everyday### A User
#### Lock NFT for stake
```js
yarn script lock -m
```#### Unlock NFT for unstake
```js
yarn script unstake -m
```#### Claim user generated rewards
```js
yarn script claim-reward
```#### Get user status
```js
yarn script user-status -a
```# 👤 Author
### Twitter: [Dieharye](https://x.com/dieharye)
https://x.com/dieharye
### Telegram: [Vladmeer](https://t.me/vladmeer67)
https://t.me/vladmeer67