Skip to content

Commit

Permalink
Merge pull request #925 from multiversx/simple-lock-exit-farm-with-pe…
Browse files Browse the repository at this point in the history
…nalty-fix

Simple lock exit farm with penalty fix
  • Loading branch information
psorinionut authored Jun 20, 2024
2 parents a639089 + 81be5bb commit 4320a90
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion locked-asset/simple-lock/src/proxy_farm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ pub trait ProxyFarmModule:
farm_address,
farm_proxy_token_attributes.farm_token_id,
farm_proxy_token_attributes.farm_token_nonce,
payment.amount,
payment.amount.clone(),
caller.clone(),
);
require!(
Expand All @@ -236,6 +236,15 @@ pub trait ProxyFarmModule:
&lp_proxy_token_payment.amount,
);

if payment.amount > lp_proxy_token_payment.amount {
let penalty_amount = &payment.amount - &lp_proxy_token_payment.amount;

self.lp_proxy_token().nft_burn(
farm_proxy_token_attributes.farming_token_locked_nonce,
&penalty_amount,
);
}

if exit_farm_result.reward_tokens.amount > 0 {
self.send().direct_esdt(
&caller,
Expand Down

0 comments on commit 4320a90

Please sign in to comment.