Skip to content
Draft
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
28 changes: 27 additions & 1 deletion Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ launchpad_v7 = "moontUzsdepotRGe5xsfip7vLPTJnVuafqdUWexVnPM"
mint_governor = "gvnr27cVeyW3AVf3acL7VCJ5WjGAphytnsgcK1feHyH"
performance_package_v2 = "pPV2pfrxnmstSb9j7kEeCLny5BGj6SNwCWGd6xbGGzz"
price_based_performance_package = "pbPPQH7jyKoSLu8QYs3rSY3YkDRXEBojKbTgnUg7NDS"
raydium_migration_helper = "migR87BnBEkJbbDECLzRxhmNsQ44WMzhDCpCJhfPvR1"

[registry]
url = "https://api.apr.dev"
Expand All @@ -31,6 +32,8 @@ initialize-dao = "yarn run tsx scripts/v0.6/initializeDao.ts"
initialize-launch = "yarn run tsx scripts/initializeLaunch.ts"
initialize-proposal = "yarn run tsx scripts/v0.5/initializeProposal.ts"
migrate-meta = "yarn run tsx scripts/v0.5/migrateMeta.ts"
migrate-to-v6-raydium = "yarn run tsx scripts/v0.5/migrateToV6Raydium.ts"
preview-migration-raydium = "yarn run tsx scripts/v0.5/previewMigrationRaydium.ts"
remove-spending-limit = "yarn run tsx scripts/v0.5/squads/removeSpendingLimit.ts"
start-launch = "yarn run tsx scripts/v0.5/startLaunch.ts"
test = "npx mocha --import=tsx --bail tests/main.test.ts --timeout 5000"
Expand All @@ -51,7 +54,6 @@ v06-migrate-daos-proposals = "yarn run tsx scripts/v0.6/migrateDaosProposals.ts"
v06-create-dao = "yarn run tsx scripts/v0.6/createDao.ts"
v06-provide-liquidity = "yarn run tsx scripts/v0.6/provideLiquidity.ts"
v06-collect-meteora-damm-fees = "yarn run tsx scripts/v0.6/collectMeteoraDammFees.ts"
v06-return-funds = "yarn run tsx scripts/v0.6/returnFunds.ts"
v07-collect-meteora-damm-fees = "yarn run tsx scripts/v0.7/collectMeteoraDammFees.ts"
v07-launch-template = "yarn run tsx scripts/v0.7/launchTemplate.ts"
v07-start-launch = "yarn run tsx scripts/v0.7/startLaunch.ts"
Expand Down Expand Up @@ -81,3 +83,27 @@ program = "./tests/fixtures/openbook_twap.so"
[[test.genesis]]
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
program = "./tests/fixtures/mpl_token_metadata.so"

[[test.genesis]]
address = "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C"
program = "./tests/fixtures/raydium_cp_swap.so"

[[test.genesis]]
address = "mooNhciQJi1LqHDmse2JPic2NqG2PXCanbE3ZYzP3qA"
program = "./tests/fixtures/launchpad_v5.so"

[[test.genesis]]
address = "auToUr3CQza3D4qreT6Std2MTomfzvrEeCC5qh7ivW5"
program = "./tests/fixtures/autocrat_v5.so"

[[test.genesis]]
address = "AMMJdEiCCa8mdugg6JPF7gFirmmxisTfDJoSNSUi5zDJ"
program = "./tests/fixtures/amm_v5.so"

[[test.genesis]]
address = "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg"
program = "./target/deploy/conditional_vault.so"

[[test.genesis]]
address = "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"
program = "./tests/fixtures/squads_multisig.so"
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions programs/raydium_migration_helper/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "raydium_migration_helper"
version = "0.1.0"
description = "Helper program for migrating autocrat v5 daos to futarchy v6 daos"
edition = "2021"

[lib]
crate-type = ["cdylib", "lib"]
name = "raydium_migration_helper"

[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []
production= []

[dependencies]
anchor-lang = "0.29.0"
anchor-spl = "0.29.0"
spl-memo = "=4.0.0"
solana-program = "=1.17.14"
spl-token = "=4.0.0"
spl-associated-token-account = "2.2"
ahash = "=0.8.6"
solana-security-txt = "1.1.1"
raydium-cpmm-cpi = { git = "https://github.com/raydium-io/raydium-cpi", package = "raydium-cpmm-cpi", branch = "anchor-0.29.0" }
futarchy = { path = "../futarchy", features = ["cpi"] }
damm_v2_cpi = { path = "../damm_v2_cpi", features = ["cpi"] }


2 changes: 2 additions & 0 deletions programs/raydium_migration_helper/Xargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.bpfel-unknown-unknown.dependencies.std]
features = []
19 changes: 19 additions & 0 deletions programs/raydium_migration_helper/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use anchor_lang::prelude::*;

#[error_code]
pub enum RaydiumMigrationError {
#[msg("Insufficient LP token balance")]
InsufficientLpBalance,

#[msg("Token account owner mismatch")]
TokenAccountOwnerMismatch,

#[msg("Invalid token mint")]
InvalidTokenMint,

#[msg("Math overflow error")]
MathOverflow,

#[msg("Base and quote mints must be different")]
DuplicateTokenMints,
}
27 changes: 27 additions & 0 deletions programs/raydium_migration_helper/src/events.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use anchor_lang::prelude::*;

#[event]
pub struct MigrationExecuted {
/// The vault authority that executed the migration
pub vault_authority: Pubkey,
/// Amount of LP tokens withdrawn from Raydium
pub lp_amount: u64,
/// Amount of base tokens withdrawn from Raydium LP
pub withdrawn_base: u64,
/// Amount of quote tokens withdrawn from Raydium LP
pub withdrawn_quote: u64,
/// Amount of base tokens sent to Meteora DAMM v2 pool (10%)
pub base_to_meteora: u64,
/// Amount of quote tokens sent to Meteora DAMM v2 pool (10%)
pub quote_to_meteora: u64,
/// Amount of base tokens sent to Futarchy AMM (90%)
pub base_to_futarchy: u64,
/// Amount of quote tokens sent to Futarchy AMM (90%)
pub quote_to_futarchy: u64,
/// The Meteora DAMM v2 pool that was created
pub meteora_pool: Pubkey,
/// Amount of base tokens transferred to V6 vault treasury
pub treasury_base_transferred: u64,
/// Amount of quote tokens transferred to V6 vault treasury
pub treasury_quote_transferred: u64,
}
5 changes: 5 additions & 0 deletions programs/raydium_migration_helper/src/instructions/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use super::*;

pub mod withdraw_and_provide_liquidity;

pub use withdraw_and_provide_liquidity::*;
Loading
Loading