From 4e5e21cde3601d0ba1a0792d35920952b9334bf1 Mon Sep 17 00:00:00 2001 From: Sorin Petreasca Date: Wed, 17 Jul 2024 12:18:47 +0300 Subject: [PATCH 1/2] remove setAllowExternalClaim --- common/modules/farm/config/src/config.rs | 11 ++++++----- dex/farm-with-locked-rewards/wasm/src/lib.rs | 5 ++--- dex/farm/wasm/src/lib.rs | 5 ++--- energy-integration/fees-collector/src/config.rs | 13 +++++++------ energy-integration/fees-collector/wasm/src/lib.rs | 5 ++--- .../tests/staking_farm_with_lp.rs | 6 ++++-- .../farm-staking/tests/farm_staking_setup/mod.rs | 3 ++- farm-staking/farm-staking/wasm/src/lib.rs | 5 ++--- 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/common/modules/farm/config/src/config.rs b/common/modules/farm/config/src/config.rs index 1f26eed6a..46564e5c0 100644 --- a/common/modules/farm/config/src/config.rs +++ b/common/modules/farm/config/src/config.rs @@ -11,11 +11,12 @@ pub const DEFAULT_FARM_POSITION_MIGRATION_NONCE: u64 = 1; #[multiversx_sc::module] pub trait ConfigModule: pausable::PausableModule + permissions_module::PermissionsModule { - #[endpoint(setAllowExternalClaimBoostedRewards)] - fn set_allow_external_claim(&self, allow_external_claim: bool) { - let caller = self.blockchain().get_caller(); - self.allow_external_claim(&caller).set(allow_external_claim); - } + // Disabled for this version of the exchange + // #[endpoint(setAllowExternalClaimBoostedRewards)] + // fn set_allow_external_claim(&self, allow_external_claim: bool) { + // let caller = self.blockchain().get_caller(); + // self.allow_external_claim(&caller).set(allow_external_claim); + // } #[inline] fn is_active(&self) -> bool { diff --git a/dex/farm-with-locked-rewards/wasm/src/lib.rs b/dex/farm-with-locked-rewards/wasm/src/lib.rs index 9efe33713..e8aa3099f 100644 --- a/dex/farm-with-locked-rewards/wasm/src/lib.rs +++ b/dex/farm-with-locked-rewards/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 67 +// Endpoints: 66 // Async Callback: 1 -// Total number of exported functions: 70 +// Total number of exported functions: 69 #![no_std] @@ -32,7 +32,6 @@ multiversx_sc_wasm_adapter::endpoints! { calculateRewardsForGivenPosition => calculate_rewards_for_given_position getRewardPerShare => reward_per_share getRewardReserve => reward_reserve - setAllowExternalClaimBoostedRewards => set_allow_external_claim getFarmingTokenId => farming_token_id getRewardTokenId => reward_token_id getPerBlockRewardAmount => per_block_reward_amount diff --git a/dex/farm/wasm/src/lib.rs b/dex/farm/wasm/src/lib.rs index a4b92d26e..525d76239 100644 --- a/dex/farm/wasm/src/lib.rs +++ b/dex/farm/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 64 +// Endpoints: 63 // Async Callback: 1 -// Total number of exported functions: 67 +// Total number of exported functions: 66 #![no_std] @@ -33,7 +33,6 @@ multiversx_sc_wasm_adapter::endpoints! { calculateRewardsForGivenPosition => calculate_rewards_for_given_position getRewardPerShare => reward_per_share getRewardReserve => reward_reserve - setAllowExternalClaimBoostedRewards => set_allow_external_claim getFarmingTokenId => farming_token_id getRewardTokenId => reward_token_id getPerBlockRewardAmount => per_block_reward_amount diff --git a/energy-integration/fees-collector/src/config.rs b/energy-integration/fees-collector/src/config.rs index a21dc6d6b..e65282d17 100644 --- a/energy-integration/fees-collector/src/config.rs +++ b/energy-integration/fees-collector/src/config.rs @@ -60,12 +60,13 @@ pub trait ConfigModule { self.all_tokens().set(&all_tokens_vec); } - #[endpoint(setAllowExternalClaimRewards)] - fn set_allow_external_claim_rewards(&self, allow_external_claim_rewards: bool) { - let caller = self.blockchain().get_caller(); - self.allow_external_claim_rewards(&caller) - .set(allow_external_claim_rewards); - } + // Disabled for this version of the exchange + // #[endpoint(setAllowExternalClaimRewards)] + // fn set_allow_external_claim_rewards(&self, allow_external_claim_rewards: bool) { + // let caller = self.blockchain().get_caller(); + // self.allow_external_claim_rewards(&caller) + // .set(allow_external_claim_rewards); + // } #[view(getLockedTokenId)] #[storage_mapper("lockedTokenId")] diff --git a/energy-integration/fees-collector/wasm/src/lib.rs b/energy-integration/fees-collector/wasm/src/lib.rs index 283f21a67..77034bd4a 100644 --- a/energy-integration/fees-collector/wasm/src/lib.rs +++ b/energy-integration/fees-collector/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 38 +// Endpoints: 37 // Async Callback (empty): 1 -// Total number of exported functions: 41 +// Total number of exported functions: 40 #![no_std] @@ -26,7 +26,6 @@ multiversx_sc_wasm_adapter::endpoints! { removeKnownContracts => remove_known_contracts addKnownTokens => add_known_tokens removeKnownTokens => remove_known_tokens - setAllowExternalClaimRewards => set_allow_external_claim_rewards getLockedTokenId => locked_token_id getAllTokens => get_all_tokens getAllKnownContracts => known_contracts diff --git a/farm-staking/farm-staking-proxy/tests/staking_farm_with_lp.rs b/farm-staking/farm-staking-proxy/tests/staking_farm_with_lp.rs index 1321443ee..50b62cb93 100644 --- a/farm-staking/farm-staking-proxy/tests/staking_farm_with_lp.rs +++ b/farm-staking/farm-staking-proxy/tests/staking_farm_with_lp.rs @@ -773,7 +773,8 @@ fn claim_for_others_positive_test() { &setup.lp_farm_wrapper, &rust_biguint!(0), |sc| { - sc.set_allow_external_claim(true); + sc.allow_external_claim(&managed_address!(&user_address)) + .set(true); }, ) .assert_ok(); @@ -785,7 +786,8 @@ fn claim_for_others_positive_test() { &setup.staking_farm_wrapper, &rust_biguint!(0), |sc| { - sc.set_allow_external_claim(true); + sc.allow_external_claim(&managed_address!(&user_address)) + .set(true); }, ) .assert_ok(); diff --git a/farm-staking/farm-staking/tests/farm_staking_setup/mod.rs b/farm-staking/farm-staking/tests/farm_staking_setup/mod.rs index 0d0cd74f4..90513e2d6 100644 --- a/farm-staking/farm-staking/tests/farm_staking_setup/mod.rs +++ b/farm-staking/farm-staking/tests/farm_staking_setup/mod.rs @@ -569,7 +569,8 @@ where pub fn allow_external_claim_rewards(&mut self, user: &Address, allow_claim: bool) { self.b_mock .execute_tx(user, &self.farm_wrapper, &rust_biguint!(0), |sc| { - sc.set_allow_external_claim(allow_claim); + sc.allow_external_claim(&managed_address!(user)) + .set(allow_claim); }) .assert_ok(); } diff --git a/farm-staking/farm-staking/wasm/src/lib.rs b/farm-staking/farm-staking/wasm/src/lib.rs index a5dfd5522..9489b1d7e 100644 --- a/farm-staking/farm-staking/wasm/src/lib.rs +++ b/farm-staking/farm-staking/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 70 +// Endpoints: 69 // Async Callback: 1 -// Total number of exported functions: 73 +// Total number of exported functions: 72 #![no_std] @@ -36,7 +36,6 @@ multiversx_sc_wasm_adapter::endpoints! { getMinUnbondEpochs => min_unbond_epochs getRewardPerShare => reward_per_share getRewardReserve => reward_reserve - setAllowExternalClaimBoostedRewards => set_allow_external_claim getFarmingTokenId => farming_token_id getRewardTokenId => reward_token_id getPerBlockRewardAmount => per_block_reward_amount From 04782742190a035e577440cc1122279365b7fe5e Mon Sep 17 00:00:00 2001 From: Sorin Petreasca Date: Wed, 31 Jul 2024 13:54:40 +0300 Subject: [PATCH 2/2] remove commented code --- common/modules/farm/config/src/config.rs | 8 +------- energy-integration/fees-collector/src/config.rs | 9 +-------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/common/modules/farm/config/src/config.rs b/common/modules/farm/config/src/config.rs index 46564e5c0..88858153e 100644 --- a/common/modules/farm/config/src/config.rs +++ b/common/modules/farm/config/src/config.rs @@ -11,13 +11,6 @@ pub const DEFAULT_FARM_POSITION_MIGRATION_NONCE: u64 = 1; #[multiversx_sc::module] pub trait ConfigModule: pausable::PausableModule + permissions_module::PermissionsModule { - // Disabled for this version of the exchange - // #[endpoint(setAllowExternalClaimBoostedRewards)] - // fn set_allow_external_claim(&self, allow_external_claim: bool) { - // let caller = self.blockchain().get_caller(); - // self.allow_external_claim(&caller).set(allow_external_claim); - // } - #[inline] fn is_active(&self) -> bool { let state = self.state().get(); @@ -78,6 +71,7 @@ pub trait ConfigModule: pausable::PausableModule + permissions_module::Permissio #[storage_mapper("userTotalFarmPosition")] fn user_total_farm_position(&self, user: &ManagedAddress) -> SingleValueMapper; + // Update for this storage disabled for this version of the exchange #[view(getAllowExternalClaim)] #[storage_mapper("allowExternalClaim")] fn allow_external_claim(&self, user: &ManagedAddress) -> SingleValueMapper; diff --git a/energy-integration/fees-collector/src/config.rs b/energy-integration/fees-collector/src/config.rs index e65282d17..72fa1fc70 100644 --- a/energy-integration/fees-collector/src/config.rs +++ b/energy-integration/fees-collector/src/config.rs @@ -60,14 +60,6 @@ pub trait ConfigModule { self.all_tokens().set(&all_tokens_vec); } - // Disabled for this version of the exchange - // #[endpoint(setAllowExternalClaimRewards)] - // fn set_allow_external_claim_rewards(&self, allow_external_claim_rewards: bool) { - // let caller = self.blockchain().get_caller(); - // self.allow_external_claim_rewards(&caller) - // .set(allow_external_claim_rewards); - // } - #[view(getLockedTokenId)] #[storage_mapper("lockedTokenId")] fn locked_token_id(&self) -> SingleValueMapper; @@ -87,6 +79,7 @@ pub trait ConfigModule { #[storage_mapper("allTokens")] fn all_tokens(&self) -> SingleValueMapper>; + // Update for this storage disabled for this version of the exchange #[view(getAllowExternalClaimRewards)] #[storage_mapper("allowExternalClaimRewards")] fn allow_external_claim_rewards(&self, user: &ManagedAddress) -> SingleValueMapper;