From d02356650108c110e706843574f731ad980c25d1 Mon Sep 17 00:00:00 2001 From: jed Date: Sun, 4 Nov 2012 13:21:19 -0800 Subject: [PATCH] XNS -> XRP --- newcoin.vcxproj | 18 +++++++++++++ newcoin.vcxproj.filters | 54 +++++++++++++++++++++++++++++++++++++++ src/Amount.cpp | 10 ++++---- src/Config.cpp | 2 +- src/Config.h | 4 +-- src/Interpreter.cpp | 4 +-- src/Interpreter.h | 4 +-- src/Ledger.cpp | 2 +- src/Ledger.h | 2 +- src/LedgerConsensus.cpp | 2 +- src/Operation.h | 2 +- src/OrderBookDB.cpp | 4 +-- src/OrderBookDB.h | 6 ++--- src/Pathfinder.cpp | 20 +++++++-------- src/RippleCalc.cpp | 22 ++++++++-------- src/SerializedTypes.h | 10 ++++---- src/TransactionAction.cpp | 14 +++++----- src/TransactionErr.cpp | 2 +- src/TransactionErr.h | 2 +- 19 files changed, 128 insertions(+), 56 deletions(-) diff --git a/newcoin.vcxproj b/newcoin.vcxproj index 8e6179238..3a318d339 100644 --- a/newcoin.vcxproj +++ b/newcoin.vcxproj @@ -206,15 +206,20 @@ + + + + + @@ -234,8 +239,12 @@ + + + + @@ -251,19 +260,28 @@ + + + + + + + + + diff --git a/newcoin.vcxproj.filters b/newcoin.vcxproj.filters index 4c14bf8ec..090e29971 100644 --- a/newcoin.vcxproj.filters +++ b/newcoin.vcxproj.filters @@ -578,6 +578,60 @@ Header Files + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + diff --git a/src/Amount.cpp b/src/Amount.cpp index bedc61b71..8f2249171 100644 --- a/src/Amount.cpp +++ b/src/Amount.cpp @@ -16,7 +16,7 @@ SETUP_LOG(); uint64 STAmount::uRateOne = STAmount::getRate(STAmount(1), STAmount(1)); -// --> sCurrency: "", "XNS", or three letter ISO code. +// --> sCurrency: "", "XRP", or three letter ISO code. bool STAmount::currencyFromString(uint160& uDstCurrency, const std::string& sCurrency) { bool bSuccess = true; @@ -1365,19 +1365,19 @@ BOOST_AUTO_TEST_CASE( CustomCurrency_test ) if (STAmount::multiply(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 20), STAmount(3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "60") BOOST_FAIL("STAmount multiply fail"); - if (STAmount::multiply(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 20), STAmount(3), uint160(), ACCOUNT_XNS).getText() != "60") + if (STAmount::multiply(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 20), STAmount(3), uint160(), ACCOUNT_XRP).getText() != "60") BOOST_FAIL("STAmount multiply fail"); if (STAmount::multiply(STAmount(20), STAmount(3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "60") BOOST_FAIL("STAmount multiply fail"); - if (STAmount::multiply(STAmount(20), STAmount(3), uint160(), ACCOUNT_XNS).getText() != "60") + if (STAmount::multiply(STAmount(20), STAmount(3), uint160(), ACCOUNT_XRP).getText() != "60") BOOST_FAIL("STAmount multiply fail"); if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "20") BOOST_FAIL("STAmount divide fail"); - if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(3), uint160(), ACCOUNT_XNS).getText() != "20") + if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(3), uint160(), ACCOUNT_XRP).getText() != "20") BOOST_FAIL("STAmount divide fail"); if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(CURRENCY_ONE, ACCOUNT_ONE, 3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "20") BOOST_FAIL("STAmount divide fail"); - if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(CURRENCY_ONE, ACCOUNT_ONE, 3), uint160(), ACCOUNT_XNS).getText() != "20") + if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(CURRENCY_ONE, ACCOUNT_ONE, 3), uint160(), ACCOUNT_XRP).getText() != "20") BOOST_FAIL("STAmount divide fail"); STAmount a1(CURRENCY_ONE, ACCOUNT_ONE, 60), a2 (CURRENCY_ONE, ACCOUNT_ONE, 10, -1); diff --git a/src/Config.cpp b/src/Config.cpp index 91e7c2b07..f69e58446 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -35,7 +35,7 @@ #define SECTION_VALIDATORS "validators" #define SECTION_VALIDATORS_SITE "validators_site" -// Fees are in XNS. +// Fees are in XRP. #define DEFAULT_FEE_DEFAULT 10 #define DEFAULT_FEE_ACCOUNT_CREATE 1000*SYSTEM_CURRENCY_PARTS #define DEFAULT_FEE_NICKNAME_CREATE 1000 diff --git a/src/Config.h b/src/Config.h index 2bc0662e5..cb17b46ed 100644 --- a/src/Config.h +++ b/src/Config.h @@ -10,9 +10,9 @@ #include #define SYSTEM_NAME "ripple" -#define SYSTEM_CURRENCY_CODE "XNS" +#define SYSTEM_CURRENCY_CODE "XRP" #define SYSTEM_CURRENCY_PRECISION 6 -#define SYSTEM_CURRENCY_CODE_RIPPLE "XNR" +#define SYSTEM_CURRENCY_CODE_RIPPLE "XRR" #define SYSTEM_CURRENCY_GIFT 1000ull #define SYSTEM_CURRENCY_USERS 100000000ull diff --git a/src/Interpreter.cpp b/src/Interpreter.cpp index dabbb692d..6fce0827b 100644 --- a/src/Interpreter.cpp +++ b/src/Interpreter.cpp @@ -46,7 +46,7 @@ Interpreter::Interpreter() mFunctionTable[CANCEL_OP]=new SubOp(); mFunctionTable[BLOCK_OP]=new SubOp(); mFunctionTable[BLOCK_END_OP]=new SubOp(); - mFunctionTable[SEND_XNS_OP]=new SendXNSOp(); + mFunctionTable[SEND_XRP_OP]=new SendXRPOp(); /* mFunctionTable[SEND_OP]=new SendOp(); mFunctionTable[REMOVE_CONTRACT_OP]=new SubOp(); @@ -63,7 +63,7 @@ Interpreter::Interpreter() mFunctionTable[GET_LEDGER_TIME_OP]=new SubOp(); mFunctionTable[GET_LEDGER_NUM_OP]=new SubOp(); mFunctionTable[GET_RAND_FLOAT_OP]=new SubOp(); - mFunctionTable[GET_XNS_ESCROWED_OP]=new SubOp(); + mFunctionTable[GET_XRP_ESCROWED_OP]=new SubOp(); mFunctionTable[GET_RIPPLE_ESCROWED_OP]=new SubOp(); mFunctionTable[GET_RIPPLE_ESCROWED_CURRENCY_OP]=new SubOp(); mFunctionTable[GET_RIPPLE_ESCROWED_ISSUER]=new GetRippleEscrowedIssuerOp(); diff --git a/src/Interpreter.h b/src/Interpreter.h index ad7d2cb85..5b43017bf 100644 --- a/src/Interpreter.h +++ b/src/Interpreter.h @@ -39,12 +39,12 @@ public: STOP_OP, CANCEL_OP, BLOCK_OP, BLOCK_END_OP, - SEND_XNS_OP,SEND_OP,REMOVE_CONTRACT_OP,FEE_OP,CHANGE_CONTRACT_OWNER_OP, + SEND_XRP_OP,SEND_OP,REMOVE_CONTRACT_OP,FEE_OP,CHANGE_CONTRACT_OWNER_OP, STOP_REMOVE_OP, SET_DATA_OP,GET_DATA_OP, GET_NUM_DATA_OP, SET_REGISTER_OP,GET_REGISTER_OP, GET_ISSUER_ID_OP, GET_OWNER_ID_OP, GET_LEDGER_TIME_OP, GET_LEDGER_NUM_OP, GET_RAND_FLOAT_OP, - GET_XNS_ESCROWED_OP, GET_RIPPLE_ESCROWED_OP, GET_RIPPLE_ESCROWED_CURRENCY_OP, GET_RIPPLE_ESCROWED_ISSUER, + GET_XRP_ESCROWED_OP, GET_RIPPLE_ESCROWED_OP, GET_RIPPLE_ESCROWED_CURRENCY_OP, GET_RIPPLE_ESCROWED_ISSUER, GET_ACCEPT_DATA_OP, GET_ACCEPTOR_ID_OP, GET_CONTRACT_ID_OP, NUM_OF_OPS }; diff --git a/src/Ledger.cpp b/src/Ledger.cpp index f05e1245a..632ced372 100644 --- a/src/Ledger.cpp +++ b/src/Ledger.cpp @@ -563,7 +563,7 @@ Json::Value Ledger::getJson(int options) } else ledger["closed"] = false; - if (mTransactionMap && (full || ((options & LEDGER_JSON_DUMP_TXNS) != 0))) + if (mTransactionMap && (full || ((options & LEDGER_JSON_DUMP_TXRP) != 0))) { Json::Value txns(Json::arrayValue); SHAMapTreeNode::TNType type; diff --git a/src/Ledger.h b/src/Ledger.h index c033c59c4..d89fcbba4 100644 --- a/src/Ledger.h +++ b/src/Ledger.h @@ -35,7 +35,7 @@ enum LedgerStateParms lepERROR = 32, // error }; -#define LEDGER_JSON_DUMP_TXNS 0x10000000 +#define LEDGER_JSON_DUMP_TXRP 0x10000000 #define LEDGER_JSON_DUMP_STATE 0x20000000 #define LEDGER_JSON_FULL 0x40000000 diff --git a/src/LedgerConsensus.cpp b/src/LedgerConsensus.cpp index 876a14cc6..fa52fddbb 100644 --- a/src/LedgerConsensus.cpp +++ b/src/LedgerConsensus.cpp @@ -1117,7 +1117,7 @@ void LedgerConsensus::accept(SHAMap::ref set) { Log(lsTRACE) << "newLCL"; Json::Value p; - newLCL->addJson(p, LEDGER_JSON_DUMP_TXNS | LEDGER_JSON_DUMP_STATE); + newLCL->addJson(p, LEDGER_JSON_DUMP_TXRP | LEDGER_JSON_DUMP_STATE); Log(lsTRACE) << p; } diff --git a/src/Operation.h b/src/Operation.h index b2946f294..5c0c6b8d1 100644 --- a/src/Operation.h +++ b/src/Operation.h @@ -276,7 +276,7 @@ public: } }; -class SendXNSOp : public Operation +class SendXRPOp : public Operation { public: bool work(Interpreter* interpreter) diff --git a/src/OrderBookDB.cpp b/src/OrderBookDB.cpp index 4f49f0133..ca06acd9b 100644 --- a/src/OrderBookDB.cpp +++ b/src/OrderBookDB.cpp @@ -20,8 +20,8 @@ OrderBookDB::OrderBookDB(Ledger::pointer ledger) mKnownMap[book->getBookBase()]=true; if(!book->getCurrencyIn()) - { // XNS - mXNSOrders.push_back(book); + { // XRP + mXRPOrders.push_back(book); }else { mIssuerMap[book->getIssuerIn()].push_back(book); diff --git a/src/OrderBookDB.h b/src/OrderBookDB.h index c8e598d18..206898dad 100644 --- a/src/OrderBookDB.h +++ b/src/OrderBookDB.h @@ -9,7 +9,7 @@ But for now it is probably faster to just generate it each time class OrderBookDB { std::vector mEmptyVector; - std::vector mXNSOrders; + std::vector mXRPOrders; std::map > mIssuerMap; std::map mKnownMap; @@ -17,8 +17,8 @@ class OrderBookDB public: OrderBookDB(Ledger::pointer ledger); - // return list of all orderbooks that want XNS - std::vector& getXNSInBooks(){ return mXNSOrders; } + // return list of all orderbooks that want XRP + std::vector& getXRPInBooks(){ return mXRPOrders; } // return list of all orderbooks that want IssuerID std::vector& getBooks(const uint160& issuerID); // return list of all orderbooks that want this issuerID and currencyID diff --git a/src/Pathfinder.cpp b/src/Pathfinder.cpp index 407d2f894..318d76371 100644 --- a/src/Pathfinder.cpp +++ b/src/Pathfinder.cpp @@ -21,18 +21,18 @@ TODO: what is a good way to come up with multiple paths? OrderDB: - getXNSOffers(); + getXRPOffers(); - // return list of all orderbooks that want XNS + // return list of all orderbooks that want XRP // return list of all orderbooks that want IssuerID // return list of all orderbooks that want this issuerID and currencyID */ /* -Test sending to XNS -Test XNS to XNS +Test sending to XRP +Test XRP to XRP Test offer in middle -Test XNS to USD +Test XRP to USD Test USD to EUR */ @@ -113,7 +113,7 @@ bool Pathfinder::findPaths(int maxSearchSteps, int maxPay, STPathSet& retPathSet // found the destination if (!ele.mCurrencyID) { - BOOST_FOREACH(OrderBook::pointer book,mOrderBook.getXNSInBooks()) + BOOST_FOREACH(OrderBook::pointer book,mOrderBook.getXRPInBooks()) { //if (!path.hasSeen(line->getAccountIDPeer().getAccountID())) { @@ -188,8 +188,8 @@ bool Pathfinder::checkComplete(STPathSet& retPathSet) // get all the options from this accountID -// if source is XNS -// every offer that wants XNS +// if source is XRP +// every offer that wants XRP // else // every ripple line that starts with the source currency // every offer that we can take that wants the source currency @@ -197,8 +197,8 @@ bool Pathfinder::checkComplete(STPathSet& retPathSet) void Pathfinder::addOptions(PathOption::pointer tail) { if(!tail->mCurrencyID) - { // source XNS - BOOST_FOREACH(OrderBook::pointer book,mOrderBook.getXNSInBooks()) + { // source XRP + BOOST_FOREACH(OrderBook::pointer book,mOrderBook.getXRPInBooks()) { PathOption::pointer pathOption(new PathOption(tail)); diff --git a/src/RippleCalc.cpp b/src/RippleCalc.cpp index d4ba49a39..b154141ef 100644 --- a/src/RippleCalc.cpp +++ b/src/RippleCalc.cpp @@ -1536,7 +1536,7 @@ TER PathState::pushNode( terResult = pushImply( pnCur.uAccountID, // Current account. pnCur.uCurrencyID, // Wanted currency. - !!pnCur.uCurrencyID ? uAccountID : ACCOUNT_XNS); // Account as wanted issuer. + !!pnCur.uCurrencyID ? uAccountID : ACCOUNT_XRP); // Account as wanted issuer. // Note: pnPrv may no longer be the immediately previous node. } @@ -1603,7 +1603,7 @@ TER PathState::pushNode( terResult = pushImply( !!pnPrv.uCurrencyID ? ACCOUNT_ONE // Rippling, but offer's don't have an account. - : ACCOUNT_XNS, + : ACCOUNT_XRP, pnPrv.uCurrencyID, pnPrv.uIssuerID); } @@ -1636,8 +1636,8 @@ PathState::PathState( { const uint160 uInCurrencyID = saSendMax.getCurrency(); const uint160 uOutCurrencyID = saSend.getCurrency(); - const uint160 uInIssuerID = !!uInCurrencyID ? saSendMax.getIssuer() : ACCOUNT_XNS; - const uint160 uOutIssuerID = !!uOutCurrencyID ? saSend.getIssuer() : ACCOUNT_XNS; + const uint160 uInIssuerID = !!uInCurrencyID ? saSendMax.getIssuer() : ACCOUNT_XRP; + const uint160 uOutIssuerID = !!uOutCurrencyID ? saSend.getIssuer() : ACCOUNT_XRP; lesEntries = lesSource.duplicate(); @@ -1665,7 +1665,7 @@ PathState::PathState( ? uOutIssuerID == uReceiverID ? uReceiverID : uOutIssuerID - : ACCOUNT_XNS; + : ACCOUNT_XRP; // Can't just use push implied, because it can't compensate for next account. if (!uNxtCurrencyID // Next is XRC - will have offer next @@ -1717,7 +1717,7 @@ PathState::PathState( | STPathElement::typeIssuer, uReceiverID, // Receive to output uOutCurrencyID, // Desired currency - !!uOutCurrencyID ? uReceiverID : ACCOUNT_XNS); + !!uOutCurrencyID ? uReceiverID : ACCOUNT_XRP); } if (tesSUCCESS == terStatus) @@ -2428,13 +2428,13 @@ void TransactionEngine::calcNodeOffer( { TER terResult = temUNKNOWN; - // Direct: not bridging via XNS + // Direct: not bridging via XRP bool bDirectNext = true; // True, if need to load. uint256 uDirectQuality; uint256 uDirectTip = Ledger::getBookBase(uGetsCurrency, uGetsIssuerID, uPaysCurrency, uPaysIssuerID); uint256 uDirectEnd = Ledger::getQualityNext(uDirectTip); - // Bridging: bridging via XNS + // Bridging: bridging via XRP bool bBridge = true; // True, if bridging active. False, missing an offer. uint256 uBridgeQuality; STAmount saBridgeIn; // Amount available. @@ -2462,10 +2462,10 @@ void TransactionEngine::calcNodeOffer( if (!uCurCurrencyID && !uPrvCurrencyID) { - // Bridging: Neither currency is XNS. - uInTip = Ledger::getBookBase(uPrvCurrencyID, uPrvIssuerID, CURRENCY_XNS, ACCOUNT_XNS); + // Bridging: Neither currency is XRP. + uInTip = Ledger::getBookBase(uPrvCurrencyID, uPrvIssuerID, CURRENCY_XRP, ACCOUNT_XRP); uInEnd = Ledger::getQualityNext(uInTip); - uOutTip = Ledger::getBookBase(CURRENCY_XNS, ACCOUNT_XNS, uCurCurrencyID, uCurIssuerID); + uOutTip = Ledger::getBookBase(CURRENCY_XRP, ACCOUNT_XRP, uCurCurrencyID, uCurIssuerID); uOutEnd = Ledger::getQualityNext(uInTip); } diff --git a/src/SerializedTypes.h b/src/SerializedTypes.h index b86df1ddb..350470fcb 100644 --- a/src/SerializedTypes.h +++ b/src/SerializedTypes.h @@ -25,9 +25,9 @@ enum PathFlags PF_ISSUE = 0x80, }; -#define CURRENCY_XNS uint160(0) +#define CURRENCY_XRP uint160(0) #define CURRENCY_ONE uint160(1) // Used as a place holder -#define ACCOUNT_XNS uint160(0) +#define ACCOUNT_XRP uint160(0) #define ACCOUNT_ONE uint160(1) // Used as a place holder DEFINE_INSTANCE(SerializedValue); @@ -209,11 +209,11 @@ class STAmount : public SerializedType protected: uint160 mCurrency; // Compared by ==. Always update mIsNative. - uint160 mIssuer; // Not compared by ==. 0 for XNS. + uint160 mIssuer; // Not compared by ==. 0 for XRP. uint64 mValue; int mOffset; - bool mIsNative; // Always !mCurrency. Native is XNS. + bool mIsNative; // Always !mCurrency. Native is XRP. bool mIsNegative; void canonicalize(); @@ -274,7 +274,7 @@ public: int getExponent() const { return mOffset; } uint64 getMantissa() const { return mValue; } - // When the currency is XNS, the value in raw units. S=signed + // When the currency is XRP, the value in raw units. S=signed uint64 getNValue() const { if (!mIsNative) throw std::runtime_error("not native"); return mValue; } void setNValue(uint64 v) { if (!mIsNative) throw std::runtime_error("not native"); mValue = v; } int64 getSNValue() const; diff --git a/src/TransactionAction.cpp b/src/TransactionAction.cpp index 8ff5c1f34..8b3002316 100644 --- a/src/TransactionAction.cpp +++ b/src/TransactionAction.cpp @@ -518,9 +518,9 @@ TER TransactionEngine::doPayment(const SerializedTransaction& txn, const Transac if (bCreate && !saDstAmount.isNative()) { // This restriction could be relaxed. - Log(lsINFO) << "doPayment: Invalid transaction: Create account may only fund XNS."; + Log(lsINFO) << "doPayment: Invalid transaction: Create account may only fund XRP."; - return temCREATEXNS; + return temCREATEXRP; } else if (!bCreate) { @@ -569,11 +569,11 @@ TER TransactionEngine::doPayment(const SerializedTransaction& txn, const Transac } else { - // Direct XNS payment. + // Direct XRP payment. - STAmount saSrcXNSBalance = mTxnAccount->getFieldAmount(sfBalance); + STAmount saSrcXRPBalance = mTxnAccount->getFieldAmount(sfBalance); - if (saSrcXNSBalance < saDstAmount) + if (saSrcXRPBalance < saDstAmount) { // Transaction might succeed, if applied in a different order. Log(lsINFO) << "doPayment: Delay transaction: Insufficent funds."; @@ -582,7 +582,7 @@ TER TransactionEngine::doPayment(const SerializedTransaction& txn, const Transac } else { - mTxnAccount->setFieldAmount(sfBalance, saSrcXNSBalance - saDstAmount); + mTxnAccount->setFieldAmount(sfBalance, saSrcXRPBalance - saDstAmount); sleDst->setFieldAmount(sfBalance, sleDst->getFieldAmount(sfBalance) + saDstAmount); terResult = tesSUCCESS; @@ -953,7 +953,7 @@ Log(lsINFO) << boost::str(boost::format("doOfferCreate: saTakerPays=%s saTakerGe } else if (saTakerPays.isNative() && saTakerGets.isNative()) { - Log(lsWARNING) << "doOfferCreate: Malformed offer: XNS for XNS"; + Log(lsWARNING) << "doOfferCreate: Malformed offer: XRP for XRP"; terResult = temBAD_OFFER; } diff --git a/src/TransactionErr.cpp b/src/TransactionErr.cpp index 9f50b4d3a..93f3c8687 100644 --- a/src/TransactionErr.cpp +++ b/src/TransactionErr.cpp @@ -34,7 +34,7 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman) { temBAD_TRANSFER_RATE, "temBAD_TRANSFER_RATE", "Malformed: Transfer rate must be >= 1.0" }, { temBAD_SET_ID, "temBAD_SET_ID", "Malformed." }, { temBAD_SEQUENCE, "temBAD_SEQUENCE", "Malformed: Sequence in not in the past." }, - { temCREATEXNS, "temCREATEXNS", "Can not specify non XNS for Create." }, + { temCREATEXRP, "temCREATEXRP", "Can not specify non XRP for Create." }, { temDST_IS_SRC, "temDST_IS_SRC", "Destination may not be source." }, { temDST_NEEDED, "temDST_NEEDED", "Destination not specified." }, { temINSUF_FEE_P, "temINSUF_FEE_P", "Fee not allowed." }, diff --git a/src/TransactionErr.h b/src/TransactionErr.h index f672caf7f..93c03515f 100644 --- a/src/TransactionErr.h +++ b/src/TransactionErr.h @@ -36,7 +36,7 @@ enum TER // aka TransactionEngineResult temBAD_TRANSFER_RATE, temBAD_SEQUENCE, temBAD_SET_ID, - temCREATEXNS, + temCREATEXRP, temDST_IS_SRC, temDST_NEEDED, temINSUF_FEE_P,