Skip to content

Commit dedcde5

Browse files
authored
Merge pull request #1934 from KomodoPlatform/extra_warning
warning when high margin
2 parents e929ffc + 7a75829 commit dedcde5

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

atomic_defi_design/Dex/Constants/General.qml

+9
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,15 @@ QtObject {
577577
return tx_fee + "\n" + trading_fee +"<br>"+minimum_amount
578578
}
579579

580+
function is_swap_safe(checkbox)
581+
{
582+
if (checkbox.checked == true || checkbox.visible == false)
583+
{
584+
return (!API.app.trading_pg.buy_sell_rpc_busy && API.app.trading_pg.last_trading_error == TradingError.None)
585+
}
586+
return false
587+
}
588+
580589
function validateWallet(wallet_name) {
581590
if (wallet_name.length >= 25) return "Wallet name must 25 chars or less"
582591
return checkIfWalletExists(wallet_name)

atomic_defi_design/Dex/Exchange/Trade/ConfirmTradeModal.qml

+38-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import "Orders/"
1111
import App 1.0
1212
import Dex.Themes 1.0 as Dex
1313

14+
1415
MultipageModal
1516
{
1617
id: root
@@ -24,9 +25,9 @@ MultipageModal
2425
titleText: qsTr("Confirm Exchange Details")
2526
title.font.pixelSize: Style.textSize2
2627
titleAlignment: Qt.AlignHCenter
27-
titleTopMargin: 10
28-
topMarginAfterTitle: 0
29-
flickMax: window.height - 450
28+
titleTopMargin: 0
29+
topMarginAfterTitle: 10
30+
flickMax: window.height - 480
3031

3132
header: [
3233
RowLayout
@@ -71,6 +72,39 @@ MultipageModal
7172
Layout.fillWidth: true
7273
Layout.alignment: Qt.AlignHCenter
7374

75+
// Large margin Warning
76+
FloatingBackground
77+
{
78+
Layout.alignment: Qt.AlignCenter
79+
width: 425
80+
height: 30
81+
color: Style.colorRed2
82+
visible: Math.abs(parseFloat(API.app.trading_pg.cex_price_diff)) >= 50
83+
84+
RowLayout
85+
{
86+
Layout.fillWidth: true
87+
88+
Item { width: 3 }
89+
90+
DefaultCheckBox
91+
{
92+
id: allow_bad_trade
93+
Layout.alignment: Qt.AlignCenter
94+
textColor: Style.colorWhite0
95+
visible: Math.abs(parseFloat(API.app.trading_pg.cex_price_diff)) >= 50
96+
spacing: 2
97+
boxWidth: 20
98+
boxHeight: 20
99+
labelWidth: 400
100+
label.wrapMode: Label.NoWrap
101+
text: qsTr("Trade price is more than 50% different to CEX! Confirm?")
102+
}
103+
104+
Item { width: 3 }
105+
}
106+
}
107+
74108
DefaultText
75109
{
76110
Layout.alignment: Qt.AlignHCenter
@@ -368,7 +402,7 @@ MultipageModal
368402
leftPadding: 45
369403
rightPadding: 45
370404
radius: 10
371-
enabled: !buy_sell_rpc_busy && last_trading_error === TradingError.None
405+
enabled: General.is_swap_safe(allow_bad_trade)
372406
onClicked:
373407
{
374408
trade({ enable_custom_config: enable_custom_config.checked,

0 commit comments

Comments
 (0)