diff --git a/.env.local.test b/.env.local.test index 4a10b919..264ed68e 100644 --- a/.env.local.test +++ b/.env.local.test @@ -27,4 +27,5 @@ VUE_APP_LBC_ADDRESS='0xc2A630c053D12D63d32b025082f6Ba268db18300' VUE_APP_DEBUG_MODE='true' NODE_ENV=test +VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2 # 2% diff --git a/.github/workflows/deploy_MainNet_UI.yml b/.github/workflows/deploy_MainNet_UI.yml index 4192a65a..409a73db 100644 --- a/.github/workflows/deploy_MainNet_UI.yml +++ b/.github/workflows/deploy_MainNet_UI.yml @@ -53,6 +53,7 @@ jobs: VUE_APP_AVERAGE_MINING_BLOCK=3 VUE_APP_SLOW_MINING_BLOCK=5 VUE_APP_LBC_ADDRESS='0xAA9cAf1e3967600578727F975F283446A3Da6612' + VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2 npm run-script build - name: Configure AWS credentials diff --git a/.github/workflows/deploy_TestNet_UI.yml b/.github/workflows/deploy_TestNet_UI.yml index 9b11a2c3..7edf5ed3 100644 --- a/.github/workflows/deploy_TestNet_UI.yml +++ b/.github/workflows/deploy_TestNet_UI.yml @@ -53,6 +53,7 @@ jobs: VUE_APP_AVERAGE_MINING_BLOCK=3 VUE_APP_SLOW_MINING_BLOCK=5 VUE_APP_LBC_ADDRESS='0xc2A630c053D12D63d32b025082f6Ba268db18300' + VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2 npm run-script build - name: Configure AWS credentials diff --git a/.github/workflows/deploy_staging_MainNet_UI.yml b/.github/workflows/deploy_staging_MainNet_UI.yml index 5643da4f..46f98081 100644 --- a/.github/workflows/deploy_staging_MainNet_UI.yml +++ b/.github/workflows/deploy_staging_MainNet_UI.yml @@ -53,6 +53,7 @@ jobs: VUE_APP_AVERAGE_MINING_BLOCK=3 VUE_APP_SLOW_MINING_BLOCK=5 VUE_APP_LBC_ADDRESS='0xAA9cAf1e3967600578727F975F283446A3Da6612' + VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2 npm run-script build - name: Configure AWS credentials diff --git a/.github/workflows/deploy_staging_TestNet_UI.yml b/.github/workflows/deploy_staging_TestNet_UI.yml index adbc7b31..739dc635 100644 --- a/.github/workflows/deploy_staging_TestNet_UI.yml +++ b/.github/workflows/deploy_staging_TestNet_UI.yml @@ -53,6 +53,7 @@ jobs: VUE_APP_AVERAGE_MINING_BLOCK=3 VUE_APP_SLOW_MINING_BLOCK=5 VUE_APP_LBC_ADDRESS='0xc2A630c053D12D63d32b025082f6Ba268db18300' + VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2 npm run-script build - name: Configure AWS credentials diff --git a/ENV_VARIABLES.md b/ENV_VARIABLES.md index e17ee9a8..66c4d41d 100644 --- a/ENV_VARIABLES.md +++ b/ENV_VARIABLES.md @@ -21,6 +21,7 @@ The value of these variables are used in **environment-variables.ts** file. |VUE_APP_MIN_FEE_SAT_PER_BYTE_SLOW | `1` | Min fee rate (sats/byte) required to broadcast the transaction | |VUE_APP_LBC_ADDRESS | `0xc2A630c053D12D63d32b025082f6Ba268db18300` | Liquidity bridge contract address on the flyover protocol | |VUE_APP_DEBUG_MODE | `false` | enable developer messages for debuging | +|VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE | `2` | Defines quote difference percentage to 2% so it requieres the user to review condition only for a difference bigger that this percentage | ## Example for .env.local.test file @@ -42,4 +43,5 @@ VUE_APP_MIN_FEE_SAT_PER_BYTE_AVG=4 VUE_APP_MIN_FEE_SAT_PER_BYTE_SLOW=1 VUE_APP_LBC_ADDRESS='0xc2A630c053D12D63d32b025082f6Ba268db18300' VUE_APP_DEBUG_MODE='false' +VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2 ``` diff --git a/src/common/store/constants.ts b/src/common/store/constants.ts index bf824c09..04677608 100644 --- a/src/common/store/constants.ts +++ b/src/common/store/constants.ts @@ -159,8 +159,7 @@ export const FLYOVER_PEGOUT_SET_CLEAR_STATE = 'FLYOVER_PEGOUT_SET_CLEAR_STATE'; export const FLYOVER_PEGOUT_SET_BTC_ADDRESS = 'FLYOVER_PEGOUT_SET_BTC_ADDRESS'; export const FLYOVER_PEGOUT_SET_TX_HASH = 'FLYOVER_PEGOUT_SET_TX_HASH'; export const FLYOVER_PEGOUT_SET_SELECTED_QUOTE = 'FLYOVER_PEGOUT_SET_SELECTED_QUOTE'; -export const FLYOVER_PEGOUT_SET_QUOTES_DIFFERENCES = 'FLYOVER_PEGOUT_SET_QUOTES_DIFFERENCES'; -export const FLYOVER_PEGOUT_SET_RESPONDING = 'FLYOVER_PEGOUT_SET_RESPONDING'; +export const FLYOVER_PEGOUT_SET_QUOTES_DIFFERENCE = 'FLYOVER_PEGOUT_SET_QUOTES_DIFFERENCE'; // Flyover PegIn mutations export const FLYOVER_PEGIN_SET_PROVIDERS = 'FLYOVER_PEGIN_SET_PROVIDERS'; diff --git a/src/common/types/Flyover/FlyoverPegout.ts b/src/common/types/Flyover/FlyoverPegout.ts index ca46a21e..9b2e8db0 100644 --- a/src/common/types/Flyover/FlyoverPegout.ts +++ b/src/common/types/Flyover/FlyoverPegout.ts @@ -1,10 +1,10 @@ -import { LiquidityProvider2WP, ObjectDifference, QuotePegOut2WP } from '@/common/types'; +import { LiquidityProvider2WP, QuotePegOut2WP } from '@/common/types'; import { FlyoverService } from '../../services'; import SatoshiBig from '../SatoshiBig'; import WeiBig from '../WeiBig'; export interface FlyoverPegoutState { - differences: Array; + difference: number; amountToTransfer: WeiBig; validAmount: boolean; btcRecipientAddress: string; @@ -14,5 +14,4 @@ export interface FlyoverPegoutState { flyoverService: FlyoverService; txHash?: string; selectedQuoteHash: string; - isResponding: boolean; } diff --git a/src/common/types/environment-variables.ts b/src/common/types/environment-variables.ts index 3e21ffbc..a8ddd673 100644 --- a/src/common/types/environment-variables.ts +++ b/src/common/types/environment-variables.ts @@ -45,6 +45,8 @@ export class EnvironmentVariables { public peginMinAmountAllowedInBtc: number; + public flyoverPegoutDiffPercentage: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor(defaultValues: any = {}) { this.vueAppCoin = process.env.VUE_APP_COIN || defaultValues.vueAppCoin; @@ -87,5 +89,7 @@ export class EnvironmentVariables { this.debugMode = process.env.VUE_APP_DEBUG_MODE === 'true' || defaultValues.debugMode; this.peginMinAmountAllowedInBtc = Number(process.env.VUE_APP_PEGIN_MIN_AMOUNT_ALLOWED_IN_BTC) || defaultValues.peginMinValue; + this.flyoverPegoutDiffPercentage = Number(process.env + .VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE) || defaultValues.flyoverPegoutDiffPercentage; } } diff --git a/src/common/utils/common.ts b/src/common/utils/common.ts index 8f7e5dd6..d22a9172 100644 --- a/src/common/utils/common.ts +++ b/src/common/utils/common.ts @@ -107,8 +107,7 @@ export const getClearFlyoverPegoutState = (): FlyoverPegoutState => ({ quotes: {}, flyoverService: markRaw(new FlyoverService()), selectedQuoteHash: '', - differences: [], - isResponding: false, + difference: 0, }); export const getClearFlyoverPeginState = (): FlyoverPeginState => ({ diff --git a/src/main.ts b/src/main.ts index 35f48aaa..9bc24a93 100644 --- a/src/main.ts +++ b/src/main.ts @@ -30,6 +30,7 @@ const defaultEnvironmentVariables = { slow: 12, }, burnDustValue: 2000, + flyoverPegoutDiffPercentage: 2, }; EnvironmentAccessorService.initializeEnvironmentVariables(defaultEnvironmentVariables); diff --git a/src/pegout/components/PegoutForm.vue b/src/pegout/components/PegoutForm.vue index 122b4408..3b899e10 100644 --- a/src/pegout/components/PegoutForm.vue +++ b/src/pegout/components/PegoutForm.vue @@ -12,7 +12,7 @@ + :clear="clearAmount" />