Skip to main content

Nosana Rewards

About 7 min

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 enter the 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 claim your earned rewards at any time (does not require an
    unstake).
  • If you unstake your reward account is voided. It is critical that
    you claim rewards before unstaking.
  • If you upstake or extend a stake your rewards program is not updated. You
    will have to claim upate 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 upstake your 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

InfoDescription
TypeSolana Programopen in new window
Source CodeGitHubopen in new window
Build StatusAnchor Verifiedopen in new window
Accounts3
Instructions6
Types0
Errors0
Domainnosana-rewards.sol
AddressnosRB8DUV67oLNrL45bo2pFLrmsWPiewe2Lk2DRNYCpopen in new window

Instructions

A number of 6 instruction are defined in the Nosana Rewards program.

To load the program with Anchoropen in new window.

const programId = new PublicKey('nosRB8DUV67oLNrL45bo2pFLrmsWPiewe2Lk2DRNYCp');
const idl = await Program.fetchIdl(programId.toString());
const program = new Program(idl, programId);
Init

Init

Initialize the ReflectionAccount and VaultAccount.

Account Info

The following 7 account addresses should be provided when invoking this instruction.

NameTypeDescription
mintThe token Mint address for this instruction.
reflectionThe ReflectionAccount address.
vaultThe VaultAccount address.
authorityThe signing authority of the program invocation.
systemProgramThe official Solana system program address. Responsible for system CPIs.
tokenProgramThe official SPL Token Program address. Responsible for token CPIs.
rentThe 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 TSopen in new window.

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

Reflection Account

The ReflectionAccount struct holds all the information on the reflection pool.
The total size of this account is 89 bytes.

NameTypeSizeOffsetDescription
rateu128168The current reward rate.
totalReflectionu1281624The current total reflection.
totalXnosu1281640The current total xNOS.
vaultpublicKey3256The VaultAccount address.
vaultBumpu8188The 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]

Diagram

Last update: