Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add liquidity pool route #484

Merged
merged 4 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions src/components/SwapInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@
<info-line v-for="(reward, index) in rewardsValues" :key="index" v-bind="reward" />
<info-line v-if="hasPriceImpact" :label="t('swap.priceImpact')" :label-tooltip="t('swap.priceImpactTooltip')">
<value-status-wrapper :value="priceImpact">
<formatted-amount class="price-impact-value" :value="priceImpactFormatted">%</formatted-amount>
<formatted-amount class="swap-value" :value="priceImpactFormatted">%</formatted-amount>
</value-status-wrapper>
</info-line>
<info-line :label="t('swap.route')">
<div v-for="token in swapRoute" class="liquidity-route swap-value" :key="token">
<span>{{ token }}</span>
<s-icon name="el-icon el-icon-arrow-right" />
</div>
</info-line>
<info-line
:label="t('swap.liquidityProviderFee')"
:label-tooltip="liquidityProviderFeeTooltipText"
Expand Down Expand Up @@ -82,6 +88,18 @@ export default class SwapInfo extends Mixins(mixins.FormattedAmountMixin, Transl
return this.t('swap.liquidityProviderFeeTooltip', { liquidityProviderFee: this.liquidityProviderFeeValue });
}

get swapRoute(): Array<string> {
const fromToken: string = this.tokenFrom?.symbol ?? '';
const toToken: string = this.tokenTo?.symbol ?? '';
const xorToken: string = KnownSymbols.XOR;

if ([fromToken, toToken].includes(xorToken)) {
return [fromToken, toToken];
}

return [fromToken, xorToken, toToken];
}

