Browse Source

spl: Add devnet feature flag for dex (#263)

bonedaddy 4 years ago
parent
commit
c06ad679d3
2 changed files with 7 additions and 0 deletions
  1. 3 0
      spl/Cargo.toml
  2. 4 0
      spl/src/dex.rs

+ 3 - 0
spl/Cargo.toml

@@ -6,6 +6,9 @@ edition = "2018"
 license = "Apache-2.0"
 description = "CPI clients for SPL programs"
 
+[features]
+devnet = []
+
 [dependencies]
 anchor-lang = { path = "../lang", version = "0.5.0", features = ["derive"] }
 lazy_static = "1.4.0"

+ 4 - 0
spl/src/dex.rs

@@ -7,8 +7,12 @@ use std::num::NonZeroU64;
 
 pub use serum_dex;
 
+#[cfg(not(feature = "devnet"))]
 anchor_lang::solana_program::declare_id!("9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin");
 
+#[cfg(feature = "devnet")]
+anchor_lang::solana_program::declare_id!("DESVgJVGajEgKGXhb6XmqDHGz3VjdgP7rEVESBgxmroY");
+
 pub fn new_order_v3<'info>(
     ctx: CpiContext<'_, '_, '_, 'info, NewOrderV3<'info>>,
     side: Side,