Skip to content

Commit

Permalink
change lib name (raydium-io#5)
Browse files Browse the repository at this point in the history
Co-authored-by: 0x777A <eddy@raydium.io>
  • Loading branch information
RainRaydium and 0x777A authored Apr 16, 2024
1 parent ca76c36 commit 1ba0cc0
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 118 deletions.
5 changes: 4 additions & 1 deletion Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ seeds = false
skip-lint = false

[programs.Localnet]
cp_swap = "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"
raydium_cp_swap = "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"


[registry]
Expand All @@ -32,3 +32,6 @@ url = "https://api.mainnet-beta.solana.com"

[[test.validator.clone]]
address = "DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8"

[[test.validator.clone]]
address = "D4FPEruKEHrG5TenZ2mpDGEfu1iUvTiqBxvpU8HLBvC2"
2 changes: 1 addition & 1 deletion programs/cp-swap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"

[lib]
crate-type = ["cdylib", "lib"]
name = "cp_swap"
name = "raydium_cp_swap"

[features]
no-entrypoint = []
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 @@ -45,7 +45,7 @@ pub mod create_pool_fee_reveiver {
pub const AUTH_SEED: &str = "vault_and_lp_mint_auth_seed";

#[program]
pub mod cp_swap {
pub mod raydium_cp_swap {
use super::*;

// The configuation of AMM protocol, include trade fee and protocol fee
Expand Down
4 changes: 2 additions & 2 deletions tests/deposit.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as anchor from "@coral-xyz/anchor";
import { Program, BN } from "@coral-xyz/anchor";
import { CpSwap } from "../target/types/cp_swap";
import { RaydiumCpSwap } from "../target/types/raydium_cp_swap";
import {
calculateFee,
calculatePreFeeAmount,
Expand All @@ -15,7 +15,7 @@ describe("deposit test", () => {
anchor.setProvider(anchor.AnchorProvider.env());
const owner = anchor.Wallet.local().payer;

const program = anchor.workspace.CpSwap as Program<CpSwap>;
const program = anchor.workspace.RaydiumCpSwap as Program<RaydiumCpSwap>;

const confirmOptions = {
skipPreflight: true,
Expand Down
4 changes: 2 additions & 2 deletions tests/initialize.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as anchor from "@coral-xyz/anchor";
import { Program, BN } from "@coral-xyz/anchor";
import { CpSwap } from "../target/types/cp_swap";
import { RaydiumCpSwap } from "../target/types/raydium_cp_swap";

import { getAccount, TOKEN_PROGRAM_ID } from "@solana/spl-token";
import { setupInitializeTest, initialize, calculateFee } from "./utils";
Expand All @@ -11,7 +11,7 @@ describe("initialize test", () => {
const owner = anchor.Wallet.local().payer;
console.log("owner: ", owner.publicKey.toString());

const program = anchor.workspace.CpSwap as Program<CpSwap>;
const program = anchor.workspace.RaydiumCpSwap as Program<RaydiumCpSwap>;

const confirmOptions = {
skipPreflight: true,
Expand Down
4 changes: 2 additions & 2 deletions tests/swap.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as anchor from "@coral-xyz/anchor";
import { Program, BN } from "@coral-xyz/anchor";
import { CpSwap } from "../target/types/cp_swap";
import { RaydiumCpSwap } from "../target/types/raydium_cp_swap";
import { setupSwapTest, swap_base_input, swap_base_output } from "./utils";
import { assert } from "chai";
import { getAccount, getAssociatedTokenAddressSync } from "@solana/spl-token";
Expand All @@ -9,7 +9,7 @@ describe("swap test", () => {
anchor.setProvider(anchor.AnchorProvider.env());
const owner = anchor.Wallet.local().payer;

const program = anchor.workspace.CpSwap as Program<CpSwap>;
const program = anchor.workspace.RaydiumCpSwap as Program<RaydiumCpSwap>;

const confirmOptions = {
skipPreflight: true,
Expand Down
20 changes: 10 additions & 10 deletions tests/utils/instruction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Program, BN } from "@coral-xyz/anchor";
import { CpSwap } from "../../target/types/cp_swap";
import { RaydiumCpSwap } from "../../target/types/raydium_cp_swap";
import {
Connection,
ConfirmOptions,
Expand Down Expand Up @@ -28,7 +28,7 @@ import {
import { ASSOCIATED_PROGRAM_ID } from "@coral-xyz/anchor/dist/cjs/utils/token";

export async function setupInitializeTest(
program: Program<CpSwap>,
program: Program<RaydiumCpSwap>,
connection: Connection,
owner: Signer,
config: {
Expand Down Expand Up @@ -72,7 +72,7 @@ export async function setupInitializeTest(
}

export async function setupDepositTest(
program: Program<CpSwap>,
program: Program<RaydiumCpSwap>,
connection: Connection,
owner: Signer,
config: {
Expand Down Expand Up @@ -151,7 +151,7 @@ export async function setupDepositTest(
}

export async function setupSwapTest(
program: Program<CpSwap>,
program: Program<RaydiumCpSwap>,
connection: Connection,
owner: Signer,
config: {
Expand Down Expand Up @@ -215,7 +215,7 @@ export async function setupSwapTest(
}

export async function createAmmConfig(
program: Program<CpSwap>,
program: Program<RaydiumCpSwap>,
connection: Connection,
owner: Signer,
config_index: number,
Expand Down Expand Up @@ -254,7 +254,7 @@ export async function createAmmConfig(
}

export async function initialize(
program: Program<CpSwap>,
program: Program<RaydiumCpSwap>,
creator: Signer,
configAddress: PublicKey,
token0: PublicKey,
Expand Down Expand Up @@ -338,7 +338,7 @@ export async function initialize(
}

export async function deposit(
program: Program<CpSwap>,
program: Program<RaydiumCpSwap>,
owner: Signer,
configAddress: PublicKey,
token0: PublicKey,
Expand Down Expand Up @@ -416,7 +416,7 @@ export async function deposit(
}

export async function withdraw(
program: Program<CpSwap>,
program: Program<RaydiumCpSwap>,
owner: Signer,
configAddress: PublicKey,
token0: PublicKey,
Expand Down Expand Up @@ -497,7 +497,7 @@ export async function withdraw(
}

export async function swap_base_input(
program: Program<CpSwap>,
program: Program<RaydiumCpSwap>,
owner: Signer,
configAddress: PublicKey,
inputToken: PublicKey,
Expand Down Expand Up @@ -562,7 +562,7 @@ export async function swap_base_input(
}

export async function swap_base_output(
program: Program<CpSwap>,
program: Program<RaydiumCpSwap>,
owner: Signer,
configAddress: PublicKey,
inputToken: PublicKey,
Expand Down
4 changes: 2 additions & 2 deletions tests/withdraw.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as anchor from "@coral-xyz/anchor";
import { Program, BN } from "@coral-xyz/anchor";
import { CpSwap } from "../target/types/cp_swap";
import { RaydiumCpSwap } from "../target/types/raydium_cp_swap";
import {
deposit,
getUserAndPoolVaultAmount,
Expand All @@ -13,7 +13,7 @@ import { assert } from "chai";
describe("withdraw test", () => {
anchor.setProvider(anchor.AnchorProvider.env());
const owner = anchor.Wallet.local().payer;
const program = anchor.workspace.CpSwap as Program<CpSwap>;
const program = anchor.workspace.RaydiumCpSwap as Program<RaydiumCpSwap>;

const confirmOptions = {
skipPreflight: true,
Expand Down
Loading

0 comments on commit 1ba0cc0

Please sign in to comment.