Skip to content

Commit

Permalink
Merge pull request #868 from multiversx/farm-staking-init-first-week-fix
Browse files Browse the repository at this point in the history
first_week_start_epoch on farm staking init
  • Loading branch information
psorinionut authored Mar 28, 2024
2 parents 7ee6ddc + 50265d9 commit 2ce5dae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dex/farm-with-locked-rewards/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ pub trait Farm:

#[endpoint]
fn upgrade(&self) {
let current_epoch = self.blockchain().get_block_epoch();
self.first_week_start_epoch().set_if_empty(current_epoch);

// Farm position migration code
let farm_token_mapper = self.farm_token();
self.try_set_farm_position_migration_nonce(farm_token_mapper);
Expand Down
3 changes: 3 additions & 0 deletions dex/farm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ pub trait Farm:

#[endpoint]
fn upgrade(&self) {
let current_epoch = self.blockchain().get_block_epoch();
self.first_week_start_epoch().set_if_empty(current_epoch);

// Farm position migration code
let farm_token_mapper = self.farm_token();
self.try_set_farm_position_migration_nonce(farm_token_mapper);
Expand Down
6 changes: 6 additions & 0 deletions farm-staking/farm-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,19 @@ pub trait FarmStaking:
);
self.min_unbond_epochs().set_if_empty(min_unbond_epochs);

let current_epoch = self.blockchain().get_block_epoch();
self.first_week_start_epoch().set_if_empty(current_epoch);

// Farm position migration code
let farm_token_mapper = self.farm_token();
self.try_set_farm_position_migration_nonce(farm_token_mapper);
}

#[endpoint]
fn upgrade(&self) {
let current_epoch = self.blockchain().get_block_epoch();
self.first_week_start_epoch().set_if_empty(current_epoch);

// Farm position migration code
let farm_token_mapper = self.farm_token();
self.try_set_farm_position_migration_nonce(farm_token_mapper);
Expand Down

0 comments on commit 2ce5dae

Please sign in to comment.