From b6049bf5b10b33bf4d85c8a4ccb8da8533f6148f Mon Sep 17 00:00:00 2001 From: ovidiuolteanu Date: Wed, 13 Dec 2023 13:04:52 +0200 Subject: [PATCH 1/2] separate upgrade endpoint --- dex/farm-with-locked-rewards/src/lib.rs | 6 +++++- farm-staking/farm-staking/src/lib.rs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dex/farm-with-locked-rewards/src/lib.rs b/dex/farm-with-locked-rewards/src/lib.rs index d4f5ec52b..473fa77d2 100644 --- a/dex/farm-with-locked-rewards/src/lib.rs +++ b/dex/farm-with-locked-rewards/src/lib.rs @@ -82,7 +82,11 @@ pub trait Farm: } #[endpoint] - fn upgrade(&self) {} + fn upgrade(&self) { + // Farm position migration code + let farm_token_mapper = self.farm_token(); + self.try_set_farm_position_migration_nonce(farm_token_mapper); + } #[payable("*")] #[endpoint(enterFarm)] diff --git a/farm-staking/farm-staking/src/lib.rs b/farm-staking/farm-staking/src/lib.rs index 32cbec0e1..33f5bbd1a 100644 --- a/farm-staking/farm-staking/src/lib.rs +++ b/farm-staking/farm-staking/src/lib.rs @@ -95,7 +95,11 @@ pub trait FarmStaking: } #[endpoint] - fn upgrade(&self) {} + fn upgrade(&self) { + // Farm position migration code + let farm_token_mapper = self.farm_token(); + self.try_set_farm_position_migration_nonce(farm_token_mapper); + } #[payable("*")] #[endpoint(mergeFarmTokens)] From d35e367368cfa30abf938befb6ab0d60fc10e1af Mon Sep 17 00:00:00 2001 From: ovidiuolteanu Date: Wed, 13 Dec 2023 13:25:53 +0200 Subject: [PATCH 2/2] separate upgrade endpoint update for farm --- dex/farm/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dex/farm/src/lib.rs b/dex/farm/src/lib.rs index b29d7c8a5..48cf893f1 100644 --- a/dex/farm/src/lib.rs +++ b/dex/farm/src/lib.rs @@ -83,7 +83,11 @@ pub trait Farm: } #[endpoint] - fn upgrade(&self) {} + fn upgrade(&self) { + // Farm position migration code + let farm_token_mapper = self.farm_token(); + self.try_set_farm_position_migration_nonce(farm_token_mapper); + } #[payable("*")] #[endpoint(enterFarm)]