Table of Contents

Class SolverMarket

Namespace
NArk.ArkadeIntents.SolverRegistry
Assembly
NArk.ArkadeIntents.dll
public class SolverMarket
Inheritance
SolverMarket
Derived
Inherited Members

Fields

ArkadeCorridor

The arkade corridor, which an absent per-side corridor means.

public const string ArkadeCorridor = "arkade"

Field Value

string

Properties

BaseAsset

public required AssetDescriptor BaseAsset { get; init; }

Property Value

AssetDescriptor

BaseCorridor

The rail the base side settles on. Absent means arkade, which every spot market is.

public string? BaseCorridor { get; init; }

Property Value

string

Remarks

When exactly one side is on the arkade corridor it is this one, so equivalent corridor markets group under a single key.

FeeBps

Solver spread, in basis points.

public int FeeBps { get; init; }

Property Value

int

FeeFlat

A flat component of the solver's fee, in quote-asset atomic units, charged on top of FeeBps.

public string? FeeFlat { get; init; }

Property Value

string

Remarks

Quote-denominated in both directions, matching MinQuoteAmount and MaxQuoteAmount, so a client converts it through the price when the maker receives base. On a same-asset corridor the two denominations coincide.

Absent on cards that charge proportionally only, which is why it is a nullable string rather than a number defaulting to zero: an unset field and a declared zero are the same charge, and treating a missing one as an error would refuse every card written before this existed. Serialized as a decimal string for the same reason as the amount bounds below.

FeeFlatAmount

The flat fee as a number, or zero when the card declares none.

[JsonIgnore]
public long FeeFlatAmount { get; }

Property Value

long

FeeFlatAtomicAmount

The flat fee without narrowing its atomic units to Int64.

[JsonIgnore]
public BigInteger FeeFlatAtomicAmount { get; }

Property Value

BigInteger

IsCorridor

True when either side settles off the arkade corridor.

public bool IsCorridor { get; }

Property Value

bool

Remarks

Such a market is negotiated per trade over RFQ rather than filled from the arkd stream, so the card's rendezvous fields are what make it reachable at all.

IsSameAsset

Both sides carry the same asset — the price is identically 1 and no feed applies.

public bool IsSameAsset { get; }

Property Value

bool

MaxBaseAmount

Maximum trade size, in base-asset units.

[JsonIgnore]
public long MaxBaseAmount { get; init; }

Property Value

long

MaxBaseAtomicAmount

Full-width maximum in base atomic units.

[JsonPropertyName("max_base_amount")]
[JsonConverter(typeof(AtomicAmountConverter))]
public BigInteger MaxBaseAtomicAmount { get; init; }

Property Value

BigInteger

MaxQuoteAmount

Maximum trade size, in quote-asset units.

[JsonIgnore]
public long MaxQuoteAmount { get; init; }

Property Value

long

MaxQuoteAtomicAmount

Full-width maximum in quote atomic units.

[JsonPropertyName("max_quote_amount")]
[JsonConverter(typeof(AtomicAmountConverter))]
public BigInteger MaxQuoteAtomicAmount { get; init; }

Property Value

BigInteger

MinBaseAmount

Minimum trade size, in base-asset units.

[JsonIgnore]
public long MinBaseAmount { get; init; }

Property Value

long

Remarks

Serialized as a decimal string: these are base units of an asset whose precision the card itself declares, and a JSON number would silently lose the large ones.

MinBaseAtomicAmount

Full-width minimum in base atomic units.

[JsonPropertyName("min_base_amount")]
[JsonConverter(typeof(AtomicAmountConverter))]
public BigInteger MinBaseAtomicAmount { get; init; }

Property Value

BigInteger

MinQuoteAmount

Minimum trade size, in quote-asset units — where a corridor states its bounds.

[JsonIgnore]
public long MinQuoteAmount { get; init; }

Property Value

long

MinQuoteAtomicAmount

Full-width minimum in quote atomic units.

[JsonPropertyName("min_quote_amount")]
[JsonConverter(typeof(AtomicAmountConverter))]
public BigInteger MinQuoteAtomicAmount { get; init; }

