Skip to content

Commit b772f62

Browse files
committed
Revert "Implement Lending Protocol (unsupported) (#5270)"
This reverts commit 6c67f1f.
1 parent bb6b847 commit b772f62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+528
-18785
lines changed

include/xrpl/basics/Number.h

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@ class Number;
1313
std::string
1414
to_string(Number const& amount);
1515

16-
template <typename T>
17-
constexpr bool
18-
isPowerOfTen(T value)
19-
{
20-
while (value >= 10 && value % 10 == 0)
21-
value /= 10;
22-
return value == 1;
23-
}
24-
2516
class Number
2617
{
2718
using rep = std::int64_t;
@@ -31,9 +22,7 @@ class Number
3122
public:
3223
// The range for the mantissa when normalized
3324
constexpr static std::int64_t minMantissa = 1'000'000'000'000'000LL;
34-
static_assert(isPowerOfTen(minMantissa));
35-
constexpr static std::int64_t maxMantissa = minMantissa * 10 - 1;
36-
static_assert(maxMantissa == 9'999'999'999'999'999LL);
25+
constexpr static std::int64_t maxMantissa = 9'999'999'999'999'999LL;
3726

3827
// The range for the exponent when normalized
3928
constexpr static int minExponent = -32768;
@@ -143,7 +132,22 @@ class Number
143132
}
144133

145134
Number
146-
truncate() const noexcept;
135+
truncate() const noexcept
136+
{
137+
if (exponent_ >= 0 || mantissa_ == 0)
138+
return *this;
139+
140+
Number ret = *this;
141+
while (ret.exponent_ < 0 && ret.mantissa_ != 0)
142+
{
143+
ret.exponent_ += 1;
144+
ret.mantissa_ /= rep(10);
145+
}
146+
// We are guaranteed that normalize() will never throw an exception
147+
// because exponent is either negative or zero at this point.
148+
ret.normalize();
149+
return ret;
150+
}
147151

148152
friend constexpr bool
149153
operator>(Number const& x, Number const& y) noexcept
@@ -188,8 +192,6 @@ class Number
188192
class Guard;
189193
};
190194

191-
constexpr static Number numZero{};
192-
193195
inline constexpr Number::Number(rep mantissa, int exponent, unchecked) noexcept
194196
: mantissa_{mantissa}, exponent_{exponent}
195197
{

include/xrpl/beast/utility/instrumentation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// The duplication is because Visual Studio 2019 cannot compile that header
1414
// even with the option -Zc:__cplusplus added.
1515
#define ALWAYS(cond, message, ...) assert((message) && (cond))
16-
#define ALWAYS_OR_UNREACHABLE(cond, message) assert((message) && (cond))
16+
#define ALWAYS_OR_UNREACHABLE(cond, message, ...) assert((message) && (cond))
1717
#define SOMETIMES(cond, message, ...)
1818
#define REACHABLE(message, ...)
1919
#define UNREACHABLE(message, ...) assert((message) && false)

include/xrpl/json/json_value.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,6 @@ class Value
381381
/// Return true if the object has a member named key.
382382
bool
383383
isMember(std::string const& key) const;
384-
/// Return true if the object has a member named key.
385-
bool
386-
isMember(StaticString const& key) const;
387384

388385
/// \brief Return a list of the member names.
389386
///

include/xrpl/ledger/ApplyView.h

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -368,45 +368,6 @@ class ApplyView : public ReadView
368368
emptyDirDelete(Keylet const& directory);
369369
};
370370

371-
namespace directory {
372-
/** Helper functions for managing low-level directory operations.
373-
These are not part of the ApplyView interface.
374-
375-
Don't use them unless you really, really know what you're doing.
376-
Instead use dirAdd, dirInsert, etc.
377-
*/
378-
379-
std::uint64_t
380-
createRoot(
381-
ApplyView& view,
382-
Keylet const& directory,
383-
uint256 const& key,
384-
std::function<void(std::shared_ptr<SLE> const&)> const& describe);
385-
386-
auto
387-
findPreviousPage(ApplyView& view, Keylet const& directory, SLE::ref start);
388-
389-
std::uint64_t
390-
insertKey(
391-
ApplyView& view,
392-
SLE::ref node,
393-
std::uint64_t page,
394-
bool preserveOrder,
395-
STVector256& indexes,
396-
uint256 const& key);
397-
398-
std::optional<std::uint64_t>
399-
insertPage(
400-
ApplyView& view,
401-
std::uint64_t page,
402-
SLE::pointer node,
403-
std::uint64_t nextPage,
404-
SLE::ref next,
405-
uint256 const& key,
406-
Keylet const& directory,
407-
std::function<void(std::shared_ptr<SLE> const&)> const& describe);
408-
409-
} // namespace directory
410371
} // namespace ripple
411372

412373
#endif

0 commit comments

Comments
 (0)