Skip to main content

Nosana Pools

About 6 min

Nosana Pools

The Nosana Pools program allows users to open token pools with predefined emission rates.

Program Information

InfoDescription
TypeSolana Programopen in new window
Source CodeGitHubopen in new window
Build StatusAnchor Verifiedopen in new window
Accounts2
Instructions5
Types1
Errors5
Domainnosana-pools.sol
AddressnosPdZrfDzND1LAR28FLMDEATUPK53K8xbRBXAirevDopen in new window

Instructions

A number of 5 instruction are defined in the Nosana Pools program.

To load the program with Anchoropen in new window.

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

Open

Open a PoolAccount and VaultAccount.

Account Info

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

NameTypeDescription
poolThe PoolAccount address.
vaultThe VaultAccount address.
beneficiaryThe token account that will receive the emissions from the Pool.
authorityThe signing authority of the program invocation.
mintThe token Mint address for this instruction.
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.

Arguments

The following 4 arguments should also be provided when invoking this instruction.

NameTypeSizeOffsetDescription
emissionu6480The emission rate for the pool, per second.
startTimei64168The unix time the pool opens.
claimTypeu8124The ClaimType for this pool.
closeablebool125Whether 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 TSopen in new window.

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();

Accounts

A number of 2 accounts make up for the Nosana Pools Program's state.

Pool Account

Pool Account

The PoolAccount struct holds all the information for any given pool.
The total size of this account is 139 bytes.

NameTypeSizeOffsetDescription
authoritypublicKey328The signing authority of the program invocation.
beneficiarypublicKey3240The token account that will receive the emissions from the Pool.
claimTypeu8172The ClaimType for this pool.
claimedTokensu64873The number of tokens that have been claimed.
closeablebool181Whether the pool should be closable or not.
emissionu64882The emission rate for the pool, per second.
startTimei641690The unix time the pool opens.
vaultpublicKey32106The VaultAccount address.
vaultBumpu81138The 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]

Types

A number of 1 type variants are defined in the Nosana Pools Program's state.

Claim Type

Claim Type

The ClaimType of any pool describes the way withdraw (claim) works.

A number of 3 variants are defined in this enum:

NameNumber
Transfer0
AddFee1
Unknown255

Errors

A number of 5 errors are defined in the Nosana Pools Program.

6000

Nosana Error

6000 - Not Started

This pool has not started yet.

Diagram

Last update: