├── programs └── pump-forking │ ├── src │ ├── utils │ │ ├── mod.rs │ │ └── calc.rs │ ├── instructions │ │ ├── mod.rs │ │ ├── initialize.rs │ │ ├── buy.rs │ │ ├── sell.rs │ │ └── create_pool.rs │ ├── consts.rs │ ├── lib.rs │ ├── errors.rs │ └── state.rs │ ├── Xargo.toml │ └── Cargo.toml ├── .gitignore ├── .prettierignore ├── logo └── pumpfunlogo.jpg ├── Cargo.toml ├── cli ├── config.ts ├── programId.ts ├── accounts │ ├── index.ts │ ├── CurveConfiguration.ts │ ├── LiquidityProvider.ts │ └── LiquidityPool.ts ├── instructions │ ├── index.ts │ ├── initialize.ts │ ├── swap.ts │ └── addLiquidity.ts └── errors │ ├── index.ts │ ├── custom.ts │ └── anchor.ts ├── tsconfig.json ├── migrations └── deploy.ts ├── Anchor.toml ├── package.json ├── README.md ├── tests └── pump.ts └── pump-idl.json /programs/pump-forking/src/utils/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod calc; 2 | pub use calc::*; 3 | -------------------------------------------------------------------------------- /programs/pump-forking/Xargo.toml: -------------------------------------------------------------------------------- 1 | [target.bpfel-unknown-unknown.dependencies.std] 2 | features = [] 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .anchor 3 | .DS_Store 4 | target 5 | **/*.rs.bk 6 | node_modules 7 | test-ledger 8 | .yarn 9 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | 2 | .anchor 3 | .DS_Store 4 | target 5 | node_modules 6 | dist 7 | build 8 | test-ledger 9 | -------------------------------------------------------------------------------- /logo/pumpfunlogo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angel10x/Solana-Pumpfun-Smart-Contract/HEAD/logo/pumpfunlogo.jpg -------------------------------------------------------------------------------- /programs/pump-forking/src/instructions/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod buy; 2 | pub mod create_pool; 3 | pub mod initialize; 4 | pub mod sell; 5 | 6 | pub use buy::*; 7 | pub use create_pool::*; 8 | pub use initialize::*; 9 | pub use sell::*; 10 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "programs/*" 4 | ] 5 | 6 | [profile.release] 7 | overflow-checks = true 8 | lto = "fat" 9 | codegen-units = 1 10 | [profile.release.build-override] 11 | opt-level = 3 12 | incremental = false 13 | codegen-units = 1 14 | -------------------------------------------------------------------------------- /cli/config.ts: -------------------------------------------------------------------------------- 1 | import idl from "../target/idl/pumpfun_forking.json"; 2 | import { PumpfunForking } from "../target/types/pumpfun_forking"; 3 | 4 | const program = new anchor.Program(idl as PumpfunForking); 5 | 6 | const network = "devnet" 7 | 8 | export { program, network }; 9 | -------------------------------------------------------------------------------- /programs/pump-forking/src/utils/calc.rs: -------------------------------------------------------------------------------- 1 | use std::ops::{Div, Mul}; 2 | 3 | pub fn convert_to_float(value: u64, decimals: u8) -> f64 { 4 | (value as f64).div(f64::powf(10.0, decimals as f64)) 5 | } 6 | 7 | pub fn convert_from_float(value: f64, decimals: u8) -> u64 { 8 | value.mul(f64::powf(10.0, decimals as f64)) as u64 9 | } 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": [ 4 | "mocha", 5 | "chai" 6 | ], 7 | "typeRoots": [ 8 | "./node_modules/@types" 9 | ], 10 | "lib": [ 11 | "es2015" 12 | ], 13 | "module": "commonjs", 14 | "target": "es6", 15 | "esModuleInterop": true, 16 | "resolveJsonModule": true 17 | } 18 | } -------------------------------------------------------------------------------- /programs/pump-forking/src/consts.rs: -------------------------------------------------------------------------------- 1 | pub const INITIAL_PRICE_DIVIDER: u64 = 800_000; // lamports per one token (without decimal) 2 | pub const INITIAL_LAMPORTS_FOR_POOL: u64 = 10_000_000; // 0.01SOL 3 | pub const TOKEN_SELL_LIMIT_PERCENT: u64 = 8000; // 80% 4 | pub const PROPORTION: u64 = 1280; // 800M token is sold on 500SOL ===> (500 * 2 / 800) = 1.25 ===> 800 : 1.25 = 640 ====> 640 * 2 = 1280 -------------------------------------------------------------------------------- /cli/programId.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from "@solana/web3.js" 2 | 3 | // Program ID defined in the provided IDL. Do not edit, it will get overwritten. 4 | export const PROGRAM_ID_IDL = new PublicKey( 5 | "7wUQXRQtBzTmyp9kcrmok9FKcc4RSYXxPYN9FGDLnqxb" 6 | ) 7 | 8 | // This constant will not get overwritten on subsequent code generations and it's safe to modify it's value. 9 | export const PROGRAM_ID: PublicKey = PROGRAM_ID_IDL 10 | -------------------------------------------------------------------------------- /migrations/deploy.ts: -------------------------------------------------------------------------------- 1 | // Migrations are an early feature. Currently, they're nothing more than this 2 | // single deploy script that's invoked from the CLI, injecting a provider 3 | // configured from the workspace's Anchor.toml. 4 | 5 | const anchor = require("@coral-xyz/anchor"); 6 | 7 | module.exports = async function (provider) { 8 | // Configure client to use the provider. 9 | anchor.setProvider(provider); 10 | 11 | // Add your deploy script here. 12 | }; 13 | -------------------------------------------------------------------------------- /cli/accounts/index.ts: -------------------------------------------------------------------------------- 1 | export { CurveConfiguration } from "./CurveConfiguration" 2 | export type { 3 | CurveConfigurationFields, 4 | CurveConfigurationJSON, 5 | } from "./CurveConfiguration" 6 | export { LiquidityProvider } from "./LiquidityProvider" 7 | export type { 8 | LiquidityProviderFields, 9 | LiquidityProviderJSON, 10 | } from "./LiquidityProvider" 11 | export { LiquidityPool } from "./LiquidityPool" 12 | export type { LiquidityPoolFields, LiquidityPoolJSON } from "./LiquidityPool" 13 | -------------------------------------------------------------------------------- /Anchor.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | 3 | [features] 4 | seeds = true 5 | skip-lint = false 6 | 7 | [programs.devnet] 8 | pump = "7wUQXRQtBzTmyp9kcrmok9FKcc4RSYXxPYN9FGDLnqxb" 9 | 10 | [registry] 11 | url = "https://devnet.helius-rpc.com/?api-key=39d83ffa-585c-4f90-8636-2f6795db4cb3" 12 | 13 | [provider] 14 | cluster = "Devnet" 15 | wallet = "./id.json" 16 | 17 | [scripts] 18 | test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts" 19 | 20 | [test] 21 | startup_wait = 10000 22 | shutdown_wait = 2000 23 | upgradeable = false 24 | -------------------------------------------------------------------------------- /cli/instructions/index.ts: -------------------------------------------------------------------------------- 1 | export { initialize } from "./initialize" 2 | export type { InitializeArgs, InitializeAccounts } from "./initialize" 3 | export { addLiquidity } from "./addLiquidity" 4 | export type { AddLiquidityArgs, AddLiquidityAccounts } from "./addLiquidity" 5 | export { removeLiquidity } from "./removeLiquidity" 6 | export type { 7 | RemoveLiquidityArgs, 8 | RemoveLiquidityAccounts, 9 | } from "./removeLiquidity" 10 | export { swap } from "./swap" 11 | export type { SwapArgs, SwapAccounts } from "./swap" 12 | export { createRaydiumPool } from "./createRaydiumPool" 13 | export type { 14 | CreateRaydiumPoolArgs, 15 | CreateRaydiumPoolAccounts, 16 | } from "./createRaydiumPool" 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Harry Anderson", 3 | "scripts": { 4 | "lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w", 5 | "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check" 6 | }, 7 | "dependencies": { 8 | "@coral-xyz/anchor": "^0.29.0", 9 | "@solana/spl-token": "^0.4.6", 10 | "@solana/web3.js": "^1.91.8" 11 | }, 12 | "devDependencies": { 13 | "@types/bn.js": "^5.1.0", 14 | "@types/chai": "^4.3.0", 15 | "@types/mocha": "^9.0.0", 16 | "chai": "^4.3.4", 17 | "mocha": "^9.0.3", 18 | "prettier": "^2.6.2", 19 | "ts-mocha": "^10.0.0", 20 | "typescript": "^4.3.5" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /programs/pump-forking/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pumpfun-forking" 3 | version = "1.1.2" 4 | description = "Created with Anchor" 5 | author = "Harry Anderson" 6 | edition = "2024" 7 | 8 | [lib] 9 | crate-type = ["cdylib", "lib"] 10 | name = "pumpfun_forking" 11 | 12 | [features] 13 | default = [] 14 | cpi = ["no-entrypoint"] 15 | no-entrypoint = [] 16 | no-idl = [] 17 | no-log-ix-name = [] 18 | anchor-debug = [] 19 | custom-heap = [] 20 | idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] 21 | devnet = ["raydium-amm-cpi/devnet"] 22 | init_if_needed = ["anchor-spl/init-if-needed"] 23 | 24 | [dependencies] 25 | anchor-lang = "=0.30.1" 26 | anchor-spl = { version = "=0.30.1", features = [ 27 | "associated_token", 28 | "token", 29 | "metadata", 30 | ] } 31 | 32 | borsh = "0.10.3" 33 | 34 | raydium-amm-cpi = { git = "https://github.com/raydium-io/raydium-cpi", package = "raydium-amm-cpi", branch = "anchor-0.30.1" } -------------------------------------------------------------------------------- /programs/pump-forking/src/lib.rs: -------------------------------------------------------------------------------- 1 | use anchor_lang::prelude::*; 2 | 3 | pub mod consts; 4 | pub mod errors; 5 | pub mod instructions; 6 | pub mod state; 7 | pub mod utils; 8 | 9 | use instructions::*; 10 | use state::CurveConfiguration; 11 | 12 | declare_id!("BDeQaWDdyQoGDWfvNrrc2ovCKCoxrRyQHZsDAiHuAuHV"); 13 | 14 | #[program] 15 | pub mod pumpfun_forking { 16 | 17 | use super::*; 18 | 19 | pub fn initialize(ctx: Context, fees: f64) -> Result<()> { 20 | instructions::initialize(ctx, fees) 21 | } 22 | 23 | pub fn create_pool( 24 | ctx: Context, 25 | fee_lamports: u64, 26 | token_amount: u64, 27 | raydium_token_amount: u64, 28 | ) -> Result<()> { 29 | ctx.accounts 30 | .process(fee_lamports, token_amount, raydium_token_amount) 31 | } 32 | 33 | pub fn buy(ctx: Context, in_amount: u64) -> Result<()> { 34 | instructions::buy(ctx, in_amount) 35 | } 36 | 37 | pub fn sell(ctx: Context, in_amount: u64) -> Result<()> { 38 | instructions::sell(ctx, in_amount) 39 | } 40 | 41 | /// Initiazlize a swap pool 42 | pub fn raydium_migrate(ctx: Context, nonce: u8, open_time: u64) -> Result<()> { 43 | ctx.accounts.process(nonce, open_time) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /programs/pump-forking/src/errors.rs: -------------------------------------------------------------------------------- 1 | 2 | use anchor_lang::prelude::*; 3 | 4 | #[error_code] 5 | pub enum CustomError { 6 | #[msg("Duplicate tokens are not allowed")] 7 | DuplicateTokenNotAllowed, 8 | 9 | #[msg("Failed to allocate shares")] 10 | FailedToAllocateShares, 11 | 12 | #[msg("Failed to deallocate shares")] 13 | FailedToDeallocateShares, 14 | 15 | #[msg("Insufficient shares")] 16 | InsufficientShares, 17 | 18 | #[msg("Insufficient funds to swap")] 19 | InsufficientFunds, 20 | 21 | #[msg("Invalid amount to swap")] 22 | InvalidAmount, 23 | 24 | #[msg("Invalid fee")] 25 | InvalidFee, 26 | 27 | #[msg("Failed to add liquidity")] 28 | FailedToAddLiquidity, 29 | 30 | #[msg("Failed to remove liquidity")] 31 | FailedToRemoveLiquidity, 32 | 33 | #[msg("Sold token is not enough to remove pool")] 34 | NotEnoughToRemove, 35 | 36 | #[msg("Not a pool creator")] 37 | NotCreator, 38 | 39 | #[msg("Overflow or underflow occured")] 40 | OverflowOrUnderflowOccurred, 41 | 42 | #[msg("Token amount is too big to sell")] 43 | TokenAmountToSellTooBig, 44 | 45 | #[msg("SOL is not enough in vault")] 46 | NotEnoughSolInVault, 47 | 48 | #[msg("Token is not enough in vault")] 49 | NotEnoughTokenInVault, 50 | 51 | #[msg("Amount is negative")] 52 | NegativeNumber, 53 | } 54 | -------------------------------------------------------------------------------- /cli/errors/index.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from "@solana/web3.js" 2 | import { PROGRAM_ID } from "../programId" 3 | import * as anchor from "./anchor" 4 | import * as custom from "./custom" 5 | 6 | export function fromCode( 7 | code: number, 8 | logs?: string[] 9 | ): custom.CustomError | anchor.AnchorError | null { 10 | return code >= 6000 11 | ? custom.fromCode(code, logs) 12 | : anchor.fromCode(code, logs) 13 | } 14 | 15 | function hasOwnProperty( 16 | obj: X, 17 | prop: Y 18 | ): obj is X & Record { 19 | return Object.hasOwnProperty.call(obj, prop) 20 | } 21 | 22 | const errorRe = /Program (\w+) failed: custom program error: (\w+)/ 23 | 24 | export function fromTxError( 25 | err: unknown, 26 | programId: PublicKey = PROGRAM_ID 27 | ): custom.CustomError | anchor.AnchorError | null { 28 | if ( 29 | typeof err !== "object" || 30 | err === null || 31 | !hasOwnProperty(err, "logs") || 32 | !Array.isArray(err.logs) 33 | ) { 34 | return null 35 | } 36 | 37 | let firstMatch: RegExpExecArray | null = null 38 | for (const logLine of err.logs) { 39 | firstMatch = errorRe.exec(logLine) 40 | if (firstMatch !== null) { 41 | break 42 | } 43 | } 44 | 45 | if (firstMatch === null) { 46 | return null 47 | } 48 | 49 | const [programIdRaw, codeRaw] = firstMatch.slice(1) 50 | if (programIdRaw !== programId.toString()) { 51 | return null 52 | } 53 | 54 | let errorCode: number 55 | try { 56 | errorCode = parseInt(codeRaw, 16) 57 | } catch (parseErr) { 58 | return null 59 | } 60 | 61 | return fromCode(errorCode, err.logs) 62 | } 63 | -------------------------------------------------------------------------------- /programs/pump-forking/src/instructions/initialize.rs: -------------------------------------------------------------------------------- 1 | use crate::{errors::CustomError, state::*}; 2 | use anchor_lang::prelude::*; 3 | use anchor_lang::system_program; 4 | 5 | pub fn initialize( 6 | ctx: Context, 7 | fees: f64, 8 | ) -> Result<()> { 9 | // Validate fee range 10 | if !(0.0..=100.0).contains(&fees) { 11 | return err!(CustomError::InvalidFee); 12 | } 13 | 14 | // Initialize configuration 15 | ctx.accounts.dex_configuration_account.set_inner(CurveConfiguration::new(fees)); 16 | 17 | // Optional: Initialize global account with minimum rent if needed 18 | // Remove this if global account initialization is handled elsewhere 19 | if ctx.accounts.global_account.lamports() == 0 { 20 | let initial_funding = 10_000_000; 21 | **ctx.accounts.global_account.to_account_info().try_borrow_mut_lamports()? = initial_funding; 22 | **ctx.accounts.admin.to_account_info().try_borrow_mut_lamports()? -= initial_funding; 23 | } 24 | 25 | Ok(()) 26 | } 27 | 28 | #[derive(Accounts)] 29 | pub struct InitializeCurveConfiguration<'info> { 30 | #[account( 31 | init, 32 | space = CurveConfiguration::ACCOUNT_SIZE, 33 | payer = admin, 34 | seeds = [CurveConfiguration::SEED.as_bytes()], 35 | bump, 36 | )] 37 | pub dex_configuration_account: Box>, 38 | 39 | /// CHECK 40 | #[account( 41 | mut, 42 | seeds = [b"global"], 43 | bump, 44 | )] 45 | pub global_account: AccountInfo<'info>, 46 | 47 | #[account(mut)] 48 | pub admin: Signer<'info>, 49 | pub rent: Sysvar<'info, Rent>, 50 | pub system_program: Program<'info, System>, 51 | } 52 | -------------------------------------------------------------------------------- /cli/instructions/initialize.ts: -------------------------------------------------------------------------------- 1 | import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface InitializeArgs { 7 | fee: number 8 | } 9 | 10 | export interface InitializeAccounts { 11 | dexConfigurationAccount: PublicKey 12 | /** CHECK */ 13 | globalAccount: PublicKey 14 | admin: PublicKey 15 | rent: PublicKey 16 | systemProgram: PublicKey 17 | } 18 | 19 | export const layout = borsh.struct([borsh.f64("fee")]) 20 | 21 | export function initialize( 22 | args: InitializeArgs, 23 | accounts: InitializeAccounts, 24 | programId: PublicKey = PROGRAM_ID 25 | ) { 26 | const keys: Array = [ 27 | { 28 | pubkey: accounts.dexConfigurationAccount, 29 | isSigner: false, 30 | isWritable: true, 31 | }, 32 | { pubkey: accounts.globalAccount, isSigner: false, isWritable: true }, 33 | { pubkey: accounts.admin, isSigner: true, isWritable: true }, 34 | { pubkey: accounts.rent, isSigner: false, isWritable: false }, 35 | { pubkey: accounts.systemProgram, isSigner: false, isWritable: false }, 36 | ] 37 | const identifier = Buffer.from([175, 175, 109, 31, 13, 152, 155, 237]) 38 | const buffer = Buffer.alloc(1000) 39 | const len = layout.encode( 40 | { 41 | fee: args.fee, 42 | }, 43 | buffer 44 | ) 45 | const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len) 46 | const ix = new TransactionInstruction({ keys, programId, data }) 47 | return ix 48 | } 49 | -------------------------------------------------------------------------------- /programs/pump-forking/src/instructions/buy.rs: -------------------------------------------------------------------------------- 1 | use anchor_lang::prelude::*; 2 | use anchor_spl::{ 3 | associated_token::AssociatedToken, 4 | token::{Mint, Token, TokenAccount}, 5 | }; 6 | 7 | use crate::state::{CurveConfiguration, LiquidityPool, LiquidityPoolAccount}; 8 | 9 | #[derive(Accounts)] 10 | pub struct Buy<'info> { 11 | #[account( 12 | mut, 13 | seeds = [CurveConfiguration::SEED.as_bytes()], 14 | bump, 15 | )] 16 | pub dex_configuration_account: Box>, 17 | 18 | #[account( 19 | mut, 20 | seeds = [LiquidityPool::POOL_SEED_PREFIX.as_bytes(), token_mint.key().as_ref()], 21 | bump = pool.bump 22 | )] 23 | pub pool: Box>, 24 | 25 | #[account(mut)] 26 | pub token_mint: Box>, 27 | 28 | #[account( 29 | mut, 30 | associated_token::mint = token_mint, 31 | associated_token::authority = pool 32 | )] 33 | pub pool_token_account: Box>, 34 | 35 | /// CHECK: 36 | #[account( 37 | mut, 38 | seeds = [LiquidityPool::SOL_VAULT_PREFIX.as_bytes(), token_mint.key().as_ref()], 39 | bump 40 | )] 41 | pub pool_sol_vault: AccountInfo<'info>, 42 | 43 | #[account( 44 | init_if_needed, 45 | payer = user, 46 | associated_token::mint = token_mint, 47 | associated_token::authority = user, 48 | )] 49 | pub user_token_account: Box>, 50 | 51 | #[account(mut)] 52 | pub user: Signer<'info>, 53 | pub rent: Sysvar<'info, Rent>, 54 | pub system_program: Program<'info, System>, 55 | pub token_program: Program<'info, Token>, 56 | pub associated_token_program: Program<'info, AssociatedToken>, 57 | } 58 | 59 | pub fn buy(ctx: Context, amount: u64) -> Result<()> { 60 | // Validate amount early 61 | require!(amount > 0, crate::errors::CustomError::InvalidAmount); 62 | 63 | let pool = &mut ctx.accounts.pool; 64 | let token_accounts = ( 65 | &mut *ctx.accounts.token_mint, 66 | &mut *ctx.accounts.pool_token_account, 67 | &mut *ctx.accounts.user_token_account, 68 | ); 69 | 70 | pool.buy( 71 | token_accounts, 72 | &mut ctx.accounts.pool_sol_vault, 73 | amount, 74 | &ctx.accounts.user, 75 | &ctx.accounts.token_program, 76 | &ctx.accounts.system_program, 77 | ) 78 | } 79 | -------------------------------------------------------------------------------- /cli/accounts/CurveConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey, Connection } from "@solana/web3.js" 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface CurveConfigurationFields { 7 | fees: number 8 | } 9 | 10 | export interface CurveConfigurationJSON { 11 | fees: number 12 | } 13 | 14 | export class CurveConfiguration { 15 | readonly fees: number 16 | 17 | static readonly discriminator = Buffer.from([ 18 | 225, 242, 252, 198, 63, 77, 56, 255, 19 | ]) 20 | 21 | static readonly layout = borsh.struct([borsh.f64("fees")]) 22 | 23 | constructor(fields: CurveConfigurationFields) { 24 | this.fees = fields.fees 25 | } 26 | 27 | static async fetch( 28 | c: Connection, 29 | address: PublicKey, 30 | programId: PublicKey = PROGRAM_ID 31 | ): Promise { 32 | const info = await c.getAccountInfo(address) 33 | 34 | if (info === null) { 35 | return null 36 | } 37 | if (!info.owner.equals(programId)) { 38 | throw new Error("account doesn't belong to this program") 39 | } 40 | 41 | return this.decode(info.data) 42 | } 43 | 44 | static async fetchMultiple( 45 | c: Connection, 46 | addresses: PublicKey[], 47 | programId: PublicKey = PROGRAM_ID 48 | ): Promise> { 49 | const infos = await c.getMultipleAccountsInfo(addresses) 50 | 51 | return infos.map((info) => { 52 | if (info === null) { 53 | return null 54 | } 55 | if (!info.owner.equals(programId)) { 56 | throw new Error("account doesn't belong to this program") 57 | } 58 | 59 | return this.decode(info.data) 60 | }) 61 | } 62 | 63 | static decode(data: Buffer): CurveConfiguration { 64 | if (!data.slice(0, 8).equals(CurveConfiguration.discriminator)) { 65 | throw new Error("invalid account discriminator") 66 | } 67 | 68 | const dec = CurveConfiguration.layout.decode(data.slice(8)) 69 | 70 | return new CurveConfiguration({ 71 | fees: dec.fees, 72 | }) 73 | } 74 | 75 | toJSON(): CurveConfigurationJSON { 76 | return { 77 | fees: this.fees, 78 | } 79 | } 80 | 81 | static fromJSON(obj: CurveConfigurationJSON): CurveConfiguration { 82 | return new CurveConfiguration({ 83 | fees: obj.fees, 84 | }) 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ##
Pump.fun Smart Contract
2 | Welcome to pumpdotfun or pump.fun smart contract with the same functionality as before, such as adding virtual LP, removing LP, creating Raydium Pool. This is the Rust/Anchor smart contract of pump.fun. And it is providing the latest anchor version. 3 | 4 | If you're interested in having the Pump.fun smart contract access or have any doubts, please reach out to me through the following contacts: 5 | 6 | If you're interested in having the Pump.fun smart contract access or have any doubts, please reach out to me through the following contacts: 7 | 8 | You can check the tx to Remove virtual LP and Create Raydium Pool in this smart contract with CPI calls. 9 | https://solscan.io/tx/4rZMqd4RtvSrhspP6R2ZGfSnhGyHuMNgt8hyn8eA18fS5GEpnKn8LKy6WAeeZJsU6HGWsvybkb3h21XrrYpoCfoL?cluster=devnet 10 | 11 | **Program Address** 12 | https://solscan.io/account/BDeQaWDdyQoGDWfvNrrc2ovCKCoxrRyQHZsDAiHuAuHV?cluster=devnet 13 | 14 | **Config Transaction** 15 | https://solscan.io/tx/9977V82eQoGq1GLmcabizpLeVwtG6MjpEyDVvikG4J7VhcawwQ7uxEtJVumj1nCs5nsfDYTFRcRv4pvPyWRFh3a?cluster=devnet 16 | 17 | **Token Launch TX** 18 | https://solscan.io/tx/2Yc9N9oDQKkh2U89i3r7ciBJEUfSWAeVTVvmrLKs15wfJg1kK4Ax1J8uBxuBSExcQApCQBMw8nzxXLQrE14Ghn61?cluster=devnet 19 | 20 | **Swap TX** 21 | https://solscan.io/tx/3z9puJ6Jcum1iQ9eA5q6hxoaVAKyKGkFFJuwqBjcrmgrA6xbpiLxwB5GDpD3cD7Wzuo48NViAZKKT9u72N6QSxPS?cluster=devnet 22 | 23 | **Curve Reach TX** 24 | https://solscan.io/tx/2QtdKZrhYuwJtWrd7dhja8mnNqZSmR4qbpo9iSLnrhkZADF3zzm8DojYVisvVaiGAkgmoU4ocSyo65EewJkpjvNo?cluster=devnet 25 | 26 | **Withdraw TX** 27 | https://solscan.io/tx/21VnRkwjGSCgUJY4KUtaNf2Sc13BUpjXp8nCmMhUFn8PPFNMkFywJFY79ZzhdVhuQUwSjmhAbyuhQutamw8Fj27u?cluster=devnet 28 | 29 | **Custom TX** 30 | https://solscan.io/tx/5DunqPfmfuYs3cVDE7SowJ9F2jKtdq7t3E3yP5W63RBGgcoNdVPDQ72asotg7fjnEEFATfQuiwPRGc7xqvW3iF64?cluster=custom&customUrl=devnet 31 | 32 | ### 📬 Say hello 33 | 34 | - [Whatsapp](https://wa.me/16286666724?text=Hello%20there) 35 | - [Telegram](https://t.me/angel001000010100) 36 | - [Discord](https://discordapp.com/users/1114372741672488990) 37 | - [Email](mailto:harran39318@gmail.com?subject=Hello%20Angel&body=Hi%20Angel%2C%20I%20found%20you%20on%20GitHub!) 38 | 39 | ### If you found this helpful, consider [following me](https://github.com/angel10x) for more projects and insights. 🌟 -------------------------------------------------------------------------------- /cli/instructions/swap.ts: -------------------------------------------------------------------------------- 1 | import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface SwapArgs { 7 | amount: BN 8 | style: BN 9 | } 10 | 11 | export interface SwapAccounts { 12 | dexConfigurationAccount: PublicKey 13 | pool: PublicKey 14 | /** CHECK */ 15 | globalAccount: PublicKey 16 | mintTokenOne: PublicKey 17 | poolTokenAccountOne: PublicKey 18 | userTokenAccountOne: PublicKey 19 | user: PublicKey 20 | rent: PublicKey 21 | systemProgram: PublicKey 22 | tokenProgram: PublicKey 23 | associatedTokenProgram: PublicKey 24 | } 25 | 26 | export const layout = borsh.struct([borsh.u64("amount"), borsh.u64("style")]) 27 | 28 | export function swap( 29 | args: SwapArgs, 30 | accounts: SwapAccounts, 31 | programId: PublicKey = PROGRAM_ID 32 | ) { 33 | const keys: Array = [ 34 | { 35 | pubkey: accounts.dexConfigurationAccount, 36 | isSigner: false, 37 | isWritable: true, 38 | }, 39 | { pubkey: accounts.pool, isSigner: false, isWritable: true }, 40 | { pubkey: accounts.globalAccount, isSigner: false, isWritable: true }, 41 | { pubkey: accounts.mintTokenOne, isSigner: false, isWritable: true }, 42 | { pubkey: accounts.poolTokenAccountOne, isSigner: false, isWritable: true }, 43 | { pubkey: accounts.userTokenAccountOne, isSigner: false, isWritable: true }, 44 | { pubkey: accounts.user, isSigner: true, isWritable: true }, 45 | { pubkey: accounts.rent, isSigner: false, isWritable: false }, 46 | { pubkey: accounts.systemProgram, isSigner: false, isWritable: false }, 47 | { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }, 48 | { 49 | pubkey: accounts.associatedTokenProgram, 50 | isSigner: false, 51 | isWritable: false, 52 | }, 53 | ] 54 | const identifier = Buffer.from([248, 198, 158, 145, 225, 117, 135, 200]) 55 | const buffer = Buffer.alloc(1000) 56 | const len = layout.encode( 57 | { 58 | amount: args.amount, 59 | style: args.style, 60 | }, 61 | buffer 62 | ) 63 | const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len) 64 | const ix = new TransactionInstruction({ keys, programId, data }) 65 | return ix 66 | } 67 | -------------------------------------------------------------------------------- /cli/accounts/LiquidityProvider.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey, Connection } from "@solana/web3.js" 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface LiquidityProviderFields { 7 | shares: BN 8 | } 9 | 10 | export interface LiquidityProviderJSON { 11 | shares: string 12 | } 13 | 14 | export class LiquidityProvider { 15 | readonly shares: BN 16 | 17 | static readonly discriminator = Buffer.from([ 18 | 219, 241, 238, 133, 56, 225, 229, 191, 19 | ]) 20 | 21 | static readonly layout = borsh.struct([borsh.u64("shares")]) 22 | 23 | constructor(fields: LiquidityProviderFields) { 24 | this.shares = fields.shares 25 | } 26 | 27 | static async fetch( 28 | c: Connection, 29 | address: PublicKey, 30 | programId: PublicKey = PROGRAM_ID 31 | ): Promise { 32 | const info = await c.getAccountInfo(address) 33 | 34 | if (info === null) { 35 | return null 36 | } 37 | if (!info.owner.equals(programId)) { 38 | throw new Error("account doesn't belong to this program") 39 | } 40 | 41 | return this.decode(info.data) 42 | } 43 | 44 | static async fetchMultiple( 45 | c: Connection, 46 | addresses: PublicKey[], 47 | programId: PublicKey = PROGRAM_ID 48 | ): Promise> { 49 | const infos = await c.getMultipleAccountsInfo(addresses) 50 | 51 | return infos.map((info) => { 52 | if (info === null) { 53 | return null 54 | } 55 | if (!info.owner.equals(programId)) { 56 | throw new Error("account doesn't belong to this program") 57 | } 58 | 59 | return this.decode(info.data) 60 | }) 61 | } 62 | 63 | static decode(data: Buffer): LiquidityProvider { 64 | if (!data.slice(0, 8).equals(LiquidityProvider.discriminator)) { 65 | throw new Error("invalid account discriminator") 66 | } 67 | 68 | const dec = LiquidityProvider.layout.decode(data.slice(8)) 69 | 70 | return new LiquidityProvider({ 71 | shares: dec.shares, 72 | }) 73 | } 74 | 75 | toJSON(): LiquidityProviderJSON { 76 | return { 77 | shares: this.shares.toString(), 78 | } 79 | } 80 | 81 | static fromJSON(obj: LiquidityProviderJSON): LiquidityProvider { 82 | return new LiquidityProvider({ 83 | shares: new BN(obj.shares), 84 | }) 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /programs/pump-forking/src/instructions/sell.rs: -------------------------------------------------------------------------------- 1 | use anchor_lang::prelude::*; 2 | use anchor_spl::{ 3 | associated_token::AssociatedToken, 4 | token::{Mint, Token, TokenAccount}, 5 | }; 6 | 7 | use crate::state::{CurveConfiguration, LiquidityPool, LiquidityPoolAccount}; 8 | 9 | pub fn sell(ctx: Context, amount: u64) -> Result<()> { 10 | let pool = &mut ctx.accounts.pool; 11 | let bump = *ctx.bumps.get("pool_sol_vault") 12 | .ok_or_else(|| anchor_lang::error!(crate::errors::CustomError::OverflowOrUnderflowOccurred))?; 13 | 14 | let token_one_accounts = ( 15 | &mut *ctx.accounts.token_mint, 16 | &mut *ctx.accounts.pool_token_account, 17 | &mut *ctx.accounts.user_token_account, 18 | ); 19 | 20 | pool.sell( 21 | token_one_accounts, 22 | &mut ctx.accounts.pool_sol_vault, 23 | amount, 24 | bump, 25 | &ctx.accounts.user, 26 | &ctx.accounts.token_program, 27 | &ctx.accounts.system_program, 28 | )?; 29 | Ok(()) 30 | } 31 | 32 | #[derive(Accounts)] 33 | pub struct Sell<'info> { 34 | #[account( 35 | mut, 36 | seeds = [CurveConfiguration::SEED.as_bytes()], 37 | bump, 38 | )] 39 | pub dex_configuration_account: Box>, 40 | 41 | #[account( 42 | mut, 43 | seeds = [LiquidityPool::POOL_SEED_PREFIX.as_bytes(), token_mint.key().as_ref()], 44 | bump = pool.bump 45 | )] 46 | pub pool: Box>, 47 | 48 | #[account(mut)] 49 | pub token_mint: Box>, 50 | 51 | #[account( 52 | mut, 53 | associated_token::mint = token_mint, 54 | associated_token::authority = pool 55 | )] 56 | pub pool_token_account: Box>, 57 | 58 | /// CHECK: 59 | #[account( 60 | mut, 61 | seeds = [LiquidityPool::SOL_VAULT_PREFIX.as_bytes(), token_mint.key().as_ref()], 62 | bump 63 | )] 64 | pub pool_sol_vault: AccountInfo<'info>, 65 | 66 | #[account( 67 | mut, 68 | associated_token::mint = token_mint, 69 | associated_token::authority = user, 70 | )] 71 | pub user_token_account: Box>, 72 | 73 | #[account(mut)] 74 | pub user: Signer<'info>, 75 | pub rent: Sysvar<'info, Rent>, 76 | pub system_program: Program<'info, System>, 77 | pub token_program: Program<'info, Token>, 78 | pub associated_token_program: Program<'info, AssociatedToken>, 79 | } 80 | -------------------------------------------------------------------------------- /cli/instructions/addLiquidity.ts: -------------------------------------------------------------------------------- 1 | import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface AddLiquidityArgs { 7 | amountOne: BN 8 | amountTwo: BN 9 | } 10 | 11 | export interface AddLiquidityAccounts { 12 | pool: PublicKey 13 | /** CHECK */ 14 | globalAccount: PublicKey 15 | liquidityProviderAccount: PublicKey 16 | mintTokenOne: PublicKey 17 | poolTokenAccountOne: PublicKey 18 | userTokenAccountOne: PublicKey 19 | user: PublicKey 20 | rent: PublicKey 21 | systemProgram: PublicKey 22 | tokenProgram: PublicKey 23 | associatedTokenProgram: PublicKey 24 | } 25 | 26 | export const layout = borsh.struct([ 27 | borsh.u64("amountOne"), 28 | borsh.u64("amountTwo"), 29 | ]) 30 | 31 | export function addLiquidity( 32 | args: AddLiquidityArgs, 33 | accounts: AddLiquidityAccounts, 34 | programId: PublicKey = PROGRAM_ID 35 | ) { 36 | const keys: Array = [ 37 | { pubkey: accounts.pool, isSigner: false, isWritable: true }, 38 | { pubkey: accounts.globalAccount, isSigner: false, isWritable: true }, 39 | { 40 | pubkey: accounts.liquidityProviderAccount, 41 | isSigner: false, 42 | isWritable: true, 43 | }, 44 | { pubkey: accounts.mintTokenOne, isSigner: false, isWritable: true }, 45 | { pubkey: accounts.poolTokenAccountOne, isSigner: false, isWritable: true }, 46 | { pubkey: accounts.userTokenAccountOne, isSigner: false, isWritable: true }, 47 | { pubkey: accounts.user, isSigner: true, isWritable: true }, 48 | { pubkey: accounts.rent, isSigner: false, isWritable: false }, 49 | { pubkey: accounts.systemProgram, isSigner: false, isWritable: false }, 50 | { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }, 51 | { 52 | pubkey: accounts.associatedTokenProgram, 53 | isSigner: false, 54 | isWritable: false, 55 | }, 56 | ] 57 | const identifier = Buffer.from([181, 157, 89, 67, 143, 182, 52, 72]) 58 | const buffer = Buffer.alloc(1000) 59 | const len = layout.encode( 60 | { 61 | amountOne: args.amountOne, 62 | amountTwo: args.amountTwo, 63 | }, 64 | buffer 65 | ) 66 | const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len) 67 | const ix = new TransactionInstruction({ keys, programId, data }) 68 | return ix 69 | } 70 | -------------------------------------------------------------------------------- /programs/pump-forking/src/instructions/create_pool.rs: -------------------------------------------------------------------------------- 1 | use anchor_lang::{ 2 | prelude::*, 3 | solana_program::system_instruction::{self}, 4 | }; 5 | use anchor_spl::{ 6 | associated_token::AssociatedToken, 7 | token::{Mint, Token, TokenAccount}, 8 | }; 9 | use core::mem::size_of; 10 | 11 | #[derive(Accounts)] 12 | pub struct CreatePool<'info> { 13 | #[account( 14 | seeds = [ GLOBAL_INFO_SEED ], 15 | bump 16 | )] 17 | pub global_info: Account<'info, GlobalInfo>, 18 | 19 | /// CHECK: This is a PDA designated for fee allocation. 20 | #[account( 21 | seeds = [ PUMP_FUN_FEE_SEED ], 22 | bump 23 | )] 24 | pub fee_account: AccountInfo<'info>, 25 | 26 | #[account( 27 | init, 28 | payer = payer, 29 | seeds =[ &token_mint.key().to_bytes(), BONDING_CURVE_SEED ], 30 | space = 8 + size_of::(), 31 | bump 32 | )] 33 | pub bonding_curve: Account<'info, BondingCurve>, 34 | 35 | pub token_mint: Account<'info, Mint>, 36 | 37 | #[account( 38 | mut, 39 | associated_token::mint = token_mint, 40 | associated_token::authority = payer 41 | )] 42 | pub user_ata: Account<'info, TokenAccount>, 43 | 44 | /// CHECK: 45 | #[account( 46 | mut, 47 | seeds = [ &token_mint.key().to_bytes() , SOL_POOL_SEED ], 48 | bump 49 | )] 50 | pub sol_pool: AccountInfo<'info>, 51 | 52 | #[account( 53 | associated_token::mint = token_mint, 54 | associated_token::authority = sol_pool 55 | )] 56 | pub token_pool: Account<'info, TokenAccount>, 57 | 58 | #[account(mut)] 59 | pub payer: Signer<'info>, 60 | 61 | pub associated_token_program: Program<'info, AssociatedToken>, 62 | pub token_program: Program<'info, Token>, 63 | pub system_program: Program<'info, System>, 64 | } 65 | 66 | impl<'info> CreatePool<'info> { 67 | pub fn process( 68 | &mut self, 69 | fee_lamports: u64, 70 | token_amount: u64, 71 | raydium_token_amount: u64, 72 | ) -> Result<()> { 73 | msg!("Calling create_pool..."); 74 | msg!( 75 | "Sent Create Fee to Fee Wallet : {} Sol ", 76 | ((fee_lamports as f32) / (1_000_000_000 as f32)) 77 | ); 78 | let fee_account = &self.fee_account; 79 | 80 | let transfer_instruction = system_instruction::transfer( 81 | &self.payer.to_account_info().key(), 82 | &fee_account.key(), 83 | fee_lamports, 84 | ); 85 | 86 | anchor_lang::solana_program::program::invoke_signed( 87 | &transfer_instruction, 88 | &[ 89 | self.payer.to_account_info(), 90 | fee_account.to_account_info(), 91 | self.system_program.to_account_info(), 92 | ], 93 | &[], 94 | )?; 95 | 96 | self.bonding_curve.token_total_supply = self.token_mint.supply; 97 | self.bonding_curve.raydium_token = raydium_token_amount; 98 | self.bonding_curve.virtual_sol_reserves = self.global_info.config.initial_virtual_sol; 99 | self.bonding_curve.virtual_token_reserves = token_amount; 100 | self.bonding_curve.real_sol_reserves = 0; 101 | self.bonding_curve.real_token_reserves = token_amount; 102 | 103 | Ok(()) 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /cli/accounts/LiquidityPool.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey, Connection } from "@solana/web3.js" 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface LiquidityPoolFields { 7 | tokenOne: PublicKey 8 | tokenTwo: PublicKey 9 | totalSupply: BN 10 | reserveOne: BN 11 | reserveTwo: BN 12 | bump: number 13 | } 14 | 15 | export interface LiquidityPoolJSON { 16 | tokenOne: string 17 | tokenTwo: string 18 | totalSupply: string 19 | reserveOne: string 20 | reserveTwo: string 21 | bump: number 22 | } 23 | 24 | export class LiquidityPool { 25 | readonly tokenOne: PublicKey 26 | readonly tokenTwo: PublicKey 27 | readonly totalSupply: BN 28 | readonly reserveOne: BN 29 | readonly reserveTwo: BN 30 | readonly bump: number 31 | 32 | static readonly discriminator = Buffer.from([ 33 | 66, 38, 17, 64, 188, 80, 68, 129, 34 | ]) 35 | 36 | static readonly layout = borsh.struct([ 37 | borsh.publicKey("tokenOne"), 38 | borsh.publicKey("tokenTwo"), 39 | borsh.u64("totalSupply"), 40 | borsh.u64("reserveOne"), 41 | borsh.u64("reserveTwo"), 42 | borsh.u8("bump"), 43 | ]) 44 | 45 | constructor(fields: LiquidityPoolFields) { 46 | this.tokenOne = fields.tokenOne 47 | this.tokenTwo = fields.tokenTwo 48 | this.totalSupply = fields.totalSupply 49 | this.reserveOne = fields.reserveOne 50 | this.reserveTwo = fields.reserveTwo 51 | this.bump = fields.bump 52 | } 53 | 54 | static async fetch( 55 | c: Connection, 56 | address: PublicKey, 57 | programId: PublicKey = PROGRAM_ID 58 | ): Promise { 59 | const info = await c.getAccountInfo(address) 60 | 61 | if (info === null) { 62 | return null 63 | } 64 | if (!info.owner.equals(programId)) { 65 | throw new Error("account doesn't belong to this program") 66 | } 67 | 68 | return this.decode(info.data) 69 | } 70 | 71 | static async fetchMultiple( 72 | c: Connection, 73 | addresses: PublicKey[], 74 | programId: PublicKey = PROGRAM_ID 75 | ): Promise> { 76 | const infos = await c.getMultipleAccountsInfo(addresses) 77 | 78 | return infos.map((info) => { 79 | if (info === null) { 80 | return null 81 | } 82 | if (!info.owner.equals(programId)) { 83 | throw new Error("account doesn't belong to this program") 84 | } 85 | 86 | return this.decode(info.data) 87 | }) 88 | } 89 | 90 | static decode(data: Buffer): LiquidityPool { 91 | if (!data.slice(0, 8).equals(LiquidityPool.discriminator)) { 92 | throw new Error("invalid account discriminator") 93 | } 94 | 95 | const dec = LiquidityPool.layout.decode(data.slice(8)) 96 | 97 | return new LiquidityPool({ 98 | tokenOne: dec.tokenOne, 99 | tokenTwo: dec.tokenTwo, 100 | totalSupply: dec.totalSupply, 101 | reserveOne: dec.reserveOne, 102 | reserveTwo: dec.reserveTwo, 103 | bump: dec.bump, 104 | }) 105 | } 106 | 107 | toJSON(): LiquidityPoolJSON { 108 | return { 109 | tokenOne: this.tokenOne.toString(), 110 | tokenTwo: this.tokenTwo.toString(), 111 | totalSupply: this.totalSupply.toString(), 112 | reserveOne: this.reserveOne.toString(), 113 | reserveTwo: this.reserveTwo.toString(), 114 | bump: this.bump, 115 | } 116 | } 117 | 118 | static fromJSON(obj: LiquidityPoolJSON): LiquidityPool { 119 | return new LiquidityPool({ 120 | tokenOne: new PublicKey(obj.tokenOne), 121 | tokenTwo: new PublicKey(obj.tokenTwo), 122 | totalSupply: new BN(obj.totalSupply), 123 | reserveOne: new BN(obj.reserveOne), 124 | reserveTwo: new BN(obj.reserveTwo), 125 | bump: obj.bump, 126 | }) 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /cli/errors/custom.ts: -------------------------------------------------------------------------------- 1 | export type CustomError = 2 | | DuplicateTokenNotAllowed 3 | | FailedToAllocateShares 4 | | FailedToDeallocateShares 5 | | InsufficientShares 6 | | InsufficientFunds 7 | | InvalidAmount 8 | | InvalidFee 9 | | FailedToAddLiquidity 10 | | FailedToRemoveLiquidity 11 | | OverflowOrUnderflowOccurred 12 | 13 | export class DuplicateTokenNotAllowed extends Error { 14 | static readonly code = 6000 15 | readonly code = 6000 16 | readonly name = "DuplicateTokenNotAllowed" 17 | readonly msg = "Duplicate tokens are not allowed" 18 | 19 | constructor(readonly logs?: string[]) { 20 | super("6000: Duplicate tokens are not allowed") 21 | } 22 | } 23 | 24 | export class FailedToAllocateShares extends Error { 25 | static readonly code = 6001 26 | readonly code = 6001 27 | readonly name = "FailedToAllocateShares" 28 | readonly msg = "Failed to allocate shares" 29 | 30 | constructor(readonly logs?: string[]) { 31 | super("6001: Failed to allocate shares") 32 | } 33 | } 34 | 35 | export class FailedToDeallocateShares extends Error { 36 | static readonly code = 6002 37 | readonly code = 6002 38 | readonly name = "FailedToDeallocateShares" 39 | readonly msg = "Failed to deallocate shares" 40 | 41 | constructor(readonly logs?: string[]) { 42 | super("6002: Failed to deallocate shares") 43 | } 44 | } 45 | 46 | export class InsufficientShares extends Error { 47 | static readonly code = 6003 48 | readonly code = 6003 49 | readonly name = "InsufficientShares" 50 | readonly msg = "Insufficient shares" 51 | 52 | constructor(readonly logs?: string[]) { 53 | super("6003: Insufficient shares") 54 | } 55 | } 56 | 57 | export class InsufficientFunds extends Error { 58 | static readonly code = 6004 59 | readonly code = 6004 60 | readonly name = "InsufficientFunds" 61 | readonly msg = "Insufficient funds to swap" 62 | 63 | constructor(readonly logs?: string[]) { 64 | super("6004: Insufficient funds to swap") 65 | } 66 | } 67 | 68 | export class InvalidAmount extends Error { 69 | static readonly code = 6005 70 | readonly code = 6005 71 | readonly name = "InvalidAmount" 72 | readonly msg = "Invalid amount to swap" 73 | 74 | constructor(readonly logs?: string[]) { 75 | super("6005: Invalid amount to swap") 76 | } 77 | } 78 | 79 | export class InvalidFee extends Error { 80 | static readonly code = 6006 81 | readonly code = 6006 82 | readonly name = "InvalidFee" 83 | readonly msg = "Invalid fee" 84 | 85 | constructor(readonly logs?: string[]) { 86 | super("6006: Invalid fee") 87 | } 88 | } 89 | 90 | export class FailedToAddLiquidity extends Error { 91 | static readonly code = 6007 92 | readonly code = 6007 93 | readonly name = "FailedToAddLiquidity" 94 | readonly msg = "Failed to add liquidity" 95 | 96 | constructor(readonly logs?: string[]) { 97 | super("6007: Failed to add liquidity") 98 | } 99 | } 100 | 101 | export class FailedToRemoveLiquidity extends Error { 102 | static readonly code = 6008 103 | readonly code = 6008 104 | readonly name = "FailedToRemoveLiquidity" 105 | readonly msg = "Failed to remove liquidity" 106 | 107 | constructor(readonly logs?: string[]) { 108 | super("6008: Failed to remove liquidity") 109 | } 110 | } 111 | 112 | export class OverflowOrUnderflowOccurred extends Error { 113 | static readonly code = 6009 114 | readonly code = 6009 115 | readonly name = "OverflowOrUnderflowOccurred" 116 | readonly msg = "Overflow or underflow occured" 117 | 118 | constructor(readonly logs?: string[]) { 119 | super("6009: Overflow or underflow occured") 120 | } 121 | } 122 | 123 | export function fromCode(code: number, logs?: string[]): CustomError | null { 124 | switch (code) { 125 | case 6000: 126 | return new DuplicateTokenNotAllowed(logs) 127 | case 6001: 128 | return new FailedToAllocateShares(logs) 129 | case 6002: 130 | return new FailedToDeallocateShares(logs) 131 | case 6003: 132 | return new InsufficientShares(logs) 133 | case 6004: 134 | return new InsufficientFunds(logs) 135 | case 6005: 136 | return new InvalidAmount(logs) 137 | case 6006: 138 | return new InvalidFee(logs) 139 | case 6007: 140 | return new FailedToAddLiquidity(logs) 141 | case 6008: 142 | return new FailedToRemoveLiquidity(logs) 143 | case 6009: 144 | return new OverflowOrUnderflowOccurred(logs) 145 | } 146 | 147 | return null 148 | } 149 | -------------------------------------------------------------------------------- /tests/pump.ts: -------------------------------------------------------------------------------- 1 | import * as anchor from "@coral-xyz/anchor"; 2 | import { Program } from "@coral-xyz/anchor"; 3 | import { Pump } from "../target/types/pump" 4 | import { Connection, PublicKey, Keypair, SystemProgram, Transaction, sendAndConfirmTransaction, ComputeBudgetProgram, SYSVAR_RENT_PUBKEY } from "@solana/web3.js" 5 | import { createMint, getOrCreateAssociatedTokenAccount, mintTo, getAssociatedTokenAddress } from "@solana/spl-token" 6 | import { expect } from "chai"; 7 | import { BN } from "bn.js"; 8 | import keys from '../keys/users.json' 9 | import key2 from '../keys/user2.json' 10 | import { ASSOCIATED_PROGRAM_ID, TOKEN_PROGRAM_ID } from "@coral-xyz/anchor/dist/cjs/utils/token"; 11 | 12 | // const connection = new Connection("https://api.devnet.solana.com") 13 | const connection = new Connection("http://localhost:8899") 14 | const curveSeed = "CurveConfiguration" 15 | const POOL_SEED_PREFIX = "liquidity_pool" 16 | const LP_SEED_PREFIX = "LiqudityProvider" 17 | 18 | function sleep(ms: number) { 19 | return new Promise(resolve => setTimeout(resolve, ms)); 20 | } 21 | 22 | describe("pump", () => { 23 | anchor.setProvider(anchor.AnchorProvider.env()); 24 | 25 | const program = anchor.workspace.Pump as Program; 26 | 27 | 28 | // custom setting 29 | const user = Keypair.fromSecretKey(new Uint8Array(keys)) 30 | const user2 = Keypair.fromSecretKey(new Uint8Array(key2)) 31 | const tokenDecimal = 6 32 | const amount = new BN(1000000000).mul(new BN(10 ** tokenDecimal)) 33 | console.log(BigInt(amount.toString())) 34 | console.log(BigInt(amount.toString()).toString()) 35 | console.log("🚀 ~ describe ~ amount:", amount.toString()) 36 | 37 | let mint1: PublicKey 38 | let tokenAta1: PublicKey 39 | 40 | // let mint2: PublicKey 41 | // let tokenAta2: PublicKey 42 | 43 | console.log("Admin's wallet address is : ", user.publicKey.toBase58()) 44 | 45 | it("Airdrop to admin wallet", async () => { 46 | console.log(`Requesting airdrop to admin for 1SOL : ${user.publicKey.toBase58()}`) 47 | // 1 - Request Airdrop 48 | const signature = await connection.requestAirdrop( 49 | user.publicKey, 50 | 10 ** 9 51 | ); 52 | // 2 - Fetch the latest blockhash 53 | const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash(); 54 | // 3 - Confirm transaction success 55 | await connection.confirmTransaction({ 56 | blockhash, 57 | lastValidBlockHeight, 58 | signature 59 | }, 'finalized'); 60 | console.log("admin wallet balance : ", (await connection.getBalance(user.publicKey)) / 10 ** 9, "SOL") 61 | }) 62 | 63 | it("Airdrop to user wallet", async () => { 64 | console.log("Created a user, address is ", user2.publicKey.toBase58()) 65 | console.log(`Requesting airdrop for another user ${user.publicKey.toBase58()}`) 66 | // 1 - Request Airdrop 67 | const signature = await connection.requestAirdrop( 68 | user2.publicKey, 69 | 10 ** 9 70 | ); 71 | // 2 - Fetch the latest blockhash 72 | const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash(); 73 | // 3 - Confirm transaction success 74 | await connection.confirmTransaction({ 75 | blockhash, 76 | lastValidBlockHeight, 77 | signature 78 | }, 'finalized'); 79 | console.log("user balance : ", (await connection.getBalance(user.publicKey)) / 10 ** 9, "SOL") 80 | }) 81 | 82 | it("Mint token1 to user wallet", async () => { 83 | console.log("Trying to create and mint token1 to user's wallet") 84 | 85 | try { 86 | mint1 = await createMint(connection, user, user.publicKey, user.publicKey, tokenDecimal) 87 | console.log('mint1 address: ', mint1.toBase58()); 88 | tokenAta1 = (await getOrCreateAssociatedTokenAccount(connection, user, mint1, user.publicKey)).address 89 | console.log('token1 account address: ', tokenAta1.toBase58()); 90 | try { 91 | //minting 100 new tokens to the token address we just created 92 | await mintTo(connection, user, mint1, tokenAta1, user.publicKey, BigInt(amount.toString())) 93 | } catch (error) { 94 | console.log("🚀 ~ here:", error) 95 | } 96 | const tokenBalance = await connection.getTokenAccountBalance(tokenAta1) 97 | console.log("tokenBalance1 in user:", tokenBalance.value.uiAmount) 98 | console.log('token 1 successfully minted'); 99 | } catch (error) { 100 | console.log("Token 1 creation error \n", error) 101 | } 102 | 103 | }) 104 | 105 | it("Mint token 2 to user wallet", async () => { 106 | console.log("Trying to create and mint token 2 to user's wallet") 107 | try { 108 | mint2 = await createMint(connection, user, user.publicKey, user.publicKey, tokenDecimal) 109 | console.log('mint 2 address: ', mint2.toBase58()); 110 | 111 | tokenAta2 = (await getOrCreateAssociatedTokenAccount(connection, user, mint2, user.publicKey)).address 112 | console.log('token 2 account address: ', tokenAta2.toBase58()); 113 | 114 | await mintTo(connection, user, mint2, tokenAta2, user.publicKey, BigInt(amount.toString())) 115 | const tokenBalance = await connection.getTokenAccountBalance(tokenAta2) 116 | console.log("token 2 Balance in user:", tokenBalance.value.uiAmount) 117 | console.log('token 2 successfully minted'); 118 | } catch (error) { 119 | console.log("Token 2 creation error \n", error) 120 | } 121 | }) 122 | 123 | it("Initialize the contract", async () => { 124 | try { 125 | const [curveConfig] = PublicKey.findProgramAddressSync( 126 | [Buffer.from(curveSeed)], 127 | program.programId 128 | ) 129 | const tx = new Transaction() 130 | .add( 131 | ComputeBudgetProgram.setComputeUnitLimit({ units: 10_000 }), 132 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1200_000 }), 133 | await program.methods 134 | .initialize(1) 135 | .accounts({ 136 | dexConfigurationAccount: curveConfig, 137 | admin: user.publicKey, 138 | rent: SYSVAR_RENT_PUBKEY, 139 | systemProgram: SystemProgram.programId 140 | }) 141 | .instruction() 142 | ) 143 | tx.feePayer = user.publicKey 144 | tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash 145 | // console.log(await connection.simulateTransaction(tx)) 146 | const sig = await sendAndConfirmTransaction(connection, tx, [user], { skipPreflight: true }) 147 | console.log("Successfully initialized : ", sig) 148 | let pool = await program.account.curveConfiguration.fetch(curveConfig) 149 | console.log("Pool State : ", pool) 150 | } catch (error) { 151 | console.log("Error in initialization :", error) 152 | } 153 | }); 154 | 155 | it("create pool", async () => { 156 | try { 157 | 158 | const [poolPda] = PublicKey.findProgramAddressSync( 159 | [Buffer.from(POOL_SEED_PREFIX), mint1.toBuffer(), mint2.toBuffer()], 160 | program.programId 161 | ) 162 | const [liquidityProviderAccount] = PublicKey.findProgramAddressSync( 163 | [Buffer.from(LP_SEED_PREFIX), poolPda.toBuffer(), user.publicKey.toBuffer()], 164 | program.programId 165 | ) 166 | const poolTokenOne = await getAssociatedTokenAddress( 167 | mint1, poolPda, true 168 | ) 169 | const poolTokenTwo = await getAssociatedTokenAddress( 170 | mint2, poolPda, true 171 | ) 172 | const userAta1 = await getAssociatedTokenAddress( 173 | mint1, user.publicKey 174 | ) 175 | const userAta2 = await getAssociatedTokenAddress( 176 | mint2, user.publicKey 177 | ) 178 | 179 | const tx = new Transaction() 180 | .add( 181 | ComputeBudgetProgram.setComputeUnitLimit({ units: 200_000 }), 182 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 200_000 }), 183 | await program.methods 184 | .createPool() 185 | .accounts({ 186 | pool: poolPda, 187 | mintTokenOne: mint1, 188 | mintTokenTwo: mint2, 189 | poolTokenAccountOne: poolTokenOne, 190 | poolTokenAccountTwo: poolTokenTwo, 191 | payer: user.publicKey, 192 | tokenProgram: TOKEN_PROGRAM_ID, 193 | rent: SYSVAR_RENT_PUBKEY, 194 | associatedTokenProgram: ASSOCIATED_PROGRAM_ID, 195 | systemProgram: SystemProgram.programId 196 | }) 197 | .instruction() 198 | ) 199 | tx.feePayer = user.publicKey 200 | tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash 201 | // console.log(await connection.simulateTransaction(tx)) 202 | const sig = await sendAndConfirmTransaction(connection, tx, [user], { skipPreflight: true }) 203 | console.log("Successfully created pool : ", sig) 204 | } catch (error) { 205 | console.log("Error in creating pool", error) 206 | } 207 | }) 208 | 209 | it("add liquidity", async () => { 210 | try { 211 | 212 | const [poolPda] = PublicKey.findProgramAddressSync( 213 | [Buffer.from(POOL_SEED_PREFIX), mint1.toBuffer()], 214 | program.programId 215 | ) 216 | 217 | 218 | const [liquidityProviderAccount] = PublicKey.findProgramAddressSync( 219 | [Buffer.from(LP_SEED_PREFIX), poolPda.toBuffer(), user.publicKey.toBuffer()], 220 | program.programId 221 | ) 222 | const poolTokenOne = await getAssociatedTokenAddress( 223 | mint1, poolPda, true 224 | ) 225 | const userAta1 = await getAssociatedTokenAddress( 226 | mint1, user.publicKey 227 | ) 228 | 229 | const tx = new Transaction() 230 | .add( 231 | ComputeBudgetProgram.setComputeUnitLimit({ units: 200_000 }), 232 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 200_000 }), 233 | await program.methods 234 | .addLiquidity(new BN(1000000000000000), new BN(30000000000)) 235 | .accounts({ 236 | pool: poolPda, 237 | mintTokenOne: mint1, 238 | poolTokenAccountOne: poolTokenOne, 239 | userTokenAccountOne: userAta1, 240 | liquidityProviderAccount: liquidityProviderAccount, 241 | user: user.publicKey, 242 | tokenProgram: TOKEN_PROGRAM_ID, 243 | associatedTokenProgram: ASSOCIATED_PROGRAM_ID, 244 | rent: SYSVAR_RENT_PUBKEY, 245 | systemProgram: SystemProgram.programId 246 | }) 247 | .instruction() 248 | ) 249 | tx.feePayer = user.publicKey 250 | tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash 251 | // console.log(await connection.simulateTransaction(tx)) 252 | const sig = await sendAndConfirmTransaction(connection, tx, [user], { skipPreflight: true }) 253 | console.log("Successfully added liquidity : ", sig) 254 | 255 | const signature = await connection.requestAirdrop( 256 | poolPda, 257 | 10 ** 9 258 | ); 259 | // 2 - Fetch the latest blockhash 260 | const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash(); 261 | // 3 - Confirm transaction success 262 | await connection.confirmTransaction({ 263 | blockhash, 264 | lastValidBlockHeight, 265 | signature 266 | }, 'finalized'); 267 | 268 | } catch (error) { 269 | console.log("Error in adding liquidity", error) 270 | } 271 | }) 272 | 273 | it("Swap token", async () => { 274 | try { 275 | const [curveConfig] = PublicKey.findProgramAddressSync( 276 | [Buffer.from(curveSeed)], 277 | program.programId 278 | ) 279 | 280 | const [poolPda] = PublicKey.findProgramAddressSync( 281 | [Buffer.from(POOL_SEED_PREFIX), mint1.toBuffer()], 282 | program.programId 283 | ) 284 | const poolTokenOne = await getAssociatedTokenAddress( 285 | mint1, poolPda, true 286 | ) 287 | 288 | const userAta1 = await getAssociatedTokenAddress( 289 | mint1, user.publicKey 290 | ) 291 | 292 | 293 | const tx = new Transaction() 294 | .add( 295 | ComputeBudgetProgram.setComputeUnitLimit({ units: 200_000 }), 296 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 200_000 }), 297 | await program.methods 298 | .swap(new BN(200000000), new BN(2)) 299 | .accounts({ 300 | pool: poolPda, 301 | mintTokenOne: mint1, 302 | poolTokenAccountOne: poolTokenOne, 303 | userTokenAccountOne: userAta1, 304 | dexConfigurationAccount: curveConfig, 305 | user: user.publicKey, 306 | tokenProgram: TOKEN_PROGRAM_ID, 307 | associatedTokenProgram: ASSOCIATED_PROGRAM_ID, 308 | rent: SYSVAR_RENT_PUBKEY, 309 | systemProgram: SystemProgram.programId 310 | }) 311 | .instruction() 312 | ) 313 | tx.feePayer = user.publicKey 314 | tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash 315 | // console.log(await connection.simulateTransaction(tx)) 316 | const sig = await sendAndConfirmTransaction(connection, tx, [user], { skipPreflight: true }) 317 | console.log("Successfully swapped : ", sig) 318 | 319 | } catch (error) { 320 | console.log("Error in swap transaction", error) 321 | } 322 | }) 323 | 324 | }); 325 | 326 | function comparePublicKeys(pubkey1: PublicKey, pubkey2: PublicKey): number { 327 | const key1Bytes = pubkey1.toBuffer(); 328 | const key2Bytes = pubkey2.toBuffer(); 329 | 330 | for (let i = 0; i < key1Bytes.length; i++) { 331 | if (key1Bytes[i] > key2Bytes[i]) { 332 | return 1; 333 | } else if (key1Bytes[i] < key2Bytes[i]) { 334 | return -1; 335 | } 336 | } 337 | return 0; 338 | } 339 | 340 | function generateSeed(tokenOne: PublicKey, tokenTwo: PublicKey): string { 341 | return comparePublicKeys(tokenOne, tokenTwo) > 0 342 | ? `${tokenOne.toString()}${tokenTwo.toString()}` 343 | : `${tokenTwo.toString()}${tokenOne.toString()}`; 344 | } -------------------------------------------------------------------------------- /programs/pump-forking/src/state.rs: -------------------------------------------------------------------------------- 1 | use crate::consts::INITIAL_LAMPORTS_FOR_POOL; 2 | use crate::consts::PROPORTION; 3 | use crate::errors::CustomError; 4 | use anchor_lang::prelude::*; 5 | use anchor_lang::system_program; 6 | use anchor_spl::token::{self, Mint, Token, TokenAccount}; 7 | 8 | // Pre-calculated constants for optimization 9 | const DECIMAL_SCALE: f64 = 1_000_000_000.0; 10 | const DECIMAL_SCALE_SQUARED: f64 = 1_000_000.0 * 1_000_000_000.0; 11 | const PROPORTION_F64: f64 = PROPORTION as f64; 12 | 13 | #[account] 14 | pub struct CurveConfiguration { 15 | pub fees: f64, 16 | } 17 | 18 | impl CurveConfiguration { 19 | pub const SEED: &'static str = "CurveConfiguration"; 20 | 21 | // Discriminator (8) + f64 (8) 22 | pub const ACCOUNT_SIZE: usize = 8 + 32 + 8; 23 | 24 | pub fn new(fees: f64) -> Self { 25 | Self { fees } 26 | } 27 | } 28 | 29 | #[account] 30 | pub struct LiquidityProvider { 31 | pub shares: u64, // The number of shares this provider holds in the liquidity pool ( didnt add to contract now ) 32 | } 33 | 34 | impl LiquidityProvider { 35 | pub const SEED_PREFIX: &'static str = "LiqudityProvider"; // Prefix for generating PDAs 36 | 37 | // Discriminator (8) + f64 (8) 38 | pub const ACCOUNT_SIZE: usize = 8 + 8; 39 | } 40 | 41 | #[account] 42 | pub struct LiquidityPool { 43 | pub creator: Pubkey, // Public key of the pool creator 44 | pub token: Pubkey, // Public key of the token in the liquidity pool 45 | pub total_supply: u64, // Total supply of liquidity tokens 46 | pub reserve_token: u64, // Reserve amount of token in the pool 47 | pub reserve_sol: u64, // Reserve amount of sol_token in the pool 48 | pub bump: u8, // Nonce for the program-derived address 49 | } 50 | 51 | impl LiquidityPool { 52 | pub const POOL_SEED_PREFIX: &'static str = "liquidity_pool"; 53 | pub const SOL_VAULT_PREFIX: &'static str = "liquidity_sol_vault"; 54 | 55 | // Discriminator (8) + Pubkey (32) + Pubkey (32) + totalsupply (8) 56 | // + reserve one (8) + reserve two (8) + Bump (1) 57 | pub const ACCOUNT_SIZE: usize = 8 + 32 + 32 + 8 + 8 + 8 + 1; 58 | 59 | // Constructor to initialize a LiquidityPool with two tokens and a bump for the PDA 60 | pub fn new(creator: Pubkey, token: Pubkey, bump: u8) -> Self { 61 | Self { 62 | creator, 63 | token, 64 | total_supply: 0_u64, 65 | reserve_token: 0_u64, 66 | reserve_sol: 0_u64, 67 | bump, 68 | } 69 | } 70 | } 71 | 72 | pub trait LiquidityPoolAccount<'info> { 73 | // Updates the token reserves in the liquidity pool 74 | fn update_reserves(&mut self, reserve_token: u64, reserve_sol: u64) -> Result<()>; 75 | 76 | // Allows adding liquidity by depositing an amount of two tokens and getting back pool shares 77 | fn add_liquidity( 78 | &mut self, 79 | token_accounts: ( 80 | &mut Account<'info, Mint>, 81 | &mut Account<'info, TokenAccount>, 82 | &mut Account<'info, TokenAccount>, 83 | ), 84 | pool_sol_vault: &mut AccountInfo<'info>, 85 | authority: &Signer<'info>, 86 | token_program: &Program<'info, Token>, 87 | system_program: &Program<'info, System>, 88 | ) -> Result<()>; 89 | 90 | // Allows removing liquidity by burning pool shares and receiving back a proportionate amount of tokens 91 | fn remove_liquidity( 92 | &mut self, 93 | token_accounts: ( 94 | &mut Account<'info, Mint>, 95 | &mut Account<'info, TokenAccount>, 96 | &mut Account<'info, TokenAccount>, 97 | ), 98 | pool_sol_account: &mut AccountInfo<'info>, 99 | authority: &Signer<'info>, 100 | bump: u8, 101 | token_program: &Program<'info, Token>, 102 | system_program: &Program<'info, System>, 103 | ) -> Result<()>; 104 | 105 | fn buy( 106 | &mut self, 107 | // bonding_configuration_account: &Account<'info, CurveConfiguration>, 108 | token_accounts: ( 109 | &mut Account<'info, Mint>, 110 | &mut Account<'info, TokenAccount>, 111 | &mut Account<'info, TokenAccount>, 112 | ), 113 | pool_sol_vault: &mut AccountInfo<'info>, 114 | amount: u64, 115 | authority: &Signer<'info>, 116 | token_program: &Program<'info, Token>, 117 | system_program: &Program<'info, System>, 118 | ) -> Result<()>; 119 | 120 | fn sell( 121 | &mut self, 122 | // bonding_configuration_account: &Account<'info, CurveConfiguration>, 123 | token_accounts: ( 124 | &mut Account<'info, Mint>, 125 | &mut Account<'info, TokenAccount>, 126 | &mut Account<'info, TokenAccount>, 127 | ), 128 | pool_sol_vault: &mut AccountInfo<'info>, 129 | amount: u64, 130 | bump: u8, 131 | authority: &Signer<'info>, 132 | token_program: &Program<'info, Token>, 133 | system_program: &Program<'info, System>, 134 | ) -> Result<()>; 135 | 136 | fn transfer_token_from_pool( 137 | &self, 138 | from: &Account<'info, TokenAccount>, 139 | to: &Account<'info, TokenAccount>, 140 | amount: u64, 141 | token_program: &Program<'info, Token>, 142 | ) -> Result<()>; 143 | 144 | fn transfer_token_to_pool( 145 | &self, 146 | from: &Account<'info, TokenAccount>, 147 | to: &Account<'info, TokenAccount>, 148 | amount: u64, 149 | authority: &Signer<'info>, 150 | token_program: &Program<'info, Token>, 151 | ) -> Result<()>; 152 | 153 | fn transfer_sol_to_pool( 154 | &self, 155 | from: &Signer<'info>, 156 | to: &mut AccountInfo<'info>, 157 | amount: u64, 158 | system_program: &Program<'info, System>, 159 | ) -> Result<()>; 160 | 161 | fn transfer_sol_from_pool( 162 | &self, 163 | from: &mut AccountInfo<'info>, 164 | to: &Signer<'info>, 165 | amount: u64, 166 | bump: u8, 167 | system_program: &Program<'info, System>, 168 | ) -> Result<()>; 169 | } 170 | 171 | impl<'info> LiquidityPoolAccount<'info> for Account<'info, LiquidityPool> { 172 | fn update_reserves(&mut self, reserve_token: u64, reserve_sol: u64) -> Result<()> { 173 | self.reserve_token = reserve_token; 174 | self.reserve_sol = reserve_sol; 175 | Ok(()) 176 | } 177 | 178 | fn add_liquidity( 179 | &mut self, 180 | token_accounts: ( 181 | &mut Account<'info, Mint>, 182 | &mut Account<'info, TokenAccount>, 183 | &mut Account<'info, TokenAccount>, 184 | ), 185 | pool_sol_vault: &mut AccountInfo<'info>, 186 | authority: &Signer<'info>, 187 | token_program: &Program<'info, Token>, 188 | system_program: &Program<'info, System>, 189 | ) -> Result<()> { 190 | let token_supply = token_accounts.0.supply; 191 | 192 | // Transfer tokens to pool 193 | self.transfer_token_to_pool( 194 | token_accounts.2, 195 | token_accounts.1, 196 | token_supply, 197 | authority, 198 | token_program, 199 | )?; 200 | 201 | // Transfer SOL to pool 202 | self.transfer_sol_to_pool( 203 | authority, 204 | pool_sol_vault, 205 | INITIAL_LAMPORTS_FOR_POOL, 206 | system_program, 207 | )?; 208 | 209 | // Set total supply and update reserves 210 | self.total_supply = 1_000_000_000_000_000_000; 211 | self.update_reserves(token_supply, INITIAL_LAMPORTS_FOR_POOL)?; 212 | 213 | Ok(()) 214 | } 215 | 216 | fn remove_liquidity( 217 | &mut self, 218 | token_accounts: ( 219 | &mut Account<'info, Mint>, 220 | &mut Account<'info, TokenAccount>, 221 | &mut Account<'info, TokenAccount>, 222 | ), 223 | pool_sol_vault: &mut AccountInfo<'info>, 224 | authority: &Signer<'info>, 225 | bump: u8, 226 | token_program: &Program<'info, Token>, 227 | system_program: &Program<'info, System>, 228 | ) -> Result<()> { 229 | let token_amount = token_accounts.1.amount; 230 | self.transfer_token_from_pool( 231 | token_accounts.1, 232 | token_accounts.2, 233 | token_amount, 234 | token_program, 235 | )?; 236 | 237 | let sol_amount = pool_sol_vault.to_account_info().lamports(); 238 | self.transfer_sol_from_pool(pool_sol_vault, authority, sol_amount, bump, system_program)?; 239 | 240 | Ok(()) 241 | } 242 | 243 | fn buy( 244 | &mut self, 245 | token_accounts: ( 246 | &mut Account<'info, Mint>, 247 | &mut Account<'info, TokenAccount>, 248 | &mut Account<'info, TokenAccount>, 249 | ), 250 | pool_sol_vault: &mut AccountInfo<'info>, 251 | amount: u64, 252 | authority: &Signer<'info>, 253 | token_program: &Program<'info, Token>, 254 | system_program: &Program<'info, System>, 255 | ) -> Result<()> { 256 | // Early validation 257 | if amount == 0 { 258 | return err!(CustomError::InvalidAmount); 259 | } 260 | 261 | // Optimized calculation: pre-compute sold tokens amount 262 | let sold_tokens: u64 = match self.total_supply.checked_sub(self.reserve_token) { 263 | Some(val) => val, 264 | None => return err!(CustomError::OverflowOrUnderflowOccurred), 265 | }; 266 | 267 | // Convert to f64 with optimized scaling 268 | let bought_amount = (sold_tokens as f64) / DECIMAL_SCALE_SQUARED; 269 | 270 | // Calculate amount out using bonding curve formula 271 | let amount_scaled = (amount as f64) / DECIMAL_SCALE; 272 | let bought_amount_squared = bought_amount * bought_amount; 273 | let root_val = (PROPORTION_F64 * amount_scaled + bought_amount_squared).sqrt(); 274 | 275 | // Calculate tokens to receive 276 | let amount_out_f64 = (root_val - bought_amount) * DECIMAL_SCALE_SQUARED; 277 | let amount_out = amount_out_f64.round() as u64; 278 | 279 | // Validate sufficient tokens in reserve 280 | if amount_out > self.reserve_token { 281 | return err!(CustomError::NotEnoughTokenInVault); 282 | } 283 | 284 | // Update reserves with checked arithmetic 285 | self.reserve_sol = match self.reserve_sol.checked_add(amount) { 286 | Some(val) => val, 287 | None => return err!(CustomError::OverflowOrUnderflowOccurred), 288 | }; 289 | 290 | self.reserve_token = match self.reserve_token.checked_sub(amount_out) { 291 | Some(val) => val, 292 | None => return err!(CustomError::OverflowOrUnderflowOccurred), 293 | }; 294 | 295 | // Execute transfers 296 | self.transfer_sol_to_pool(authority, pool_sol_vault, amount, system_program)?; 297 | self.transfer_token_from_pool( 298 | token_accounts.1, 299 | token_accounts.2, 300 | amount_out, 301 | token_program, 302 | )?; 303 | 304 | Ok(()) 305 | } 306 | 307 | fn sell( 308 | &mut self, 309 | token_accounts: ( 310 | &mut Account<'info, Mint>, 311 | &mut Account<'info, TokenAccount>, 312 | &mut Account<'info, TokenAccount>, 313 | ), 314 | pool_sol_vault: &mut AccountInfo<'info>, 315 | amount: u64, 316 | bump: u8, 317 | authority: &Signer<'info>, 318 | token_program: &Program<'info, Token>, 319 | system_program: &Program<'info, System>, 320 | ) -> Result<()> { 321 | // Early validation 322 | if amount == 0 { 323 | return err!(CustomError::InvalidAmount); 324 | } 325 | 326 | // Validate sufficient tokens to sell 327 | if amount > self.reserve_token { 328 | return err!(CustomError::TokenAmountToSellTooBig); 329 | } 330 | 331 | // Optimized calculation: pre-compute sold tokens before and after 332 | let sold_tokens_before: u64 = match self.total_supply.checked_sub(self.reserve_token) { 333 | Some(val) => val, 334 | None => return err!(CustomError::OverflowOrUnderflowOccurred), 335 | }; 336 | 337 | let reserve_token_after: u64 = match self.reserve_token.checked_add(amount) { 338 | Some(val) => val, 339 | None => return err!(CustomError::OverflowOrUnderflowOccurred), 340 | }; 341 | 342 | let sold_tokens_after: u64 = match self.total_supply.checked_sub(reserve_token_after) { 343 | Some(val) => val, 344 | None => return err!(CustomError::OverflowOrUnderflowOccurred), 345 | }; 346 | 347 | // Convert to f64 with optimized scaling 348 | let bought_amount = (sold_tokens_before as f64) / DECIMAL_SCALE_SQUARED; 349 | let result_amount = (sold_tokens_after as f64) / DECIMAL_SCALE_SQUARED; 350 | 351 | // Calculate SOL to receive using bonding curve formula 352 | let bought_amount_squared = bought_amount * bought_amount; 353 | let result_amount_squared = result_amount * result_amount; 354 | let amount_out_f64 = (bought_amount_squared - result_amount_squared) / PROPORTION_F64 * DECIMAL_SCALE; 355 | let amount_out = amount_out_f64.round() as u64; 356 | 357 | // Validate sufficient SOL in reserve 358 | if amount_out > self.reserve_sol { 359 | return err!(CustomError::NotEnoughSolInVault); 360 | } 361 | 362 | // Execute token transfer first (fail early if insufficient balance) 363 | self.transfer_token_to_pool( 364 | token_accounts.2, 365 | token_accounts.1, 366 | amount, 367 | authority, 368 | token_program, 369 | )?; 370 | 371 | // Update reserves with checked arithmetic 372 | self.reserve_token = reserve_token_after; 373 | self.reserve_sol = match self.reserve_sol.checked_sub(amount_out) { 374 | Some(val) => val, 375 | None => return err!(CustomError::OverflowOrUnderflowOccurred), 376 | }; 377 | 378 | // Execute SOL transfer 379 | self.transfer_sol_from_pool(pool_sol_vault, authority, amount_out, bump, system_program)?; 380 | 381 | Ok(()) 382 | } 383 | 384 | fn transfer_token_from_pool( 385 | &self, 386 | from: &Account<'info, TokenAccount>, 387 | to: &Account<'info, TokenAccount>, 388 | amount: u64, 389 | token_program: &Program<'info, Token>, 390 | ) -> Result<()> { 391 | token::transfer( 392 | CpiContext::new_with_signer( 393 | token_program.to_account_info(), 394 | token::Transfer { 395 | from: from.to_account_info(), 396 | to: to.to_account_info(), 397 | authority: self.to_account_info(), 398 | }, 399 | &[&[ 400 | LiquidityPool::POOL_SEED_PREFIX.as_bytes(), 401 | self.token.key().as_ref(), 402 | &[self.bump], 403 | ]], 404 | ), 405 | amount, 406 | )?; 407 | Ok(()) 408 | } 409 | 410 | fn transfer_token_to_pool( 411 | &self, 412 | from: &Account<'info, TokenAccount>, 413 | to: &Account<'info, TokenAccount>, 414 | amount: u64, 415 | authority: &Signer<'info>, 416 | token_program: &Program<'info, Token>, 417 | ) -> Result<()> { 418 | token::transfer( 419 | CpiContext::new( 420 | token_program.to_account_info(), 421 | token::Transfer { 422 | from: from.to_account_info(), 423 | to: to.to_account_info(), 424 | authority: authority.to_account_info(), 425 | }, 426 | ), 427 | amount, 428 | )?; 429 | Ok(()) 430 | } 431 | 432 | fn transfer_sol_from_pool( 433 | &self, 434 | from: &mut AccountInfo<'info>, 435 | to: &Signer<'info>, 436 | amount: u64, 437 | bump: u8, 438 | system_program: &Program<'info, System>, 439 | ) -> Result<()> { 440 | system_program::transfer( 441 | CpiContext::new_with_signer( 442 | system_program.to_account_info(), 443 | system_program::Transfer { 444 | from: from.clone(), 445 | to: to.to_account_info().clone(), 446 | }, 447 | &[&[ 448 | LiquidityPool::SOL_VAULT_PREFIX.as_bytes(), 449 | self.token.key().as_ref(), 450 | &[bump], 451 | ]], 452 | ), 453 | amount, 454 | )?; 455 | Ok(()) 456 | } 457 | 458 | fn transfer_sol_to_pool( 459 | &self, 460 | from: &Signer<'info>, 461 | to: &mut AccountInfo<'info>, 462 | amount: u64, 463 | system_program: &Program<'info, System>, 464 | ) -> Result<()> { 465 | system_program::transfer( 466 | CpiContext::new( 467 | system_program.to_account_info(), 468 | system_program::Transfer { 469 | from: from.to_account_info(), 470 | to: to.to_account_info(), 471 | }, 472 | ), 473 | amount, 474 | )?; 475 | Ok(()) 476 | } 477 | } 478 | -------------------------------------------------------------------------------- /cli/errors/anchor.ts: -------------------------------------------------------------------------------- 1 | export type AnchorError = 2 | | InstructionMissing 3 | | InstructionFallbackNotFound 4 | | InstructionDidNotDeserialize 5 | | InstructionDidNotSerialize 6 | | IdlInstructionStub 7 | | IdlInstructionInvalidProgram 8 | | ConstraintMut 9 | | ConstraintHasOne 10 | | ConstraintSigner 11 | | ConstraintRaw 12 | | ConstraintOwner 13 | | ConstraintRentExempt 14 | | ConstraintSeeds 15 | | ConstraintExecutable 16 | | ConstraintState 17 | | ConstraintAssociated 18 | | ConstraintAssociatedInit 19 | | ConstraintClose 20 | | ConstraintAddress 21 | | ConstraintZero 22 | | ConstraintTokenMint 23 | | ConstraintTokenOwner 24 | | ConstraintMintMintAuthority 25 | | ConstraintMintFreezeAuthority 26 | | ConstraintMintDecimals 27 | | ConstraintSpace 28 | | ConstraintAccountIsNone 29 | | RequireViolated 30 | | RequireEqViolated 31 | | RequireKeysEqViolated 32 | | RequireNeqViolated 33 | | RequireKeysNeqViolated 34 | | RequireGtViolated 35 | | RequireGteViolated 36 | | AccountDiscriminatorAlreadySet 37 | | AccountDiscriminatorNotFound 38 | | AccountDiscriminatorMismatch 39 | | AccountDidNotDeserialize 40 | | AccountDidNotSerialize 41 | | AccountNotEnoughKeys 42 | | AccountNotMutable 43 | | AccountOwnedByWrongProgram 44 | | InvalidProgramId 45 | | InvalidProgramExecutable 46 | | AccountNotSigner 47 | | AccountNotSystemOwned 48 | | AccountNotInitialized 49 | | AccountNotProgramData 50 | | AccountNotAssociatedTokenAccount 51 | | AccountSysvarMismatch 52 | | AccountReallocExceedsLimit 53 | | AccountDuplicateReallocs 54 | | DeclaredProgramIdMismatch 55 | | Deprecated 56 | 57 | export class InstructionMissing extends Error { 58 | static readonly code = 100 59 | readonly code = 100 60 | readonly name = "InstructionMissing" 61 | readonly msg = "8 byte instruction identifier not provided" 62 | 63 | constructor(readonly logs?: string[]) { 64 | super("100: 8 byte instruction identifier not provided") 65 | } 66 | } 67 | 68 | export class InstructionFallbackNotFound extends Error { 69 | static readonly code = 101 70 | readonly code = 101 71 | readonly name = "InstructionFallbackNotFound" 72 | readonly msg = "Fallback functions are not supported" 73 | 74 | constructor(readonly logs?: string[]) { 75 | super("101: Fallback functions are not supported") 76 | } 77 | } 78 | 79 | export class InstructionDidNotDeserialize extends Error { 80 | static readonly code = 102 81 | readonly code = 102 82 | readonly name = "InstructionDidNotDeserialize" 83 | readonly msg = "The program could not deserialize the given instruction" 84 | 85 | constructor(readonly logs?: string[]) { 86 | super("102: The program could not deserialize the given instruction") 87 | } 88 | } 89 | 90 | export class InstructionDidNotSerialize extends Error { 91 | static readonly code = 103 92 | readonly code = 103 93 | readonly name = "InstructionDidNotSerialize" 94 | readonly msg = "The program could not serialize the given instruction" 95 | 96 | constructor(readonly logs?: string[]) { 97 | super("103: The program could not serialize the given instruction") 98 | } 99 | } 100 | 101 | export class IdlInstructionStub extends Error { 102 | static readonly code = 1000 103 | readonly code = 1000 104 | readonly name = "IdlInstructionStub" 105 | readonly msg = "The program was compiled without idl instructions" 106 | 107 | constructor(readonly logs?: string[]) { 108 | super("1000: The program was compiled without idl instructions") 109 | } 110 | } 111 | 112 | export class IdlInstructionInvalidProgram extends Error { 113 | static readonly code = 1001 114 | readonly code = 1001 115 | readonly name = "IdlInstructionInvalidProgram" 116 | readonly msg = 117 | "The transaction was given an invalid program for the IDL instruction" 118 | 119 | constructor(readonly logs?: string[]) { 120 | super( 121 | "1001: The transaction was given an invalid program for the IDL instruction" 122 | ) 123 | } 124 | } 125 | 126 | export class ConstraintMut extends Error { 127 | static readonly code = 2000 128 | readonly code = 2000 129 | readonly name = "ConstraintMut" 130 | readonly msg = "A mut constraint was violated" 131 | 132 | constructor(readonly logs?: string[]) { 133 | super("2000: A mut constraint was violated") 134 | } 135 | } 136 | 137 | export class ConstraintHasOne extends Error { 138 | static readonly code = 2001 139 | readonly code = 2001 140 | readonly name = "ConstraintHasOne" 141 | readonly msg = "A has one constraint was violated" 142 | 143 | constructor(readonly logs?: string[]) { 144 | super("2001: A has one constraint was violated") 145 | } 146 | } 147 | 148 | export class ConstraintSigner extends Error { 149 | static readonly code = 2002 150 | readonly code = 2002 151 | readonly name = "ConstraintSigner" 152 | readonly msg = "A signer constraint was violated" 153 | 154 | constructor(readonly logs?: string[]) { 155 | super("2002: A signer constraint was violated") 156 | } 157 | } 158 | 159 | export class ConstraintRaw extends Error { 160 | static readonly code = 2003 161 | readonly code = 2003 162 | readonly name = "ConstraintRaw" 163 | readonly msg = "A raw constraint was violated" 164 | 165 | constructor(readonly logs?: string[]) { 166 | super("2003: A raw constraint was violated") 167 | } 168 | } 169 | 170 | export class ConstraintOwner extends Error { 171 | static readonly code = 2004 172 | readonly code = 2004 173 | readonly name = "ConstraintOwner" 174 | readonly msg = "An owner constraint was violated" 175 | 176 | constructor(readonly logs?: string[]) { 177 | super("2004: An owner constraint was violated") 178 | } 179 | } 180 | 181 | export class ConstraintRentExempt extends Error { 182 | static readonly code = 2005 183 | readonly code = 2005 184 | readonly name = "ConstraintRentExempt" 185 | readonly msg = "A rent exemption constraint was violated" 186 | 187 | constructor(readonly logs?: string[]) { 188 | super("2005: A rent exemption constraint was violated") 189 | } 190 | } 191 | 192 | export class ConstraintSeeds extends Error { 193 | static readonly code = 2006 194 | readonly code = 2006 195 | readonly name = "ConstraintSeeds" 196 | readonly msg = "A seeds constraint was violated" 197 | 198 | constructor(readonly logs?: string[]) { 199 | super("2006: A seeds constraint was violated") 200 | } 201 | } 202 | 203 | export class ConstraintExecutable extends Error { 204 | static readonly code = 2007 205 | readonly code = 2007 206 | readonly name = "ConstraintExecutable" 207 | readonly msg = "An executable constraint was violated" 208 | 209 | constructor(readonly logs?: string[]) { 210 | super("2007: An executable constraint was violated") 211 | } 212 | } 213 | 214 | export class ConstraintState extends Error { 215 | static readonly code = 2008 216 | readonly code = 2008 217 | readonly name = "ConstraintState" 218 | readonly msg = "Deprecated Error, feel free to replace with something else" 219 | 220 | constructor(readonly logs?: string[]) { 221 | super("2008: Deprecated Error, feel free to replace with something else") 222 | } 223 | } 224 | 225 | export class ConstraintAssociated extends Error { 226 | static readonly code = 2009 227 | readonly code = 2009 228 | readonly name = "ConstraintAssociated" 229 | readonly msg = "An associated constraint was violated" 230 | 231 | constructor(readonly logs?: string[]) { 232 | super("2009: An associated constraint was violated") 233 | } 234 | } 235 | 236 | export class ConstraintAssociatedInit extends Error { 237 | static readonly code = 2010 238 | readonly code = 2010 239 | readonly name = "ConstraintAssociatedInit" 240 | readonly msg = "An associated init constraint was violated" 241 | 242 | constructor(readonly logs?: string[]) { 243 | super("2010: An associated init constraint was violated") 244 | } 245 | } 246 | 247 | export class ConstraintClose extends Error { 248 | static readonly code = 2011 249 | readonly code = 2011 250 | readonly name = "ConstraintClose" 251 | readonly msg = "A close constraint was violated" 252 | 253 | constructor(readonly logs?: string[]) { 254 | super("2011: A close constraint was violated") 255 | } 256 | } 257 | 258 | export class ConstraintAddress extends Error { 259 | static readonly code = 2012 260 | readonly code = 2012 261 | readonly name = "ConstraintAddress" 262 | readonly msg = "An address constraint was violated" 263 | 264 | constructor(readonly logs?: string[]) { 265 | super("2012: An address constraint was violated") 266 | } 267 | } 268 | 269 | export class ConstraintZero extends Error { 270 | static readonly code = 2013 271 | readonly code = 2013 272 | readonly name = "ConstraintZero" 273 | readonly msg = "Expected zero account discriminant" 274 | 275 | constructor(readonly logs?: string[]) { 276 | super("2013: Expected zero account discriminant") 277 | } 278 | } 279 | 280 | export class ConstraintTokenMint extends Error { 281 | static readonly code = 2014 282 | readonly code = 2014 283 | readonly name = "ConstraintTokenMint" 284 | readonly msg = "A token mint constraint was violated" 285 | 286 | constructor(readonly logs?: string[]) { 287 | super("2014: A token mint constraint was violated") 288 | } 289 | } 290 | 291 | export class ConstraintTokenOwner extends Error { 292 | static readonly code = 2015 293 | readonly code = 2015 294 | readonly name = "ConstraintTokenOwner" 295 | readonly msg = "A token owner constraint was violated" 296 | 297 | constructor(readonly logs?: string[]) { 298 | super("2015: A token owner constraint was violated") 299 | } 300 | } 301 | 302 | export class ConstraintMintMintAuthority extends Error { 303 | static readonly code = 2016 304 | readonly code = 2016 305 | readonly name = "ConstraintMintMintAuthority" 306 | readonly msg = "A mint mint authority constraint was violated" 307 | 308 | constructor(readonly logs?: string[]) { 309 | super("2016: A mint mint authority constraint was violated") 310 | } 311 | } 312 | 313 | export class ConstraintMintFreezeAuthority extends Error { 314 | static readonly code = 2017 315 | readonly code = 2017 316 | readonly name = "ConstraintMintFreezeAuthority" 317 | readonly msg = "A mint freeze authority constraint was violated" 318 | 319 | constructor(readonly logs?: string[]) { 320 | super("2017: A mint freeze authority constraint was violated") 321 | } 322 | } 323 | 324 | export class ConstraintMintDecimals extends Error { 325 | static readonly code = 2018 326 | readonly code = 2018 327 | readonly name = "ConstraintMintDecimals" 328 | readonly msg = "A mint decimals constraint was violated" 329 | 330 | constructor(readonly logs?: string[]) { 331 | super("2018: A mint decimals constraint was violated") 332 | } 333 | } 334 | 335 | export class ConstraintSpace extends Error { 336 | static readonly code = 2019 337 | readonly code = 2019 338 | readonly name = "ConstraintSpace" 339 | readonly msg = "A space constraint was violated" 340 | 341 | constructor(readonly logs?: string[]) { 342 | super("2019: A space constraint was violated") 343 | } 344 | } 345 | 346 | export class ConstraintAccountIsNone extends Error { 347 | static readonly code = 2020 348 | readonly code = 2020 349 | readonly name = "ConstraintAccountIsNone" 350 | readonly msg = "A required account for the constraint is None" 351 | 352 | constructor(readonly logs?: string[]) { 353 | super("2020: A required account for the constraint is None") 354 | } 355 | } 356 | 357 | export class RequireViolated extends Error { 358 | static readonly code = 2500 359 | readonly code = 2500 360 | readonly name = "RequireViolated" 361 | readonly msg = "A require expression was violated" 362 | 363 | constructor(readonly logs?: string[]) { 364 | super("2500: A require expression was violated") 365 | } 366 | } 367 | 368 | export class RequireEqViolated extends Error { 369 | static readonly code = 2501 370 | readonly code = 2501 371 | readonly name = "RequireEqViolated" 372 | readonly msg = "A require_eq expression was violated" 373 | 374 | constructor(readonly logs?: string[]) { 375 | super("2501: A require_eq expression was violated") 376 | } 377 | } 378 | 379 | export class RequireKeysEqViolated extends Error { 380 | static readonly code = 2502 381 | readonly code = 2502 382 | readonly name = "RequireKeysEqViolated" 383 | readonly msg = "A require_keys_eq expression was violated" 384 | 385 | constructor(readonly logs?: string[]) { 386 | super("2502: A require_keys_eq expression was violated") 387 | } 388 | } 389 | 390 | export class RequireNeqViolated extends Error { 391 | static readonly code = 2503 392 | readonly code = 2503 393 | readonly name = "RequireNeqViolated" 394 | readonly msg = "A require_neq expression was violated" 395 | 396 | constructor(readonly logs?: string[]) { 397 | super("2503: A require_neq expression was violated") 398 | } 399 | } 400 | 401 | export class RequireKeysNeqViolated extends Error { 402 | static readonly code = 2504 403 | readonly code = 2504 404 | readonly name = "RequireKeysNeqViolated" 405 | readonly msg = "A require_keys_neq expression was violated" 406 | 407 | constructor(readonly logs?: string[]) { 408 | super("2504: A require_keys_neq expression was violated") 409 | } 410 | } 411 | 412 | export class RequireGtViolated extends Error { 413 | static readonly code = 2505 414 | readonly code = 2505 415 | readonly name = "RequireGtViolated" 416 | readonly msg = "A require_gt expression was violated" 417 | 418 | constructor(readonly logs?: string[]) { 419 | super("2505: A require_gt expression was violated") 420 | } 421 | } 422 | 423 | export class RequireGteViolated extends Error { 424 | static readonly code = 2506 425 | readonly code = 2506 426 | readonly name = "RequireGteViolated" 427 | readonly msg = "A require_gte expression was violated" 428 | 429 | constructor(readonly logs?: string[]) { 430 | super("2506: A require_gte expression was violated") 431 | } 432 | } 433 | 434 | export class AccountDiscriminatorAlreadySet extends Error { 435 | static readonly code = 3000 436 | readonly code = 3000 437 | readonly name = "AccountDiscriminatorAlreadySet" 438 | readonly msg = "The account discriminator was already set on this account" 439 | 440 | constructor(readonly logs?: string[]) { 441 | super("3000: The account discriminator was already set on this account") 442 | } 443 | } 444 | 445 | export class AccountDiscriminatorNotFound extends Error { 446 | static readonly code = 3001 447 | readonly code = 3001 448 | readonly name = "AccountDiscriminatorNotFound" 449 | readonly msg = "No 8 byte discriminator was found on the account" 450 | 451 | constructor(readonly logs?: string[]) { 452 | super("3001: No 8 byte discriminator was found on the account") 453 | } 454 | } 455 | 456 | export class AccountDiscriminatorMismatch extends Error { 457 | static readonly code = 3002 458 | readonly code = 3002 459 | readonly name = "AccountDiscriminatorMismatch" 460 | readonly msg = "8 byte discriminator did not match what was expected" 461 | 462 | constructor(readonly logs?: string[]) { 463 | super("3002: 8 byte discriminator did not match what was expected") 464 | } 465 | } 466 | 467 | export class AccountDidNotDeserialize extends Error { 468 | static readonly code = 3003 469 | readonly code = 3003 470 | readonly name = "AccountDidNotDeserialize" 471 | readonly msg = "Failed to deserialize the account" 472 | 473 | constructor(readonly logs?: string[]) { 474 | super("3003: Failed to deserialize the account") 475 | } 476 | } 477 | 478 | export class AccountDidNotSerialize extends Error { 479 | static readonly code = 3004 480 | readonly code = 3004 481 | readonly name = "AccountDidNotSerialize" 482 | readonly msg = "Failed to serialize the account" 483 | 484 | constructor(readonly logs?: string[]) { 485 | super("3004: Failed to serialize the account") 486 | } 487 | } 488 | 489 | export class AccountNotEnoughKeys extends Error { 490 | static readonly code = 3005 491 | readonly code = 3005 492 | readonly name = "AccountNotEnoughKeys" 493 | readonly msg = "Not enough account keys given to the instruction" 494 | 495 | constructor(readonly logs?: string[]) { 496 | super("3005: Not enough account keys given to the instruction") 497 | } 498 | } 499 | 500 | export class AccountNotMutable extends Error { 501 | static readonly code = 3006 502 | readonly code = 3006 503 | readonly name = "AccountNotMutable" 504 | readonly msg = "The given account is not mutable" 505 | 506 | constructor(readonly logs?: string[]) { 507 | super("3006: The given account is not mutable") 508 | } 509 | } 510 | 511 | export class AccountOwnedByWrongProgram extends Error { 512 | static readonly code = 3007 513 | readonly code = 3007 514 | readonly name = "AccountOwnedByWrongProgram" 515 | readonly msg = 516 | "The given account is owned by a different program than expected" 517 | 518 | constructor(readonly logs?: string[]) { 519 | super( 520 | "3007: The given account is owned by a different program than expected" 521 | ) 522 | } 523 | } 524 | 525 | export class InvalidProgramId extends Error { 526 | static readonly code = 3008 527 | readonly code = 3008 528 | readonly name = "InvalidProgramId" 529 | readonly msg = "Program ID was not as expected" 530 | 531 | constructor(readonly logs?: string[]) { 532 | super("3008: Program ID was not as expected") 533 | } 534 | } 535 | 536 | export class InvalidProgramExecutable extends Error { 537 | static readonly code = 3009 538 | readonly code = 3009 539 | readonly name = "InvalidProgramExecutable" 540 | readonly msg = "Program account is not executable" 541 | 542 | constructor(readonly logs?: string[]) { 543 | super("3009: Program account is not executable") 544 | } 545 | } 546 | 547 | export class AccountNotSigner extends Error { 548 | static readonly code = 3010 549 | readonly code = 3010 550 | readonly name = "AccountNotSigner" 551 | readonly msg = "The given account did not sign" 552 | 553 | constructor(readonly logs?: string[]) { 554 | super("3010: The given account did not sign") 555 | } 556 | } 557 | 558 | export class AccountNotSystemOwned extends Error { 559 | static readonly code = 3011 560 | readonly code = 3011 561 | readonly name = "AccountNotSystemOwned" 562 | readonly msg = "The given account is not owned by the system program" 563 | 564 | constructor(readonly logs?: string[]) { 565 | super("3011: The given account is not owned by the system program") 566 | } 567 | } 568 | 569 | export class AccountNotInitialized extends Error { 570 | static readonly code = 3012 571 | readonly code = 3012 572 | readonly name = "AccountNotInitialized" 573 | readonly msg = "The program expected this account to be already initialized" 574 | 575 | constructor(readonly logs?: string[]) { 576 | super("3012: The program expected this account to be already initialized") 577 | } 578 | } 579 | 580 | export class AccountNotProgramData extends Error { 581 | static readonly code = 3013 582 | readonly code = 3013 583 | readonly name = "AccountNotProgramData" 584 | readonly msg = "The given account is not a program data account" 585 | 586 | constructor(readonly logs?: string[]) { 587 | super("3013: The given account is not a program data account") 588 | } 589 | } 590 | 591 | export class AccountNotAssociatedTokenAccount extends Error { 592 | static readonly code = 3014 593 | readonly code = 3014 594 | readonly name = "AccountNotAssociatedTokenAccount" 595 | readonly msg = "The given account is not the associated token account" 596 | 597 | constructor(readonly logs?: string[]) { 598 | super("3014: The given account is not the associated token account") 599 | } 600 | } 601 | 602 | export class AccountSysvarMismatch extends Error { 603 | static readonly code = 3015 604 | readonly code = 3015 605 | readonly name = "AccountSysvarMismatch" 606 | readonly msg = "The given public key does not match the required sysvar" 607 | 608 | constructor(readonly logs?: string[]) { 609 | super("3015: The given public key does not match the required sysvar") 610 | } 611 | } 612 | 613 | export class AccountReallocExceedsLimit extends Error { 614 | static readonly code = 3016 615 | readonly code = 3016 616 | readonly name = "AccountReallocExceedsLimit" 617 | readonly msg = 618 | "The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit" 619 | 620 | constructor(readonly logs?: string[]) { 621 | super( 622 | "3016: The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit" 623 | ) 624 | } 625 | } 626 | 627 | export class AccountDuplicateReallocs extends Error { 628 | static readonly code = 3017 629 | readonly code = 3017 630 | readonly name = "AccountDuplicateReallocs" 631 | readonly msg = "The account was duplicated for more than one reallocation" 632 | 633 | constructor(readonly logs?: string[]) { 634 | super("3017: The account was duplicated for more than one reallocation") 635 | } 636 | } 637 | 638 | export class DeclaredProgramIdMismatch extends Error { 639 | static readonly code = 4100 640 | readonly code = 4100 641 | readonly name = "DeclaredProgramIdMismatch" 642 | readonly msg = "The declared program id does not match the actual program id" 643 | 644 | constructor(readonly logs?: string[]) { 645 | super("4100: The declared program id does not match the actual program id") 646 | } 647 | } 648 | 649 | export class Deprecated extends Error { 650 | static readonly code = 5000 651 | readonly code = 5000 652 | readonly name = "Deprecated" 653 | readonly msg = "The API being used is deprecated and should no longer be used" 654 | 655 | constructor(readonly logs?: string[]) { 656 | super("5000: The API being used is deprecated and should no longer be used") 657 | } 658 | } 659 | 660 | export function fromCode(code: number, logs?: string[]): AnchorError | null { 661 | switch (code) { 662 | case 100: 663 | return new InstructionMissing(logs) 664 | case 101: 665 | return new InstructionFallbackNotFound(logs) 666 | case 102: 667 | return new InstructionDidNotDeserialize(logs) 668 | case 103: 669 | return new InstructionDidNotSerialize(logs) 670 | case 1000: 671 | return new IdlInstructionStub(logs) 672 | case 1001: 673 | return new IdlInstructionInvalidProgram(logs) 674 | case 2000: 675 | return new ConstraintMut(logs) 676 | case 2001: 677 | return new ConstraintHasOne(logs) 678 | case 2002: 679 | return new ConstraintSigner(logs) 680 | case 2003: 681 | return new ConstraintRaw(logs) 682 | case 2004: 683 | return new ConstraintOwner(logs) 684 | case 2005: 685 | return new ConstraintRentExempt(logs) 686 | case 2006: 687 | return new ConstraintSeeds(logs) 688 | case 2007: 689 | return new ConstraintExecutable(logs) 690 | case 2008: 691 | return new ConstraintState(logs) 692 | case 2009: 693 | return new ConstraintAssociated(logs) 694 | case 2010: 695 | return new ConstraintAssociatedInit(logs) 696 | case 2011: 697 | return new ConstraintClose(logs) 698 | case 2012: 699 | return new ConstraintAddress(logs) 700 | case 2013: 701 | return new ConstraintZero(logs) 702 | case 2014: 703 | return new ConstraintTokenMint(logs) 704 | case 2015: 705 | return new ConstraintTokenOwner(logs) 706 | case 2016: 707 | return new ConstraintMintMintAuthority(logs) 708 | case 2017: 709 | return new ConstraintMintFreezeAuthority(logs) 710 | case 2018: 711 | return new ConstraintMintDecimals(logs) 712 | case 2019: 713 | return new ConstraintSpace(logs) 714 | case 2020: 715 | return new ConstraintAccountIsNone(logs) 716 | case 2500: 717 | return new RequireViolated(logs) 718 | case 2501: 719 | return new RequireEqViolated(logs) 720 | case 2502: 721 | return new RequireKeysEqViolated(logs) 722 | case 2503: 723 | return new RequireNeqViolated(logs) 724 | case 2504: 725 | return new RequireKeysNeqViolated(logs) 726 | case 2505: 727 | return new RequireGtViolated(logs) 728 | case 2506: 729 | return new RequireGteViolated(logs) 730 | case 3000: 731 | return new AccountDiscriminatorAlreadySet(logs) 732 | case 3001: 733 | return new AccountDiscriminatorNotFound(logs) 734 | case 3002: 735 | return new AccountDiscriminatorMismatch(logs) 736 | case 3003: 737 | return new AccountDidNotDeserialize(logs) 738 | case 3004: 739 | return new AccountDidNotSerialize(logs) 740 | case 3005: 741 | return new AccountNotEnoughKeys(logs) 742 | case 3006: 743 | return new AccountNotMutable(logs) 744 | case 3007: 745 | return new AccountOwnedByWrongProgram(logs) 746 | case 3008: 747 | return new InvalidProgramId(logs) 748 | case 3009: 749 | return new InvalidProgramExecutable(logs) 750 | case 3010: 751 | return new AccountNotSigner(logs) 752 | case 3011: 753 | return new AccountNotSystemOwned(logs) 754 | case 3012: 755 | return new AccountNotInitialized(logs) 756 | case 3013: 757 | return new AccountNotProgramData(logs) 758 | case 3014: 759 | return new AccountNotAssociatedTokenAccount(logs) 760 | case 3015: 761 | return new AccountSysvarMismatch(logs) 762 | case 3016: 763 | return new AccountReallocExceedsLimit(logs) 764 | case 3017: 765 | return new AccountDuplicateReallocs(logs) 766 | case 4100: 767 | return new DeclaredProgramIdMismatch(logs) 768 | case 5000: 769 | return new Deprecated(logs) 770 | } 771 | 772 | return null 773 | } 774 | -------------------------------------------------------------------------------- /pump-idl.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", 3 | "metadata": { 4 | "name": "pump", 5 | "version": "0.1.0", 6 | "spec": "0.1.0", 7 | "description": "Created with Anchor" 8 | }, 9 | "instructions": [ 10 | { 11 | "name": "admin_set_creator", 12 | "docs": ["Allows Global::admin_set_creator_authority to override the bonding curve creator"], 13 | "discriminator": [69, 25, 171, 142, 57, 239, 13, 4], 14 | "accounts": [ 15 | { 16 | "name": "admin_set_creator_authority", 17 | "signer": true, 18 | "relations": ["global"] 19 | }, 20 | { 21 | "name": "global", 22 | "pda": { 23 | "seeds": [ 24 | { 25 | "kind": "const", 26 | "value": [103, 108, 111, 98, 97, 108] 27 | } 28 | ] 29 | } 30 | }, 31 | { 32 | "name": "mint" 33 | }, 34 | { 35 | "name": "bonding_curve", 36 | "writable": true, 37 | "pda": { 38 | "seeds": [ 39 | { 40 | "kind": "const", 41 | "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] 42 | }, 43 | { 44 | "kind": "account", 45 | "path": "mint" 46 | } 47 | ] 48 | } 49 | }, 50 | { 51 | "name": "event_authority", 52 | "pda": { 53 | "seeds": [ 54 | { 55 | "kind": "const", 56 | "value": [ 57 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 58 | ] 59 | } 60 | ] 61 | } 62 | }, 63 | { 64 | "name": "program" 65 | } 66 | ], 67 | "args": [ 68 | { 69 | "name": "creator", 70 | "type": "pubkey" 71 | } 72 | ] 73 | }, 74 | { 75 | "name": "admin_set_idl_authority", 76 | "discriminator": [8, 217, 96, 231, 144, 104, 192, 5], 77 | "accounts": [ 78 | { 79 | "name": "authority", 80 | "signer": true, 81 | "relations": ["global"] 82 | }, 83 | { 84 | "name": "global", 85 | "pda": { 86 | "seeds": [ 87 | { 88 | "kind": "const", 89 | "value": [103, 108, 111, 98, 97, 108] 90 | } 91 | ] 92 | } 93 | }, 94 | { 95 | "name": "idl_account", 96 | "writable": true 97 | }, 98 | { 99 | "name": "system_program", 100 | "address": "11111111111111111111111111111111" 101 | }, 102 | { 103 | "name": "program_signer", 104 | "pda": { 105 | "seeds": [] 106 | } 107 | }, 108 | { 109 | "name": "event_authority", 110 | "pda": { 111 | "seeds": [ 112 | { 113 | "kind": "const", 114 | "value": [ 115 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 116 | ] 117 | } 118 | ] 119 | } 120 | }, 121 | { 122 | "name": "program" 123 | } 124 | ], 125 | "args": [ 126 | { 127 | "name": "idl_authority", 128 | "type": "pubkey" 129 | } 130 | ] 131 | }, 132 | { 133 | "name": "admin_update_token_incentives", 134 | "discriminator": [209, 11, 115, 87, 213, 23, 124, 204], 135 | "accounts": [ 136 | { 137 | "name": "authority", 138 | "writable": true, 139 | "signer": true, 140 | "relations": ["global"] 141 | }, 142 | { 143 | "name": "global", 144 | "pda": { 145 | "seeds": [ 146 | { 147 | "kind": "const", 148 | "value": [103, 108, 111, 98, 97, 108] 149 | } 150 | ] 151 | } 152 | }, 153 | { 154 | "name": "global_volume_accumulator", 155 | "writable": true, 156 | "pda": { 157 | "seeds": [ 158 | { 159 | "kind": "const", 160 | "value": [ 161 | 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 162 | 109, 117, 108, 97, 116, 111, 114 163 | ] 164 | } 165 | ] 166 | } 167 | }, 168 | { 169 | "name": "mint" 170 | }, 171 | { 172 | "name": "global_incentive_token_account", 173 | "writable": true, 174 | "pda": { 175 | "seeds": [ 176 | { 177 | "kind": "account", 178 | "path": "global_volume_accumulator" 179 | }, 180 | { 181 | "kind": "account", 182 | "path": "token_program" 183 | }, 184 | { 185 | "kind": "account", 186 | "path": "mint" 187 | } 188 | ], 189 | "program": { 190 | "kind": "const", 191 | "value": [ 192 | 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 193 | 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 194 | ] 195 | } 196 | } 197 | }, 198 | { 199 | "name": "associated_token_program", 200 | "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" 201 | }, 202 | { 203 | "name": "system_program", 204 | "address": "11111111111111111111111111111111" 205 | }, 206 | { 207 | "name": "token_program" 208 | }, 209 | { 210 | "name": "event_authority", 211 | "pda": { 212 | "seeds": [ 213 | { 214 | "kind": "const", 215 | "value": [ 216 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 217 | ] 218 | } 219 | ] 220 | } 221 | }, 222 | { 223 | "name": "program" 224 | } 225 | ], 226 | "args": [ 227 | { 228 | "name": "start_time", 229 | "type": "i64" 230 | }, 231 | { 232 | "name": "end_time", 233 | "type": "i64" 234 | }, 235 | { 236 | "name": "seconds_in_a_day", 237 | "type": "i64" 238 | }, 239 | { 240 | "name": "day_number", 241 | "type": "u64" 242 | }, 243 | { 244 | "name": "pump_token_supply_per_day", 245 | "type": "u64" 246 | } 247 | ] 248 | }, 249 | { 250 | "name": "buy", 251 | "docs": ["Buys tokens from a bonding curve."], 252 | "discriminator": [102, 6, 61, 18, 1, 218, 235, 234], 253 | "accounts": [ 254 | { 255 | "name": "global", 256 | "pda": { 257 | "seeds": [ 258 | { 259 | "kind": "const", 260 | "value": [103, 108, 111, 98, 97, 108] 261 | } 262 | ] 263 | } 264 | }, 265 | { 266 | "name": "fee_recipient", 267 | "writable": true 268 | }, 269 | { 270 | "name": "mint" 271 | }, 272 | { 273 | "name": "bonding_curve", 274 | "writable": true, 275 | "pda": { 276 | "seeds": [ 277 | { 278 | "kind": "const", 279 | "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] 280 | }, 281 | { 282 | "kind": "account", 283 | "path": "mint" 284 | } 285 | ] 286 | } 287 | }, 288 | { 289 | "name": "associated_bonding_curve", 290 | "writable": true, 291 | "pda": { 292 | "seeds": [ 293 | { 294 | "kind": "account", 295 | "path": "bonding_curve" 296 | }, 297 | { 298 | "kind": "const", 299 | "value": [ 300 | 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 301 | 180, 133, 237, 95, 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169 302 | ] 303 | }, 304 | { 305 | "kind": "account", 306 | "path": "mint" 307 | } 308 | ], 309 | "program": { 310 | "kind": "const", 311 | "value": [ 312 | 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 313 | 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 314 | ] 315 | } 316 | } 317 | }, 318 | { 319 | "name": "associated_user", 320 | "writable": true 321 | }, 322 | { 323 | "name": "user", 324 | "writable": true, 325 | "signer": true 326 | }, 327 | { 328 | "name": "system_program", 329 | "address": "11111111111111111111111111111111" 330 | }, 331 | { 332 | "name": "token_program", 333 | "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 334 | }, 335 | { 336 | "name": "creator_vault", 337 | "writable": true, 338 | "pda": { 339 | "seeds": [ 340 | { 341 | "kind": "const", 342 | "value": [99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116] 343 | }, 344 | { 345 | "kind": "account", 346 | "path": "bonding_curve.creator", 347 | "account": "BondingCurve" 348 | } 349 | ] 350 | } 351 | }, 352 | { 353 | "name": "event_authority", 354 | "pda": { 355 | "seeds": [ 356 | { 357 | "kind": "const", 358 | "value": [ 359 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 360 | ] 361 | } 362 | ] 363 | } 364 | }, 365 | { 366 | "name": "program", 367 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 368 | }, 369 | { 370 | "name": "global_volume_accumulator", 371 | "writable": true, 372 | "pda": { 373 | "seeds": [ 374 | { 375 | "kind": "const", 376 | "value": [ 377 | 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 378 | 109, 117, 108, 97, 116, 111, 114 379 | ] 380 | } 381 | ] 382 | } 383 | }, 384 | { 385 | "name": "user_volume_accumulator", 386 | "writable": true, 387 | "pda": { 388 | "seeds": [ 389 | { 390 | "kind": "const", 391 | "value": [ 392 | 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, 393 | 108, 97, 116, 111, 114 394 | ] 395 | }, 396 | { 397 | "kind": "account", 398 | "path": "user" 399 | } 400 | ] 401 | } 402 | }, 403 | { 404 | "name": "fee_config", 405 | "pda": { 406 | "seeds": [ 407 | { 408 | "kind": "const", 409 | "value": [102, 101, 101, 95, 99, 111, 110, 102, 105, 103] 410 | }, 411 | { 412 | "kind": "const", 413 | "value": [ 414 | 1, 86, 224, 246, 147, 102, 90, 207, 68, 219, 21, 104, 191, 23, 91, 170, 81, 137, 415 | 203, 151, 245, 210, 255, 59, 101, 93, 43, 182, 253, 109, 24, 176 416 | ] 417 | } 418 | ], 419 | "program": { 420 | "kind": "account", 421 | "path": "fee_program" 422 | } 423 | } 424 | }, 425 | { 426 | "name": "fee_program", 427 | "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" 428 | } 429 | ], 430 | "args": [ 431 | { 432 | "name": "amount", 433 | "type": "u64" 434 | }, 435 | { 436 | "name": "max_sol_cost", 437 | "type": "u64" 438 | } 439 | ] 440 | }, 441 | { 442 | "name": "buy_exact_sol_in", 443 | "docs": [ 444 | "Given a budget of spendable SOL, buy at least min_tokens_out", 445 | "Account creation and fees will be deducted from the spendable SOL", 446 | "", 447 | "f(sol) = tokens, where tokens >= min_tokens_out and sol > rent + fees", 448 | "", 449 | "max_slippage = min_tokens_out = 1", 450 | "", 451 | "Make sure the sol budget is enough to cover creation of the following accounts (unless already created):", 452 | "- creator_vault: rent.minimum_balance(SystemAccount::LEN)", 453 | "- user_volume_accumulator: rent.minimum_balance(UserVolumeAccumulator::LEN)" 454 | ], 455 | "discriminator": [56, 252, 116, 8, 158, 223, 205, 95], 456 | "accounts": [ 457 | { 458 | "name": "global", 459 | "pda": { 460 | "seeds": [ 461 | { 462 | "kind": "const", 463 | "value": [103, 108, 111, 98, 97, 108] 464 | } 465 | ] 466 | } 467 | }, 468 | { 469 | "name": "fee_recipient", 470 | "writable": true 471 | }, 472 | { 473 | "name": "mint" 474 | }, 475 | { 476 | "name": "bonding_curve", 477 | "writable": true, 478 | "pda": { 479 | "seeds": [ 480 | { 481 | "kind": "const", 482 | "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] 483 | }, 484 | { 485 | "kind": "account", 486 | "path": "mint" 487 | } 488 | ] 489 | } 490 | }, 491 | { 492 | "name": "associated_bonding_curve", 493 | "writable": true, 494 | "pda": { 495 | "seeds": [ 496 | { 497 | "kind": "account", 498 | "path": "bonding_curve" 499 | }, 500 | { 501 | "kind": "const", 502 | "value": [ 503 | 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 504 | 180, 133, 237, 95, 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169 505 | ] 506 | }, 507 | { 508 | "kind": "account", 509 | "path": "mint" 510 | } 511 | ], 512 | "program": { 513 | "kind": "const", 514 | "value": [ 515 | 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 516 | 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 517 | ] 518 | } 519 | } 520 | }, 521 | { 522 | "name": "associated_user", 523 | "writable": true 524 | }, 525 | { 526 | "name": "user", 527 | "writable": true, 528 | "signer": true 529 | }, 530 | { 531 | "name": "system_program", 532 | "address": "11111111111111111111111111111111" 533 | }, 534 | { 535 | "name": "token_program", 536 | "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 537 | }, 538 | { 539 | "name": "creator_vault", 540 | "writable": true, 541 | "pda": { 542 | "seeds": [ 543 | { 544 | "kind": "const", 545 | "value": [99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116] 546 | }, 547 | { 548 | "kind": "account", 549 | "path": "bonding_curve.creator", 550 | "account": "BondingCurve" 551 | } 552 | ] 553 | } 554 | }, 555 | { 556 | "name": "event_authority", 557 | "pda": { 558 | "seeds": [ 559 | { 560 | "kind": "const", 561 | "value": [ 562 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 563 | ] 564 | } 565 | ] 566 | } 567 | }, 568 | { 569 | "name": "program", 570 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 571 | }, 572 | { 573 | "name": "global_volume_accumulator", 574 | "writable": true, 575 | "pda": { 576 | "seeds": [ 577 | { 578 | "kind": "const", 579 | "value": [ 580 | 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 581 | 109, 117, 108, 97, 116, 111, 114 582 | ] 583 | } 584 | ] 585 | } 586 | }, 587 | { 588 | "name": "user_volume_accumulator", 589 | "writable": true, 590 | "pda": { 591 | "seeds": [ 592 | { 593 | "kind": "const", 594 | "value": [ 595 | 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, 596 | 108, 97, 116, 111, 114 597 | ] 598 | }, 599 | { 600 | "kind": "account", 601 | "path": "user" 602 | } 603 | ] 604 | } 605 | }, 606 | { 607 | "name": "fee_config", 608 | "pda": { 609 | "seeds": [ 610 | { 611 | "kind": "const", 612 | "value": [102, 101, 101, 95, 99, 111, 110, 102, 105, 103] 613 | }, 614 | { 615 | "kind": "const", 616 | "value": [ 617 | 1, 86, 224, 246, 147, 102, 90, 207, 68, 219, 21, 104, 191, 23, 91, 170, 81, 137, 618 | 203, 151, 245, 210, 255, 59, 101, 93, 43, 182, 253, 109, 24, 176 619 | ] 620 | } 621 | ], 622 | "program": { 623 | "kind": "account", 624 | "path": "fee_program" 625 | } 626 | } 627 | }, 628 | { 629 | "name": "fee_program", 630 | "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" 631 | } 632 | ], 633 | "args": [ 634 | { 635 | "name": "spendable_sol_in", 636 | "type": "u64" 637 | }, 638 | { 639 | "name": "min_tokens_out", 640 | "type": "u64" 641 | } 642 | ] 643 | }, 644 | { 645 | "name": "claim_token_incentives", 646 | "discriminator": [16, 4, 71, 28, 204, 1, 40, 27], 647 | "accounts": [ 648 | { 649 | "name": "user" 650 | }, 651 | { 652 | "name": "user_ata", 653 | "writable": true, 654 | "pda": { 655 | "seeds": [ 656 | { 657 | "kind": "account", 658 | "path": "user" 659 | }, 660 | { 661 | "kind": "account", 662 | "path": "token_program" 663 | }, 664 | { 665 | "kind": "account", 666 | "path": "mint" 667 | } 668 | ], 669 | "program": { 670 | "kind": "const", 671 | "value": [ 672 | 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 673 | 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 674 | ] 675 | } 676 | } 677 | }, 678 | { 679 | "name": "global_volume_accumulator", 680 | "pda": { 681 | "seeds": [ 682 | { 683 | "kind": "const", 684 | "value": [ 685 | 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 686 | 109, 117, 108, 97, 116, 111, 114 687 | ] 688 | } 689 | ] 690 | } 691 | }, 692 | { 693 | "name": "global_incentive_token_account", 694 | "writable": true, 695 | "pda": { 696 | "seeds": [ 697 | { 698 | "kind": "account", 699 | "path": "global_volume_accumulator" 700 | }, 701 | { 702 | "kind": "account", 703 | "path": "token_program" 704 | }, 705 | { 706 | "kind": "account", 707 | "path": "mint" 708 | } 709 | ], 710 | "program": { 711 | "kind": "const", 712 | "value": [ 713 | 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 714 | 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 715 | ] 716 | } 717 | } 718 | }, 719 | { 720 | "name": "user_volume_accumulator", 721 | "writable": true, 722 | "pda": { 723 | "seeds": [ 724 | { 725 | "kind": "const", 726 | "value": [ 727 | 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, 728 | 108, 97, 116, 111, 114 729 | ] 730 | }, 731 | { 732 | "kind": "account", 733 | "path": "user" 734 | } 735 | ] 736 | } 737 | }, 738 | { 739 | "name": "mint", 740 | "relations": ["global_volume_accumulator"] 741 | }, 742 | { 743 | "name": "token_program" 744 | }, 745 | { 746 | "name": "system_program", 747 | "address": "11111111111111111111111111111111" 748 | }, 749 | { 750 | "name": "associated_token_program", 751 | "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" 752 | }, 753 | { 754 | "name": "event_authority", 755 | "pda": { 756 | "seeds": [ 757 | { 758 | "kind": "const", 759 | "value": [ 760 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 761 | ] 762 | } 763 | ] 764 | } 765 | }, 766 | { 767 | "name": "program", 768 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 769 | }, 770 | { 771 | "name": "payer", 772 | "writable": true, 773 | "signer": true 774 | } 775 | ], 776 | "args": [] 777 | }, 778 | { 779 | "name": "close_user_volume_accumulator", 780 | "discriminator": [249, 69, 164, 218, 150, 103, 84, 138], 781 | "accounts": [ 782 | { 783 | "name": "user", 784 | "writable": true, 785 | "signer": true 786 | }, 787 | { 788 | "name": "user_volume_accumulator", 789 | "writable": true, 790 | "pda": { 791 | "seeds": [ 792 | { 793 | "kind": "const", 794 | "value": [ 795 | 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, 796 | 108, 97, 116, 111, 114 797 | ] 798 | }, 799 | { 800 | "kind": "account", 801 | "path": "user" 802 | } 803 | ] 804 | } 805 | }, 806 | { 807 | "name": "event_authority", 808 | "pda": { 809 | "seeds": [ 810 | { 811 | "kind": "const", 812 | "value": [ 813 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 814 | ] 815 | } 816 | ] 817 | } 818 | }, 819 | { 820 | "name": "program" 821 | } 822 | ], 823 | "args": [] 824 | }, 825 | { 826 | "name": "collect_creator_fee", 827 | "docs": ["Collects creator_fee from creator_vault to the coin creator account"], 828 | "discriminator": [20, 22, 86, 123, 198, 28, 219, 132], 829 | "accounts": [ 830 | { 831 | "name": "creator", 832 | "writable": true 833 | }, 834 | { 835 | "name": "creator_vault", 836 | "writable": true, 837 | "pda": { 838 | "seeds": [ 839 | { 840 | "kind": "const", 841 | "value": [99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116] 842 | }, 843 | { 844 | "kind": "account", 845 | "path": "creator" 846 | } 847 | ] 848 | } 849 | }, 850 | { 851 | "name": "system_program", 852 | "address": "11111111111111111111111111111111" 853 | }, 854 | { 855 | "name": "event_authority", 856 | "pda": { 857 | "seeds": [ 858 | { 859 | "kind": "const", 860 | "value": [ 861 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 862 | ] 863 | } 864 | ] 865 | } 866 | }, 867 | { 868 | "name": "program" 869 | } 870 | ], 871 | "args": [] 872 | }, 873 | { 874 | "name": "create", 875 | "docs": ["Creates a new coin and bonding curve."], 876 | "discriminator": [24, 30, 200, 40, 5, 28, 7, 119], 877 | "accounts": [ 878 | { 879 | "name": "mint", 880 | "writable": true, 881 | "signer": true 882 | }, 883 | { 884 | "name": "mint_authority", 885 | "pda": { 886 | "seeds": [ 887 | { 888 | "kind": "const", 889 | "value": [109, 105, 110, 116, 45, 97, 117, 116, 104, 111, 114, 105, 116, 121] 890 | } 891 | ] 892 | } 893 | }, 894 | { 895 | "name": "bonding_curve", 896 | "writable": true, 897 | "pda": { 898 | "seeds": [ 899 | { 900 | "kind": "const", 901 | "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] 902 | }, 903 | { 904 | "kind": "account", 905 | "path": "mint" 906 | } 907 | ] 908 | } 909 | }, 910 | { 911 | "name": "associated_bonding_curve", 912 | "writable": true, 913 | "pda": { 914 | "seeds": [ 915 | { 916 | "kind": "account", 917 | "path": "bonding_curve" 918 | }, 919 | { 920 | "kind": "const", 921 | "value": [ 922 | 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 923 | 180, 133, 237, 95, 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169 924 | ] 925 | }, 926 | { 927 | "kind": "account", 928 | "path": "mint" 929 | } 930 | ], 931 | "program": { 932 | "kind": "const", 933 | "value": [ 934 | 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 935 | 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 936 | ] 937 | } 938 | } 939 | }, 940 | { 941 | "name": "global", 942 | "pda": { 943 | "seeds": [ 944 | { 945 | "kind": "const", 946 | "value": [103, 108, 111, 98, 97, 108] 947 | } 948 | ] 949 | } 950 | }, 951 | { 952 | "name": "mpl_token_metadata", 953 | "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" 954 | }, 955 | { 956 | "name": "metadata", 957 | "writable": true, 958 | "pda": { 959 | "seeds": [ 960 | { 961 | "kind": "const", 962 | "value": [109, 101, 116, 97, 100, 97, 116, 97] 963 | }, 964 | { 965 | "kind": "const", 966 | "value": [ 967 | 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 968 | 108, 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 969 | ] 970 | }, 971 | { 972 | "kind": "account", 973 | "path": "mint" 974 | } 975 | ], 976 | "program": { 977 | "kind": "account", 978 | "path": "mpl_token_metadata" 979 | } 980 | } 981 | }, 982 | { 983 | "name": "user", 984 | "writable": true, 985 | "signer": true 986 | }, 987 | { 988 | "name": "system_program", 989 | "address": "11111111111111111111111111111111" 990 | }, 991 | { 992 | "name": "token_program", 993 | "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 994 | }, 995 | { 996 | "name": "associated_token_program", 997 | "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" 998 | }, 999 | { 1000 | "name": "rent", 1001 | "address": "SysvarRent111111111111111111111111111111111" 1002 | }, 1003 | { 1004 | "name": "event_authority", 1005 | "pda": { 1006 | "seeds": [ 1007 | { 1008 | "kind": "const", 1009 | "value": [ 1010 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 1011 | ] 1012 | } 1013 | ] 1014 | } 1015 | }, 1016 | { 1017 | "name": "program" 1018 | } 1019 | ], 1020 | "args": [ 1021 | { 1022 | "name": "name", 1023 | "type": "string" 1024 | }, 1025 | { 1026 | "name": "symbol", 1027 | "type": "string" 1028 | }, 1029 | { 1030 | "name": "uri", 1031 | "type": "string" 1032 | }, 1033 | { 1034 | "name": "creator", 1035 | "type": "pubkey" 1036 | } 1037 | ] 1038 | }, 1039 | { 1040 | "name": "extend_account", 1041 | "docs": ["Extends the size of program-owned accounts"], 1042 | "discriminator": [234, 102, 194, 203, 150, 72, 62, 229], 1043 | "accounts": [ 1044 | { 1045 | "name": "account", 1046 | "writable": true 1047 | }, 1048 | { 1049 | "name": "user", 1050 | "signer": true 1051 | }, 1052 | { 1053 | "name": "system_program", 1054 | "address": "11111111111111111111111111111111" 1055 | }, 1056 | { 1057 | "name": "event_authority", 1058 | "pda": { 1059 | "seeds": [ 1060 | { 1061 | "kind": "const", 1062 | "value": [ 1063 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 1064 | ] 1065 | } 1066 | ] 1067 | } 1068 | }, 1069 | { 1070 | "name": "program" 1071 | } 1072 | ], 1073 | "args": [] 1074 | }, 1075 | { 1076 | "name": "init_user_volume_accumulator", 1077 | "discriminator": [94, 6, 202, 115, 255, 96, 232, 183], 1078 | "accounts": [ 1079 | { 1080 | "name": "payer", 1081 | "writable": true, 1082 | "signer": true 1083 | }, 1084 | { 1085 | "name": "user" 1086 | }, 1087 | { 1088 | "name": "user_volume_accumulator", 1089 | "writable": true, 1090 | "pda": { 1091 | "seeds": [ 1092 | { 1093 | "kind": "const", 1094 | "value": [ 1095 | 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, 1096 | 108, 97, 116, 111, 114 1097 | ] 1098 | }, 1099 | { 1100 | "kind": "account", 1101 | "path": "user" 1102 | } 1103 | ] 1104 | } 1105 | }, 1106 | { 1107 | "name": "system_program", 1108 | "address": "11111111111111111111111111111111" 1109 | }, 1110 | { 1111 | "name": "event_authority", 1112 | "pda": { 1113 | "seeds": [ 1114 | { 1115 | "kind": "const", 1116 | "value": [ 1117 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 1118 | ] 1119 | } 1120 | ] 1121 | } 1122 | }, 1123 | { 1124 | "name": "program" 1125 | } 1126 | ], 1127 | "args": [] 1128 | }, 1129 | { 1130 | "name": "initialize", 1131 | "docs": ["Creates the global state."], 1132 | "discriminator": [175, 175, 109, 31, 13, 152, 155, 237], 1133 | "accounts": [ 1134 | { 1135 | "name": "global", 1136 | "writable": true, 1137 | "pda": { 1138 | "seeds": [ 1139 | { 1140 | "kind": "const", 1141 | "value": [103, 108, 111, 98, 97, 108] 1142 | } 1143 | ] 1144 | } 1145 | }, 1146 | { 1147 | "name": "user", 1148 | "writable": true, 1149 | "signer": true 1150 | }, 1151 | { 1152 | "name": "system_program", 1153 | "address": "11111111111111111111111111111111" 1154 | } 1155 | ], 1156 | "args": [] 1157 | }, 1158 | { 1159 | "name": "migrate", 1160 | "docs": ["Migrates liquidity to pump_amm if the bonding curve is complete"], 1161 | "discriminator": [155, 234, 231, 146, 236, 158, 162, 30], 1162 | "accounts": [ 1163 | { 1164 | "name": "global", 1165 | "pda": { 1166 | "seeds": [ 1167 | { 1168 | "kind": "const", 1169 | "value": [103, 108, 111, 98, 97, 108] 1170 | } 1171 | ] 1172 | } 1173 | }, 1174 | { 1175 | "name": "withdraw_authority", 1176 | "writable": true, 1177 | "relations": ["global"] 1178 | }, 1179 | { 1180 | "name": "mint" 1181 | }, 1182 | { 1183 | "name": "bonding_curve", 1184 | "writable": true, 1185 | "pda": { 1186 | "seeds": [ 1187 | { 1188 | "kind": "const", 1189 | "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] 1190 | }, 1191 | { 1192 | "kind": "account", 1193 | "path": "mint" 1194 | } 1195 | ] 1196 | } 1197 | }, 1198 | { 1199 | "name": "associated_bonding_curve", 1200 | "writable": true, 1201 | "pda": { 1202 | "seeds": [ 1203 | { 1204 | "kind": "account", 1205 | "path": "bonding_curve" 1206 | }, 1207 | { 1208 | "kind": "const", 1209 | "value": [ 1210 | 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 1211 | 180, 133, 237, 95, 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169 1212 | ] 1213 | }, 1214 | { 1215 | "kind": "account", 1216 | "path": "mint" 1217 | } 1218 | ], 1219 | "program": { 1220 | "kind": "const", 1221 | "value": [ 1222 | 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 1223 | 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 1224 | ] 1225 | } 1226 | } 1227 | }, 1228 | { 1229 | "name": "user", 1230 | "signer": true 1231 | }, 1232 | { 1233 | "name": "system_program", 1234 | "address": "11111111111111111111111111111111" 1235 | }, 1236 | { 1237 | "name": "token_program", 1238 | "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 1239 | }, 1240 | { 1241 | "name": "pump_amm", 1242 | "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" 1243 | }, 1244 | { 1245 | "name": "pool", 1246 | "writable": true, 1247 | "pda": { 1248 | "seeds": [ 1249 | { 1250 | "kind": "const", 1251 | "value": [112, 111, 111, 108] 1252 | }, 1253 | { 1254 | "kind": "const", 1255 | "value": [0, 0] 1256 | }, 1257 | { 1258 | "kind": "account", 1259 | "path": "pool_authority" 1260 | }, 1261 | { 1262 | "kind": "account", 1263 | "path": "mint" 1264 | }, 1265 | { 1266 | "kind": "account", 1267 | "path": "wsol_mint" 1268 | } 1269 | ], 1270 | "program": { 1271 | "kind": "account", 1272 | "path": "pump_amm" 1273 | } 1274 | } 1275 | }, 1276 | { 1277 | "name": "pool_authority", 1278 | "writable": true, 1279 | "pda": { 1280 | "seeds": [ 1281 | { 1282 | "kind": "const", 1283 | "value": [112, 111, 111, 108, 45, 97, 117, 116, 104, 111, 114, 105, 116, 121] 1284 | }, 1285 | { 1286 | "kind": "account", 1287 | "path": "mint" 1288 | } 1289 | ] 1290 | } 1291 | }, 1292 | { 1293 | "name": "pool_authority_mint_account", 1294 | "writable": true, 1295 | "pda": { 1296 | "seeds": [ 1297 | { 1298 | "kind": "account", 1299 | "path": "pool_authority" 1300 | }, 1301 | { 1302 | "kind": "account", 1303 | "path": "token_program" 1304 | }, 1305 | { 1306 | "kind": "account", 1307 | "path": "mint" 1308 | } 1309 | ], 1310 | "program": { 1311 | "kind": "account", 1312 | "path": "associated_token_program" 1313 | } 1314 | } 1315 | }, 1316 | { 1317 | "name": "pool_authority_wsol_account", 1318 | "writable": true, 1319 | "pda": { 1320 | "seeds": [ 1321 | { 1322 | "kind": "account", 1323 | "path": "pool_authority" 1324 | }, 1325 | { 1326 | "kind": "account", 1327 | "path": "token_program" 1328 | }, 1329 | { 1330 | "kind": "account", 1331 | "path": "wsol_mint" 1332 | } 1333 | ], 1334 | "program": { 1335 | "kind": "account", 1336 | "path": "associated_token_program" 1337 | } 1338 | } 1339 | }, 1340 | { 1341 | "name": "amm_global_config", 1342 | "pda": { 1343 | "seeds": [ 1344 | { 1345 | "kind": "const", 1346 | "value": [103, 108, 111, 98, 97, 108, 95, 99, 111, 110, 102, 105, 103] 1347 | } 1348 | ], 1349 | "program": { 1350 | "kind": "account", 1351 | "path": "pump_amm" 1352 | } 1353 | } 1354 | }, 1355 | { 1356 | "name": "wsol_mint", 1357 | "address": "So11111111111111111111111111111111111111112" 1358 | }, 1359 | { 1360 | "name": "lp_mint", 1361 | "writable": true, 1362 | "pda": { 1363 | "seeds": [ 1364 | { 1365 | "kind": "const", 1366 | "value": [112, 111, 111, 108, 95, 108, 112, 95, 109, 105, 110, 116] 1367 | }, 1368 | { 1369 | "kind": "account", 1370 | "path": "pool" 1371 | } 1372 | ], 1373 | "program": { 1374 | "kind": "account", 1375 | "path": "pump_amm" 1376 | } 1377 | } 1378 | }, 1379 | { 1380 | "name": "user_pool_token_account", 1381 | "writable": true, 1382 | "pda": { 1383 | "seeds": [ 1384 | { 1385 | "kind": "account", 1386 | "path": "pool_authority" 1387 | }, 1388 | { 1389 | "kind": "account", 1390 | "path": "token_2022_program" 1391 | }, 1392 | { 1393 | "kind": "account", 1394 | "path": "lp_mint" 1395 | } 1396 | ], 1397 | "program": { 1398 | "kind": "account", 1399 | "path": "associated_token_program" 1400 | } 1401 | } 1402 | }, 1403 | { 1404 | "name": "pool_base_token_account", 1405 | "writable": true, 1406 | "pda": { 1407 | "seeds": [ 1408 | { 1409 | "kind": "account", 1410 | "path": "pool" 1411 | }, 1412 | { 1413 | "kind": "account", 1414 | "path": "token_program" 1415 | }, 1416 | { 1417 | "kind": "account", 1418 | "path": "mint" 1419 | } 1420 | ], 1421 | "program": { 1422 | "kind": "account", 1423 | "path": "associated_token_program" 1424 | } 1425 | } 1426 | }, 1427 | { 1428 | "name": "pool_quote_token_account", 1429 | "writable": true, 1430 | "pda": { 1431 | "seeds": [ 1432 | { 1433 | "kind": "account", 1434 | "path": "pool" 1435 | }, 1436 | { 1437 | "kind": "account", 1438 | "path": "token_program" 1439 | }, 1440 | { 1441 | "kind": "account", 1442 | "path": "wsol_mint" 1443 | } 1444 | ], 1445 | "program": { 1446 | "kind": "account", 1447 | "path": "associated_token_program" 1448 | } 1449 | } 1450 | }, 1451 | { 1452 | "name": "token_2022_program", 1453 | "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" 1454 | }, 1455 | { 1456 | "name": "associated_token_program", 1457 | "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" 1458 | }, 1459 | { 1460 | "name": "pump_amm_event_authority", 1461 | "pda": { 1462 | "seeds": [ 1463 | { 1464 | "kind": "const", 1465 | "value": [ 1466 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 1467 | ] 1468 | } 1469 | ], 1470 | "program": { 1471 | "kind": "account", 1472 | "path": "pump_amm" 1473 | } 1474 | } 1475 | }, 1476 | { 1477 | "name": "event_authority", 1478 | "pda": { 1479 | "seeds": [ 1480 | { 1481 | "kind": "const", 1482 | "value": [ 1483 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 1484 | ] 1485 | } 1486 | ] 1487 | } 1488 | }, 1489 | { 1490 | "name": "program" 1491 | } 1492 | ], 1493 | "args": [] 1494 | }, 1495 | { 1496 | "name": "sell", 1497 | "docs": ["Sells tokens into a bonding curve."], 1498 | "discriminator": [51, 230, 133, 164, 1, 127, 131, 173], 1499 | "accounts": [ 1500 | { 1501 | "name": "global", 1502 | "pda": { 1503 | "seeds": [ 1504 | { 1505 | "kind": "const", 1506 | "value": [103, 108, 111, 98, 97, 108] 1507 | } 1508 | ] 1509 | } 1510 | }, 1511 | { 1512 | "name": "fee_recipient", 1513 | "writable": true 1514 | }, 1515 | { 1516 | "name": "mint" 1517 | }, 1518 | { 1519 | "name": "bonding_curve", 1520 | "writable": true, 1521 | "pda": { 1522 | "seeds": [ 1523 | { 1524 | "kind": "const", 1525 | "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] 1526 | }, 1527 | { 1528 | "kind": "account", 1529 | "path": "mint" 1530 | } 1531 | ] 1532 | } 1533 | }, 1534 | { 1535 | "name": "associated_bonding_curve", 1536 | "writable": true, 1537 | "pda": { 1538 | "seeds": [ 1539 | { 1540 | "kind": "account", 1541 | "path": "bonding_curve" 1542 | }, 1543 | { 1544 | "kind": "const", 1545 | "value": [ 1546 | 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 1547 | 180, 133, 237, 95, 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169 1548 | ] 1549 | }, 1550 | { 1551 | "kind": "account", 1552 | "path": "mint" 1553 | } 1554 | ], 1555 | "program": { 1556 | "kind": "const", 1557 | "value": [ 1558 | 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 1559 | 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 1560 | ] 1561 | } 1562 | } 1563 | }, 1564 | { 1565 | "name": "associated_user", 1566 | "writable": true 1567 | }, 1568 | { 1569 | "name": "user", 1570 | "writable": true, 1571 | "signer": true 1572 | }, 1573 | { 1574 | "name": "system_program", 1575 | "address": "11111111111111111111111111111111" 1576 | }, 1577 | { 1578 | "name": "creator_vault", 1579 | "writable": true, 1580 | "pda": { 1581 | "seeds": [ 1582 | { 1583 | "kind": "const", 1584 | "value": [99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116] 1585 | }, 1586 | { 1587 | "kind": "account", 1588 | "path": "bonding_curve.creator", 1589 | "account": "BondingCurve" 1590 | } 1591 | ] 1592 | } 1593 | }, 1594 | { 1595 | "name": "token_program", 1596 | "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" 1597 | }, 1598 | { 1599 | "name": "event_authority", 1600 | "pda": { 1601 | "seeds": [ 1602 | { 1603 | "kind": "const", 1604 | "value": [ 1605 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 1606 | ] 1607 | } 1608 | ] 1609 | } 1610 | }, 1611 | { 1612 | "name": "program", 1613 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" 1614 | }, 1615 | { 1616 | "name": "fee_config", 1617 | "pda": { 1618 | "seeds": [ 1619 | { 1620 | "kind": "const", 1621 | "value": [102, 101, 101, 95, 99, 111, 110, 102, 105, 103] 1622 | }, 1623 | { 1624 | "kind": "const", 1625 | "value": [ 1626 | 1, 86, 224, 246, 147, 102, 90, 207, 68, 219, 21, 104, 191, 23, 91, 170, 81, 137, 1627 | 203, 151, 245, 210, 255, 59, 101, 93, 43, 182, 253, 109, 24, 176 1628 | ] 1629 | } 1630 | ], 1631 | "program": { 1632 | "kind": "account", 1633 | "path": "fee_program" 1634 | } 1635 | } 1636 | }, 1637 | { 1638 | "name": "fee_program", 1639 | "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" 1640 | } 1641 | ], 1642 | "args": [ 1643 | { 1644 | "name": "amount", 1645 | "type": "u64" 1646 | }, 1647 | { 1648 | "name": "min_sol_output", 1649 | "type": "u64" 1650 | } 1651 | ] 1652 | }, 1653 | { 1654 | "name": "set_creator", 1655 | "docs": [ 1656 | "Allows Global::set_creator_authority to set the bonding curve creator from Metaplex metadata or input argument" 1657 | ], 1658 | "discriminator": [254, 148, 255, 112, 207, 142, 170, 165], 1659 | "accounts": [ 1660 | { 1661 | "name": "set_creator_authority", 1662 | "signer": true, 1663 | "relations": ["global"] 1664 | }, 1665 | { 1666 | "name": "global", 1667 | "pda": { 1668 | "seeds": [ 1669 | { 1670 | "kind": "const", 1671 | "value": [103, 108, 111, 98, 97, 108] 1672 | } 1673 | ] 1674 | } 1675 | }, 1676 | { 1677 | "name": "mint" 1678 | }, 1679 | { 1680 | "name": "metadata", 1681 | "pda": { 1682 | "seeds": [ 1683 | { 1684 | "kind": "const", 1685 | "value": [109, 101, 116, 97, 100, 97, 116, 97] 1686 | }, 1687 | { 1688 | "kind": "const", 1689 | "value": [ 1690 | 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 1691 | 108, 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 1692 | ] 1693 | }, 1694 | { 1695 | "kind": "account", 1696 | "path": "mint" 1697 | } 1698 | ], 1699 | "program": { 1700 | "kind": "const", 1701 | "value": [ 1702 | 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 108, 1703 | 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 1704 | ] 1705 | } 1706 | } 1707 | }, 1708 | { 1709 | "name": "bonding_curve", 1710 | "writable": true, 1711 | "pda": { 1712 | "seeds": [ 1713 | { 1714 | "kind": "const", 1715 | "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] 1716 | }, 1717 | { 1718 | "kind": "account", 1719 | "path": "mint" 1720 | } 1721 | ] 1722 | } 1723 | }, 1724 | { 1725 | "name": "event_authority", 1726 | "pda": { 1727 | "seeds": [ 1728 | { 1729 | "kind": "const", 1730 | "value": [ 1731 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 1732 | ] 1733 | } 1734 | ] 1735 | } 1736 | }, 1737 | { 1738 | "name": "program" 1739 | } 1740 | ], 1741 | "args": [ 1742 | { 1743 | "name": "creator", 1744 | "type": "pubkey" 1745 | } 1746 | ] 1747 | }, 1748 | { 1749 | "name": "set_metaplex_creator", 1750 | "docs": ["Syncs the bonding curve creator with the Metaplex metadata creator if it exists"], 1751 | "discriminator": [138, 96, 174, 217, 48, 85, 197, 246], 1752 | "accounts": [ 1753 | { 1754 | "name": "mint" 1755 | }, 1756 | { 1757 | "name": "metadata", 1758 | "pda": { 1759 | "seeds": [ 1760 | { 1761 | "kind": "const", 1762 | "value": [109, 101, 116, 97, 100, 97, 116, 97] 1763 | }, 1764 | { 1765 | "kind": "const", 1766 | "value": [ 1767 | 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 1768 | 108, 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 1769 | ] 1770 | }, 1771 | { 1772 | "kind": "account", 1773 | "path": "mint" 1774 | } 1775 | ], 1776 | "program": { 1777 | "kind": "const", 1778 | "value": [ 1779 | 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 108, 1780 | 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 1781 | ] 1782 | } 1783 | } 1784 | }, 1785 | { 1786 | "name": "bonding_curve", 1787 | "writable": true, 1788 | "pda": { 1789 | "seeds": [ 1790 | { 1791 | "kind": "const", 1792 | "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] 1793 | }, 1794 | { 1795 | "kind": "account", 1796 | "path": "mint" 1797 | } 1798 | ] 1799 | } 1800 | }, 1801 | { 1802 | "name": "event_authority", 1803 | "pda": { 1804 | "seeds": [ 1805 | { 1806 | "kind": "const", 1807 | "value": [ 1808 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 1809 | ] 1810 | } 1811 | ] 1812 | } 1813 | }, 1814 | { 1815 | "name": "program" 1816 | } 1817 | ], 1818 | "args": [] 1819 | }, 1820 | { 1821 | "name": "set_params", 1822 | "docs": ["Sets the global state parameters."], 1823 | "discriminator": [27, 234, 178, 52, 147, 2, 187, 141], 1824 | "accounts": [ 1825 | { 1826 | "name": "global", 1827 | "writable": true, 1828 | "pda": { 1829 | "seeds": [ 1830 | { 1831 | "kind": "const", 1832 | "value": [103, 108, 111, 98, 97, 108] 1833 | } 1834 | ] 1835 | } 1836 | }, 1837 | { 1838 | "name": "authority", 1839 | "writable": true, 1840 | "signer": true, 1841 | "relations": ["global"] 1842 | }, 1843 | { 1844 | "name": "event_authority", 1845 | "pda": { 1846 | "seeds": [ 1847 | { 1848 | "kind": "const", 1849 | "value": [ 1850 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 1851 | ] 1852 | } 1853 | ] 1854 | } 1855 | }, 1856 | { 1857 | "name": "program" 1858 | } 1859 | ], 1860 | "args": [ 1861 | { 1862 | "name": "initial_virtual_token_reserves", 1863 | "type": "u64" 1864 | }, 1865 | { 1866 | "name": "initial_virtual_sol_reserves", 1867 | "type": "u64" 1868 | }, 1869 | { 1870 | "name": "initial_real_token_reserves", 1871 | "type": "u64" 1872 | }, 1873 | { 1874 | "name": "token_total_supply", 1875 | "type": "u64" 1876 | }, 1877 | { 1878 | "name": "fee_basis_points", 1879 | "type": "u64" 1880 | }, 1881 | { 1882 | "name": "withdraw_authority", 1883 | "type": "pubkey" 1884 | }, 1885 | { 1886 | "name": "enable_migrate", 1887 | "type": "bool" 1888 | }, 1889 | { 1890 | "name": "pool_migration_fee", 1891 | "type": "u64" 1892 | }, 1893 | { 1894 | "name": "creator_fee_basis_points", 1895 | "type": "u64" 1896 | }, 1897 | { 1898 | "name": "set_creator_authority", 1899 | "type": "pubkey" 1900 | }, 1901 | { 1902 | "name": "admin_set_creator_authority", 1903 | "type": "pubkey" 1904 | } 1905 | ] 1906 | }, 1907 | { 1908 | "name": "sync_user_volume_accumulator", 1909 | "discriminator": [86, 31, 192, 87, 163, 87, 79, 238], 1910 | "accounts": [ 1911 | { 1912 | "name": "user" 1913 | }, 1914 | { 1915 | "name": "global_volume_accumulator", 1916 | "pda": { 1917 | "seeds": [ 1918 | { 1919 | "kind": "const", 1920 | "value": [ 1921 | 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 1922 | 109, 117, 108, 97, 116, 111, 114 1923 | ] 1924 | } 1925 | ] 1926 | } 1927 | }, 1928 | { 1929 | "name": "user_volume_accumulator", 1930 | "writable": true, 1931 | "pda": { 1932 | "seeds": [ 1933 | { 1934 | "kind": "const", 1935 | "value": [ 1936 | 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, 1937 | 108, 97, 116, 111, 114 1938 | ] 1939 | }, 1940 | { 1941 | "kind": "account", 1942 | "path": "user" 1943 | } 1944 | ] 1945 | } 1946 | }, 1947 | { 1948 | "name": "event_authority", 1949 | "pda": { 1950 | "seeds": [ 1951 | { 1952 | "kind": "const", 1953 | "value": [ 1954 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 1955 | ] 1956 | } 1957 | ] 1958 | } 1959 | }, 1960 | { 1961 | "name": "program" 1962 | } 1963 | ], 1964 | "args": [] 1965 | }, 1966 | { 1967 | "name": "update_global_authority", 1968 | "discriminator": [227, 181, 74, 196, 208, 21, 97, 213], 1969 | "accounts": [ 1970 | { 1971 | "name": "global", 1972 | "writable": true, 1973 | "pda": { 1974 | "seeds": [ 1975 | { 1976 | "kind": "const", 1977 | "value": [103, 108, 111, 98, 97, 108] 1978 | } 1979 | ] 1980 | } 1981 | }, 1982 | { 1983 | "name": "authority", 1984 | "signer": true, 1985 | "relations": ["global"] 1986 | }, 1987 | { 1988 | "name": "new_authority" 1989 | }, 1990 | { 1991 | "name": "event_authority", 1992 | "pda": { 1993 | "seeds": [ 1994 | { 1995 | "kind": "const", 1996 | "value": [ 1997 | 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 1998 | ] 1999 | } 2000 | ] 2001 | } 2002 | }, 2003 | { 2004 | "name": "program" 2005 | } 2006 | ], 2007 | "args": [] 2008 | } 2009 | ], 2010 | "accounts": [ 2011 | { 2012 | "name": "BondingCurve", 2013 | "discriminator": [23, 183, 248, 55, 96, 216, 172, 96] 2014 | }, 2015 | { 2016 | "name": "FeeConfig", 2017 | "discriminator": [143, 52, 146, 187, 219, 123, 76, 155] 2018 | }, 2019 | { 2020 | "name": "Global", 2021 | "discriminator": [167, 232, 232, 177, 200, 108, 114, 127] 2022 | }, 2023 | { 2024 | "name": "GlobalVolumeAccumulator", 2025 | "discriminator": [202, 42, 246, 43, 142, 190, 30, 255] 2026 | }, 2027 | { 2028 | "name": "UserVolumeAccumulator", 2029 | "discriminator": [86, 255, 112, 14, 102, 53, 154, 250] 2030 | } 2031 | ], 2032 | "events": [ 2033 | { 2034 | "name": "AdminSetCreatorEvent", 2035 | "discriminator": [64, 69, 192, 104, 29, 30, 25, 107] 2036 | }, 2037 | { 2038 | "name": "AdminSetIdlAuthorityEvent", 2039 | "discriminator": [245, 59, 70, 34, 75, 185, 109, 92] 2040 | }, 2041 | { 2042 | "name": "AdminUpdateTokenIncentivesEvent", 2043 | "discriminator": [147, 250, 108, 120, 247, 29, 67, 222] 2044 | }, 2045 | { 2046 | "name": "ClaimTokenIncentivesEvent", 2047 | "discriminator": [79, 172, 246, 49, 205, 91, 206, 232] 2048 | }, 2049 | { 2050 | "name": "CloseUserVolumeAccumulatorEvent", 2051 | "discriminator": [146, 159, 189, 172, 146, 88, 56, 244] 2052 | }, 2053 | { 2054 | "name": "CollectCreatorFeeEvent", 2055 | "discriminator": [122, 2, 127, 1, 14, 191, 12, 175] 2056 | }, 2057 | { 2058 | "name": "CompleteEvent", 2059 | "discriminator": [95, 114, 97, 156, 212, 46, 152, 8] 2060 | }, 2061 | { 2062 | "name": "CompletePumpAmmMigrationEvent", 2063 | "discriminator": [189, 233, 93, 185, 92, 148, 234, 148] 2064 | }, 2065 | { 2066 | "name": "CreateEvent", 2067 | "discriminator": [27, 114, 169, 77, 222, 235, 99, 118] 2068 | }, 2069 | { 2070 | "name": "ExtendAccountEvent", 2071 | "discriminator": [97, 97, 215, 144, 93, 146, 22, 124] 2072 | }, 2073 | { 2074 | "name": "InitUserVolumeAccumulatorEvent", 2075 | "discriminator": [134, 36, 13, 72, 232, 101, 130, 216] 2076 | }, 2077 | { 2078 | "name": "SetCreatorEvent", 2079 | "discriminator": [237, 52, 123, 37, 245, 251, 72, 210] 2080 | }, 2081 | { 2082 | "name": "SetMetaplexCreatorEvent", 2083 | "discriminator": [142, 203, 6, 32, 127, 105, 191, 162] 2084 | }, 2085 | { 2086 | "name": "SetParamsEvent", 2087 | "discriminator": [223, 195, 159, 246, 62, 48, 143, 131] 2088 | }, 2089 | { 2090 | "name": "SyncUserVolumeAccumulatorEvent", 2091 | "discriminator": [197, 122, 167, 124, 116, 81, 91, 255] 2092 | }, 2093 | { 2094 | "name": "TradeEvent", 2095 | "discriminator": [189, 219, 127, 211, 78, 230, 97, 238] 2096 | }, 2097 | { 2098 | "name": "UpdateGlobalAuthorityEvent", 2099 | "discriminator": [182, 195, 137, 42, 35, 206, 207, 247] 2100 | } 2101 | ], 2102 | "errors": [ 2103 | { 2104 | "code": 6000, 2105 | "name": "NotAuthorized", 2106 | "msg": "The given account is not authorized to execute this instruction." 2107 | }, 2108 | { 2109 | "code": 6001, 2110 | "name": "AlreadyInitialized", 2111 | "msg": "The program is already initialized." 2112 | }, 2113 | { 2114 | "code": 6002, 2115 | "name": "TooMuchSolRequired", 2116 | "msg": "slippage: Too much SOL required to buy the given amount of tokens." 2117 | }, 2118 | { 2119 | "code": 6003, 2120 | "name": "TooLittleSolReceived", 2121 | "msg": "slippage: Too little SOL received to sell the given amount of tokens." 2122 | }, 2123 | { 2124 | "code": 6004, 2125 | "name": "MintDoesNotMatchBondingCurve", 2126 | "msg": "The mint does not match the bonding curve." 2127 | }, 2128 | { 2129 | "code": 6005, 2130 | "name": "BondingCurveComplete", 2131 | "msg": "The bonding curve has completed and liquidity migrated to raydium." 2132 | }, 2133 | { 2134 | "code": 6006, 2135 | "name": "BondingCurveNotComplete", 2136 | "msg": "The bonding curve has not completed." 2137 | }, 2138 | { 2139 | "code": 6007, 2140 | "name": "NotInitialized", 2141 | "msg": "The program is not initialized." 2142 | }, 2143 | { 2144 | "code": 6008, 2145 | "name": "WithdrawTooFrequent", 2146 | "msg": "Withdraw too frequent" 2147 | }, 2148 | { 2149 | "code": 6009, 2150 | "name": "NewSizeShouldBeGreaterThanCurrentSize", 2151 | "msg": "new_size should be > current_size" 2152 | }, 2153 | { 2154 | "code": 6010, 2155 | "name": "AccountTypeNotSupported", 2156 | "msg": "Account type not supported" 2157 | }, 2158 | { 2159 | "code": 6011, 2160 | "name": "InitialRealTokenReservesShouldBeLessThanTokenTotalSupply", 2161 | "msg": "initial_real_token_reserves should be less than token_total_supply" 2162 | }, 2163 | { 2164 | "code": 6012, 2165 | "name": "InitialVirtualTokenReservesShouldBeGreaterThanInitialRealTokenReserves", 2166 | "msg": "initial_virtual_token_reserves should be greater than initial_real_token_reserves" 2167 | }, 2168 | { 2169 | "code": 6013, 2170 | "name": "FeeBasisPointsGreaterThanMaximum", 2171 | "msg": "fee_basis_points greater than maximum" 2172 | }, 2173 | { 2174 | "code": 6014, 2175 | "name": "AllZerosWithdrawAuthority", 2176 | "msg": "Withdraw authority cannot be set to System Program ID" 2177 | }, 2178 | { 2179 | "code": 6015, 2180 | "name": "PoolMigrationFeeShouldBeLessThanFinalRealSolReserves", 2181 | "msg": "pool_migration_fee should be less than final_real_sol_reserves" 2182 | }, 2183 | { 2184 | "code": 6016, 2185 | "name": "PoolMigrationFeeShouldBeGreaterThanCreatorFeePlusMaxMigrateFees", 2186 | "msg": "pool_migration_fee should be greater than creator_fee + MAX_MIGRATE_FEES" 2187 | }, 2188 | { 2189 | "code": 6017, 2190 | "name": "DisabledWithdraw", 2191 | "msg": "Migrate instruction is disabled" 2192 | }, 2193 | { 2194 | "code": 6018, 2195 | "name": "DisabledMigrate", 2196 | "msg": "Migrate instruction is disabled" 2197 | }, 2198 | { 2199 | "code": 6019, 2200 | "name": "InvalidCreator", 2201 | "msg": "Invalid creator pubkey" 2202 | }, 2203 | { 2204 | "code": 6020, 2205 | "name": "BuyZeroAmount", 2206 | "msg": "Buy zero amount" 2207 | }, 2208 | { 2209 | "code": 6021, 2210 | "name": "NotEnoughTokensToBuy", 2211 | "msg": "Not enough tokens to buy" 2212 | }, 2213 | { 2214 | "code": 6022, 2215 | "name": "SellZeroAmount", 2216 | "msg": "Sell zero amount" 2217 | }, 2218 | { 2219 | "code": 6023, 2220 | "name": "NotEnoughTokensToSell", 2221 | "msg": "Not enough tokens to sell" 2222 | }, 2223 | { 2224 | "code": 6024, 2225 | "name": "Overflow", 2226 | "msg": "Overflow" 2227 | }, 2228 | { 2229 | "code": 6025, 2230 | "name": "Truncation", 2231 | "msg": "Truncation" 2232 | }, 2233 | { 2234 | "code": 6026, 2235 | "name": "DivisionByZero", 2236 | "msg": "Division by zero" 2237 | }, 2238 | { 2239 | "code": 6027, 2240 | "name": "NotEnoughRemainingAccounts", 2241 | "msg": "Not enough remaining accounts" 2242 | }, 2243 | { 2244 | "code": 6028, 2245 | "name": "AllFeeRecipientsShouldBeNonZero", 2246 | "msg": "All fee recipients should be non-zero" 2247 | }, 2248 | { 2249 | "code": 6029, 2250 | "name": "UnsortedNotUniqueFeeRecipients", 2251 | "msg": "Unsorted or not unique fee recipients" 2252 | }, 2253 | { 2254 | "code": 6030, 2255 | "name": "CreatorShouldNotBeZero", 2256 | "msg": "Creator should not be zero" 2257 | }, 2258 | { 2259 | "code": 6031, 2260 | "name": "StartTimeInThePast" 2261 | }, 2262 | { 2263 | "code": 6032, 2264 | "name": "EndTimeInThePast" 2265 | }, 2266 | { 2267 | "code": 6033, 2268 | "name": "EndTimeBeforeStartTime" 2269 | }, 2270 | { 2271 | "code": 6034, 2272 | "name": "TimeRangeTooLarge" 2273 | }, 2274 | { 2275 | "code": 6035, 2276 | "name": "EndTimeBeforeCurrentDay" 2277 | }, 2278 | { 2279 | "code": 6036, 2280 | "name": "SupplyUpdateForFinishedRange" 2281 | }, 2282 | { 2283 | "code": 6037, 2284 | "name": "DayIndexAfterEndIndex" 2285 | }, 2286 | { 2287 | "code": 6038, 2288 | "name": "DayInActiveRange" 2289 | }, 2290 | { 2291 | "code": 6039, 2292 | "name": "InvalidIncentiveMint" 2293 | }, 2294 | { 2295 | "code": 6040, 2296 | "name": "BuyNotEnoughSolToCoverRent", 2297 | "msg": "Buy: Not enough SOL to cover for rent exemption." 2298 | }, 2299 | { 2300 | "code": 6041, 2301 | "name": "BuyNotEnoughSolToCoverFees", 2302 | "msg": "Buy: Not enough SOL to cover for fees." 2303 | }, 2304 | { 2305 | "code": 6042, 2306 | "name": "BuySlippageBelowMinTokensOut", 2307 | "msg": "Slippage: Would buy less tokens than expected min_tokens_out" 2308 | } 2309 | ], 2310 | "types": [ 2311 | { 2312 | "name": "AdminSetCreatorEvent", 2313 | "type": { 2314 | "kind": "struct", 2315 | "fields": [ 2316 | { 2317 | "name": "timestamp", 2318 | "type": "i64" 2319 | }, 2320 | { 2321 | "name": "admin_set_creator_authority", 2322 | "type": "pubkey" 2323 | }, 2324 | { 2325 | "name": "mint", 2326 | "type": "pubkey" 2327 | }, 2328 | { 2329 | "name": "bonding_curve", 2330 | "type": "pubkey" 2331 | }, 2332 | { 2333 | "name": "old_creator", 2334 | "type": "pubkey" 2335 | }, 2336 | { 2337 | "name": "new_creator", 2338 | "type": "pubkey" 2339 | } 2340 | ] 2341 | } 2342 | }, 2343 | { 2344 | "name": "AdminSetIdlAuthorityEvent", 2345 | "type": { 2346 | "kind": "struct", 2347 | "fields": [ 2348 | { 2349 | "name": "idl_authority", 2350 | "type": "pubkey" 2351 | } 2352 | ] 2353 | } 2354 | }, 2355 | { 2356 | "name": "AdminUpdateTokenIncentivesEvent", 2357 | "type": { 2358 | "kind": "struct", 2359 | "fields": [ 2360 | { 2361 | "name": "start_time", 2362 | "type": "i64" 2363 | }, 2364 | { 2365 | "name": "end_time", 2366 | "type": "i64" 2367 | }, 2368 | { 2369 | "name": "day_number", 2370 | "type": "u64" 2371 | }, 2372 | { 2373 | "name": "token_supply_per_day", 2374 | "type": "u64" 2375 | }, 2376 | { 2377 | "name": "mint", 2378 | "type": "pubkey" 2379 | }, 2380 | { 2381 | "name": "seconds_in_a_day", 2382 | "type": "i64" 2383 | }, 2384 | { 2385 | "name": "timestamp", 2386 | "type": "i64" 2387 | } 2388 | ] 2389 | } 2390 | }, 2391 | { 2392 | "name": "BondingCurve", 2393 | "type": { 2394 | "kind": "struct", 2395 | "fields": [ 2396 | { 2397 | "name": "virtual_token_reserves", 2398 | "type": "u64" 2399 | }, 2400 | { 2401 | "name": "virtual_sol_reserves", 2402 | "type": "u64" 2403 | }, 2404 | { 2405 | "name": "real_token_reserves", 2406 | "type": "u64" 2407 | }, 2408 | { 2409 | "name": "real_sol_reserves", 2410 | "type": "u64" 2411 | }, 2412 | { 2413 | "name": "token_total_supply", 2414 | "type": "u64" 2415 | }, 2416 | { 2417 | "name": "complete", 2418 | "type": "bool" 2419 | }, 2420 | { 2421 | "name": "creator", 2422 | "type": "pubkey" 2423 | } 2424 | ] 2425 | } 2426 | }, 2427 | { 2428 | "name": "ClaimTokenIncentivesEvent", 2429 | "type": { 2430 | "kind": "struct", 2431 | "fields": [ 2432 | { 2433 | "name": "user", 2434 | "type": "pubkey" 2435 | }, 2436 | { 2437 | "name": "mint", 2438 | "type": "pubkey" 2439 | }, 2440 | { 2441 | "name": "amount", 2442 | "type": "u64" 2443 | }, 2444 | { 2445 | "name": "timestamp", 2446 | "type": "i64" 2447 | }, 2448 | { 2449 | "name": "total_claimed_tokens", 2450 | "type": "u64" 2451 | }, 2452 | { 2453 | "name": "current_sol_volume", 2454 | "type": "u64" 2455 | } 2456 | ] 2457 | } 2458 | }, 2459 | { 2460 | "name": "CloseUserVolumeAccumulatorEvent", 2461 | "type": { 2462 | "kind": "struct", 2463 | "fields": [ 2464 | { 2465 | "name": "user", 2466 | "type": "pubkey" 2467 | }, 2468 | { 2469 | "name": "timestamp", 2470 | "type": "i64" 2471 | }, 2472 | { 2473 | "name": "total_unclaimed_tokens", 2474 | "type": "u64" 2475 | }, 2476 | { 2477 | "name": "total_claimed_tokens", 2478 | "type": "u64" 2479 | }, 2480 | { 2481 | "name": "current_sol_volume", 2482 | "type": "u64" 2483 | }, 2484 | { 2485 | "name": "last_update_timestamp", 2486 | "type": "i64" 2487 | } 2488 | ] 2489 | } 2490 | }, 2491 | { 2492 | "name": "CollectCreatorFeeEvent", 2493 | "type": { 2494 | "kind": "struct", 2495 | "fields": [ 2496 | { 2497 | "name": "timestamp", 2498 | "type": "i64" 2499 | }, 2500 | { 2501 | "name": "creator", 2502 | "type": "pubkey" 2503 | }, 2504 | { 2505 | "name": "creator_fee", 2506 | "type": "u64" 2507 | } 2508 | ] 2509 | } 2510 | }, 2511 | { 2512 | "name": "CompleteEvent", 2513 | "type": { 2514 | "kind": "struct", 2515 | "fields": [ 2516 | { 2517 | "name": "user", 2518 | "type": "pubkey" 2519 | }, 2520 | { 2521 | "name": "mint", 2522 | "type": "pubkey" 2523 | }, 2524 | { 2525 | "name": "bonding_curve", 2526 | "type": "pubkey" 2527 | }, 2528 | { 2529 | "name": "timestamp", 2530 | "type": "i64" 2531 | } 2532 | ] 2533 | } 2534 | }, 2535 | { 2536 | "name": "CompletePumpAmmMigrationEvent", 2537 | "type": { 2538 | "kind": "struct", 2539 | "fields": [ 2540 | { 2541 | "name": "user", 2542 | "type": "pubkey" 2543 | }, 2544 | { 2545 | "name": "mint", 2546 | "type": "pubkey" 2547 | }, 2548 | { 2549 | "name": "mint_amount", 2550 | "type": "u64" 2551 | }, 2552 | { 2553 | "name": "sol_amount", 2554 | "type": "u64" 2555 | }, 2556 | { 2557 | "name": "pool_migration_fee", 2558 | "type": "u64" 2559 | }, 2560 | { 2561 | "name": "bonding_curve", 2562 | "type": "pubkey" 2563 | }, 2564 | { 2565 | "name": "timestamp", 2566 | "type": "i64" 2567 | }, 2568 | { 2569 | "name": "pool", 2570 | "type": "pubkey" 2571 | } 2572 | ] 2573 | } 2574 | }, 2575 | { 2576 | "name": "CreateEvent", 2577 | "type": { 2578 | "kind": "struct", 2579 | "fields": [ 2580 | { 2581 | "name": "name", 2582 | "type": "string" 2583 | }, 2584 | { 2585 | "name": "symbol", 2586 | "type": "string" 2587 | }, 2588 | { 2589 | "name": "uri", 2590 | "type": "string" 2591 | }, 2592 | { 2593 | "name": "mint", 2594 | "type": "pubkey" 2595 | }, 2596 | { 2597 | "name": "bonding_curve", 2598 | "type": "pubkey" 2599 | }, 2600 | { 2601 | "name": "user", 2602 | "type": "pubkey" 2603 | }, 2604 | { 2605 | "name": "creator", 2606 | "type": "pubkey" 2607 | }, 2608 | { 2609 | "name": "timestamp", 2610 | "type": "i64" 2611 | }, 2612 | { 2613 | "name": "virtual_token_reserves", 2614 | "type": "u64" 2615 | }, 2616 | { 2617 | "name": "virtual_sol_reserves", 2618 | "type": "u64" 2619 | }, 2620 | { 2621 | "name": "real_token_reserves", 2622 | "type": "u64" 2623 | }, 2624 | { 2625 | "name": "token_total_supply", 2626 | "type": "u64" 2627 | } 2628 | ] 2629 | } 2630 | }, 2631 | { 2632 | "name": "ExtendAccountEvent", 2633 | "type": { 2634 | "kind": "struct", 2635 | "fields": [ 2636 | { 2637 | "name": "account", 2638 | "type": "pubkey" 2639 | }, 2640 | { 2641 | "name": "user", 2642 | "type": "pubkey" 2643 | }, 2644 | { 2645 | "name": "current_size", 2646 | "type": "u64" 2647 | }, 2648 | { 2649 | "name": "new_size", 2650 | "type": "u64" 2651 | }, 2652 | { 2653 | "name": "timestamp", 2654 | "type": "i64" 2655 | } 2656 | ] 2657 | } 2658 | }, 2659 | { 2660 | "name": "FeeConfig", 2661 | "type": { 2662 | "kind": "struct", 2663 | "fields": [ 2664 | { 2665 | "name": "bump", 2666 | "type": "u8" 2667 | }, 2668 | { 2669 | "name": "admin", 2670 | "type": "pubkey" 2671 | }, 2672 | { 2673 | "name": "flat_fees", 2674 | "type": { 2675 | "defined": { 2676 | "name": "Fees" 2677 | } 2678 | } 2679 | }, 2680 | { 2681 | "name": "fee_tiers", 2682 | "type": { 2683 | "vec": { 2684 | "defined": { 2685 | "name": "FeeTier" 2686 | } 2687 | } 2688 | } 2689 | } 2690 | ] 2691 | } 2692 | }, 2693 | { 2694 | "name": "FeeTier", 2695 | "type": { 2696 | "kind": "struct", 2697 | "fields": [ 2698 | { 2699 | "name": "market_cap_lamports_threshold", 2700 | "type": "u128" 2701 | }, 2702 | { 2703 | "name": "fees", 2704 | "type": { 2705 | "defined": { 2706 | "name": "Fees" 2707 | } 2708 | } 2709 | } 2710 | ] 2711 | } 2712 | }, 2713 | { 2714 | "name": "Fees", 2715 | "type": { 2716 | "kind": "struct", 2717 | "fields": [ 2718 | { 2719 | "name": "lp_fee_bps", 2720 | "type": "u64" 2721 | }, 2722 | { 2723 | "name": "protocol_fee_bps", 2724 | "type": "u64" 2725 | }, 2726 | { 2727 | "name": "creator_fee_bps", 2728 | "type": "u64" 2729 | } 2730 | ] 2731 | } 2732 | }, 2733 | { 2734 | "name": "Global", 2735 | "type": { 2736 | "kind": "struct", 2737 | "fields": [ 2738 | { 2739 | "name": "initialized", 2740 | "docs": ["Unused"], 2741 | "type": "bool" 2742 | }, 2743 | { 2744 | "name": "authority", 2745 | "type": "pubkey" 2746 | }, 2747 | { 2748 | "name": "fee_recipient", 2749 | "type": "pubkey" 2750 | }, 2751 | { 2752 | "name": "initial_virtual_token_reserves", 2753 | "type": "u64" 2754 | }, 2755 | { 2756 | "name": "initial_virtual_sol_reserves", 2757 | "type": "u64" 2758 | }, 2759 | { 2760 | "name": "initial_real_token_reserves", 2761 | "type": "u64" 2762 | }, 2763 | { 2764 | "name": "token_total_supply", 2765 | "type": "u64" 2766 | }, 2767 | { 2768 | "name": "fee_basis_points", 2769 | "type": "u64" 2770 | }, 2771 | { 2772 | "name": "withdraw_authority", 2773 | "type": "pubkey" 2774 | }, 2775 | { 2776 | "name": "enable_migrate", 2777 | "docs": ["Unused"], 2778 | "type": "bool" 2779 | }, 2780 | { 2781 | "name": "pool_migration_fee", 2782 | "type": "u64" 2783 | }, 2784 | { 2785 | "name": "creator_fee_basis_points", 2786 | "type": "u64" 2787 | }, 2788 | { 2789 | "name": "fee_recipients", 2790 | "type": { 2791 | "array": ["pubkey", 7] 2792 | } 2793 | }, 2794 | { 2795 | "name": "set_creator_authority", 2796 | "type": "pubkey" 2797 | }, 2798 | { 2799 | "name": "admin_set_creator_authority", 2800 | "type": "pubkey" 2801 | } 2802 | ] 2803 | } 2804 | }, 2805 | { 2806 | "name": "GlobalVolumeAccumulator", 2807 | "type": { 2808 | "kind": "struct", 2809 | "fields": [ 2810 | { 2811 | "name": "start_time", 2812 | "type": "i64" 2813 | }, 2814 | { 2815 | "name": "end_time", 2816 | "type": "i64" 2817 | }, 2818 | { 2819 | "name": "seconds_in_a_day", 2820 | "type": "i64" 2821 | }, 2822 | { 2823 | "name": "mint", 2824 | "type": "pubkey" 2825 | }, 2826 | { 2827 | "name": "total_token_supply", 2828 | "type": { 2829 | "array": ["u64", 30] 2830 | } 2831 | }, 2832 | { 2833 | "name": "sol_volumes", 2834 | "type": { 2835 | "array": ["u64", 30] 2836 | } 2837 | } 2838 | ] 2839 | } 2840 | }, 2841 | { 2842 | "name": "InitUserVolumeAccumulatorEvent", 2843 | "type": { 2844 | "kind": "struct", 2845 | "fields": [ 2846 | { 2847 | "name": "payer", 2848 | "type": "pubkey" 2849 | }, 2850 | { 2851 | "name": "user", 2852 | "type": "pubkey" 2853 | }, 2854 | { 2855 | "name": "timestamp", 2856 | "type": "i64" 2857 | } 2858 | ] 2859 | } 2860 | }, 2861 | { 2862 | "name": "SetCreatorEvent", 2863 | "type": { 2864 | "kind": "struct", 2865 | "fields": [ 2866 | { 2867 | "name": "timestamp", 2868 | "type": "i64" 2869 | }, 2870 | { 2871 | "name": "mint", 2872 | "type": "pubkey" 2873 | }, 2874 | { 2875 | "name": "bonding_curve", 2876 | "type": "pubkey" 2877 | }, 2878 | { 2879 | "name": "creator", 2880 | "type": "pubkey" 2881 | } 2882 | ] 2883 | } 2884 | }, 2885 | { 2886 | "name": "SetMetaplexCreatorEvent", 2887 | "type": { 2888 | "kind": "struct", 2889 | "fields": [ 2890 | { 2891 | "name": "timestamp", 2892 | "type": "i64" 2893 | }, 2894 | { 2895 | "name": "mint", 2896 | "type": "pubkey" 2897 | }, 2898 | { 2899 | "name": "bonding_curve", 2900 | "type": "pubkey" 2901 | }, 2902 | { 2903 | "name": "metadata", 2904 | "type": "pubkey" 2905 | }, 2906 | { 2907 | "name": "creator", 2908 | "type": "pubkey" 2909 | } 2910 | ] 2911 | } 2912 | }, 2913 | { 2914 | "name": "SetParamsEvent", 2915 | "type": { 2916 | "kind": "struct", 2917 | "fields": [ 2918 | { 2919 | "name": "initial_virtual_token_reserves", 2920 | "type": "u64" 2921 | }, 2922 | { 2923 | "name": "initial_virtual_sol_reserves", 2924 | "type": "u64" 2925 | }, 2926 | { 2927 | "name": "initial_real_token_reserves", 2928 | "type": "u64" 2929 | }, 2930 | { 2931 | "name": "final_real_sol_reserves", 2932 | "type": "u64" 2933 | }, 2934 | { 2935 | "name": "token_total_supply", 2936 | "type": "u64" 2937 | }, 2938 | { 2939 | "name": "fee_basis_points", 2940 | "type": "u64" 2941 | }, 2942 | { 2943 | "name": "withdraw_authority", 2944 | "type": "pubkey" 2945 | }, 2946 | { 2947 | "name": "enable_migrate", 2948 | "type": "bool" 2949 | }, 2950 | { 2951 | "name": "pool_migration_fee", 2952 | "type": "u64" 2953 | }, 2954 | { 2955 | "name": "creator_fee_basis_points", 2956 | "type": "u64" 2957 | }, 2958 | { 2959 | "name": "fee_recipients", 2960 | "type": { 2961 | "array": ["pubkey", 8] 2962 | } 2963 | }, 2964 | { 2965 | "name": "timestamp", 2966 | "type": "i64" 2967 | }, 2968 | { 2969 | "name": "set_creator_authority", 2970 | "type": "pubkey" 2971 | }, 2972 | { 2973 | "name": "admin_set_creator_authority", 2974 | "type": "pubkey" 2975 | } 2976 | ] 2977 | } 2978 | }, 2979 | { 2980 | "name": "SyncUserVolumeAccumulatorEvent", 2981 | "type": { 2982 | "kind": "struct", 2983 | "fields": [ 2984 | { 2985 | "name": "user", 2986 | "type": "pubkey" 2987 | }, 2988 | { 2989 | "name": "total_claimed_tokens_before", 2990 | "type": "u64" 2991 | }, 2992 | { 2993 | "name": "total_claimed_tokens_after", 2994 | "type": "u64" 2995 | }, 2996 | { 2997 | "name": "timestamp", 2998 | "type": "i64" 2999 | } 3000 | ] 3001 | } 3002 | }, 3003 | { 3004 | "name": "TradeEvent", 3005 | "type": { 3006 | "kind": "struct", 3007 | "fields": [ 3008 | { 3009 | "name": "mint", 3010 | "type": "pubkey" 3011 | }, 3012 | { 3013 | "name": "sol_amount", 3014 | "type": "u64" 3015 | }, 3016 | { 3017 | "name": "token_amount", 3018 | "type": "u64" 3019 | }, 3020 | { 3021 | "name": "is_buy", 3022 | "type": "bool" 3023 | }, 3024 | { 3025 | "name": "user", 3026 | "type": "pubkey" 3027 | }, 3028 | { 3029 | "name": "timestamp", 3030 | "type": "i64" 3031 | }, 3032 | { 3033 | "name": "virtual_sol_reserves", 3034 | "type": "u64" 3035 | }, 3036 | { 3037 | "name": "virtual_token_reserves", 3038 | "type": "u64" 3039 | }, 3040 | { 3041 | "name": "real_sol_reserves", 3042 | "type": "u64" 3043 | }, 3044 | { 3045 | "name": "real_token_reserves", 3046 | "type": "u64" 3047 | }, 3048 | { 3049 | "name": "fee_recipient", 3050 | "type": "pubkey" 3051 | }, 3052 | { 3053 | "name": "fee_basis_points", 3054 | "type": "u64" 3055 | }, 3056 | { 3057 | "name": "fee", 3058 | "type": "u64" 3059 | }, 3060 | { 3061 | "name": "creator", 3062 | "type": "pubkey" 3063 | }, 3064 | { 3065 | "name": "creator_fee_basis_points", 3066 | "type": "u64" 3067 | }, 3068 | { 3069 | "name": "creator_fee", 3070 | "type": "u64" 3071 | } 3072 | ] 3073 | } 3074 | }, 3075 | { 3076 | "name": "UpdateGlobalAuthorityEvent", 3077 | "type": { 3078 | "kind": "struct", 3079 | "fields": [ 3080 | { 3081 | "name": "global", 3082 | "type": "pubkey" 3083 | }, 3084 | { 3085 | "name": "authority", 3086 | "type": "pubkey" 3087 | }, 3088 | { 3089 | "name": "new_authority", 3090 | "type": "pubkey" 3091 | }, 3092 | { 3093 | "name": "timestamp", 3094 | "type": "i64" 3095 | } 3096 | ] 3097 | } 3098 | }, 3099 | { 3100 | "name": "UserVolumeAccumulator", 3101 | "type": { 3102 | "kind": "struct", 3103 | "fields": [ 3104 | { 3105 | "name": "user", 3106 | "type": "pubkey" 3107 | }, 3108 | { 3109 | "name": "needs_claim", 3110 | "type": "bool" 3111 | }, 3112 | { 3113 | "name": "total_unclaimed_tokens", 3114 | "type": "u64" 3115 | }, 3116 | { 3117 | "name": "total_claimed_tokens", 3118 | "type": "u64" 3119 | }, 3120 | { 3121 | "name": "current_sol_volume", 3122 | "type": "u64" 3123 | }, 3124 | { 3125 | "name": "last_update_timestamp", 3126 | "type": "i64" 3127 | }, 3128 | { 3129 | "name": "has_total_claimed_tokens", 3130 | "type": "bool" 3131 | } 3132 | ] 3133 | } 3134 | } 3135 | ] 3136 | } --------------------------------------------------------------------------------