Change Darkcoin units to DRK and added duffs.

This commit is contained in:
vertoe 2014-12-05 10:09:38 +01:00
parent 4f95ea2ada
commit 601457c2fe
11 changed files with 88 additions and 67 deletions

View File

@ -21,6 +21,8 @@ DONE:
- Defined regression test genesis block
- Updated wallet layout and branding
- Reset testnet (v4) with new genesis and address version (start with x)
- BIP0032 addresses xpub and xpriv start with x (unchanged by design)
- Changed Darkcoin units to DRK and added duffs
MANDATORY:
@ -33,7 +35,6 @@ MANDATORY:
OPTIONAL:
---------
- Define BIP0032 addresses EXT_PUBLIC_KEY and EXT_SECRET_KEY for Darkcoin
- Include Evan's public key for msg signing
- Darksend, Instant Transactions, Atomic Transfers, etc. pp.
- Include centralized checkpoint syncing (peercoin style)

View File

@ -1,4 +1,5 @@
// Copyright (c) 2011-2013 The Bitcoin developers
// Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014 vertoe & the Darkcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -15,9 +16,10 @@ BitcoinUnits::BitcoinUnits(QObject *parent):
QList<BitcoinUnits::Unit> BitcoinUnits::availableUnits()
{
QList<BitcoinUnits::Unit> unitlist;
unitlist.append(BTC);
unitlist.append(mBTC);
unitlist.append(uBTC);
unitlist.append(DRK);
unitlist.append(mDRK);
unitlist.append(uDRK);
unitlist.append(duffs);
return unitlist;
}
@ -25,9 +27,10 @@ bool BitcoinUnits::valid(int unit)
{
switch(unit)
{
case BTC:
case mBTC:
case uBTC:
case DRK:
case mDRK:
case uDRK:
case duffs:
return true;
default:
return false;
@ -38,9 +41,10 @@ QString BitcoinUnits::name(int unit)
{
switch(unit)
{
case BTC: return QString("BTC");
case mBTC: return QString("mBTC");
case uBTC: return QString::fromUtf8("μBTC");
case DRK: return QString("DRK");
case mDRK: return QString("mDRK");
case uDRK: return QString::fromUtf8("μDRK");
case duffs: return QString::fromUtf8("duffs");
default: return QString("???");
}
}
@ -49,9 +53,10 @@ QString BitcoinUnits::description(int unit)
{
switch(unit)
{
case BTC: return QString("Bitcoins");
case mBTC: return QString("Milli-Bitcoins (1 / 1,000)");
case uBTC: return QString("Micro-Bitcoins (1 / 1,000,000)");
case DRK: return QString("Darkcoins");
case mDRK: return QString("Milli-Darkcoins (1 / 1,000)");
case uDRK: return QString("Micro-Darkcoins (1 / 1,000,000)");
case duffs: return QString("Ten Nano-Darkcoins (1 / 100,000,000)");
default: return QString("???");
}
}
@ -60,9 +65,10 @@ qint64 BitcoinUnits::factor(int unit)
{
switch(unit)
{
case BTC: return 100000000;
case mBTC: return 100000;
case uBTC: return 100;
case DRK: return 100000000;
case mDRK: return 100000;
case uDRK: return 100;
case duffs: return 1;
default: return 100000000;
}
}
@ -71,9 +77,10 @@ qint64 BitcoinUnits::maxAmount(int unit)
{
switch(unit)
{
case BTC: return Q_INT64_C(21000000);
case mBTC: return Q_INT64_C(21000000000);
case uBTC: return Q_INT64_C(21000000000000);
case DRK: return Q_INT64_C(21000000);
case mDRK: return Q_INT64_C(21000000000);
case uDRK: return Q_INT64_C(21000000000000);
case duffs: return Q_INT64_C(2100000000000000);
default: return 0;
}
}
@ -82,9 +89,10 @@ int BitcoinUnits::amountDigits(int unit)
{
switch(unit)
{
case BTC: return 8; // 21,000,000 (# digits, without commas)
case mBTC: return 11; // 21,000,000,000
case uBTC: return 14; // 21,000,000,000,000
case DRK: return 8; // 21,000,000 (# digits, without commas)
case mDRK: return 11; // 21,000,000,000
case uDRK: return 14; // 21,000,000,000,000
case duffs: return 16; // 2,100,000,000,000,000
default: return 0;
}
}
@ -93,9 +101,10 @@ int BitcoinUnits::decimals(int unit)
{
switch(unit)
{
case BTC: return 8;
case mBTC: return 5;
case uBTC: return 2;
case DRK: return 8;
case mDRK: return 5;
case uDRK: return 2;
case duffs: return 0;
default: return 0;
}
}
@ -124,6 +133,10 @@ QString BitcoinUnits::format(int unit, qint64 n, bool fPlus)
quotient_str.insert(0, '-');
else if (fPlus && n > 0)
quotient_str.insert(0, '+');
if (num_decimals <= 0)
return quotient_str;
return quotient_str + QString(".") + remainder_str;
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2011-2013 The Bitcoin developers
// Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014 vertoe & the Darkcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -8,7 +9,7 @@
#include <QAbstractListModel>
#include <QString>
/** Bitcoin unit definitions. Encapsulates parsing and formatting
/** Darkcoin unit definitions. Encapsulates parsing and formatting
and serves as list model for drop-down selection boxes.
*/
class BitcoinUnits: public QAbstractListModel
@ -18,14 +19,15 @@ class BitcoinUnits: public QAbstractListModel
public:
explicit BitcoinUnits(QObject *parent);
/** Bitcoin units.
/** Darkcoin units.
@note Source: https://en.bitcoin.it/wiki/Units . Please add only sensible ones
*/
enum Unit
{
BTC,
mBTC,
uBTC
DRK,
mDRK,
uDRK,
duffs
};
//! @name Static API

View File

@ -33,7 +33,7 @@ enum NumConnections {
CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT),
};
/** Model for Bitcoin network client. */
/** Model for Darkcoin network client. */
class ClientModel : public QObject
{
Q_OBJECT

View File

@ -1,4 +1,5 @@
// Copyright (c) 2011-2013 The Bitcoin developers
// Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014 vertoe & the Darkcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -573,7 +574,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
}
// actually update labels
int nDisplayUnit = BitcoinUnits::BTC;
int nDisplayUnit = BitcoinUnits::DRK;
if (model && model->getOptionsModel())
nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
@ -606,7 +607,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
l5->setStyleSheet((nBytes >= 1000) ? "color:red;" : ""); // Bytes >= 1000
l6->setStyleSheet((dPriority > 0 && !AllowFree(dPriority)) ? "color:red;" : ""); // Priority < "medium"
l7->setStyleSheet((fLowOutput) ? "color:red;" : ""); // Low Output = "yes"
l8->setStyleSheet((nChange > 0 && nChange < CENT) ? "color:red;" : ""); // Change < 0.01BTC
l8->setStyleSheet((nChange > 0 && nChange < CENT) ? "color:red;" : ""); // Change < 0.01DRK
// tool tips
QString toolTip1 = tr("This label turns red, if the transaction size is greater than 1000 bytes.") + "<br /><br />";
@ -704,7 +705,7 @@ void CoinControlDialog::updateView()
{
sAddress = CBitcoinAddress(outputAddress).ToString().c_str();
// if listMode or change => show bitcoin address. In tree mode, address is not shown again for direct wallet address outputs
// if listMode or change => show darkcoin address. In tree mode, address is not shown again for direct wallet address outputs
if (!treeMode || (!(sAddress == sWalletAddress)))
itemOutput->setText(COLUMN_ADDRESS, sAddress);

View File

@ -51,7 +51,7 @@
<item>
<widget class="QValidatedLineEdit" name="payTo">
<property name="toolTip">
<string>The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</string>
<string>The address to send the payment to (e.g. XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg)</string>
</property>
</widget>
</item>
@ -154,7 +154,7 @@
<item row="3" column="1">
<widget class="QLabel" name="messageTextLabel">
<property name="toolTip">
<string>A message that was attached to the bitcoin: URI which will be stored with the transaction for your reference. Note: This message will not be sent over the Bitcoin network.</string>
<string>A message that was attached to the darkcoin: URI which will be stored with the transaction for your reference. Note: This message will not be sent over the Darkcoin network.</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>

View File

@ -45,7 +45,7 @@
<item>
<widget class="QValidatedLineEdit" name="addressIn_SM">
<property name="toolTip">
<string>The address to sign the message with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</string>
<string>The address to sign the message with (e.g. XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg)</string>
</property>
</widget>
</item>
@ -149,7 +149,7 @@
<item>
<widget class="QPushButton" name="signMessageButton_SM">
<property name="toolTip">
<string>Sign the message to prove you own this Bitcoin address</string>
<string>Sign the message to prove you own this Darkcoin address</string>
</property>
<property name="text">
<string>Sign &amp;Message</string>
@ -255,7 +255,7 @@
<item>
<widget class="QValidatedLineEdit" name="addressIn_VM">
<property name="toolTip">
<string>The address the message was signed with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</string>
<string>The address the message was signed with (e.g. XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg)</string>
</property>
</widget>
</item>
@ -292,7 +292,7 @@
<item>
<widget class="QPushButton" name="verifyMessageButton_VM">
<property name="toolTip">
<string>Verify the message to ensure it was signed with the specified Bitcoin address</string>
<string>Verify the message to ensure it was signed with the specified Darkcoin address</string>
</property>
<property name="text">
<string>Verify &amp;Message</string>

View File

@ -1,4 +1,5 @@
// Copyright (c) 2011-2013 The Bitcoin developers
// Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014 vertoe & the Darkcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -97,7 +98,7 @@ void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
widget->setFont(bitcoinAddressFont());
#if QT_VERSION >= 0x040700
widget->setPlaceholderText(QObject::tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)"));
widget->setPlaceholderText(QObject::tr("Enter a Darkcoin address (e.g. XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg)"));
#endif
widget->setValidator(new BitcoinAddressEntryValidator(parent));
widget->setCheckValidator(new BitcoinAddressCheckValidator(parent));
@ -114,8 +115,8 @@ void setupAmountWidget(QLineEdit *widget, QWidget *parent)
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
{
// return if URI is not valid or is no bitcoin: URI
if(!uri.isValid() || uri.scheme() != QString("bitcoin"))
// return if URI is not valid or is no darkcoin: URI
if(!uri.isValid() || uri.scheme() != QString("darkcoin"))
return false;
SendCoinsRecipient rv;
@ -151,7 +152,7 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
{
if(!i->second.isEmpty())
{
if(!BitcoinUnits::parse(BitcoinUnits::BTC, i->second, &rv.amount))
if(!BitcoinUnits::parse(BitcoinUnits::DRK, i->second, &rv.amount))
{
return false;
}
@ -171,13 +172,13 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
{
// Convert bitcoin:// to bitcoin:
// Convert darkcoin:// to darkcoin:
//
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
// Cannot handle this later, because darkcoin:// will cause Qt to see the part after // as host,
// which will lower-case it (and thus invalidate the address).
if(uri.startsWith("bitcoin://", Qt::CaseInsensitive))
if(uri.startsWith("darkcoin://", Qt::CaseInsensitive))
{
uri.replace(0, 10, "bitcoin:");
uri.replace(0, 10, "darkcoin:");
}
QUrl uriInstance(uri);
return parseBitcoinURI(uriInstance, out);
@ -185,12 +186,12 @@ bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
QString formatBitcoinURI(const SendCoinsRecipient &info)
{
QString ret = QString("bitcoin:%1").arg(info.address);
QString ret = QString("darkcoin:%1").arg(info.address);
int paramCount = 0;
if (info.amount)
{
ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, info.amount));
ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::DRK, info.amount));
paramCount++;
}
@ -537,12 +538,12 @@ TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* t
#ifdef WIN32
boost::filesystem::path static StartupShortcutPath()
{
return GetSpecialFolderPath(CSIDL_STARTUP) / "Bitcoin.lnk";
return GetSpecialFolderPath(CSIDL_STARTUP) / "Darkcoin.lnk";
}
bool GetStartOnSystemStartup()
{
// check for Bitcoin.lnk
// check for Darkcoin.lnk
return boost::filesystem::exists(StartupShortcutPath());
}
@ -619,7 +620,7 @@ boost::filesystem::path static GetAutostartDir()
boost::filesystem::path static GetAutostartFilePath()
{
return GetAutostartDir() / "bitcoin.desktop";
return GetAutostartDir() / "darkcoin.desktop";
}
bool GetStartOnSystemStartup()
@ -657,10 +658,10 @@ bool SetStartOnSystemStartup(bool fAutoStart)
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out|std::ios_base::trunc);
if (!optionFile.good())
return false;
// Write a bitcoin.desktop file to the autostart directory:
// Write a darkcoin.desktop file to the autostart directory:
optionFile << "[Desktop Entry]\n";
optionFile << "Type=Application\n";
optionFile << "Name=Bitcoin\n";
optionFile << "Name=Darkcoin\n";
optionFile << "Exec=" << pszExePath << " -min\n";
optionFile << "Terminal=false\n";
optionFile << "Hidden=false\n";
@ -679,7 +680,7 @@ bool SetStartOnSystemStartup(bool fAutoStart)
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl);
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl)
{
// loop through the list of startup items and try to find the bitcoin app
// loop through the list of startup items and try to find the darkcoin app
CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, NULL);
for(int i = 0; i < CFArrayGetCount(listSnapshot); i++) {
LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i);
@ -713,7 +714,7 @@ bool SetStartOnSystemStartup(bool fAutoStart)
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);
if(fAutoStart && !foundItem) {
// add bitcoin app to startup item list
// add darkcoin app to startup item list
LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst, NULL, NULL, bitcoinAppUrl, NULL, NULL);
}
else if(!fAutoStart && foundItem) {

View File

@ -1,4 +1,5 @@
// Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014 vertoe & the Darkcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -56,7 +57,7 @@ void OptionsModel::Init()
// Display
if (!settings.contains("nDisplayUnit"))
settings.setValue("nDisplayUnit", BitcoinUnits::BTC);
settings.setValue("nDisplayUnit", BitcoinUnits::DRK);
nDisplayUnit = settings.value("nDisplayUnit").toInt();
if (!settings.contains("bDisplayAddresses"))

View File

@ -1,4 +1,5 @@
// Copyright (c) 2011-2013 The Bitcoin developers
// Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014 vertoe & the Darkcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -24,7 +25,7 @@ class TxViewDelegate : public QAbstractItemDelegate
{
Q_OBJECT
public:
TxViewDelegate(): QAbstractItemDelegate(), unit(BitcoinUnits::BTC)
TxViewDelegate(): QAbstractItemDelegate(), unit(BitcoinUnits::DRK)
{
}
@ -188,7 +189,7 @@ void OverviewPage::setWalletModel(WalletModel *model)
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
}
// update the display unit, to not use the default ("BTC")
// update the display unit, to not use the default ("DRK")
updateDisplayUnit();
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2011-2013 The Bitcoin developers
// Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014 vertoe & the Darkcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -27,7 +28,7 @@ SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) :
#if QT_VERSION >= 0x040700
ui->signatureOut_SM->setPlaceholderText(tr("Click \"Sign Message\" to generate signature"));
ui->addressIn_VM->setPlaceholderText(tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)"));
ui->addressIn_VM->setPlaceholderText(tr("Enter a Darkcoin address (e.g. XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg)"));
#endif
GUIUtil::setupAddressWidget(ui->addressIn_SM, this);