Class OfferCreateCrossing
An OfferCreate crossed locally against a DexSnapshot, the way rippled
3.4.1's payment engine crosses it: every offer of the book in quality order, the AMM pool
interleaved with them, the auto-bridge through XRP when neither side is XRP, and the
result the node would return.
Inheritance
Namespace: Xrpl.Amounts
Assembly: Xrpl.dll
Syntax
public static class OfferCreateCrossing
Remarks
The crossing repeats OfferCreate's checks - the tem codes of
preflight, the frozen, unfunded, expired and unauthorized cases of
preclaim, the permissioned domain - then OfferSequence's cancellation and
OfferCreate::flowCross with the engine under it: strands, book steps, the AMM's
synthetic offers and StrandFlow, including their rounding, so against the same
state the amounts match the node's to the last digit.
MPT books (MPTokensV2) cross as the node crosses them: the issuances' transfer fees,
locks and trade permissions, the MPTokens a crossing creates, and an issuer's own offers
bounded by what it may still issue. Not covered: sponsored reserves, and vault shares,
whose underlying asset's permissions are not consulted. A result is exact only against the state
it was given; simulate remains the reference for a transaction that is about to be
submitted.
Methods
| Edit this page View SourceCross(DexSnapshot, string, XrplAmount, XrplAmount, ulong, OfferCreateFlags, LedgerRules)
What an OfferCreate by account would do against
snapshot.
Declaration
public static OfferCrossingResult Cross(DexSnapshot snapshot, string account, XrplAmount takerPays, XrplAmount takerGets, ulong fee, OfferCreateFlags flags = (OfferCreateFlags)0, LedgerRules rules = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DexSnapshot | snapshot | The ledger state to cross against. |
| string | account | The account placing the offer; it must be in the snapshot. |
| XrplAmount | takerPays | The offer's |
| XrplAmount | takerGets | The offer's |
| ulong | fee | The transaction's fee in drops, charged before anything is crossed. |
| OfferCreateFlags | flags | The offer's flags: |
| LedgerRules | rules | The amendments in force; the current rules when null. |
Returns
| Type | Description |
|---|---|
| OfferCrossingResult |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | The account is not in the snapshot, the two sides are the same asset, or the snapshot lists a trust line twice. |
Cross(DexSnapshot, OfferCreate, LedgerRules)
What offer would do against snapshot.
Declaration
public static OfferCrossingResult Cross(DexSnapshot snapshot, OfferCreate offer, LedgerRules rules = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DexSnapshot | snapshot | The ledger state to cross against. |
| OfferCreate | offer | The transaction, with its |
| LedgerRules | rules | The amendments in force; the current rules when null. |
Returns
| Type | Description |
|---|---|
| OfferCrossingResult |
Remarks
With OfferSequence, the offer it cancels must be in the snapshot to be removed;
FromNodeAsync(IXrplClient, OfferCreate, DexSnapshotOptions, CancellationToken)
reads it.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | The offer lacks its account or amounts, the account is not in the snapshot, or the snapshot lists a trust line twice. |
RoundToTickSize(XrplAmount, XrplAmount, int, bool, LedgerRules)
The tick-size rounding an OfferCreate goes through before it crosses
(applyGuts): the offer's quality is rounded to tickSize
significant digits, to a worse quality, and the side that is not exact moves -
TakerPays for a tfSell offer, TakerGets otherwise.
Declaration
public static (XrplAmount TakerPays, XrplAmount TakerGets)? RoundToTickSize(XrplAmount takerPays, XrplAmount takerGets, int tickSize, bool sell, LedgerRules rules = null)
Parameters
| Type | Name | Description |
|---|---|---|
| XrplAmount | takerPays | What the offer asks for. |
| XrplAmount | takerGets | What the offer gives. |
| int | tickSize | The tick size, 3 to 15; 0 or 16 for none. |
| bool | sell | Whether the offer has |
| LedgerRules | rules | The amendments in force; all of them when null. |
Returns
| Type | Description |
|---|---|
| (XrplAmount In, XrplAmount Out)? | The amounts the node writes, or null when a side rounds to nothing. |
Remarks
The node takes the smaller TickSize of the issuers of the offer's issued-currency
sides; an XRP or MPT side has none.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|