diff --git a/contracts/core b/contracts/core index dc8104e4..20333a08 160000 --- a/contracts/core +++ b/contracts/core @@ -1 +1 @@ -Subproject commit dc8104e4ec287e31df33695e33be22b6cbaadfdb +Subproject commit 20333a08e726ace3a66bf0227daf003c60be8316 diff --git a/packages/vectis-tests/src/test_tube/plugin_registry_mgmt/add_subscription_tiers.rs b/packages/vectis-tests/src/test_tube/plugin_registry_mgmt/add_subscription_tiers.rs index 1e7eb68a..89edbadd 100644 --- a/packages/vectis-tests/src/test_tube/plugin_registry_mgmt/add_subscription_tiers.rs +++ b/packages/vectis-tests/src/test_tube/plugin_registry_mgmt/add_subscription_tiers.rs @@ -30,7 +30,7 @@ fn deployer_can_add_subscription_tier() { &app, suite.deployer.clone(), suite.plugin_registry.clone(), - ®istry_management_trait::ExecMsg::AddSubscriptionTiers { + ®istry_management_trait::ExecMsg::AddOrUpdateSubscriptionTiers { tier: SubscriptionTier::Other as u8, details: TierDetails { max_plugins: 3, @@ -65,7 +65,7 @@ fn existing_tier_cannot_be_added() { &app, suite.deployer.clone(), suite.plugin_registry.clone(), - ®istry_management_trait::ExecMsg::AddSubscriptionTiers { + ®istry_management_trait::ExecMsg::AddOrUpdateSubscriptionTiers { tier: current_tier, details: TierDetails { max_plugins: 3, @@ -88,7 +88,7 @@ fn not_deployer_cannot_add_subscription_tier() { // Sent from another signer registry .execute( - ®istry_management_trait::ExecMsg::AddSubscriptionTiers { + ®istry_management_trait::ExecMsg::AddOrUpdateSubscriptionTiers { tier: SubscriptionTier::L1 as u8, details: TierDetails { max_plugins: 3, diff --git a/packages/vectis-tests/src/unit_tests/registry_mgmt.rs b/packages/vectis-tests/src/unit_tests/registry_mgmt.rs index 29d8144b..37f7b05f 100644 --- a/packages/vectis-tests/src/unit_tests/registry_mgmt.rs +++ b/packages/vectis-tests/src/unit_tests/registry_mgmt.rs @@ -142,3 +142,36 @@ fn new_plugin_version_with_same_code_id_fails() { assert_eq!(err, PluginRegError::CodeIdAlreadyRegistered) } + +#[test] +fn can_update_subscription_tier() { + let suite = VectisTestSuite::new(); + let registry = VectisPluginRegistryProxy::new(suite.plugin_registry, &suite.app); + let existing_tier = registry + .registry_management_trait_proxy() + .get_config() + .unwrap() + .subscription_tiers + .pop() + .unwrap(); + + let mut new_tier_details = existing_tier.1.clone(); + new_tier_details.fee = coin(REGISTRY_FEE, DENOM); + + registry + .registry_management_trait_proxy() + .add_or_update_subscription_tiers(existing_tier.0, new_tier_details) + .call(suite.deployer.as_str()) + .unwrap(); + + let new_tier = registry + .registry_management_trait_proxy() + .get_config() + .unwrap() + .subscription_tiers + .pop() + .unwrap(); + + assert_eq!(existing_tier.0, new_tier.0); + assert_ne!(existing_tier.1, new_tier.1) +} diff --git a/packages/vectis/src/interface/plugin_registry.rs b/packages/vectis/src/interface/plugin_registry.rs index 27157b3b..cec9ab2b 100644 --- a/packages/vectis/src/interface/plugin_registry.rs +++ b/packages/vectis/src/interface/plugin_registry.rs @@ -89,7 +89,7 @@ pub mod registry_management_trait { /// To remove tier there may already be subscribers and so it will require a migration /// function #[msg(exec)] - fn add_subscription_tiers( + fn add_or_update_subscription_tiers( &self, ctx: ExecCtx, tier: u8,