Property Value

BigInteger

Pair

Optional display label; empty when omitted. Never used as market identity.

public string Pair { get; init; }

Property Value

string

PriceDecimals

Normalization factor: the raw feed scalar is divided by 10^PriceDecimals.

public int PriceDecimals { get; init; }

Property Value

int

PriceFeed

Exact price-feed URL. Must be CORS-accessible for browser clients. Absent on a corridor market, where terms are negotiated per trade by RFQ rather than read off a feed.

public string? PriceFeed { get; init; }

Property Value

string

PriceFeedSchema

How to read PriceFeed. Absent whenever that is.

public PriceFeedSchema? PriceFeedSchema { get; init; }

Property Value

PriceFeedSchema

QuoteAsset

public required AssetDescriptor QuoteAsset { get; init; }

Property Value

AssetDescriptor

QuoteCorridor

The rail the quote side settles on — "lightning", "onchain". Absent means arkade, i.e. an ordinary spot market rather than a corridor.

public string? QuoteCorridor { get; init; }

Property Value

string

SolverFee

Per-direction fees, when this market prices its two directions differently.

public SolverFeeSides? SolverFee { get; init; }

Property Value

SolverFeeSides

Remarks

Supersedes FeeBps and FeeFlat for a market that publishes it; both are still emitted, at the widest direction, so a reader predating this field prices conservatively rather than wrongly.

Methods

CorridorOf(MarketSide)

A side's corridor from its canonical id, or legacy fields; maps bolt11/bitcoin to lightning/onchain.

public string CorridorOf(MarketSide side)

Parameters

side MarketSide

Which side to read.

Returns

string

The corridor name.

FeeBpsOn(MarketSide)

This market's spread for a swap depositing deposited, in basis points.

public int FeeBpsOn(MarketSide deposited)

Parameters

deposited MarketSide

Which leg the client pays in.

Returns

int

The direction's own rate, or the market's single rate when it publishes one.

FeeFlatOn(MarketSide)

This market's flat charge for a swap depositing deposited, in atomic units of that leg.

public BigInteger FeeFlatOn(MarketSide deposited)

Parameters

deposited MarketSide

Which leg the client pays in.

Returns

BigInteger

The direction's own flat charge, or the market's single one.

Remarks

A market publishing per-direction fees states every flat charge it makes, so a direction with no entry charges nothing — falling back to FeeFlat there would bill one direction for the other's flat component.

LegKey(MarketSide)

One side's full CAIP-19 identity, or a corridor-qualified legacy id when no canonical identity was published.

public string LegKey(MarketSide side)

Parameters

side MarketSide

Which side to read.

Returns

string

The leg key.

PairKey()

The market's canonical identity: the corridor-qualified leg pair.

public string PairKey()

Returns

string

<base-corridor>:<base-id>/<quote-corridor>:<quote-id>.

Remarks

Never the Pair label, and no longer the bare id pair: two BTC/BTC markets on different rails are different markets, and grouping them together offers a maker a Lightning corridor where they asked for an onchain one.

TotalFeeOn(long)

The total fee this market charges on amount, in its units.

public long TotalFeeOn(long amount)

Parameters

amount long

The size being traded.

Returns

long

Basis points on the amount, plus the flat component.

Remarks

FeeBps alone is not a ranking key once FeeFlat exists: a market with a lower spread and a flat fee is dearer at small sizes and cheaper at large ones.

TotalFeeOn(BigInteger)

The fee in full-width atomic units, without intermediate Int64 overflow.

public BigInteger TotalFeeOn(BigInteger amount)

Parameters

amount BigInteger

Returns

BigInteger

TotalFeeOn(BigInteger, MarketSide)

What this market charges to swap amount of the deposited leg.

public BigInteger TotalFeeOn(BigInteger amount, MarketSide deposited)

Parameters

amount BigInteger

The deposit, in atomic units.

deposited MarketSide

Which leg it is denominated in.

Returns

BigInteger

The advertised fee, in the same units.