Add dev fee for testnet

This commit is contained in:
Aditya Kulkarni
2018-10-18 10:11:12 -07:00
parent fa4f8685d9
commit 6f79abcc14
6 changed files with 147 additions and 21 deletions

View File

@@ -42,7 +42,8 @@ void MainWindow::setupSendTab() {
QObject::connect(ui->tabWidget, &QTabWidget::currentChanged, [=] (int pos) {
if (pos == 1) {
// Set the fees
ui->sendTxFees->setText("0.0001 " + Utils::getTokenName());
ui->sendTxFees->setText(QString::number(Utils::getTotalFee(), 'g', 8) %
" " % Utils::getTokenName());
// Set focus to the first address box
ui->Address1->setFocus();
@@ -221,7 +222,7 @@ void MainWindow::maxAmountChecked(int checked) {
auto amt = ui->sendToWidgets->findChild<QLineEdit*>(QString("Amount") % QString::number(i+1));
sumAllAmounts += amt->text().toDouble();
}
sumAllAmounts += settings->fees();
sumAllAmounts += Utils::getTotalFee();
auto addr = ui->inputsCombo->currentText().split("(")[0];
@@ -276,6 +277,8 @@ void MainWindow::sendButton() {
return;
}
auto devAddress = Utils::getDevAddr(fromAddr, toAddrs);
// Get all the addresses and amounts
json allRecepients = json::array();
@@ -336,6 +339,28 @@ void MainWindow::sendButton() {
}
}
// Add the dev fee to the transaction
if (!devAddress.isEmpty() && Utils::getDevFee() > 0) {
json devFee = json::object();
devFee["address"] = devAddress.toStdString();
devFee["amount"] = Utils::getDevFee();
allRecepients.push_back(devFee);
}
// Add two rows for fees
{
confirm.labelMinerFee->setText("Miner Fee");
confirm.minerFee->setText(QString::number(Utils::getMinerFee(), 'g', 8) % " " % Utils::getTokenName());
if (!devAddress.isEmpty() && Utils::getDevFee() > 0) {
confirm.labelDevFee->setText("Dev Fee");
confirm.devFee->setText(QString::number(Utils::getMinerFee(), 'g', 8) % " " % Utils::getTokenName());
} else {
confirm.labelDevFee->setText("");
confirm.devFee->setText("");
}
}
// Add sender
json params = json::array();
params.push_back(fromAddr.toStdString());
@@ -344,9 +369,6 @@ void MainWindow::sendButton() {
// And show it in the confirm dialog
confirm.sendFrom->setText(fnSplitAddressForWrap(fromAddr));
// Fees in the confirm dialog
confirm.feesLabel->setText("Fee 0.0001 " % Utils::getTokenName());
// Show the dialog and submit it if the user confirms
if (d.exec() == QDialog::Accepted) {
rpc->sendZTransaction(params, [=](const json& reply) {