Nosana Pools
Nosana Pools
The Nosana Pools program allows users to open token pools with predefined emission rates.
Program Information
Info | Description |
---|---|
Type | Solana Program |
Source Code | GitHub |
Build Status | Anchor Verified |
Accounts | 2 |
Instructions | 5 |
Types | 1 |
Errors | 5 |
Domain | nosana-pools.sol |
Address | nosPdZrfDzND1LAR28FLMDEATUPK53K8xbRBXAirevD |
Instructions
A number of 5 instruction are defined in the Nosana Pools program.
To load the program with Anchor.
const programId = new PublicKey('nosPdZrfDzND1LAR28FLMDEATUPK53K8xbRBXAirevD');
const idl = await Program.fetchIdl(programId.toString());
const program = new Program(idl, programId);
Open
Open a PoolAccount and VaultAccount.
Account Info
The following 8 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
pool | The PoolAccount address. | |
vault | The VaultAccount address. | |
beneficiary | The token account that will receive the emissions from the Pool. | |
authority | The signing authority of the program invocation. | |
mint | The token Mint address for this instruction. | |
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. |
Arguments
The following 4 arguments should also be provided when invoking this instruction.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
emission | u64 | 8 | 0 | The emission rate for the pool, per second. |
startTime | i64 | 16 | 8 | The unix time the pool opens. |
claimType | u8 | 1 | 24 | The ClaimType for this pool. |
closeable | bool | 1 | 25 | Whether the pool should be closable or not. |
Solana Dispatch ID
The Solana dispatch ID for the Open Instruction
is e4dc9b47c7bd3c2d
,
which can also be expressed as an 8 byte discriminator:
[228,220,155,71,199,189,60,45]
Example with Anchor
To invoke the Open Instruction
with Anchor TS.
let tx = await program.methods
.open(
emission, // type: u64
startTime, // type: i64
claimType, // type: u8
closeable, // type: bool
)
.accounts({
pool, // β writable, β signer
vault, // β writable, π signer
beneficiary, // π writable, π signer
authority, // β writable, β signer
mint, // π writable, π signer
systemProgram, // π writable, π signer
tokenProgram, // π writable, π signer
rent, // π writable, π signer
})
.signers([poolKey, authorityKey])
.rpc();
Claim Fee
Add fees from a PoolAccount with claim type 1
Account Info
The following 7 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
vault | The VaultAccount address. | |
rewardsReflection | The Nosana Rewards Program's ReflectionAccount address. | |
rewardsVault | The Nosana Rewards Program's VaultAccount address. | |
pool | The PoolAccount address. | |
authority | The signing authority of the program invocation. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. | |
rewardsProgram | The Nosana Rewards Program address. |
Solana Dispatch ID
The Solana dispatch ID for the Claim Fee Instruction
is a9204f8988e84689
,
which can also be expressed as an 8 byte discriminator:
[169,32,79,137,136,232,70,137]
Example with Anchor
To invoke the Claim Fee Instruction
with Anchor TS.
let tx = await program.methods
.claimFee()
.accounts({
vault, // β writable, π signer
rewardsReflection, // β writable, π signer
rewardsVault, // β writable, π signer
pool, // β writable, π signer
authority, // β writable, β signer
tokenProgram, // π writable, π signer
rewardsProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
Claim Transfer
Claim emission from a PoolAccount with claim type 0
Account Info
The following 5 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
vault | The VaultAccount address. | |
beneficiary | The token account that will receive the emissions from the Pool. | |
pool | The PoolAccount 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 Transfer Instruction
is cab23abee6eae511
,
which can also be expressed as an 8 byte discriminator:
[202,178,58,190,230,234,229,17]
Example with Anchor
To invoke the Claim Transfer Instruction
with Anchor TS.
let tx = await program.methods
.claimTransfer()
.accounts({
vault, // β writable, π signer
beneficiary, // β writable, π signer
pool, // β writable, π signer
authority, // β writable, β signer
tokenProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
Close
Close a PoolAccount and VaultAccount.
Account Info
The following 5 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
vault | The VaultAccount address. | |
user | The user token account that will debit/credit the tokens. | |
pool | The PoolAccount 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 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({
vault, // β writable, π signer
user, // β writable, π signer
pool, // β writable, π signer
authority, // β writable, β signer
tokenProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
Update Beneficiary
Update the beneficiary in a PoolAccount.
Account Info
The following 5 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
beneficiary | The token account that will receive the emissions from the Pool. | |
newBeneficiary | The token account that will become the new beneficiary. | |
pool | The PoolAccount 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 Update Beneficiary Instruction
is 7e7adb46bc7ef37e
,
which can also be expressed as an 8 byte discriminator:
[126,122,219,70,188,126,243,126]
Example with Anchor
To invoke the Update Beneficiary Instruction
with Anchor TS.
let tx = await program.methods
.updateBeneficiary()
.accounts({
beneficiary, // π writable, π signer
newBeneficiary, // π writable, π signer
pool, // β writable, π signer
authority, // β writable, β signer
tokenProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
Accounts
A number of 2 accounts make up for the Nosana Pools Program's state.
Pool Account
The PoolAccount
struct holds all the information for any given pool.
The total size of this account is 139
bytes.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
authority | publicKey | 32 | 8 | The signing authority of the program invocation. |
beneficiary | publicKey | 32 | 40 | The token account that will receive the emissions from the Pool. |
claimType | u8 | 1 | 72 | The ClaimType for this pool. |
claimedTokens | u64 | 8 | 73 | The number of tokens that have been claimed. |
closeable | bool | 1 | 81 | Whether the pool should be closable or not. |
emission | u64 | 8 | 82 | The emission rate for the pool, per second. |
startTime | i64 | 16 | 90 | The unix time the pool opens. |
vault | publicKey | 32 | 106 | The VaultAccount address. |
vaultBump | u8 | 1 | 138 | The bump for the VaultAccount. |
Anchor Account Discriminator
The first 8 bytes, also known as Anchor's 8 byte discriminator, for the Pool Account
are 74d2bb77c4c43489
, which can also be expressed in byte array:
[116,210,187,119,196,196,52,137]
Vault Account
The VaultAccount
is a regular Solana Token Account.
Types
A number of 1 type variants are defined in the Nosana Pools Program's state.
Claim Type
The ClaimType
of any pool describes the way withdraw (claim) works.
A number of 3 variants are defined in this enum
:
Name | Number |
---|---|
Transfer | 0 |
AddFee | 1 |
Unknown | 255 |
Errors
A number of 5 errors are defined in the Nosana Pools Program.
Nosana Error
6000
- Not Started
This pool has not started yet.
Nosana Error
6001
- Underfunded
This pool does not have enough funds.
Nosana Error
6002
- Not Closeable
This pool is not closeable.
Nosana Error
6003
- Wrong Claim Type
This pool has a different claim type.
Nosana Error
6004
- Wrong Beneficiary
This pool does not match the beneficiary.