From 4463206df3824fb6c82ebc12d57a1efeb266431e Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Fri, 12 Apr 2024 10:23:37 +0300 Subject: [PATCH 1/2] upgrade annotation --- dex/farm-with-locked-rewards/src/lib.rs | 2 +- dex/farm/src/lib.rs | 2 +- dex/governance/src/lib.rs | 2 +- dex/pair/src/lib.rs | 2 +- dex/price-discovery/src/lib.rs | 2 +- dex/proxy-deployer/src/lib.rs | 2 +- dex/router/src/contract.rs | 2 +- energy-integration/energy-update/src/lib.rs | 2 +- energy-integration/fees-collector/src/lib.rs | 2 +- energy-integration/governance-v2/src/lib.rs | 2 +- farm-staking/farm-staking-proxy/src/lib.rs | 2 +- farm-staking/farm-staking/src/lib.rs | 2 +- farm-staking/metabonding-staking/src/lib.rs | 2 +- locked-asset/distribution/src/lib.rs | 2 +- locked-asset/energy-factory/src/lib.rs | 2 +- locked-asset/factory/src/lib.rs | 2 +- locked-asset/lkmex-transfer/src/lib.rs | 2 +- locked-asset/locked-token-wrapper/src/lib.rs | 2 +- locked-asset/proxy_dex/src/lib.rs | 2 +- locked-asset/simple-lock-whitelist/src/lib.rs | 2 +- locked-asset/simple-lock/src/lib.rs | 2 +- locked-asset/token-unstake/src/lib.rs | 2 +- pause-all/src/lib.rs | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dex/farm-with-locked-rewards/src/lib.rs b/dex/farm-with-locked-rewards/src/lib.rs index cfe9838e5..6b5b334a2 100644 --- a/dex/farm-with-locked-rewards/src/lib.rs +++ b/dex/farm-with-locked-rewards/src/lib.rs @@ -82,7 +82,7 @@ pub trait Farm: self.try_set_farm_position_migration_nonce(farm_token_mapper); } - #[endpoint] + #[upgrade] fn upgrade(&self) { let current_epoch = self.blockchain().get_block_epoch(); self.first_week_start_epoch().set_if_empty(current_epoch); diff --git a/dex/farm/src/lib.rs b/dex/farm/src/lib.rs index a200881c6..97163efb0 100644 --- a/dex/farm/src/lib.rs +++ b/dex/farm/src/lib.rs @@ -85,7 +85,7 @@ pub trait Farm: self.try_set_farm_position_migration_nonce(farm_token_mapper); } - #[endpoint] + #[upgrade] fn upgrade(&self) { let current_epoch = self.blockchain().get_block_epoch(); self.first_week_start_epoch().set_if_empty(current_epoch); diff --git a/dex/governance/src/lib.rs b/dex/governance/src/lib.rs index e9d4147d3..460aabcda 100644 --- a/dex/governance/src/lib.rs +++ b/dex/governance/src/lib.rs @@ -49,7 +49,7 @@ pub trait Governance: self.try_change_price_providers(price_providers); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} #[payable("*")] diff --git a/dex/pair/src/lib.rs b/dex/pair/src/lib.rs index 090b66cf3..e67010d67 100644 --- a/dex/pair/src/lib.rs +++ b/dex/pair/src/lib.rs @@ -101,7 +101,7 @@ pub trait Pair: }; } - #[endpoint] + #[upgrade] fn upgrade(&self) {} #[endpoint(setLpTokenIdentifier)] diff --git a/dex/price-discovery/src/lib.rs b/dex/price-discovery/src/lib.rs index 32a07acf0..b0c430e52 100644 --- a/dex/price-discovery/src/lib.rs +++ b/dex/price-discovery/src/lib.rs @@ -113,7 +113,7 @@ pub trait PriceDiscovery: self.set_locking_sc_address(locking_sc_address); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} /// Users can deposit either launched_token or accepted_token. diff --git a/dex/proxy-deployer/src/lib.rs b/dex/proxy-deployer/src/lib.rs index a05bab7b0..7f7f0c16a 100644 --- a/dex/proxy-deployer/src/lib.rs +++ b/dex/proxy-deployer/src/lib.rs @@ -16,6 +16,6 @@ pub trait ProxyDeployer: farm_deploy::FarmDeployModule { self.farm_template_address().set(&farm_template_address); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} } diff --git a/dex/router/src/contract.rs b/dex/router/src/contract.rs index 04b787a03..094e61f07 100644 --- a/dex/router/src/contract.rs +++ b/dex/router/src/contract.rs @@ -41,7 +41,7 @@ pub trait Router: self.owner().set(&self.blockchain().get_caller()); } - #[endpoint] + #[upgrade] fn upgrade(&self) { self.state().set(false); } diff --git a/energy-integration/energy-update/src/lib.rs b/energy-integration/energy-update/src/lib.rs index a8e10213f..6cb9a7520 100644 --- a/energy-integration/energy-update/src/lib.rs +++ b/energy-integration/energy-update/src/lib.rs @@ -9,7 +9,7 @@ pub trait EnergyUpdate { #[init] fn init(&self) {} - #[endpoint] + #[upgrade] fn upgrade(&self) {} #[endpoint(updateFarmsEnergyForUser)] diff --git a/energy-integration/fees-collector/src/lib.rs b/energy-integration/fees-collector/src/lib.rs index b5a37d7fb..e78ed6812 100644 --- a/energy-integration/fees-collector/src/lib.rs +++ b/energy-integration/fees-collector/src/lib.rs @@ -44,7 +44,7 @@ pub trait FeesCollector: self.energy_factory_address().set(&energy_factory_address); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} #[endpoint(claimRewards)] diff --git a/energy-integration/governance-v2/src/lib.rs b/energy-integration/governance-v2/src/lib.rs index 0fcb53dca..2014b3a53 100644 --- a/energy-integration/governance-v2/src/lib.rs +++ b/energy-integration/governance-v2/src/lib.rs @@ -61,7 +61,7 @@ pub trait GovernanceV2: self.try_change_fee_token_id(fee_token); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} /// Propose a list of actions. diff --git a/farm-staking/farm-staking-proxy/src/lib.rs b/farm-staking/farm-staking-proxy/src/lib.rs index bd8ef7013..7bfc66bab 100644 --- a/farm-staking/farm-staking-proxy/src/lib.rs +++ b/farm-staking/farm-staking-proxy/src/lib.rs @@ -58,6 +58,6 @@ pub trait FarmStakingProxy: self.lp_token_id().set_if_empty(&lp_token_id); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} } diff --git a/farm-staking/farm-staking/src/lib.rs b/farm-staking/farm-staking/src/lib.rs index c210d080c..5d321d8ad 100644 --- a/farm-staking/farm-staking/src/lib.rs +++ b/farm-staking/farm-staking/src/lib.rs @@ -97,7 +97,7 @@ pub trait FarmStaking: self.try_set_farm_position_migration_nonce(farm_token_mapper); } - #[endpoint] + #[upgrade] fn upgrade(&self) { let current_epoch = self.blockchain().get_block_epoch(); self.first_week_start_epoch().set_if_empty(current_epoch); diff --git a/farm-staking/metabonding-staking/src/lib.rs b/farm-staking/metabonding-staking/src/lib.rs index 94be22193..d15ce3c90 100644 --- a/farm-staking/metabonding-staking/src/lib.rs +++ b/farm-staking/metabonding-staking/src/lib.rs @@ -26,7 +26,7 @@ pub trait MetabondingStaking: .set_if_empty(&locked_asset_factory_address); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} #[payable("*")] diff --git a/locked-asset/distribution/src/lib.rs b/locked-asset/distribution/src/lib.rs index 93187154e..b996701df 100644 --- a/locked-asset/distribution/src/lib.rs +++ b/locked-asset/distribution/src/lib.rs @@ -47,7 +47,7 @@ pub trait Distribution: global_op::GlobalOperationModule { .set_if_empty(&locked_asset_factory_address); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} #[only_owner] diff --git a/locked-asset/energy-factory/src/lib.rs b/locked-asset/energy-factory/src/lib.rs index d146566d6..f38c2e0e7 100644 --- a/locked-asset/energy-factory/src/lib.rs +++ b/locked-asset/energy-factory/src/lib.rs @@ -91,7 +91,7 @@ pub trait SimpleLockEnergy: self.set_paused(true); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} /// Locks a whitelisted token until `unlock_epoch` and receive meta ESDT LOCKED tokens diff --git a/locked-asset/factory/src/lib.rs b/locked-asset/factory/src/lib.rs index d8de993b4..b826bb14b 100644 --- a/locked-asset/factory/src/lib.rs +++ b/locked-asset/factory/src/lib.rs @@ -63,7 +63,7 @@ pub trait LockedAssetFactory: self.set_paused(true); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} fn set_extended_attributes_activation_nonce(&self, is_sc_upgrade: bool) { diff --git a/locked-asset/lkmex-transfer/src/lib.rs b/locked-asset/lkmex-transfer/src/lib.rs index 7c187882e..126e740b8 100644 --- a/locked-asset/lkmex-transfer/src/lib.rs +++ b/locked-asset/lkmex-transfer/src/lib.rs @@ -56,7 +56,7 @@ pub trait LkmexTransfer: self.add_permissions(caller, Permissions::OWNER); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} #[endpoint] diff --git a/locked-asset/locked-token-wrapper/src/lib.rs b/locked-asset/locked-token-wrapper/src/lib.rs index a6aa3e96f..5398cc42a 100644 --- a/locked-asset/locked-token-wrapper/src/lib.rs +++ b/locked-asset/locked-token-wrapper/src/lib.rs @@ -20,7 +20,7 @@ pub trait LockedTokenWrapper: self.energy_factory_address().set(&energy_factory_address); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} #[payable("*")] diff --git a/locked-asset/proxy_dex/src/lib.rs b/locked-asset/proxy_dex/src/lib.rs index 810cd3640..3e03c2f06 100644 --- a/locked-asset/proxy_dex/src/lib.rs +++ b/locked-asset/proxy_dex/src/lib.rs @@ -58,7 +58,7 @@ pub trait ProxyDexImpl: .set_if_empty(&energy_factory_address); } - #[endpoint] + #[upgrade] fn upgrade(&self, old_locked_token_id: TokenIdentifier, old_factory_address: ManagedAddress) { require!( old_locked_token_id.is_valid_esdt_identifier(), diff --git a/locked-asset/simple-lock-whitelist/src/lib.rs b/locked-asset/simple-lock-whitelist/src/lib.rs index 577671ede..7ed5b52ac 100644 --- a/locked-asset/simple-lock-whitelist/src/lib.rs +++ b/locked-asset/simple-lock-whitelist/src/lib.rs @@ -30,7 +30,7 @@ pub trait SimpleLockWhitelist: self.transfer_roles_not_set().set(true); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} /// Sets the transfer role for the given address. Defaults to own address. diff --git a/locked-asset/simple-lock/src/lib.rs b/locked-asset/simple-lock/src/lib.rs index 5db24f38e..fb59b792c 100644 --- a/locked-asset/simple-lock/src/lib.rs +++ b/locked-asset/simple-lock/src/lib.rs @@ -25,7 +25,7 @@ pub trait SimpleLock: #[init] fn init(&self) {} - #[endpoint] + #[upgrade] fn upgrade(&self) {} /// Locks any token (including EGLD) until `unlock_epoch` and receive meta ESDT LOCKED tokens. diff --git a/locked-asset/token-unstake/src/lib.rs b/locked-asset/token-unstake/src/lib.rs index 6295d46a2..985e91be9 100644 --- a/locked-asset/token-unstake/src/lib.rs +++ b/locked-asset/token-unstake/src/lib.rs @@ -42,6 +42,6 @@ pub trait TokenUnstakeModule: self.fees_burn_percentage().set(fees_burn_percentage); } - #[endpoint] + #[upgrade] fn upgrade(&self) {} } diff --git a/pause-all/src/lib.rs b/pause-all/src/lib.rs index 6e9bcd823..05f7fe541 100644 --- a/pause-all/src/lib.rs +++ b/pause-all/src/lib.rs @@ -28,7 +28,7 @@ pub trait PauseAll: #[init] fn init(&self) {} - #[endpoint] + #[upgrade] fn upgrade(&self) {} #[only_owner] From 0f92c4ff1a9d7596f4da41c918f7a782afab7539 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Fri, 12 Apr 2024 10:23:51 +0300 Subject: [PATCH 2/2] cargo fmt --- dex/pair/src/read_pair_storage.rs | 2 +- dex/router/src/multi_pair_swap.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dex/pair/src/read_pair_storage.rs b/dex/pair/src/read_pair_storage.rs index a14f862c3..2aeff0566 100644 --- a/dex/pair/src/read_pair_storage.rs +++ b/dex/pair/src/read_pair_storage.rs @@ -73,4 +73,4 @@ pub trait ReadPairStorageModule { SingleValueMapper::<_, _, ManagedAddress>::new_from_address(pair_address, storage_key) } -} \ No newline at end of file +} diff --git a/dex/router/src/multi_pair_swap.rs b/dex/router/src/multi_pair_swap.rs index e69350ecd..dc5492f9d 100644 --- a/dex/router/src/multi_pair_swap.rs +++ b/dex/router/src/multi_pair_swap.rs @@ -19,7 +19,10 @@ pub trait MultiPairSwap: { #[payable("*")] #[endpoint(multiPairSwap)] - fn multi_pair_swap(&self, swap_operations: MultiValueEncoded>) -> ManagedVec { + fn multi_pair_swap( + &self, + swap_operations: MultiValueEncoded>, + ) -> ManagedVec { require!(self.is_active(), "Not active"); let (token_id, nonce, amount) = self.call_value().single_esdt().into_tuple();