get priceValues(): Array<object> {
const fromSymbol = this.tokenFrom?.symbol ?? '';
const toSymbol = this.tokenTo?.symbol ?? '';
Expand Down Expand Up @@ -177,7 +195,11 @@ export default class SwapInfo extends Mixins(mixins.FormattedAmountMixin, Transl
color: inherit;
}
}
.price-impact-value {
.swap-value {
font-weight: 600;
}

.liquidity-route:last-child .el-icon {
display: none;
}
</style>
3 changes: 2 additions & 1 deletion src/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Potvrďte výměnu",
"swapOutputMessage": "Výstup je odhadován. Obdržíte alespoň {transactionValue}, jinak se transakce vrátí zpět.",
"rewardsForSwap": "Strategické odměny PSWAP",
"swapInputMessage": "Vstup je odhadován. Prodáte maximálně {transactionValue}, jinak se transakce vrátí zpět."
"swapInputMessage": "Vstup je odhadován. Prodáte maximálně {transactionValue}, jinak se transakce vrátí zpět.",
"route": "Trasa"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Tausch bestätigen",
"swapOutputMessage": "Die Ausgabe ist geschätzt. Du erhältst mindestens {transactionValue}, ansonsten wird die Transaktion rückgängig gemacht.",
"rewardsForSwap": "PSWAP strategische Belohnungen",
"swapInputMessage": "Die Eingabe wird geschätzt. Du wirst maximal {transactionValue} verkaufen oder die Transaktion wird rückgängig gemacht."
"swapInputMessage": "Die Eingabe wird geschätzt. Du wirst maximal {transactionValue} verkaufen oder die Transaktion wird rückgängig gemacht.",
"route": "Route"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Confirm swap",
"swapOutputMessage": "Output is estimated. You will receive at least {transactionValue} or the transaction will revert.",
"rewardsForSwap": "PSWAP Strategic Rewards",
"swapInputMessage": "Input is estimated. You will sell maximum {transactionValue} or the transaction will revert."
"swapInputMessage": "Input is estimated. You will sell maximum {transactionValue} or the transaction will revert.",
"route": "Route"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Confirmar el intercambio",
"swapOutputMessage": "La cantidad de salida es estimada. Recibirá al menos {transactionValue} o la transacción se revertirá.",
"rewardsForSwap": "Recompensas estratégicas de PSWAP",
"swapInputMessage": "La entrada es estimada. Venderá el máximo de {transactionValue} o la transacción se revertirá"
"swapInputMessage": "La entrada es estimada. Venderá el máximo de {transactionValue} o la transacción se revertirá",
"route": "Ruta"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Confirmer l'échange",
"swapOutputMessage": "Le montant à recevoir est estimé. Vous recevrez au moins {transactionValue} ou la transaction sera annulée.",
"rewardsForSwap": "Récompenses stratégiques PSWAP",
"swapInputMessage": "Le montant est estimé. Vous vendrez au maximum {transactionValue} ou la transaction sera annulée."
"swapInputMessage": "Le montant est estimé. Vous vendrez au maximum {transactionValue} ou la transaction sera annulée.",
"route": "Route"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/hy.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Հաստատեք փոխանակումը",
"swapOutputMessage": "Արդյունքը գնահատվում է: Դուք կստանաք առնվազն {transactionValue} կամ գործարքը կվերականգնվի:",
"rewardsForSwap": "PSWAP ստրատեգիական պարգևատրումներ",
"swapInputMessage": "Արդյունքը գնահատվում է: Դուք կստանաք առնվազն {transactionValue} կամ գործարքը կվերականգնվի:"
"swapInputMessage": "Արդյունքը գնահատվում է: Դուք կստանաք առնվազն {transactionValue} կամ գործարքը կվերականգնվի:",
"route": "Երթուղի"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Konfirmasi swap",
"swapOutputMessage": "Keluaran diperkirakan. Anda akan menerima setidaknya {transactionValue} atau transaksi akan dibatalkan.",
"rewardsForSwap": "Reward Strategis PSWAP",
"swapInputMessage": "Masukan diperkirakan. Anda akan menjual maksimum {transactionValue} atau transaksi akan kembali."
"swapInputMessage": "Masukan diperkirakan. Anda akan menjual maksimum {transactionValue} atau transaksi akan kembali.",
"route": "Rute"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Conferma lo scambio",
"swapOutputMessage": "L'output è stimato. Riceverai almeno {transactionValue} o la transazione tornerà indietro.",
"rewardsForSwap": "PSWAP Strategic Rewards",
"swapInputMessage": "L'input è stimato. Venderai al massimo {transactionValue} o la transazione verrà annullata."
"swapInputMessage": "L'input è stimato. Venderai al massimo {transactionValue} o la transazione verrà annullata.",
"route": "Rotta"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Swap bevestigen",
"swapOutputMessage": "De output wordt geschat. U ontvangt minimaal {transactionValue} of de transactie wordt teruggedraaid.",
"rewardsForSwap": "PSWAP Strategische Beloningen",
"swapInputMessage": "Invoer wordt geschat. U verkoopt maximaal {transactionValue} of de transactie wordt teruggedraaid."
"swapInputMessage": "Invoer wordt geschat. U verkoopt maximaal {transactionValue} of de transactie wordt teruggedraaid.",
"route": "Route"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Bekreft bytte",
"swapOutputMessage": "Beløp er estimert. Du vil motta minst {transactionValue} ellers vil transaksjonen gå tilbake.",
"rewardsForSwap": "Strategiske PSWAP belønninger",
"swapInputMessage": "Inndata er estimert. Du vil selge maksimalt {transactionValue} ellers vil transaksjonen gå tilbake."
"swapInputMessage": "Inndata er estimert. Du vil selge maksimalt {transactionValue} ellers vil transaksjonen gå tilbake.",
"route": "Rute"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Potwierdź zamianę",
"swapOutputMessage": "Wynik jest szacunkowy. Otrzymasz co najmniej {transactionValue} lub transakcja zostanie anulowana.",
"rewardsForSwap": "Wynagrodzenie strategiczne w PSWAP",
"swapInputMessage": "Wprowadzone dane są szacunkowe. Sprzedasz maksymalnie {transactionValue} lub transakcja zostanie anulowana."
"swapInputMessage": "Wprowadzone dane są szacunkowe. Sprzedasz maksymalnie {transactionValue} lub transakcja zostanie anulowana.",
"route": "Trasa"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Подтвердить обмен",
"swapOutputMessage": "Вывод оценён. Вы получите как минимум {transactionValue} или транзакция будет отменена.",
"rewardsForSwap": "Стратегические вознаграждения PSWAP",
"swapInputMessage": "Ввод оценивается. Вы продадите максимум {transactionValue} иначе транзакция будет отменена."
"swapInputMessage": "Ввод оценивается. Вы продадите максимум {transactionValue} иначе транзакция будет отменена.",
"route": "Маршрут"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down
3 changes: 2 additions & 1 deletion src/lang/yo.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"confirmSwap": "Jẹrisi afiropo ",
"swapOutputMessage": "Ti ṣe iṣiro iṣẹjade. Iwọ yoo gba o kere ju {transactionValue} tabi idunadura naa yoo pada.",
"rewardsForSwap": "Awọn ere ilana PSWAP",
"swapInputMessage": "Iṣagbewọle ti ni iṣiro. Iwọ yoo ta o pọju {transactionValue} tabi idunadura naa yoo pada."
"swapInputMessage": "Iṣagbewọle ti ni iṣiro. Iwọ yoo ta o pọju {transactionValue} tabi idunadura naa yoo pada.",
"route": "Ipa ọna"
},
"pool": {
"connectWallet": "@:connectWalletText",
Expand Down