Show / Hide Table of Contents

Class LedgerRules

The amendments that change how rippled computes lending, vault and AMM amounts: which Number rounding the ledger uses and which fixes apply. Defaults are the newest rules.

Inheritance
object
LedgerRules
Namespace: Xrpl.Sugar
Assembly: Xrpl.dll
Syntax
public sealed class LedgerRules

Properties

| Edit this page View Source

FixAMMv1_1

Whether fixAMMv1_1 is enabled: AMM swaps round in the pool's favour, a pool offer beside an order book is sized from its coarser side, a single-path AMM offer in offer crossing accounts for the transfer fee, and a withdrawal by the only liquidity provider first aligns the pool's LP token balance with the provider's.

Declaration
public bool FixAMMv1_1 { get; init; }
Property Value
Type Description
bool
Remarks

rippled retired the amendment (XRPL_RETIRE_FIX(AMMv1_1), rippled #8226): a node runs it whatever the ledger records, so FromNodeAsync(IXrplClient, CancellationToken) always sets it. Set it to false by hand only to replay the behaviour before the amendment.

| Edit this page View Source

FixAMMv1_2

Whether fixAMMv1_2 is enabled: when a pool cannot be brought to the order book's quality, its largest offer is still taken if it beats the book.

Declaration
public bool FixAMMv1_2 { get; init; }
Property Value
Type Description
bool
| Edit this page View Source

FixAMMv1_3

Whether fixAMMv1_3 is enabled: AMM deposits and withdrawals round against the trader. AmmLiquidity follows these rules only.

Declaration
public bool FixAMMv1_3 { get; init; }
Property Value
Type Description
bool
| Edit this page View Source

FixCleanup3_1_3

Whether fixCleanup3_1_3 is enabled: the amount of a loan payment is rounded toward zero to the loan's scale before the overpayment is taken from it.

Declaration
public bool FixCleanup3_1_3 { get; init; }
Property Value
Type Description
bool
| Edit this page View Source

FixCleanup3_2_0

Whether fixCleanup3_2_0 is enabled: the rounded target state after a payment rounds principal up and interest down, and (1 + r)^n - 1 is evaluated without cancellation for tiny rates. Before it, both round to nearest.

Declaration
public bool FixCleanup3_2_0 { get; init; }
Property Value
Type Description
bool
| Edit this page View Source

FixCleanup3_3_0

Whether fixCleanup3_3_0 is enabled, which selects the Number rounding the ledger computes with (Large330).

Declaration
public bool FixCleanup3_3_0 { get; init; }
Property Value
Type Description
bool
| Edit this page View Source

FixCleanup3_4_0

Whether fixCleanup3_4_0 is enabled: a payment made exactly at NextPaymentDueDate is on time. Before it, it counts as late.

Declaration
public bool FixCleanup3_4_0 { get; init; }
Property Value
Type Description
bool
| Edit this page View Source

FixCleanup3_5_0

Whether fixCleanup3_5_0 is enabled: a direct MPT payment and an MPT sent through its issuer charge the transfer fee in exact integer arithmetic, rounded up; an XRP amount beyond the ledger's range no longer aborts ceilOut; divRound takes an MPT operand through Number; LoanSet refuses a value field out of the asset's range with tecPRECISION_LOSS; and a vault withdrawal from one holder to another pays the asset's transfer fee.

Declaration
public bool FixCleanup3_5_0 { get; init; }
Property Value
Type Description
bool
Remarks

rippled 3.5.0 reads the amendment outside a transaction as enabled (resultIfNoRules), so path finding on such a node follows it whatever the ledger records. FromNodeAsync(IXrplClient, CancellationToken) tells such a node from an older one by whether its feature list names the amendment.

| Edit this page View Source

FixFillOrKill

Whether fixFillOrKill is enabled: a fill-or-kill offer without tfSell must receive all of its TakerPays, not spend all of its TakerGets.

Declaration
public bool FixFillOrKill { get; init; }
Property Value
Type Description
bool
Remarks

rippled retired the amendment (XRPL_RETIRE_FIX(FillOrKill), rippled #7366): a node runs it whatever the ledger records, so FromNodeAsync(IXrplClient, CancellationToken) always sets it. Set it to false by hand only to replay the behaviour before the amendment.

| Edit this page View Source

FixReducedOffersV2

Whether fixReducedOffersV2 is enabled: an offer cut down to an input limit is sized with ceilInStrict, rounded down, instead of ceilIn.

Declaration
public bool FixReducedOffersV2 { get; init; }
Property Value
Type Description
bool
| Edit this page View Source

LargeNumbers

Whether SingleAssetVault, LendingProtocol or MPTokensV2 is enabled, which switches rippled's Number to the large mantissa. Lending and vaults imply it; AMM arithmetic follows it. FromNodeAsync(IXrplClient, CancellationToken) derives it from those amendments; set by hand, it selects the scale on its own, as rippled's tests do through setMantissaScale.

Declaration
public bool LargeNumbers { get; init; }
Property Value
Type Description
bool
| Edit this page View Source

LendingProtocolV1_1

Whether LendingProtocolV1_1 is enabled: a closed-ended vault takes deposits only in its subscription phase and pays out nothing in its investment phase.

Declaration
public bool LendingProtocolV1_1 { get; init; }
Property Value
Type Description
bool
| Edit this page View Source

MPTokensV2

Whether MPTokensV2 is enabled, which refuses a withdrawal that empties a pool side without its LP tokens or the other side. On a node it also selects the large Number mantissa, which FromNodeAsync(IXrplClient, CancellationToken) records in LargeNumbers.

Declaration
public bool MPTokensV2 { get; init; }
Property Value
Type Description
bool

Methods

| Edit this page View Source

FromNodeAsync(IXrplClient, CancellationToken)

Reads the amendments from the node.

Declaration
public static Task<LedgerRules> FromNodeAsync(IXrplClient client, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client
CancellationToken cancellationToken
Returns
Type Description
Task<LedgerRules>
Remarks

The rules come from the feature command, which reports the amendments the ledger's Amendments object records. A node can also apply amendments listed in the [features] stanza of its config: they act as presets of its rules without being enabled on the ledger, and feature reports them as disabled. A standalone test node started that way runs amendments this method sees as off, and the engine then differs from it; build the LedgerRules by hand for such a node, or enable the amendments at genesis through the [amendments] stanza. Mainnet, testnet and devnet enable amendments on the ledger.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX