Class SolverTerms
- Namespace
- NArk.ArkadeIntents.SolverRegistry
- Assembly
- NArk.ArkadeIntents.dll
Checks a trade against what a solver publicly committed to on its registry card.
public static class SolverTerms
- Inheritance
-
SolverTerms
- Inherited Members
Remarks
The card is the only statement of terms that carries provenance — signed, git-reviewed, tied to a discoverable identity — while a quote is whatever arrived on a socket. Comparing one against the other is the only way to notice a solver quoting differently from how it advertises, which no amount of checking the quote against itself can reveal.
Checking limits before asking also spares a round trip: a request outside the published range is one the solver refuses anyway, and its refusal cannot say by how much.
Methods
AssertFeeWithinAdvertised<TProfile>(SolverCard, RfqQuote<TProfile>)
Refuse a same-asset quote that charges more than the card advertises; cross-asset quotes need a price-aware check.
public static void AssertFeeWithinAdvertised<TProfile>(SolverCard card, RfqQuote<TProfile> quote)
Parameters
cardSolverCardThe solver's card.
quoteRfqQuote<TProfile>The quote to check.
Type Parameters
TProfileThe corridor's quote-profile shape.
Remarks
The spread is the fee, so this compares the gap between the two amounts against what the card commits to: basis points on the amount, plus a flat component where the card declares one. A rounding satoshi is tolerated because a solver computing the same rate in integer arithmetic can legitimately land one either side.
The flat part matters more than its size suggests. Ignoring it does not make the check stricter in a useful direction — it makes it refuse quotes that match the card exactly, turning an honest solver's advertised pricing into a failed swap.
Exceptions
- SolverTermsException
The spread exceeds the advertised fee.
AssertInputWithinLimits(SolverCard, string, long)
Refuses an exact-input size outside the advertised bounds for the request's from leg.
public static void AssertInputWithinLimits(SolverCard card, string pair, long amount)
Parameters
cardSolverCardThe solver's card.
pairstringDirectional RFQ pair.
amountlongAtomic units of the pair's from leg.
Exceptions
- SolverTermsException
The corridor or input size is not advertised.
AssertInputWithinLimits(SolverCard, string, BigInteger)
Refuse a deposit the solver's card says it will not accept, in atomic units of the deposited leg.
public static void AssertInputWithinLimits(SolverCard card, string pair, BigInteger amount)
Parameters
cardSolverCardThe solver's card.
pairstringThe corridor being asked for.
amountBigIntegerThe deposit size, in atomic units.
Remarks
Widened for the reason AssertWithinLimits(SolverCard, string, BigInteger) gives.
Exceptions
- SolverTermsException
The card does not accept that size, or that direction.
AssertWithinLimits(SolverCard, string, long)
Refuse a size the solver's card already rules out, before anything is asked of it.
public static void AssertWithinLimits(SolverCard card, string pair, long amountSats)
Parameters
cardSolverCardThe solver's card.
pairstringThe RFQ pair.
amountSatslongThe size being traded.
Exceptions
- SolverTermsException
The corridor is unserved, or the size is out of range.
AssertWithinLimits(SolverCard, string, BigInteger)
Refuse a size the solver's card says it will not pay out, in atomic units of the receiving leg.
public static void AssertWithinLimits(SolverCard card, string pair, BigInteger amount)
Parameters
cardSolverCardThe solver's card.
pairstringThe corridor being asked for.
amountBigIntegerThe payout size, in atomic units.
Remarks
The width matters on an asset leg and nowhere else: one whole unit of an 18-decimal asset is already 10^18, so a pair of them overflows the satoshi-shaped overload above — and an overflow at a bounds check reads as a broken SDK rather than as a size the solver would have been happy to quote.
Exceptions
- SolverTermsException
The card does not serve that size, or that direction.
MarketFor(SolverCard, string)
Find the market a card serves for a directional pair.
public static SolverMarket? MarketFor(SolverCard card, string pair)
Parameters
cardSolverCardThe solver's card.
pairstringThe RFQ pair, e.g.
arkade:BTC->lightning:BTC.
Returns
- SolverMarket
The market, or
nullwhen the solver does not serve it.
Remarks
Matches asset identities in either direction, never the display label. Current legacy RFQ legs are matched through the explicit canonical adapter.