Skip to content

Commit

Permalink
[SQUASH] GUI: enable custom operator payout
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Feb 24, 2022
1 parent fb620ff commit 65bdcba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/qt/pivx/masternodewizarddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "qt/pivx/qtutils.h"
#include "qt/walletmodel.h"

#include <QIntValidator>
#include <QDoubleValidator>
#include <QRegularExpression>
#include <QGraphicsDropShadowEffect>

Expand Down Expand Up @@ -176,7 +176,7 @@ void MasterNodeWizardDialog::initOperatorPage()
initCssEditLine(ui->lineEditOperatorKey);
initCssEditLine(ui->lineEditOperatorPayoutAddress);
initCssEditLine(ui->lineEditPercentage);
ui->lineEditPercentage->setValidator(new QIntValidator(1, 99));
ui->lineEditPercentage->setValidator(new QDoubleValidator(0.00, 100.00, 2, ui->lineEditPercentage));
}

void MasterNodeWizardDialog::initVoterPage()
Expand Down Expand Up @@ -454,7 +454,7 @@ bool MasterNodeWizardDialog::createMN()
// 3) Get operator data
QString operatorKey = ui->lineEditOperatorKey->text();
Optional<CKeyID> operatorPayoutKeyId = walletModel->getKeyIDFromAddr(ui->lineEditOperatorPayoutAddress->text().toStdString());
int operatorPercentage = ui->lineEditPercentage->text().isEmpty() ? 0 : (int) ui->lineEditPercentage->text().toUInt();
double operatorPercentage = ui->lineEditPercentage->text().isEmpty() ? 0 : (int) ui->lineEditPercentage->text().toDouble();

// 4) Get voter data
Optional<CKeyID> votingAddr;
Expand All @@ -481,7 +481,7 @@ bool MasterNodeWizardDialog::createMN()
votingAddr,
payoutKeyId,
error_str,
operatorPercentage, // operator percentage
(uint16_t) operatorPercentage * 10000, // operator percentage
operatorPayoutKeyId); // operator payout script
if (!res) {
return errorOut(tr(error_str.c_str()));
Expand Down
4 changes: 2 additions & 2 deletions src/qt/pivx/mnmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ static CallResult<uint256> createDMNInternal(const COutPoint& collateral,
const Optional<CKeyID>& votingAddr,
const CKeyID& payoutAddr,
const Optional<CBLSSecretKey>& operatorSk,
const Optional<int>& operatorPercentage,
const Optional<uint16_t>& operatorPercentage,
const Optional<CKeyID>& operatorPayoutAddr)
{
ProRegPL pl;
Expand Down Expand Up @@ -362,7 +362,7 @@ CallResult<uint256> MNModel::createDMN(const std::string& alias,
const Optional<CKeyID>& votingAddr,
const CKeyID& payoutKeyId,
std::string& strError,
const Optional<int>& operatorPercentage,
const Optional<uint16_t>& operatorPercentage,
const Optional<CKeyID>& operatorPayoutAddr)
{
// Parse and validate inputs
Expand Down
2 changes: 1 addition & 1 deletion src/qt/pivx/mnmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class MNModel : public QAbstractTableModel
const Optional<CKeyID>& votingAddr,
const CKeyID& payoutAddr,
std::string& strError,
const Optional<int>& operatorPercentage = nullopt,
const Optional<uint16_t>& operatorPercentage = nullopt,
const Optional<CKeyID>& operatorPayoutAddr = nullopt);

// Completely stops the Masternode spending the collateral
Expand Down

0 comments on commit 65bdcba

Please sign in to comment.