From b3e4fdc563439d5002fb060edfa4b7dc86607915 Mon Sep 17 00:00:00 2001 From: Abdelrhman Farag Date: Fri, 9 Sep 2022 13:05:58 +0200 Subject: [PATCH 01/15] Add VaultLiquidationTransactionTable component and stories --- ...VaultLiqudationTransactionTable.stories.js | 15 +++ .../vault/VaultLiqudationTransactionTable.vue | 108 ++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 frontend/components/auction/vault/VaultLiqudationTransactionTable.stories.js create mode 100644 frontend/components/auction/vault/VaultLiqudationTransactionTable.vue diff --git a/frontend/components/auction/vault/VaultLiqudationTransactionTable.stories.js b/frontend/components/auction/vault/VaultLiqudationTransactionTable.stories.js new file mode 100644 index 000000000..7d6d4ca5a --- /dev/null +++ b/frontend/components/auction/vault/VaultLiqudationTransactionTable.stories.js @@ -0,0 +1,15 @@ +import { storiesOf } from '@storybook/vue'; +import VaultLiqudationTransactionTable from './VaultLiqudationTransactionTable'; +import { generateFakeVaultNotLiquidatedTransaction } from '~/helpers/generateFakeVault'; + +const common = { + components: { VaultLiqudationTransactionTable }, + data: () => ({ + auction: generateFakeVaultNotLiquidatedTransaction(), + }), + template: '', +}; + +storiesOf('Auction/Vault/VaultLiqudationTransactionTable', module).add('Default', () => ({ + ...common, +})); diff --git a/frontend/components/auction/vault/VaultLiqudationTransactionTable.vue b/frontend/components/auction/vault/VaultLiqudationTransactionTable.vue new file mode 100644 index 000000000..184517cf7 --- /dev/null +++ b/frontend/components/auction/vault/VaultLiqudationTransactionTable.vue @@ -0,0 +1,108 @@ + + + From 47d7e481dc58ac1cef93555defbe16d31a3fdbb8 Mon Sep 17 00:00:00 2001 From: Abdelrhman Farag Date: Fri, 9 Sep 2022 13:08:47 +0200 Subject: [PATCH 02/15] Use float for transaction fees and correct net profit calculation --- frontend/helpers/generateFakeVault.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/helpers/generateFakeVault.ts b/frontend/helpers/generateFakeVault.ts index aaebfd97a..14cf2cbde 100644 --- a/frontend/helpers/generateFakeVault.ts +++ b/frontend/helpers/generateFakeVault.ts @@ -67,7 +67,7 @@ export const generateFakeVault = function (): Vault { }; const generateFakeVaultTransactionFees = function (): VaultTransactionFees { - const transactionFeeLiquidationEth = new BigNumber(faker.datatype.number(0.5)); + const transactionFeeLiquidationEth = new BigNumber(faker.datatype.float({ max: 0.5 })); const transactionFeeLiquidationDai = transactionFeeLiquidationEth.multipliedBy(1600); return { @@ -120,7 +120,7 @@ export const generateFakeVaultNotLiquidatedTransaction = function (): VaultTrans const incentiveConstantDai = new BigNumber(faker.finance.amount()); const incentiveCombinedDai = incentiveRelativeDai.plus(incentiveConstantDai); - const grossProfitDai = incentiveCombinedDai.minus(fakeTransactionFees.transactionFeeLiquidationDai); + const netProfitDai = incentiveCombinedDai.minus(fakeTransactionFees.transactionFeeLiquidationDai); const debtDai = new BigNumber(faker.finance.amount()); return { @@ -134,8 +134,8 @@ export const generateFakeVaultNotLiquidatedTransaction = function (): VaultTrans incentiveRelativeDai, incentiveConstantDai, incentiveCombinedDai, - grossProfitDai, - netProfitDai: incentiveCombinedDai, + grossProfitDai: incentiveCombinedDai, + netProfitDai, debtDai, }; }; From 11dcdf0cf8c89e2ebd48fed45579acaed219b6e2 Mon Sep 17 00:00:00 2001 From: Abdelrhman Farag Date: Fri, 9 Sep 2022 18:12:36 +0200 Subject: [PATCH 03/15] Add signs in transaction table and remove extra space in FormatCurrency --- .../auction/vault/VaultLiqudationTransactionTable.vue | 4 ++-- frontend/components/common/formatters/FormatCurrency.vue | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/components/auction/vault/VaultLiqudationTransactionTable.vue b/frontend/components/auction/vault/VaultLiqudationTransactionTable.vue index 184517cf7..4147716bc 100644 --- a/frontend/components/auction/vault/VaultLiqudationTransactionTable.vue +++ b/frontend/components/auction/vault/VaultLiqudationTransactionTable.vue @@ -50,7 +50,7 @@
Potential gross profit
- + + Unknown
@@ -62,7 +62,7 @@ >
- Unknown - {{ sign }} + {{ sign }} {{ currency }} From 000870dbe06a501ab55112b4240cf1f0625a400a Mon Sep 17 00:00:00 2001 From: Abdelrhman Farag Date: Mon, 12 Sep 2022 16:50:06 +0200 Subject: [PATCH 04/15] Add AnimatedArrow --- .../vault/VaultLiqudationTransactionTable.vue | 25 ++++++++++++++----- .../components/common/other/AnimatedArrow.vue | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/frontend/components/auction/vault/VaultLiqudationTransactionTable.vue b/frontend/components/auction/vault/VaultLiqudationTransactionTable.vue index 4147716bc..0049e8a77 100644 --- a/frontend/components/auction/vault/VaultLiqudationTransactionTable.vue +++ b/frontend/components/auction/vault/VaultLiqudationTransactionTable.vue @@ -11,9 +11,9 @@
Next price update
-
- - in +
+ + in
@@ -82,26 +82,39 @@ diff --git a/frontend/components/vault/VaultLiquidationTransactionFlow.stories.js b/frontend/components/vault/VaultLiquidationTransactionFlow.stories.js new file mode 100644 index 000000000..fe20af5ac --- /dev/null +++ b/frontend/components/vault/VaultLiquidationTransactionFlow.stories.js @@ -0,0 +1,52 @@ +import { storiesOf } from '@storybook/vue'; +import faker from 'faker'; +import VaultLiquidationTransactionFlow from '~/components/vault/VaultLiquidationTransactionFlow'; +import { + generateFakeVaultLiquidatedTransaction, + generateFakeVaultNotLiquidatedTransaction, +} from '~/helpers/generateFakeVault'; + +const common = { + components: { VaultLiquidationTransactionFlow }, + data: () => ({ + vaultTransaction: generateFakeVaultNotLiquidatedTransaction(), + network: 'mainnet', + + isConnectingWallet: false, + walletAddress: undefined, + }), + methods: { + connect() { + this.isConnectingWallet = true; + setTimeout(() => { + this.walletAddress = faker.finance.ethereumAddress(); + this.isConnectingWallet = false; + }, 1000); + }, + disconnect() { + this.isConnectingWallet = true; + setTimeout(() => { + this.walletAddress = undefined; + this.isConnectingWallet = false; + }, 1000); + }, + }, + template: ` + `, +}; + +storiesOf('Vault/VaultLiquidationTransactionFlow', module) + .add('Default', () => ({ + ...common, + })) + .add('Liquidated', () => ({ + ...common, + data: () => ({ + ...common.data(), + vaultTransaction: generateFakeVaultLiquidatedTransaction(), + }), + })); diff --git a/frontend/components/vault/VaultLiquidationTransactionFlow.vue b/frontend/components/vault/VaultLiquidationTransactionFlow.vue new file mode 100644 index 000000000..b4a06722f --- /dev/null +++ b/frontend/components/vault/VaultLiquidationTransactionFlow.vue @@ -0,0 +1,113 @@ + + + diff --git a/frontend/components/vault/VaultLiquidationTransactionTable.stories.js b/frontend/components/vault/VaultLiquidationTransactionTable.stories.js new file mode 100644 index 000000000..b163d5078 --- /dev/null +++ b/frontend/components/vault/VaultLiquidationTransactionTable.stories.js @@ -0,0 +1,26 @@ +import { storiesOf } from '@storybook/vue'; +import VaultLiquidationTransactionTable from '~/components/vault/VaultLiquidationTransactionTable'; +import { + generateFakeVaultLiquidatedTransaction, + generateFakeVaultNotLiquidatedTransaction, +} from '~/helpers/generateFakeVault'; + +const common = { + components: { VaultLiquidationTransactionTable }, + data: () => ({ + vaultTransaction: generateFakeVaultNotLiquidatedTransaction(), + }), + template: '', +}; + +storiesOf('Vault/VaultLiquidationTransactionTable', module) + .add('Default', () => ({ + ...common, + })) + .add('Liquidated', () => ({ + ...common, + data: () => ({ + ...common.data(), + vaultTransaction: generateFakeVaultLiquidatedTransaction(), + }), + })); diff --git a/frontend/components/vault/VaultLiquidationTransactionTable.vue b/frontend/components/vault/VaultLiquidationTransactionTable.vue new file mode 100644 index 000000000..b983492ab --- /dev/null +++ b/frontend/components/vault/VaultLiquidationTransactionTable.vue @@ -0,0 +1,158 @@ + + + diff --git a/frontend/helpers/generateFakeVault.ts b/frontend/helpers/generateFakeVault.ts index 14cf2cbde..067c4243f 100644 --- a/frontend/helpers/generateFakeVault.ts +++ b/frontend/helpers/generateFakeVault.ts @@ -88,7 +88,7 @@ const generateFakeOraclePrices = function (): OraclePrices { }; }; -const generateFakeVaultLiqudatedTransaction = function (): VaultTransactionLiquidated { +export const generateFakeVaultLiquidatedTransaction = function (): VaultTransactionLiquidated { const fakeVault = generateFakeVault(); const liqudiationDate = faker.date.recent(); @@ -149,7 +149,7 @@ export const generateFakeVaultTransactions = function ( notLiquidatedVaultsAmount = random(5, 15) ) { const vaults = []; - vaults.push(Array(liquidatedVaultsAmount).fill(null).map(generateFakeVaultLiqudatedTransaction)); + vaults.push(Array(liquidatedVaultsAmount).fill(null).map(generateFakeVaultLiquidatedTransaction)); vaults.push(Array(notLiquidatedVaultsAmount).fill(null).map(generateFakeVaultNotLiquidatedTransaction)); return vaults; }; From 580ae571c17cc9886ec8410aa42728af9baeccf7 Mon Sep 17 00:00:00 2001 From: Zoey Kaiser Date: Wed, 14 Sep 2022 18:29:57 +0200 Subject: [PATCH 09/15] Requested changes --- .../common/formatters/FormatPercentage.vue | 2 +- .../components/common/other/AnimatedArrow.vue | 7 +++++-- .../VaultLiquidationTransactionFlow.stories.js | 1 - .../vault/VaultLiquidationTransactionFlow.vue | 13 ++++--------- .../vault/VaultLiquidationTransactionTable.vue | 15 ++++++++------- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/frontend/components/common/formatters/FormatPercentage.vue b/frontend/components/common/formatters/FormatPercentage.vue index fef05c758..38fc18e2b 100644 --- a/frontend/components/common/formatters/FormatPercentage.vue +++ b/frontend/components/common/formatters/FormatPercentage.vue @@ -9,7 +9,7 @@ export default Vue.extend({ name: 'FormatPercentage', props: { value: { - type: Number, + type: [Number, String], required: true, }, }, diff --git a/frontend/components/common/other/AnimatedArrow.vue b/frontend/components/common/other/AnimatedArrow.vue index 2dd8523b1..1bdb6dbd0 100644 --- a/frontend/components/common/other/AnimatedArrow.vue +++ b/frontend/components/common/other/AnimatedArrow.vue @@ -1,5 +1,5 @@ diff --git a/frontend/components/vault/VaultLiquidationTransactionTable.stories.js b/frontend/components/vault/VaultLiquidationTransactionTable.stories.js index b163d5078..ab7a9e24b 100644 --- a/frontend/components/vault/VaultLiquidationTransactionTable.stories.js +++ b/frontend/components/vault/VaultLiquidationTransactionTable.stories.js @@ -1,9 +1,6 @@ import { storiesOf } from '@storybook/vue'; import VaultLiquidationTransactionTable from '~/components/vault/VaultLiquidationTransactionTable'; -import { - generateFakeVaultLiquidatedTransaction, - generateFakeVaultNotLiquidatedTransaction, -} from '~/helpers/generateFakeVault'; +import { generateFakeVaultNotLiquidatedTransaction } from '~/helpers/generateFakeVault'; const common = { components: { VaultLiquidationTransactionTable }, @@ -13,14 +10,6 @@ const common = { template: '', }; -storiesOf('Vault/VaultLiquidationTransactionTable', module) - .add('Default', () => ({ - ...common, - })) - .add('Liquidated', () => ({ - ...common, - data: () => ({ - ...common.data(), - vaultTransaction: generateFakeVaultLiquidatedTransaction(), - }), - })); +storiesOf('Vault/VaultLiquidationTransactionTable', module).add('Default', () => ({ + ...common, +})); diff --git a/frontend/components/vault/VaultLiquidationTransactionTable.vue b/frontend/components/vault/VaultLiquidationTransactionTable.vue index cf680de6b..95b19587d 100644 --- a/frontend/components/vault/VaultLiquidationTransactionTable.vue +++ b/frontend/components/vault/VaultLiquidationTransactionTable.vue @@ -6,27 +6,20 @@ (Ready for liquidation) - - {{ vaultTransaction.proximityToLiquidation }}% - - + {{ vaultTransaction.proximityToLiquidation }}%
Next price update
- - Unknown + + in
Debt
- - Unknown +
@@ -40,20 +33,13 @@ >clip.chip. - (~ for {{ vaultTransaction.collateralType }})
- - Unknown +
@@ -70,46 +56,26 @@
- - Unknown +
Potential gross profit
-
- - Unknown -
+
+
Transaction fee - (~ ) -
-
- - Unknown + + (~ ) +
+
-
Potential net profit
- - Unknown +
From 39abfe3b31593062528621a38b9b7e5dd0080029 Mon Sep 17 00:00:00 2001 From: Zoey Kaiser Date: Thu, 15 Sep 2022 18:02:03 +0200 Subject: [PATCH 14/15] Made more props required in VaultLiquidationLimitsCheckPanel --- .../components/common/other/AnimatedArrow.vue | 5 +---- .../panels/VaultLiquidationLimitsCheckPanel.vue | 17 +++++++---------- .../vault/VaultLiquidationTransactionFlow.vue | 4 ++-- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/frontend/components/common/other/AnimatedArrow.vue b/frontend/components/common/other/AnimatedArrow.vue index be4816e51..2dd8523b1 100644 --- a/frontend/components/common/other/AnimatedArrow.vue +++ b/frontend/components/common/other/AnimatedArrow.vue @@ -1,5 +1,5 @@