mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
* Restrict access to SField constructors. * Make all SField access const. * Hide and simplify databases used to hold SField constants. * Separate the two concerns of representing a field, and maintaining a database of fields.
120 lines
5.5 KiB
C++
120 lines
5.5 KiB
C++
//------------------------------------------------------------------------------
|
|
/*
|
|
This file is part of rippled: https://github.com/ripple/rippled
|
|
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
//==============================================================================
|
|
|
|
#include <beast/module/core/memory/SharedSingleton.h>
|
|
|
|
namespace ripple {
|
|
|
|
LedgerFormats::LedgerFormats ()
|
|
{
|
|
add ("AccountRoot", ltACCOUNT_ROOT)
|
|
<< SOElement (sfAccount, SOE_REQUIRED)
|
|
<< SOElement (sfSequence, SOE_REQUIRED)
|
|
<< SOElement (sfBalance, SOE_REQUIRED)
|
|
<< SOElement (sfOwnerCount, SOE_REQUIRED)
|
|
<< SOElement (sfPreviousTxnID, SOE_REQUIRED)
|
|
<< SOElement (sfPreviousTxnLgrSeq, SOE_REQUIRED)
|
|
<< SOElement (sfAccountTxnID, SOE_OPTIONAL)
|
|
<< SOElement (sfRegularKey, SOE_OPTIONAL)
|
|
<< SOElement (sfEmailHash, SOE_OPTIONAL)
|
|
<< SOElement (sfWalletLocator, SOE_OPTIONAL)
|
|
<< SOElement (sfWalletSize, SOE_OPTIONAL)
|
|
<< SOElement (sfMessageKey, SOE_OPTIONAL)
|
|
<< SOElement (sfTransferRate, SOE_OPTIONAL)
|
|
<< SOElement (sfDomain, SOE_OPTIONAL)
|
|
;
|
|
|
|
add ("DirectoryNode", ltDIR_NODE)
|
|
<< SOElement (sfOwner, SOE_OPTIONAL) // for owner directories
|
|
<< SOElement (sfTakerPaysCurrency, SOE_OPTIONAL) // for order book directories
|
|
<< SOElement (sfTakerPaysIssuer, SOE_OPTIONAL) // for order book directories
|
|
<< SOElement (sfTakerGetsCurrency, SOE_OPTIONAL) // for order book directories
|
|
<< SOElement (sfTakerGetsIssuer, SOE_OPTIONAL) // for order book directories
|
|
<< SOElement (sfExchangeRate, SOE_OPTIONAL) // for order book directories
|
|
<< SOElement (sfIndexes, SOE_REQUIRED)
|
|
<< SOElement (sfRootIndex, SOE_REQUIRED)
|
|
<< SOElement (sfIndexNext, SOE_OPTIONAL)
|
|
<< SOElement (sfIndexPrevious, SOE_OPTIONAL)
|
|
;
|
|
|
|
add ("GeneratorMap", ltGENERATOR_MAP)
|
|
<< SOElement (sfGenerator, SOE_REQUIRED)
|
|
;
|
|
|
|
add ("Offer", ltOFFER)
|
|
<< SOElement (sfAccount, SOE_REQUIRED)
|
|
<< SOElement (sfSequence, SOE_REQUIRED)
|
|
<< SOElement (sfTakerPays, SOE_REQUIRED)
|
|
<< SOElement (sfTakerGets, SOE_REQUIRED)
|
|
<< SOElement (sfBookDirectory, SOE_REQUIRED)
|
|
<< SOElement (sfBookNode, SOE_REQUIRED)
|
|
<< SOElement (sfOwnerNode, SOE_REQUIRED)
|
|
<< SOElement (sfPreviousTxnID, SOE_REQUIRED)
|
|
<< SOElement (sfPreviousTxnLgrSeq, SOE_REQUIRED)
|
|
<< SOElement (sfExpiration, SOE_OPTIONAL)
|
|
;
|
|
|
|
add ("RippleState", ltRIPPLE_STATE)
|
|
<< SOElement (sfBalance, SOE_REQUIRED)
|
|
<< SOElement (sfLowLimit, SOE_REQUIRED)
|
|
<< SOElement (sfHighLimit, SOE_REQUIRED)
|
|
<< SOElement (sfPreviousTxnID, SOE_REQUIRED)
|
|
<< SOElement (sfPreviousTxnLgrSeq, SOE_REQUIRED)
|
|
<< SOElement (sfLowNode, SOE_OPTIONAL)
|
|
<< SOElement (sfLowQualityIn, SOE_OPTIONAL)
|
|
<< SOElement (sfLowQualityOut, SOE_OPTIONAL)
|
|
<< SOElement (sfHighNode, SOE_OPTIONAL)
|
|
<< SOElement (sfHighQualityIn, SOE_OPTIONAL)
|
|
<< SOElement (sfHighQualityOut, SOE_OPTIONAL)
|
|
;
|
|
|
|
add ("LedgerHashes", ltLEDGER_HASHES)
|
|
<< SOElement (sfFirstLedgerSequence, SOE_OPTIONAL) // Remove if we do a ledger restart
|
|
<< SOElement (sfLastLedgerSequence, SOE_OPTIONAL)
|
|
<< SOElement (sfHashes, SOE_REQUIRED)
|
|
;
|
|
|
|
add ("EnabledAmendments", ltAMENDMENTS)
|
|
<< SOElement (sfAmendments, SOE_REQUIRED)
|
|
;
|
|
|
|
add ("FeeSettings", ltFEE_SETTINGS)
|
|
<< SOElement (sfBaseFee, SOE_REQUIRED)
|
|
<< SOElement (sfReferenceFeeUnits, SOE_REQUIRED)
|
|
<< SOElement (sfReserveBase, SOE_REQUIRED)
|
|
<< SOElement (sfReserveIncrement, SOE_REQUIRED)
|
|
;
|
|
}
|
|
|
|
void LedgerFormats::addCommonFields (Item& item)
|
|
{
|
|
item
|
|
<< SOElement(sfLedgerIndex, SOE_OPTIONAL)
|
|
<< SOElement(sfLedgerEntryType, SOE_REQUIRED)
|
|
<< SOElement(sfFlags, SOE_REQUIRED)
|
|
;
|
|
}
|
|
|
|
LedgerFormats* LedgerFormats::getInstance ()
|
|
{
|
|
return beast::SharedSingleton <LedgerFormats>::getInstance ();
|
|
}
|
|
|
|
} // ripple
|