Browse Source

Remove dev fee

import_zecw
Aditya Kulkarni 6 years ago
parent
commit
efe29297c7
  1. 79
      src/confirm.ui
  2. 2
      src/mainwindow.h
  3. 42
      src/sendtab.cpp
  4. 9
      src/settings.cpp
  5. 2
      src/settings.h

79
src/confirm.ui

@ -39,26 +39,10 @@
<string>To</string> <string>To</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="3" column="1"> <item row="0" column="2">
<widget class="QLabel" name="devFee"> <widget class="QLabel" name="AmtUSD1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Dev Fee Amount</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="Amt1">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -71,26 +55,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="1" column="0" colspan="3">
<widget class="QLabel" name="labelDevFee"> <widget class="QLabel" name="Memo1">
<property name="text">
<string>Dev Textlabel</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="minerFee">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>Miner Amount</string> <string>TextLabel</string>
</property> </property>
<property name="alignment"> <property name="wordWrap">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -104,15 +75,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="2">
<widget class="QLabel" name="labelMinerFee"> <widget class="QLabel" name="minerFeeUSD">
<property name="text">
<string>Miner Textlabel</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="AmtUSD1">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -127,20 +91,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="3"> <item row="2" column="0">
<widget class="QLabel" name="Memo1"> <widget class="QLabel" name="labelMinerFee">
<property name="text"> <property name="text">
<string>TextLabel</string> <string>Miner Textlabel</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="0" column="1">
<widget class="QLabel" name="minerFeeUSD"> <widget class="QLabel" name="Amt1">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -153,16 +114,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="2" column="1">
<widget class="QLabel" name="devFeeUSD"> <widget class="QLabel" name="minerFee">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>TextLabel</string> <string>Miner Amount</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>

2
src/mainwindow.h

@ -61,7 +61,7 @@ private:
void setDefaultPayFrom(); void setDefaultPayFrom();
Tx createTxFromSendPage(); Tx createTxFromSendPage();
bool confirmTx(Tx tx, ToFields devFee); bool confirmTx(Tx tx);
void turnstileDoMigration(QString fromAddr = ""); void turnstileDoMigration(QString fromAddr = "");
void turnstileProgress(); void turnstileProgress();

42
src/sendtab.cpp

