Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
475 changes: 172 additions & 303 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions programs/cp-swap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enable-log = []
devnet = []
client = []
anchor-debug = []
idl-build = ["anchor-lang/idl-build", "light-sdk/idl-build", "light-token-sdk/idl-build"]
idl-build = ["anchor-lang/idl-build", "light-sdk/idl-build", "light-token/idl-build", "light-anchor-spl/idl-build"]
test-sbf = []

[dependencies]
Expand All @@ -32,8 +32,10 @@ bytemuck = { version = "1.4.0", features = ["derive", "min_const_generics"] }
arrayref = { version = "0.3.6" }
blake3 = { workspace = true }

light-sdk = { git = "https://github.com/Lightprotocol/light-protocol", rev = "5013dbe2f2abc77984a2801e69b5c46453962b31", features = ["anchor", "anchor-discriminator", "v2", "idl-build", "cpi-context"] }
light-token-sdk = { git = "https://github.com/Lightprotocol/light-protocol", rev = "5013dbe2f2abc77984a2801e69b5c46453962b31", features = ["anchor", "idl-build", "anchor-spl-memo", "anchor-spl-associated-token"] }
light-sdk = { version = "0.18.0", features = ["anchor", "anchor-discriminator", "idl-build", "cpi-context"] }
light-token = { version = "0.3.0", features = ["anchor", "idl-build"] }
light-hasher = "5"
light-anchor-spl = { version = "0.31.1", features = ["idl-build", "memo"] }
solana-account-info = "2.3"
solana-program = "2.2"
solana-pubkey = "2.2"
Expand All @@ -46,8 +48,8 @@ quickcheck = "1.0.3"
proptest = "1.0"
rand = "0.9.0"

light-program-test = { git = "https://github.com/Lightprotocol/light-protocol", rev = "5013dbe2f2abc77984a2801e69b5c46453962b31", features = ["v2", "devenv"] }
light-client = { git = "https://github.com/Lightprotocol/light-protocol", rev = "5013dbe2f2abc77984a2801e69b5c46453962b31", features = ["v2"] }
light-program-test = { version = "0.18.0" }
light-client = { version = "0.18.0" }
tokio = { version = "1", features = ["full"] }
spl-token = "7.0.0"
solana-keypair = { version = "2.2" }
Expand Down
8 changes: 4 additions & 4 deletions programs/cp-swap/src/instructions/admin/collect_fund_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use crate::error::ErrorCode;
use crate::states::*;
use crate::utils::token::*;
use anchor_lang::prelude::*;
use light_token_sdk::anchor::anchor_spl::token::Token;
use light_token_sdk::anchor::anchor_spl::token_interface::Mint;
use light_token_sdk::anchor::anchor_spl::token_interface::Token2022;
use light_token_sdk::anchor::anchor_spl::token_interface::TokenAccount;
use light_anchor_spl::token::Token;
use light_anchor_spl::token_interface::Mint;
use light_anchor_spl::token_interface::Token2022;
use light_anchor_spl::token_interface::TokenAccount;
#[derive(Accounts)]
pub struct CollectFundFee<'info> {
/// Only admin or fund_owner can collect fee now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use crate::error::ErrorCode;
use crate::states::*;
use crate::utils::*;
use anchor_lang::prelude::*;
use light_token_sdk::anchor::anchor_spl::token::Token;
use light_token_sdk::anchor::anchor_spl::token_interface::Mint;
use light_token_sdk::anchor::anchor_spl::token_interface::Token2022;
use light_token_sdk::anchor::anchor_spl::token_interface::TokenAccount;
use light_anchor_spl::token::Token;
use light_anchor_spl::token_interface::Mint;
use light_anchor_spl::token_interface::Token2022;
use light_anchor_spl::token_interface::TokenAccount;

#[derive(Accounts)]
pub struct CollectProtocolFee<'info> {
Expand Down
8 changes: 4 additions & 4 deletions programs/cp-swap/src/instructions/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use crate::error::ErrorCode;
use crate::states::*;
use crate::utils::token::*;
use anchor_lang::prelude::*;
use light_token_sdk::anchor::anchor_spl::token::Token;
use light_token_sdk::anchor::anchor_spl::token_interface::Token2022;
use light_token_sdk::token::MintToCpi;
use light_token_sdk::anchor::anchor_spl::token_interface::{TokenAccount, Mint,TokenInterface};
use light_anchor_spl::token::Token;
use light_anchor_spl::token_interface::Token2022;
use light_token::instruction::MintToCpi;
use light_anchor_spl::token_interface::{TokenAccount, Mint,TokenInterface};

