Nosana Rewards
The Nosana Rewards Program allow stakers to earn rewards. Anyone that has staked NOS tokens can enter the rewards program.
The following are some of the Nosana Rewards program's characteristics:
- A staker's xNOS score determines the portion of the fees a user will receive.
- You have to explicitly
enterthe rewards program to participate. The rewards you receive are the percentage of your xNOS compared to that of all the other participants. - When new fees are added to the program, they are distributed to all current participants.
- The program uses a token reflection model to distribute: fees are accounted for "live" as they come in and no loops necessary.
- Anyone can send in new fees to be distributed using
add_fees. - You can
claimyour earned rewards at any time (does not require an unstake). - If you
unstakeyour reward account is voided. It is critical that you claim rewards before unstaking. - If you
upstakeorextenda stake your rewards program is not updated. You will have toclaimupate your reward to make use of your new xNOS score. - A user can only have 1 active rewards entry at a time.
- The rewards a user earns are automatically added to the percentage of rewards they receive. Earned rewards are added to their xNOS score (with a multiplier of 1) - but can be claimed without any delay. They gain a slight advandage from this, and it's a great feature as well. Also it's easy to
upstakeyour rewards directly in order to receive a bigger multiplier. - One can close their own reward account at any time. If there are any unclaimed rewards on the account, they will be cancelled (and distributed to all other participants).
- Anyone is permitted to close a user's reward account if they've unstaked. This feature prevents "ghost" accounts from accumulating rewards.
Program Information
| Info | Description |
|---|---|
| Type | Solana Program |
| Source Code | GitHub |
| Build Status | Anchor Verified |
| Accounts | 3 |
| Instructions | 6 |
| Types | 0 |
| Errors | 0 |
| Domain | nosana-rewards.sol |
| Address | nosRB8DUV67oLNrL45bo2pFLrmsWPiewe2Lk2DRNYCp |
Instructions
A number of 6 instruction are defined in the Nosana Rewards program.
To load the program with Anchor.
const programId = new PublicKey('nosRB8DUV67oLNrL45bo2pFLrmsWPiewe2Lk2DRNYCp');
const idl = await Program.fetchIdl(programId.toString());
const program = new Program(idl, programId);Init
Initialize the ReflectionAccount and VaultAccount.
Account Info
The following 7 account addresses should be provided when invoking this instruction.
| Name | Type | Description |
|---|---|---|
mint | The token Mint address for this instruction. | |
reflection | The ReflectionAccount address. | |
vault | The VaultAccount address. | |
authority | The signing authority of the program invocation. | |
systemProgram | The official Solana system program address. Responsible for system CPIs. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. | |
rent | The official Solana rent address. Responsible for lamports. |
Solana Dispatch ID
The Solana dispatch ID for the Init Instruction is dc3bcfec6cfa2f64, which can also be expressed as an 8 byte discriminator:
[220,59,207,236,108,250,47,100]Example with Anchor
To invoke the Init Instruction with Anchor TS.
let tx = await program.methods
.init()
.accounts({
mint, // 𐄂 writable, 𐄂 signer
reflection, // ✓ writable, 𐄂 signer
vault, // ✓ writable, 𐄂 signer
authority, // ✓ writable, ✓ signer
systemProgram, // 𐄂 writable, 𐄂 signer
tokenProgram, // 𐄂 writable, 𐄂 signer
rent, // 𐄂 writable, 𐄂 signer
})
.signers([authorityKey])
.rpc();Accounts
A number of 3 accounts make up for the Nosana Rewards Program's state.
Reflection Account
The ReflectionAccount struct holds all the information on the reflection pool. The total size of this account is 89 bytes.
| Name | Type | Size | Offset | Description |
|---|---|---|---|---|
rate | u128 | 16 | 8 | The current reward rate. |
totalReflection | u128 | 16 | 24 | The current total reflection. |
totalXnos | u128 | 16 | 40 | The current total xNOS. |
vault | publicKey | 32 | 56 | The VaultAccount address. |
vaultBump | u8 | 1 | 88 | The bump for the VaultAccount. |
Anchor Account Discriminator
The first 8 bytes, also known as Anchor's 8 byte discriminator, for the Reflection Account are cd99a036ef1adbbc, which can also be expressed in byte array:
[205,153,160,54,239,26,219,188]