From 7491986faa037f668d9b8d84e78d7e78b992eef0 Mon Sep 17 00:00:00 2001 From: Alan Soares Date: Sat, 1 Oct 2022 10:34:43 +1300 Subject: [PATCH 1/2] fix: display currentRowanLiquidityThreshold based on maxRowanLiquidityThresholdAsset --- app/src/business/calculators/swapCalculatorPMTP.ts | 14 +++++++++----- app/src/views/SwapPage/useSwapPageData.ts | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/business/calculators/swapCalculatorPMTP.ts b/app/src/business/calculators/swapCalculatorPMTP.ts index 41c54b930..ec9416caa 100644 --- a/app/src/business/calculators/swapCalculatorPMTP.ts +++ b/app/src/business/calculators/swapCalculatorPMTP.ts @@ -357,12 +357,16 @@ export function useSwapCalculator(input: { const { data: liquidityProtectionParams } = useLiquidityProtectionParams(); - const currentRowanLiquidityThreshold = computed(() => { + const currentAssetLiquidityThreshold = computed(() => { const value = liquidityProtectionParams.value?.rateParams ?.currentRowanLiquidityThreshold; - return AssetAmount("rowan", value ?? "0"); + return AssetAmount( + liquidityProtectionParams.value?.params + ?.maxRowanLiquidityThresholdAsset ?? "rowan", + value ?? "0", + ); }); // Derive state @@ -410,12 +414,12 @@ export function useSwapCalculator(input: { if ( fromField.value.asset?.symbol === "rowan" && fromField.value.fieldAmount.greaterThanOrEqual( - currentRowanLiquidityThreshold.value, + currentAssetLiquidityThreshold.value, ) ) { if (process.env.NODE_ENV !== "production") { console.log({ - currentRowanLiquidityThreshold: currentRowanLiquidityThreshold.value + currentRowanLiquidityThreshold: currentAssetLiquidityThreshold.value .toDerived() .toNumber(), }); @@ -453,6 +457,6 @@ export function useSwapCalculator(input: { swapResult, reverseSwapResult, priceRatio, - currentRowanLiquidityThreshold, + currentAssetLiquidityThreshold, }; } diff --git a/app/src/views/SwapPage/useSwapPageData.ts b/app/src/views/SwapPage/useSwapPageData.ts index 91770fce3..135b26b15 100644 --- a/app/src/views/SwapPage/useSwapPageData.ts +++ b/app/src/views/SwapPage/useSwapPageData.ts @@ -181,7 +181,7 @@ export const useSwapPageData = () => { providerFee, minimumReceived, effectiveMinimumReceived, - currentRowanLiquidityThreshold, + currentAssetLiquidityThreshold, } = useSwapCalculator({ balances: computed(() => store.wallet.get(Network.SIFCHAIN).balances), fromAmount, @@ -293,7 +293,7 @@ export const useSwapPageData = () => { }); const formattedCurrentLiquidityThreshold = computed(() => - currentRowanLiquidityThreshold.value + currentAssetLiquidityThreshold.value .toDerived() .toNumber() .toLocaleString("en", { From ef816cc902e138283a84b7e1ebae9bb6fa2675c0 Mon Sep 17 00:00:00 2001 From: Alan Soares Date: Sat, 1 Oct 2022 10:36:18 +1300 Subject: [PATCH 2/2] testnet release 2.12.3 --- app/package.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/package.json b/app/package.json index 30b2f3d65..442c3997a 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "app", - "version": "2.12.2", + "version": "2.12.3", "private": true, "scripts": { "bump": "bump patch --tag --commit 'testnet release '", diff --git a/package.json b/package.json index 344ad5ac1..742c4360a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sifchain-ui", - "version": "2.12.2", + "version": "2.12.3", "private": true, "license": "UNLICENSED", "packageManager": "yarn@3.2.0",