Skip to content

Commit

Permalink
remove caller check in migrate old position func
Browse files Browse the repository at this point in the history
  • Loading branch information
psorinionut committed Sep 19, 2023
1 parent be142a3 commit a77b760
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
13 changes: 4 additions & 9 deletions dex/farm/src/base_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,10 @@ pub trait BaseFunctionsModule:
if farm_position.token_identifier == farm_token_id
&& self.is_old_farm_position(farm_position.token_nonce)
{
let token_attributes: FarmTokenAttributes<Self::Api> =
farm_token_mapper.get_token_attributes(farm_position.token_nonce);

if &token_attributes.original_owner == caller {
let mut user_total_farm_position = self.get_user_total_farm_position(caller);
user_total_farm_position.total_farm_position += farm_position.amount;
self.user_total_farm_position(caller)
.set(user_total_farm_position);
}
let mut user_total_farm_position = self.get_user_total_farm_position(caller);
user_total_farm_position.total_farm_position += farm_position.amount;
self.user_total_farm_position(caller)
.set(user_total_farm_position);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{base_impl_wrapper::FarmStakingWrapper, token_attributes::StakingFarmTokenAttributes};
use crate::base_impl_wrapper::FarmStakingWrapper;

multiversx_sc::imports!();

Expand Down Expand Up @@ -57,15 +57,10 @@ pub trait ClaimOnlyBoostedStakingRewardsModule:
if farm_position.token_identifier == farm_token_id
&& self.is_old_farm_position(farm_position.token_nonce)
{
let token_attributes: StakingFarmTokenAttributes<Self::Api> =
farm_token_mapper.get_token_attributes(farm_position.token_nonce);

if &token_attributes.original_owner == caller {
let mut user_total_farm_position = self.get_user_total_farm_position(caller);
user_total_farm_position.total_farm_position += farm_position.amount;
self.user_total_farm_position(caller)
.set(user_total_farm_position);
}
let mut user_total_farm_position = self.get_user_total_farm_position(caller);
user_total_farm_position.total_farm_position += farm_position.amount;
self.user_total_farm_position(caller)
.set(user_total_farm_position);
}
}
}
Expand Down

0 comments on commit a77b760

Please sign in to comment.