Nosana Rewards
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
orextend
a stake your rewards program is not updated. You
will have toclaim
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 toupstake
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
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();
Enter
Initialize a RewardsAccount.
Account Info
The following 5 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
reflection | The ReflectionAccount address. | |
stake | The StakeAccount address. | |
reward | The RewardAccount address. | |
authority | The signing authority of the program invocation. | |
systemProgram | The official Solana system program address. Responsible for system CPIs. |
Solana Dispatch ID
The Solana dispatch ID for the Enter Instruction
is 8b31d172585b4d86
,
which can also be expressed as an 8 byte discriminator:
[139,49,209,114,88,91,77,134]
Example with Anchor
To invoke the Enter Instruction
with Anchor TS.
let tx = await program.methods
.enter()
.accounts({
reflection, // β writable, π signer
stake, // π writable, π signer
reward, // β writable, π signer
authority, // β writable, β signer
systemProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
Add Fee
Send NOS to the VaultAccount.
Account Info
The following 5 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
user | The user token account that will debit/credit the tokens. | |
reflection | The ReflectionAccount address. | |
vault | The VaultAccount address. | |
authority | The signing authority of the program invocation. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. |
Arguments
The following 1 arguments should also be provided when invoking this instruction.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
amount | u64 | 8 | 0 | The number of tokens. |
Solana Dispatch ID
The Solana dispatch ID for the Add Fee Instruction
is 43e1bdd4fd7b4c70
,
which can also be expressed as an 8 byte discriminator:
[67,225,189,212,253,123,76,112]
Example with Anchor
To invoke the Add Fee Instruction
with Anchor TS.
let tx = await program.methods
.addFee(
amount, // type: u64
)
.accounts({
user, // β writable, π signer
reflection, // β writable, π signer
vault, // β writable, π signer
authority, // π writable, β signer
tokenProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
Claim
Claim rewards from a RewardsAccount and VaultAccount.
Account Info
The following 7 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
user | The user token account that will debit/credit the tokens. | |
vault | The VaultAccount address. | |
reflection | The ReflectionAccount address. | |
reward | The RewardAccount address. | |
stake | The StakeAccount address. | |
authority | The signing authority of the program invocation. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. |
Solana Dispatch ID
The Solana dispatch ID for the Claim Instruction
is 3ec6d6c1d59f6cd2
,
which can also be expressed as an 8 byte discriminator:
[62,198,214,193,213,159,108,210]
Example with Anchor
To invoke the Claim Instruction
with Anchor TS.
let tx = await program.methods
.claim()
.accounts({
user, // β writable, π signer
vault, // β writable, π signer
reflection, // β writable, π signer
reward, // β writable, π signer
stake, // π writable, π signer
authority, // β writable, β signer
tokenProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
Sync
Re-calculate reflection points.
Account Info
The following 3 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
reward | The RewardAccount address. | |
stake | The StakeAccount address. | |
reflection | The ReflectionAccount address. |
Solana Dispatch ID
The Solana dispatch ID for the Sync Instruction
is 04db28a4159dbd58
,
which can also be expressed as an 8 byte discriminator:
[4,219,40,164,21,157,189,88]
Example with Anchor
To invoke the Sync Instruction
with Anchor TS.
let tx = await program.methods
.sync()
.accounts({
reward, // β writable, π signer
stake, // π writable, π signer
reflection, // β writable, π signer
})
.rpc();
Close
Close a RewardsAccount.
Account Info
The following 3 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
reflection | The ReflectionAccount address. | |
reward | The RewardAccount address. | |
authority | The signing authority of the program invocation. |
Solana Dispatch ID
The Solana dispatch ID for the Close Instruction
is 62a5c9b16c41ce60
,
which can also be expressed as an 8 byte discriminator:
[98,165,201,177,108,65,206,96]
Example with Anchor
To invoke the Close Instruction
with Anchor TS.
let tx = await program.methods
.close()
.accounts({
reflection, // β writable, π signer
reward, // β writable, π signer
authority, // β 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]
Reward Account
The RewardAccount
struct holds all the information for any given user account.
The total size of this account is 73
bytes.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
authority | publicKey | 32 | 8 | The signing authority of the program invocation. |
bump | u8 | 1 | 40 | n/a |
reflection | u128 | 16 | 41 | The ReflectionAccount address. |
xnos | u128 | 16 | 57 | n/a |
Anchor Account Discriminator
The first 8 bytes, also known as Anchor's 8 byte discriminator, for the Reward Account
are e1511ffd54eaab81
, which can also be expressed in byte array:
[225,81,31,253,84,234,171,129]
Vault Account
The VaultAccount
is a regular Solana Token Account.