@ -75,17 +75,6 @@ void MainWindow::setupSendTab() {
" " % Settings::getTokenName()); " " % Settings::getTokenName());
ui->lblMinerFeeUSD->setText(Settings::getUSDFormat(Settings::getMinerFee())); ui->lblMinerFeeUSD->setText(Settings::getUSDFormat(Settings::getMinerFee()));
// Dev Fee.
if (Settings::getDevFee() < 0.0001) {
ui->lblDevFee->setText("");
ui->lblDevFeeUSD->setText("");
ui->lblDevFeeTxt->setText("");
} else {
ui->lblDevFee->setText(QString::number(Settings::getDevFee(), 'g', 8) %
" " % Settings::getTokenName());
ui->lblDevFeeUSD->setText(Settings::getUSDFormat(Settings::getDevFee()));
}
// Set focus to the first address box // Set focus to the first address box
ui->Address1->setFocus(); ui->Address1->setFocus();
} }
@ -389,7 +378,7 @@ Tx MainWindow::createTxFromSendPage() {
return tx; return tx;
} }
bool MainWindow::confirmTx(Tx tx, ToFields devFee) { bool MainWindow::confirmTx(Tx tx) {
auto fnSplitAddressForWrap = [=] (const QString& a) -> QString { auto fnSplitAddressForWrap = [=] (const QString& a) -> QString {
if (!a.startsWith("z")) return a; if (!a.startsWith("z")) return a;
@ -469,7 +458,7 @@ bool MainWindow::confirmTx(Tx tx, ToFields devFee) {
} }
} }
// Add two rows for fees // Add fees
{ {
auto i = tx.toAddrs.size() * 2; auto i = tx.toAddrs.size() * 2;
@ -493,26 +482,6 @@ bool MainWindow::confirmTx(Tx tx, ToFields devFee) {
minerFeeUSD->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); minerFeeUSD->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
confirm.gridLayout->addWidget(minerFeeUSD, i, 2, 1, 1); confirm.gridLayout->addWidget(minerFeeUSD, i, 2, 1, 1);
minerFeeUSD->setText(Settings::getUSDFormat(tx.fee)); minerFeeUSD->setText(Settings::getUSDFormat(tx.fee));
if (!devFee.addr.isEmpty()) {
auto labelDevFee = new QLabel(confirm.sendToAddrs);
labelDevFee->setObjectName(QStringLiteral("labelDevFee"));
confirm.gridLayout->addWidget(labelDevFee, i+1, 0, 1, 1);
labelDevFee ->setText("Dev Fee");
auto fee = new QLabel(confirm.sendToAddrs);
fee->setObjectName(QStringLiteral("devFee"));
fee->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
confirm.gridLayout->addWidget(fee, i+1, 1, 1, 1);
fee ->setText(Settings::getZECDisplayFormat(Settings::getDevFee()));
auto devFeeUSD = new QLabel(confirm.sendToAddrs);
devFeeUSD->setSizePolicy(sizePolicy1);
devFeeUSD->setObjectName(QStringLiteral("devFeeUSD"));
devFeeUSD->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
confirm.gridLayout->addWidget(devFeeUSD, i+1, 2, 1, 1);
devFeeUSD ->setText(Settings::getUSDFormat(Settings::getDevFee()));
}
} }
// And FromAddress in the confirm dialog // And FromAddress in the confirm dialog
@ -543,14 +512,9 @@ void MainWindow::sendButton() {
// abort the Tx // abort the Tx
return; return;
} }
ToFields devFee{ Settings::getDevAddr(tx), Settings::getDevFee(), "", "" };
// Show a dialog to confirm the Tx // Show a dialog to confirm the Tx
if (confirmTx(tx, devFee)) { if (confirmTx(tx)) {
if (!devFee.addr.isEmpty())
tx.toAddrs.push_back(devFee);
json params = json::array(); json params = json::array();
rpc->fillTxJsonParams(params, tx); rpc->fillTxJsonParams(params, tx);
std::cout << std::setw(2) << params << std::endl; std::cout << std::setw(2) << params << std::endl;

9
src/settings.cpp

@ -188,15 +188,8 @@ QString Settings::getZboardAddr() {
return "zs10m00rvkhfm4f7n23e4sxsx275r7ptnggx39ygl0vy46j9mdll5c97gl6dxgpk0njuptg2mn9w5s"; return "zs10m00rvkhfm4f7n23e4sxsx275r7ptnggx39ygl0vy46j9mdll5c97gl6dxgpk0njuptg2mn9w5s";
} }
} }
double Settings::getDevFee() {
if (Settings::getInstance()->isTestnet()) {
return 0;
} else {
return 0;
}
}
double Settings::getTotalFee() { return getMinerFee() + getDevFee(); } double Settings::getTotalFee() { return getMinerFee(); }
bool Settings::isValidAddress(QString addr) { bool Settings::isValidAddress(QString addr) {
QRegExp zcexp("^z[a-z0-9]{94}$", Qt::CaseInsensitive); QRegExp zcexp("^z[a-z0-9]{94}$", Qt::CaseInsensitive);

2
src/settings.h

@ -69,7 +69,7 @@ public:
static double getMinerFee(); static double getMinerFee();
static double getZboardAmount(); static double getZboardAmount();
static QString getZboardAddr(); static QString getZboardAddr();
static double getDevFee();
static double getTotalFee(); static double getTotalFee();
static bool isValidAddress(QString addr); static bool isValidAddress(QString addr);

Loading…
Cancel
Save