本文整理汇总了C++中sle::pointer::getFieldAccount160方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::getFieldAccount160方法的具体用法?C++ pointer::getFieldAccount160怎么用?C++ pointer::getFieldAccount160使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sle::pointer
的用法示例。
在下文中一共展示了pointer::getFieldAccount160方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doApply
TER doApply () override
{
assert (mTxnAccount);
uint256 const ticketId = mTxn.getFieldH256 (sfTicketID);
SLE::pointer sleTicket = mEngine->view ().entryCache (ltTICKET, ticketId);
if (!sleTicket)
return tecNO_ENTRY;
Account const ticket_owner (sleTicket->getFieldAccount160 (sfAccount));
bool authorized (mTxnAccountID == ticket_owner);
// The target can also always remove a ticket
if (!authorized && sleTicket->isFieldPresent (sfTarget))
authorized = (mTxnAccountID == sleTicket->getFieldAccount160 (sfTarget));
// And finally, anyone can remove an expired ticket
if (!authorized && sleTicket->isFieldPresent (sfExpiration))
{
std::uint32_t const expiration = sleTicket->getFieldU32 (sfExpiration);
if (mEngine->getLedger ()->getParentCloseTimeNC () >= expiration)
authorized = true;
}
if (!authorized)
return tecNO_PERMISSION;
std::uint64_t const hint (sleTicket->getFieldU64 (sfOwnerNode));
TER const result = mEngine->view ().dirDelete (false, hint,
getOwnerDirIndex (ticket_owner), ticketId, false, (hint == 0));
mEngine->view ().decrementOwnerCount (mTxnAccount);
mEngine->view ().entryDelete (sleTicket);
return result;
}
示例2: takeOffers
//.........这里部分代码省略.........
% uTakeQuality
% (uTakeQuality == uTipQuality
? '='
: uTakeQuality < uTipQuality
? '<'
: '>')
% uTipQuality
% saTakerRate
% (saTakerRate == saTipRate
? '='
: saTakerRate < saTipRate
? '<'
: '>')
% saTipRate
% bPassive);
terResult = tesSUCCESS;
}
else
{
// Have an offer directory to consider.
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: considering dir: " << sleOfferDir->getJson (0);
SLE::pointer sleBookNode;
unsigned int uBookEntry;
uint256 uOfferIndex;
lesActive.dirFirst (uTipIndex, sleBookNode, uBookEntry, uOfferIndex);
SLE::pointer sleOffer = mEngine->entryCache (ltOFFER, uOfferIndex);
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: considering offer : " << sleOffer->getJson (0);
const uint160 uOfferOwnerID = sleOffer->getFieldAccount160 (sfAccount);
STAmount saOfferPays = sleOffer->getFieldAmount (sfTakerGets);
STAmount saOfferGets = sleOffer->getFieldAmount (sfTakerPays);
STAmount saOfferFunds; // Funds of offer owner to payout.
bool bValid;
bValid = bValidOffer (
sleOfferDir, uOfferIndex, uOfferOwnerID, saOfferPays, saOfferGets,
uTakerAccountID,
usOfferUnfundedFound, usOfferUnfundedBecame, usAccountTouched,
saOfferFunds);
if (bValid)
{
STAmount saSubTakerPaid;
STAmount saSubTakerGot;
STAmount saTakerIssuerFee;
STAmount saOfferIssuerFee;
STAmount saOfferRate = STAmount::setRate (uTipQuality);
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerPays: " << saTakerPays.getFullText ();
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerPaid: " << saTakerPaid.getFullText ();
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerFunds: " << saTakerFunds.getFullText ();
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferFunds: " << saOfferFunds.getFullText ();
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferPays: " << saOfferPays.getFullText ();
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferGets: " << saOfferGets.getFullText ();
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferRate: " << saOfferRate.getFullText ();
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saSubTakerPays: " << saSubTakerPays.getFullText ();
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saSubTakerGets: " << saSubTakerGets.getFullText ();
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerPays: " << saTakerPays.getFullText ();
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerGets: " << saTakerGets.getFullText ();
示例3: doApply
TER TransferTransactor::doApply ()
{
WriteLog (lsTRACE, LedgerConsensus) << "Transfer transaction is applying\n\n\n\n\n\n";
uint160 const uDstAccountID = mTxn.getFieldAccount160 (sfDestination);
uint256 const objectId = mTxn.getObjectId ();
WriteLog (lsTRACE, LedgerConsensus) << "Transfer transaction is applying";
WriteLog (lsTRACE, LedgerConsensus) << "___________________________________applying";
WriteLog (lsTRACE, LedgerConsensus) << "\n\n\n\n\n\n";
WriteLog (lsTRACE, LedgerConsensus) << uDstAccountID;
WriteLog (lsTRACE, LedgerConsensus) << objectId;
if (!uDstAccountID)
{
m_journal.trace <<
"Malformed transaction: Transfer destination account not specified.";
return temDST_NEEDED;
}
WriteLog (lsTRACE, LedgerConsensus) << "Checking object in db \n\n\n\n\n\n";
SLE::pointer sleObj (mEngine->entryCache (
ltOWNERSHIP, objectId));
WriteLog (lsTRACE, LedgerConsensus) << objectId << " \n\n\n\n\n\n";
WriteLog (lsTRACE, LedgerConsensus) << "Checked object in db \n\n\n\n\n\n";
WriteLog (lsTRACE, LedgerConsensus) << sleObj<< " \n\n\n\n\n\n";
if (sleObj)
{
// Object exists.
WriteLog (lsTRACE, LedgerConsensus) << "Object exists \n\n\n\n\n\n Source account";
WriteLog (lsTRACE, LedgerConsensus) << mTxn.getSourceAccount().getAccountID();
WriteLog (lsTRACE, LedgerConsensus) << "Object exists \n\n\n\n\n\n New account";
WriteLog (lsTRACE, LedgerConsensus) << uDstAccountID;
if(sleObj->getFieldAccount160(sfAccount) != mTxn.getSourceAccount().getAccountID())
{
WriteLog (lsTRACE, LedgerConsensus) << "Not your object \n\n\n\n\n\n";
return temMALFORMED;
}
SLE::pointer sleDst (mEngine->entryCache (
ltACCOUNT_ROOT, Ledger::getAccountRootIndex (uDstAccountID)));
if (!sleDst)
{
WriteLog (lsTRACE, LedgerConsensus) << "Destination account doesnt exist \n\n\n\n\n\n";
return temMALFORMED;
}
sleObj->setFieldAccount (sfAccount, uDstAccountID);
WriteLog (lsTRACE, LedgerConsensus) << "New dstAccount is set \n\n\n\n\n\n";
}
else
{
WriteLog (lsTRACE, LedgerConsensus) << "You cannot make Transfer to non-existing object \n\n\n\n\n\n";
return temMALFORMED;
}
WriteLog (lsTRACE, LedgerConsensus) << "Transfer applying is finished \n\n\n\n\n\n";
return tesSUCCESS;
}
示例4: takeOffers
//.........这里部分代码省略.........
? '='
: uTakeQuality < uTipQuality
? '<'
: '>')
% uTipQuality
% saTakerRate
% (saTakerRate == saTipRate
? '='
: saTakerRate < saTipRate
? '<'
: '>')
% saTipRate
% bPassive);
terResult = tesSUCCESS;
}
else
{
// We have a crossing offer to consider.
SLE::pointer sleOffer = bookIterator.getCurrentOffer ();
if (!sleOffer)
{ // offer is in directory but not in ledger
uint256 offerIndex = bookIterator.getCurrentIndex ();
WriteLog (lsWARNING, OfferCreateTransactor) << "takeOffers: offer not found : " << offerIndex;
usMissingOffers.insert (missingOffer_t (
bookIterator.getCurrentIndex (), bookIterator.getCurrentDirectory ()));
}
else
{
WriteLog (lsDEBUG, OfferCreateTransactor) << "takeOffers: considering offer : " << sleOffer->getJson (0);
const uint160& uOfferOwnerID = sleOffer->getFieldAccount160 (sfAccount);
STAmount saOfferPays = sleOffer->getFieldAmount (sfTakerGets);
STAmount saOfferGets = sleOffer->getFieldAmount (sfTakerPays);
STAmount saOfferFunds; // Funds of offer owner to payout.
bool bValid;
bValid = bValidOffer (
sleOffer, uOfferOwnerID, saOfferPays, saOfferGets,
uTakerAccountID,
usOfferUnfundedFound, usOfferUnfundedBecame, usAccountTouched,
saOfferFunds);
if (bValid)
{
STAmount saSubTakerPaid;
STAmount saSubTakerGot;
STAmount saTakerIssuerFee;
STAmount saOfferIssuerFee;
STAmount saOfferRate = STAmount::setRate (uTipQuality);
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerPays: " << saTakerPays.getFullText ();
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerPaid: " << saTakerPaid.getFullText ();
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerFunds: " << saTakerFunds.getFullText ();
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferFunds: " << saOfferFunds.getFullText ();
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferPays: " << saOfferPays.getFullText ();
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferGets: " << saOfferGets.getFullText ();
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: applyOffer: saOfferRate: " << saOfferRate.getFullText ();
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: applyOffer: saSubTakerPays: " << saSubTakerPays.getFullText ();
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: applyOffer: saSubTakerGets: " << saSubTakerGets.getFullText ();
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerPays: " << saTakerPays.getFullText ();
WriteLog (lsTRACE, OfferCreateTransactor) << "takeOffers: applyOffer: saTakerGets: " << saTakerGets.getFullText ();
示例5: doAccountOffers
// {
// account: <account>|<account_public_key>
// account_index: <number> // optional, defaults to 0.
// ledger_hash : <ledger>
// ledger_index : <ledger_index>
// limit: integer // optional
// marker: opaque // optional, resume previous query
// }
Json::Value doAccountOffers (RPC::Context& context)
{
auto const& params (context.params_);
Ledger::pointer ledger;
Json::Value result (RPC::lookupLedger (params, ledger, context.netOps_));
if (! ledger)
return result;
if (! params.isMember (jss::account))
return RPC::missing_field_error ("account");
std::string strIdent (params[jss::account].asString ());
bool bIndex (params.isMember (jss::account_index));
int const iIndex (bIndex ? params[jss::account_index].asUInt () : 0);
RippleAddress rippleAddress;
result = RPC::accountFromString (ledger, rippleAddress, bIndex, strIdent,
iIndex, false, context.netOps_);
if (! result.empty ())
return result;
// Get info on account.
result[jss::account] = rippleAddress.humanAccountID ();
if (bIndex)
result[jss::account_index] = iIndex;
if (! ledger->hasAccount (rippleAddress))
return rpcError (rpcACT_NOT_FOUND);
unsigned int limit;
if (params.isMember (jss::limit))
{
limit = std::max (RPC::Tuning::minOffersPerRequest,
std::min (params[jss::limit].asUInt (),
RPC::Tuning::maxOffersPerRequest));
}
else
{
limit = RPC::Tuning::defaultOffersPerRequest;
}
Account const& raAccount (rippleAddress.getAccountID ());
Json::Value& jsonOffers (result[jss::offers] = Json::arrayValue);
std::vector <SLE::pointer> offers;
unsigned int reserve (limit);
uint256 startAfter;
std::uint64_t startHint;
if (params.isMember(jss::marker))
{
// We have a start point. Use limit - 1 from the result and use the
// very last one for the resume.
Json::Value const& marker (params[jss::marker]);
if (! marker.isString ())
return rpcError (rpcACT_MALFORMED);
startAfter.SetHex (marker.asString ());
SLE::pointer sleOffer (ledger->getSLEi (startAfter));
if (sleOffer == nullptr ||
sleOffer->getType () != ltOFFER ||
raAccount != sleOffer->getFieldAccount160 (sfAccount))
{
return rpcError (rpcINVALID_PARAMS);
}
startHint = sleOffer->getFieldU64(sfOwnerNode);
// Caller provided the first offer (startAfter), add it as first result
Json::Value& obj (jsonOffers.append (Json::objectValue));
sleOffer->getFieldAmount (sfTakerPays).setJson (obj[jss::taker_pays]);
sleOffer->getFieldAmount (sfTakerGets).setJson (obj[jss::taker_gets]);
obj[jss::seq] = sleOffer->getFieldU32 (sfSequence);
obj[jss::flags] = sleOffer->getFieldU32 (sfFlags);
offers.reserve (reserve);
}
else
{
startHint = 0;
// We have no start point, limit should be one higher than requested.
offers.reserve (++reserve);
}
if (! ledger->visitAccountItems (raAccount, startAfter, startHint, reserve,
[&offers](SLE::ref offer)
//.........这里部分代码省略.........