Skip to content

Commit

Permalink
Merge pull request #238 from Phoenix-Protocol-Group/220-v-phx-vul-020…
Browse files Browse the repository at this point in the history
…-incorrect-computation-of-return-amount

Pool: adds a missed part of return_amount argument
  • Loading branch information
ueco-jb authored Feb 9, 2024
2 parents dd5627d + 15cdbbc commit 9978b81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ and this project adheres to

- Update soroban-sdk version from v20.0.3 to v20.1.0 ([#193])
- Fixes documentation and naming ([#200])
- Pool: adds a missed part of return_amount argument ([#238])

[#200]: https://github.com/Phoenix-Protocol-Group/phoenix-contracts/pull/200
[#238]: https://github.com/Phoenix-Protocol-Group/phoenix-contracts/pull/238

## Added

Expand Down
6 changes: 5 additions & 1 deletion contracts/pool/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,16 @@ fn do_swap(
referral_fee_bps,
);

let total_return_amount = compute_swap.return_amount
+ compute_swap.commission_amount
+ compute_swap.referral_fee_amount;

assert_max_spread(
&env,
belief_price,
max_spread,
offer_amount,
compute_swap.return_amount + compute_swap.commission_amount,
total_return_amount,
compute_swap.spread_amount,
);

Expand Down

0 comments on commit 9978b81

Please sign in to comment.