From cd66df2aefa073f8a76a7694f2634bf71faa4d59 Mon Sep 17 00:00:00 2001 From: zzz Date: Thu, 17 Oct 2024 23:38:19 +0800 Subject: [PATCH] chore: sync dvn code --- .../programs/dvn/src/instructions/admin/set_config.rs | 4 ++++ .../solana/programs/programs/dvn/src/state/dvn_config.rs | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/packages/layerzero-v2/solana/programs/programs/dvn/src/instructions/admin/set_config.rs b/packages/layerzero-v2/solana/programs/programs/dvn/src/instructions/admin/set_config.rs index 4c2153c..f692e59 100644 --- a/packages/layerzero-v2/solana/programs/programs/dvn/src/instructions/admin/set_config.rs +++ b/packages/layerzero-v2/solana/programs/programs/dvn/src/instructions/admin/set_config.rs @@ -32,6 +32,7 @@ pub enum AdminConfig { DefaultMultiplierBps(u16), DstConfigs(Vec), PriceFeed(Pubkey), + RemoveDstConfigs(Vec), } impl AdminConfig { @@ -49,6 +50,9 @@ impl AdminConfig { AdminConfig::PriceFeed(price_feed) => { config.price_feed = *price_feed; }, + AdminConfig::RemoveDstConfigs(dst_eids) => { + config.remove_dst_configs(dst_eids.clone())?; + }, } Ok(()) } diff --git a/packages/layerzero-v2/solana/programs/programs/dvn/src/state/dvn_config.rs b/packages/layerzero-v2/solana/programs/programs/dvn/src/state/dvn_config.rs index 89bd06e..81e4f34 100644 --- a/packages/layerzero-v2/solana/programs/programs/dvn/src/state/dvn_config.rs +++ b/packages/layerzero-v2/solana/programs/programs/dvn/src/state/dvn_config.rs @@ -74,6 +74,13 @@ impl DvnConfig { } Ok(()) } + + pub fn remove_dst_configs(&mut self, dst_eids: Vec) -> Result<()> { + for eid in dst_eids { + sorted_list_helper::remove_from_sorted_list_by_eid(&mut self.dst_configs, eid)?; + } + Ok(()) + } } impl sorted_list_helper::EID for DstConfig {