mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 03:26:01 +00:00
Add more fields
This commit is contained in:
@@ -20,6 +20,8 @@
|
|||||||
#include <xrpl/basics/Number.h>
|
#include <xrpl/basics/Number.h>
|
||||||
#include <xrpl/beast/utility/instrumentation.h>
|
#include <xrpl/beast/utility/instrumentation.h>
|
||||||
|
|
||||||
|
#include <boost/predef.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|||||||
57
src/test/app/LoanBroker_test.cpp
Normal file
57
src/test/app/LoanBroker_test.cpp
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
This file is part of rippled: https://github.com/ripple/rippled
|
||||||
|
Copyright (c) 2025 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 <test/jtx/Account.h>
|
||||||
|
#include <test/jtx/Env.h>
|
||||||
|
#include <test/jtx/vault.h>
|
||||||
|
|
||||||
|
#include <xrpl/basics/base_uint.h>
|
||||||
|
#include <xrpl/beast/unit_test/suite.h>
|
||||||
|
#include <xrpl/json/json_forwards.h>
|
||||||
|
#include <xrpl/protocol/Asset.h>
|
||||||
|
#include <xrpl/protocol/Feature.h>
|
||||||
|
#include <xrpl/protocol/Indexes.h>
|
||||||
|
#include <xrpl/protocol/STAmount.h>
|
||||||
|
#include <xrpl/protocol/STNumber.h>
|
||||||
|
#include <xrpl/protocol/TER.h>
|
||||||
|
#include <xrpl/protocol/TxFlags.h>
|
||||||
|
#include <xrpl/protocol/jss.h>
|
||||||
|
|
||||||
|
namespace ripple {
|
||||||
|
|
||||||
|
using namespace test::jtx;
|
||||||
|
|
||||||
|
class LoanBroker_test : public beast::unit_test::suite
|
||||||
|
{
|
||||||
|
void
|
||||||
|
testDisabled()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
void
|
||||||
|
run() override
|
||||||
|
{
|
||||||
|
testDisabled();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
BEAST_DEFINE_TESTSUITE(LoanBroker, tx, ripple);
|
||||||
|
|
||||||
|
} // namespace ripple
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <xrpl/json/json_value.h>
|
#include <xrpl/json/json_value.h>
|
||||||
#include <xrpl/protocol/AccountID.h>
|
#include <xrpl/protocol/AccountID.h>
|
||||||
#include <xrpl/protocol/Quality.h>
|
#include <xrpl/protocol/Quality.h>
|
||||||
|
#include <xrpl/protocol/STNumber.h>
|
||||||
#include <xrpl/protocol/TxFlags.h>
|
#include <xrpl/protocol/TxFlags.h>
|
||||||
#include <xrpl/protocol/jss.h>
|
#include <xrpl/protocol/jss.h>
|
||||||
|
|
||||||
@@ -181,6 +182,35 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct JTxFieldWrapper<blobField>
|
||||||
|
{
|
||||||
|
using JF = blobField;
|
||||||
|
using SF = JF::SF;
|
||||||
|
using SV = JF::SV;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SF const& sfield_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit JTxFieldWrapper(SF const& sfield) : sfield_(sfield)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
JF const&
|
||||||
|
operator()(Slice const& cond) const
|
||||||
|
{
|
||||||
|
return JF(sfield_, cond);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <size_t N>
|
||||||
|
JF const&
|
||||||
|
operator()(std::array<std::uint8_t, N> const& c) const
|
||||||
|
{
|
||||||
|
return operator()(makeSlice(c));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <class SField, class StoredValue = SField::type::value_type>
|
template <class SField, class StoredValue = SField::type::value_type>
|
||||||
using simpleField = JTxFieldWrapper<JTxField<SField, StoredValue>>;
|
using simpleField = JTxFieldWrapper<JTxField<SField, StoredValue>>;
|
||||||
|
|
||||||
@@ -560,21 +590,12 @@ auto const data = JTxFieldWrapper<blobField>(sfData);
|
|||||||
|
|
||||||
auto const managementFeeRate = simpleField<SF_UINT16>(sfManagementFeeRate);
|
auto const managementFeeRate = simpleField<SF_UINT16>(sfManagementFeeRate);
|
||||||
|
|
||||||
/*
|
auto const debtMaximum = simpleField<SF_NUMBER>(sfDebtMaximum);
|
||||||
Data string BLOB None Arbitrary metadata in hex
|
|
||||||
format.The field is limited to 256 bytes.ManagementFeeRate number
|
auto const coverRateMinimum = simpleField<SF_UINT32>(sfCoverRateMinimum);
|
||||||
UINT16 0 The 1 /
|
|
||||||
10th basis point fee charged by the Lending Protocol Owner.Valid values
|
auto const coverRateLiquidation =
|
||||||
are between 0 and
|
simpleField<SF_UINT32>(sfCoverRateLiquidation);
|
||||||
10000 inclusive
|
|
||||||
.DebtMaximum number NUMBER 0 The maximum amount the protocol can owe
|
|
||||||
the Vault
|
|
||||||
.The default value of 0 means there is no limit to the
|
|
||||||
debt.CoverRateMinimum number UINT16 0 The 1 /
|
|
||||||
10th basis point DebtTotal that the first loss capital must
|
|
||||||
cover.Valid values are between 0 and
|
|
||||||
100000 inclusive.CoverRateLiquidation
|
|
||||||
*/
|
|
||||||
|
|
||||||
} // namespace loanBroker
|
} // namespace loanBroker
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user