Solana nft staking smart contract for Kingdom of Dwarves NFT collections
If you have any question about it, feel free to reach out of me[Whatsapp: https://wa.me/13137423660, Telegram: https://t.me/DevCutup].
- Install
nodeandyarn - Install
ts-nodeas global command - Confirm the solana wallet preparation:
/home/fury/.config/solana/id.jsonin test case
- Main script source for all functionality is here:
/cli/script.ts - Program account types are declared here:
/cli/types.ts - Idl to make the JS binding easy is here:
/cli/staking_program.json
Able to test the script functions working in this way.
- Change commands properly in the main functions of the
script.tsfile to call the other functions - Confirm the
ANCHOR_WALLETenvironment variable of thets-nodescript inpackage.json - Run
yarn ts-node
For the first time use, the Smart Contract Owner should initialize the Smart Contract for global account allocation.
initProject
Recall initialize function for update the Threshold values after change the constants properly
initProject
Maintain the Reward token($KCROWN) vault's balance
REWARD_TOKEN_MINTis the reward token mint (for test).rewardVaultis the reward token account for owner. The owner should have the token'sMint Authorityor shouldFundregularly.
This is current test value. Should be revised properly.
EPOCH= 60 // A dayREWARD_PER_DAY= 100_000_000 // 0.1 $KCROWN According to the rank of NFTs, there reward amount will be changed automatically following the below logic.
{ "Dwarf": { "The Dark Lord": 2.3, "Emerald Underlord": 2.2, "Irish Archer": 2, "Invisible": 2, "Fluorite Underlord": 2.2, "Lapis Underlord": 2.2, "Ruby Underlord": 2.2, "Hellbender": 2, "Airbender": 2, "Palpatine": 2, "Avatar": 2, "Jack Skellington": 2, "England": 2, "Mouse": 2, "Pepe": 2, "Reanimated Undead Fiend": 1.5, "Cadaverous Undead Wraith": 1.5, "Reanimated Undead Wraith": 1.4, "Possessed Undead Wraith": 1.4, "Electrified Undead Fiend": 1.35, "Electrified Undead Wraith": 1.35, "Possessed Undead Fiend": 1.3, "Cadaverous Undead Fiend": 1.3, "Burned Accursed": 1.25, "Demonic Accursed": 1.25, "Miner": 1.42, "Mauled Accursed": 1.23, "Fight Club Accursed": 1.22, "Inflicted Accursed": 1.22, "Infernal Accursed": 1.21, "Corrupted Accursed": 1.21, "Reanimated Undead": 1.2, "Dwarf of War": 1.35, "Cultic Accursed": 1.22, "Electrified Undead": 1.2, "Possessed Undead": 1.2, "Full Moon": 1.33, "Mustard Skull Accursed": 1.23, "Cadaverous Undead": 1.22, "Umber Skull Accursed": 1.15, "Ivory Skull Accursed": 1.15, "Half Moon Grey": 1.26, "Aqua Skull Accursed": 1.1, "Half Moon": 1.15, "Gametime": 1.07, "Bloodied": 1.07, "Accursed": 1.05, "Neutral": 1 }, "Occupation": { "High King": 2.5, "King": 2.2, "King's Guards": 1 }, "Season": { "1": 1.08, "2": 1.07 }, "Gemstone": { "Diamond": 1.1, "Lapis Lazuli": 1.06, "Ruby": 1.05, "Obsidian": 1.07, "Emerald": 1.04, "Flourite": 1.03, "Amethyst": 1.01 }, }
Stake Shred Collection NFTs with NFT mint address and a boolean parameter weather the NFT is Legendary NFT.
stakeNft
Unstake their staked NFTs with mint address and get rewards. ( Calculate generated reward by this NFT too )
withdrawNft
Claim reward to receive generated $KCROWN from their staking.
claimReward
- Telegram: https://t.me/DevCutup
- Whatsapp: https://wa.me/13137423660
- Twitter: https://x.com/devcutup