Skip to content

Commit

Permalink
Merge pull request #307 from archethic-foundation/306-lp-token-valori…
Browse files Browse the repository at this point in the history
…sation-error

fix: 🐛 Fix lp token fiat calculation
  • Loading branch information
redDwarf03 authored Oct 31, 2024
2 parents 7342701 + 6bf0de0 commit 9651f1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/application/dex_token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,17 @@ Future<double> _estimateLPTokenInFiat(
final amounts = await ref.watch(
DexTokensProviders.getRemoveAmounts(poolAddress, lpTokenAmount).future,
);

if (fiatValueToken1 > 0 && fiatValueToken2 > 0) {
return amounts.token1 * fiatValueToken1 + amounts.token2 * fiatValueToken2;
}

if (fiatValueToken1 > 0 && fiatValueToken2 == 0) {
return (amounts.token1 + amounts.token2) * fiatValueToken1;
return (2 * amounts.token1) * fiatValueToken1;
}

if (fiatValueToken1 == 0 && fiatValueToken2 > 0) {
return (amounts.token1 + amounts.token2) * fiatValueToken2;
return (2 * amounts.token2) * fiatValueToken2;
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: aedex
description: Enable direct peer-to-peer trading of digital assets on the Archethic blockchain, eliminating the need for centralized intermediaries.
publish_to: "none"

version: 2.3.0+92
version: 2.3.1+93

environment:
sdk: ">=3.3.0 <4.0.0"
Expand Down

0 comments on commit 9651f1b

Please sign in to comment.