Skip to content

Commit

Permalink
fix: swap-calculator-amount-initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
alanrsoares committed Mar 23, 2022
1 parent ae3bf93 commit a9b1530
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ui/app/src/business/calculators/swapCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ export function useSwapCalculator(input: {
const toField = useField(input.toAmount, input.toSymbol);

const priceRatio = computed(() => {
if (
!fromField.fieldAmount.value ||
fromField.fieldAmount.value.equalTo("0") ||
!pool.value
) {
if (!fromField.fieldAmount.value || !pool.value) {
return "0.0";
}

const amount = fromField.fieldAmount.value;
const amount = fromField.fieldAmount.value.equalTo("0")
? AssetAmount(fromField.fieldAmount.value.asset, "1")
: fromField.fieldAmount.value;

const pair = pool.value;
const swapResult = pair.calcSwapResult(amount);
// to get ratio needs to be divided by amount as input by user
Expand Down

0 comments on commit a9b1530

Please sign in to comment.