#[derive(Accounts)]
pub struct Deposit<'info> {
Expand Down
8 changes: 4 additions & 4 deletions programs/cp-swap/src/instructions/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ use anchor_lang::{
prelude::*,
solana_program::{clock, program::invoke, system_instruction},
};
use light_token_sdk::anchor::anchor_spl::{
use light_anchor_spl::{
associated_token::AssociatedToken,
token::spl_token,
token::Token,
token_interface::{Mint, TokenAccount, TokenInterface},
};
use light_sdk::interface::CreateAccountsProof;
use light_token_sdk::anchor::LightAccounts;
use light_token_sdk::{
token::{
use light_token::anchor::LightAccounts;
use light_token::{
instruction::{
CreateTokenAccountCpi, CreateTokenAtaCpi, MintToCpi, COMPRESSIBLE_CONFIG_V1,
RENT_SPONSOR as LIGHT_TOKEN_RENT_SPONSOR,
},
Expand Down
2 changes: 1 addition & 1 deletion programs/cp-swap/src/instructions/swap_base_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::states::*;
use crate::utils::token::*;
use anchor_lang::prelude::*;
use anchor_lang::solana_program;
use light_token_sdk::anchor::anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface};
use light_anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface};

#[derive(Accounts)]
pub struct Swap<'info> {
Expand Down
4 changes: 2 additions & 2 deletions programs/cp-swap/src/instructions/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use crate::error::ErrorCode;
use crate::states::*;
use crate::utils::token::*;
use anchor_lang::prelude::*;
use light_token_sdk::anchor::anchor_spl::{
use light_anchor_spl::{
memo::spl_memo,
token::Token,
token_interface::{Mint, Token2022, TokenAccount, TokenInterface},
};
use light_token_sdk::token::BurnCpi;
use light_token::instruction::BurnCpi;

#[derive(Accounts)]
pub struct Withdraw<'info> {
Expand Down
2 changes: 1 addition & 1 deletion programs/cp-swap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub use crate::states::{
};
use anchor_lang::prelude::*;
use instructions::*;
use light_token_sdk::anchor::{
use light_token::anchor::{
derive_light_cpi_signer, derive_light_rent_sponsor_pda, light_program, CpiSigner,
};

Expand Down
2 changes: 1 addition & 1 deletion programs/cp-swap/src/states/oracle.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anchor_lang::prelude::*;
use light_sdk::LightDiscriminator;
use light_token_sdk::anchor::{CompressionInfo, LightAccount};
use light_token::anchor::{CompressionInfo, LightAccount};

#[cfg(test)]
use std::time::{SystemTime, UNIX_EPOCH};
Expand Down
4 changes: 2 additions & 2 deletions programs/cp-swap/src/states/pool.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anchor_lang::prelude::*;
use light_token_sdk::anchor::anchor_spl::token_interface::Mint;
use light_anchor_spl::token_interface::Mint;
use light_sdk::LightDiscriminator;
use light_token_sdk::anchor::{CompressionInfo, LightAccount};
use light_token::anchor::{CompressionInfo, LightAccount};
use std::ops::{BitAnd, BitOr, BitXor};

pub const POOL_SEED: &str = "pool";
Expand Down
4 changes: 2 additions & 2 deletions programs/cp-swap/src/utils/token.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::error::ErrorCode;
use anchor_lang::{prelude::*, system_program};
use light_token_sdk::anchor::anchor_spl::{
use light_anchor_spl::{
token::{Token, TokenAccount},
token_2022,
token_interface::{initialize_account3, InitializeAccount3, Mint},
};
use light_sdk::constants::LIGHT_TOKEN_PROGRAM_ID;
use light_token_sdk::token::TransferInterfaceCpi;
use light_token::instruction::TransferInterfaceCpi;
use spl_token_2022::{
self,
extension::{
Expand Down
10 changes: 5 additions & 5 deletions programs/cp-swap/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use light_program_test::{
program_test::{setup_mock_program_data, LightProgramTest, TestRpc},
Indexer, ProgramTestConfig, Rpc,
};
use light_token_sdk::{
use light_token::{
constants::CPI_AUTHORITY_PDA,
token::{
instruction::{
find_mint_address, get_associated_token_address_and_bump, CreateAssociatedTokenAccount,
CreateMint, CreateMintParams, MintTo, COMPRESSIBLE_CONFIG_V1,
RENT_SPONSOR as LIGHT_TOKEN_RENT_SPONSOR,
Expand All @@ -32,7 +32,7 @@ use solana_keypair::Keypair;
use solana_pubkey::Pubkey;
use solana_signer::Signer;
use solana_sdk::{program_pack::Pack, signature::SeedDerivable};
use light_token_sdk::anchor::anchor_spl::memo::spl_memo;
use light_anchor_spl::memo::spl_memo;
use spl_token_2022;


Expand Down Expand Up @@ -129,7 +129,7 @@ pub async fn setup_create_mint(
let address_tree = rpc.get_address_tree_v2();
let output_queue = rpc.get_random_state_tree_info().unwrap().queue;

let compression_address = light_token_sdk::token::derive_mint_compressed_address(
let compression_address = light_token::instruction::derive_mint_compressed_address(
&mint_seed.pubkey(),
&address_tree.tree,
);
Expand Down Expand Up @@ -628,7 +628,7 @@ pub fn build_initialize_instruction(
token_program: spl_token::id(),
token_0_program: light_token_program_id(),
token_1_program: light_token_program_id(),
associated_token_program: light_token_sdk::anchor::anchor_spl::associated_token::ID,
associated_token_program: light_anchor_spl::associated_token::ID,
system_program: solana_sdk::system_program::ID,
rent: solana_sdk::sysvar::rent::ID,
compression_config: config_pda,
Expand Down
4 changes: 2 additions & 2 deletions programs/cp-swap/tests/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use light_client::interface::{
TokenAccountInterface,
};
use light_sdk::LightDiscriminator;
use light_token_sdk::compat::{CTokenData, TokenData};
use light_token::compat::{CTokenData, TokenData};
use raydium_cp_swap::instructions::initialize::LP_MINT_SIGNER_SEED;
use raydium_cp_swap::{
raydium_cp_swap::{LightAccountVariant, TokenAccountVariant},
Expand Down Expand Up @@ -203,7 +203,7 @@ impl CpSwapSdk {
} else {
None
},
state: light_token_sdk::compat::AccountState::Initialized,
state: light_token::compat::AccountState::Initialized,
tlv: None,
};

Expand Down