mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 02:25:53 +00:00
remove comments
This commit is contained in:
committed by
Richard Holland
parent
66105b6c68
commit
7d4b00cfcb
@@ -63,16 +63,6 @@ inline URIOperation inferOperation(STTx const& tx)
|
|||||||
(hasBurnableFlag ? 0b000000010U : 0) +
|
(hasBurnableFlag ? 0b000000010U : 0) +
|
||||||
(blankFlags ? 0b000000001U : 0);
|
(blankFlags ? 0b000000001U : 0);
|
||||||
|
|
||||||
std::cout << "combination" << combination << "\n";
|
|
||||||
std::cout << "mint" << (0b110000001U == combination) << "\n";
|
|
||||||
std::cout << "mint" << (0b110000010U == combination) << "\n";
|
|
||||||
std::cout << "mint" << (0b010000001U == combination) << "\n";
|
|
||||||
std::cout << "mint" << (0b010000010U == combination) << "\n";
|
|
||||||
std::cout << "burn" << (0b001100000U == combination) << "\n";
|
|
||||||
std::cout << "buy" << (0b000110001U == combination) << "\n";
|
|
||||||
std::cout << "sell" << (0b000110100U == combination) << "\n";
|
|
||||||
std::cout << "sell" << (0b000111100U == combination) << "\n";
|
|
||||||
std::cout << "clear" << (0b000100001U == combination) << "\n";
|
|
||||||
switch (combination)
|
switch (combination)
|
||||||
{
|
{
|
||||||
case 0b110000001U:
|
case 0b110000001U:
|
||||||
@@ -112,7 +102,7 @@ URIToken::preflight(PreflightContext const& ctx)
|
|||||||
<< "documentation for how to specify Mint/Burn/Buy/Sell operations.";
|
<< "documentation for how to specify Mint/Burn/Buy/Sell operations.";
|
||||||
return temMALFORMED;
|
return temMALFORMED;
|
||||||
}
|
}
|
||||||
|
|
||||||
JLOG(ctx.j.trace())
|
JLOG(ctx.j.trace())
|
||||||
<< "URIToken txnid=" << ctx.tx.getTransactionID() << " inferred operation="
|
<< "URIToken txnid=" << ctx.tx.getTransactionID() << " inferred operation="
|
||||||
<< (op == URIOperation::Invalid ? "Invalid" :
|
<< (op == URIOperation::Invalid ? "Invalid" :
|
||||||
@@ -291,7 +281,6 @@ URIToken::preclaim(PreclaimContext const& ctx)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
std::cout << "preclaim with URIOperation::Invalid\n " << "\n";
|
|
||||||
JLOG(ctx.j.warn())
|
JLOG(ctx.j.warn())
|
||||||
<< "URIToken txid=" << ctx.tx.getTransactionID() << " preclaim with URIOperation::Invalid\n";
|
<< "URIToken txid=" << ctx.tx.getTransactionID() << " preclaim with URIOperation::Invalid\n";
|
||||||
return tecINTERNAL;
|
return tecINTERNAL;
|
||||||
@@ -332,16 +321,10 @@ URIToken::doApply()
|
|||||||
sleU = view().peek(*kl);
|
sleU = view().peek(*kl);
|
||||||
|
|
||||||
if (!sleU)
|
if (!sleU)
|
||||||
{
|
|
||||||
std::cout << "no entry object" << "\n";
|
|
||||||
return tecNO_ENTRY;
|
return tecNO_ENTRY;
|
||||||
}
|
|
||||||
|
|
||||||
if (sleU->getFieldU16(sfLedgerEntryType) != ltURI_TOKEN)
|
if (sleU->getFieldU16(sfLedgerEntryType) != ltURI_TOKEN)
|
||||||
{
|
|
||||||
std::cout << "wrong uri token" << "\n";
|
|
||||||
return tecNO_ENTRY;
|
return tecNO_ENTRY;
|
||||||
}
|
|
||||||
|
|
||||||
owner = (*sleU)[sfOwner];
|
owner = (*sleU)[sfOwner];
|
||||||
issuer = (*sleU)[sfIssuer];
|
issuer = (*sleU)[sfIssuer];
|
||||||
@@ -355,7 +338,6 @@ URIToken::doApply()
|
|||||||
|
|
||||||
if (!sleOwner)
|
if (!sleOwner)
|
||||||
{
|
{
|
||||||
std::cout << "tecNO_ENTRY - no owner" << "\n";
|
|
||||||
JLOG(j.warn())
|
JLOG(j.warn())
|
||||||
<< "Malformed transaction: owner of URIToken is not in the ledger.";
|
<< "Malformed transaction: owner of URIToken is not in the ledger.";
|
||||||
return tecNO_ENTRY;
|
return tecNO_ENTRY;
|
||||||
@@ -468,7 +450,6 @@ URIToken::doApply()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// IOU sale
|
// IOU sale
|
||||||
std::cout << "IOU SALE" << "\n";
|
|
||||||
STAmount availableFunds{accountFunds(
|
STAmount availableFunds{accountFunds(
|
||||||
view(),
|
view(),
|
||||||
account_,
|
account_,
|
||||||
@@ -476,8 +457,6 @@ URIToken::doApply()
|
|||||||
fhZERO_IF_FROZEN,
|
fhZERO_IF_FROZEN,
|
||||||
j)};
|
j)};
|
||||||
|
|
||||||
// std::cout << "PURCHASE AMT: " << purchaseAmount << "\n";
|
|
||||||
// std::cout << "AVAIL FUNDS: " << availableFunds << "\n";
|
|
||||||
if (purchaseAmount > availableFunds)
|
if (purchaseAmount > availableFunds)
|
||||||
return tecINSUFFICIENT_FUNDS;
|
return tecINSUFFICIENT_FUNDS;
|
||||||
|
|
||||||
@@ -507,10 +486,7 @@ URIToken::doApply()
|
|||||||
|
|
||||||
// remove from buyer
|
// remove from buyer
|
||||||
initBuyerBal = buyerLow ? ((*sleSrcLine)[sfBalance]) : -((*sleSrcLine)[sfBalance]);
|
initBuyerBal = buyerLow ? ((*sleSrcLine)[sfBalance]) : -((*sleSrcLine)[sfBalance]);
|
||||||
// std::cout << "BUYER LOW: " << buyerLow << "\n";
|
|
||||||
// std::cout << "BUYER BAL: " << *initBuyerBal << "\n";
|
|
||||||
finBuyerBal = *initBuyerBal - purchaseAmount;
|
finBuyerBal = *initBuyerBal - purchaseAmount;
|
||||||
// std::cout << "FIN BUYER BAL: " << *finBuyerBal << "\n";
|
|
||||||
|
|
||||||
// compute amount to deliver
|
// compute amount to deliver
|
||||||
static Rate const parityRate(QUALITY_ONE);
|
static Rate const parityRate(QUALITY_ONE);
|
||||||
@@ -520,25 +496,16 @@ URIToken::doApply()
|
|||||||
? purchaseAmount
|
? purchaseAmount
|
||||||
: multiplyRound(purchaseAmount, xferRate, purchaseAmount.issue(), true);
|
: multiplyRound(purchaseAmount, xferRate, purchaseAmount.issue(), true);
|
||||||
|
|
||||||
// std::cout << "SELLER LOW: " << sellerLow << "\n";
|
|
||||||
// std::cout << "DEST AMT: " << *dstAmt << "\n";
|
|
||||||
// if (!sellerLow)
|
|
||||||
// dstAmt->negate();
|
|
||||||
|
|
||||||
// std::cout << "TRUE DEST AMT: " << *dstAmt << "\n";
|
|
||||||
initSellerBal = !sleDstLine
|
initSellerBal = !sleDstLine
|
||||||
? purchaseAmount.zeroed()
|
? purchaseAmount.zeroed()
|
||||||
: sellerLow ? ((*sleDstLine)[sfBalance]) : -((*sleDstLine)[sfBalance]);
|
: sellerLow ? ((*sleDstLine)[sfBalance]) : -((*sleDstLine)[sfBalance]);
|
||||||
|
|
||||||
// std::cout << "INIT SELLER BAL: " << *initSellerBal << "\n";
|
|
||||||
finSellerBal = *initSellerBal + *dstAmt;
|
finSellerBal = *initSellerBal + *dstAmt;
|
||||||
// std::cout << "FINAL SELLER BAL: " << *finSellerBal << "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sanity check balance mutations (xrp or iou, both are checked the same way now)
|
// sanity check balance mutations (xrp or iou, both are checked the same way now)
|
||||||
if (*finSellerBal < *initSellerBal)
|
if (*finSellerBal < *initSellerBal)
|
||||||
{
|
{
|
||||||
std::cout << "finSellerBal" << *finSellerBal << "< initSellerBal" << *initSellerBal << "\n";
|
|
||||||
JLOG(j.warn())
|
JLOG(j.warn())
|
||||||
<< "URIToken txid=" << ctx_.tx.getTransactionID() << " "
|
<< "URIToken txid=" << ctx_.tx.getTransactionID() << " "
|
||||||
<< "finSellerBal < initSellerBal";
|
<< "finSellerBal < initSellerBal";
|
||||||
@@ -547,7 +514,6 @@ URIToken::doApply()
|
|||||||
|
|
||||||
if (*finBuyerBal > *initBuyerBal)
|
if (*finBuyerBal > *initBuyerBal)
|
||||||
{
|
{
|
||||||
std::cout << "finBuyerBal > initBuyerBal\n " << "\n";
|
|
||||||
JLOG(j.warn())
|
JLOG(j.warn())
|
||||||
<< "URIToken txid=" << ctx_.tx.getTransactionID() << " "
|
<< "URIToken txid=" << ctx_.tx.getTransactionID() << " "
|
||||||
<< "finBuyerBal > initBuyerBal";
|
<< "finBuyerBal > initBuyerBal";
|
||||||
@@ -556,7 +522,6 @@ URIToken::doApply()
|
|||||||
|
|
||||||
if (*finBuyerBal < beast::zero)
|
if (*finBuyerBal < beast::zero)
|
||||||
{
|
{
|
||||||
std::cout << "finBuyerBal < 0\n " << "\n";
|
|
||||||
JLOG(j.warn())
|
JLOG(j.warn())
|
||||||
<< "URIToken txid=" << ctx_.tx.getTransactionID() << " "
|
<< "URIToken txid=" << ctx_.tx.getTransactionID() << " "
|
||||||
<< "finBuyerBal < 0";
|
<< "finBuyerBal < 0";
|
||||||
@@ -565,7 +530,6 @@ URIToken::doApply()
|
|||||||
|
|
||||||
if (*finSellerBal < beast::zero)
|
if (*finSellerBal < beast::zero)
|
||||||
{
|
{
|
||||||
std::cout << "finSellerBal < 0\n " << "\n";
|
|
||||||
JLOG(j.warn())
|
JLOG(j.warn())
|
||||||
<< "URIToken txid=" << ctx_.tx.getTransactionID() << " "
|
<< "URIToken txid=" << ctx_.tx.getTransactionID() << " "
|
||||||
<< "finSellerBal < 0";
|
<< "finSellerBal < 0";
|
||||||
@@ -724,7 +688,6 @@ URIToken::doApply()
|
|||||||
|
|
||||||
view().update(sleU);
|
view().update(sleU);
|
||||||
view().update(sleOwner);
|
view().update(sleOwner);
|
||||||
// std::cout << "BUY tecSUCCESS" << "\n";
|
|
||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
}
|
}
|
||||||
case URIOperation::Burn:
|
case URIOperation::Burn:
|
||||||
@@ -753,7 +716,6 @@ URIToken::doApply()
|
|||||||
|
|
||||||
view().erase(sleU);
|
view().erase(sleU);
|
||||||
adjustOwnerCount(view(), sle, -1, j);
|
adjustOwnerCount(view(), sle, -1, j);
|
||||||
// std::cout << "BURN tecSUCCESS" << "\n";
|
|
||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -773,7 +735,6 @@ URIToken::doApply()
|
|||||||
sleU->setFieldAmount(sfAmount, ctx_.tx[sfAmount]);
|
sleU->setFieldAmount(sfAmount, ctx_.tx[sfAmount]);
|
||||||
|
|
||||||
view().update(sleU);
|
view().update(sleU);
|
||||||
// std::cout << "SELL tecSUCCESS" << "\n";
|
|
||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user