Add dev fee for testnet
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "utils.h"
|
||||
#include "settings.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
const QString Utils::txidStatusMessage = QString("Tx submitted (right click to copy) txid:");
|
||||
|
||||
@@ -9,4 +10,51 @@ const QString Utils::getTokenName() {
|
||||
} else {
|
||||
return "ZEC";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the dev fee address based on the transaction
|
||||
const QString Utils::getDevAddr(const QString& fromAddr, const QList<ToFields>& toAddrs) {
|
||||
auto testnetAddrLookup = [=] (const QString& addr) -> QString {
|
||||
if (addr.startsWith("ztestsapling")) {
|
||||
return "ztestsapling1kdp74adyfsmm9838jaupgfyx3npgw8ut63stjjx757pc248cuc0ymzphqeux60c64qe5qt68ygh";
|
||||
} else if (addr.startsWith("zt")) {
|
||||
return "ztbGDqgkmXQjheivgeirwEvJLD4SUNqsWCGwxwVg4YpGz1ARR8P2rXaptkT14z3NDKamcxNmQuvmvktyokMs7HkutRNSx1D";
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
};
|
||||
|
||||
if (Settings::getInstance()->isTestnet()) {
|
||||
auto devAddr = testnetAddrLookup(fromAddr);
|
||||
if (!devAddr.isEmpty()) {
|
||||
return devAddr;
|
||||
}
|
||||
|
||||
// t-Addr, find if it is going to a sprout or sapling address
|
||||
for (const ToFields& to : toAddrs) {
|
||||
devAddr = testnetAddrLookup(to.addr);
|
||||
if (!devAddr.isEmpty()) {
|
||||
return devAddr;
|
||||
}
|
||||
}
|
||||
|
||||
// If this is a t-Addr -> t-Addr transaction, use the sapling address by default
|
||||
return testnetAddrLookup("ztestsapling");
|
||||
} else {
|
||||
// Mainnet doesn't have a fee yet!
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double Utils::getMinerFee() {
|
||||
return 0.0001;
|
||||
}
|
||||
double Utils::getDevFee() {
|
||||
if (Settings::getInstance()->isTestnet()) {
|
||||
return 0.0001;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
double Utils::getTotalFee() { return getMinerFee() + getDevFee(); }
|
||||
Reference in New Issue
Block a user