Agent gateway
Methodology and evidence
Every number published here is either read from a validated XRP Ledger, derived from identified ledger inputs by the arithmetic on this page, or declared by the project and labelled as such. This page is the reference the machine surfaces point to.
ASTEROID XRPL methodology and evidence
Methodology identifier
asteroid-aos-amm-constant-productMethodology version
2.2.0Schema version
1.0.0Canonical token identifier
xrpl-mainnet:rS5LWaqWuzmoiNpzgYJbPvD1bsRZTgDG7:41535445524F4944000000000000000000000000Claim statuses
ledger-verified
Read directly from a validated ledger by the stated XRPL method. The value is what the ledger contained at the stated ledger index.
owner-confirmed
A role the project declares — treasury, dev allocation, LP holder. The underlying objects may be ledger-readable, but the role itself is a declaration and is never presented as ledger proof of control.
derived
Computed from identified ledger inputs using the arithmetic published on this page. Derived values always state the inputs they were computed from.
Source of every published metric
Each row states the XRPL method used, the claim status of the result, and the maximum age of a served reading.
| Metric | Source | Claim status | Max age |
|---|---|---|---|
| Outstanding supply | `gateway_balances` on the issuer at a validated ledger | ledger-verified | 30s |
| Escrowed supply and schedule | `account_objects` (type=escrow) on the project-declared treasury, filtered to the canonical currency and issuer | escrow objects ledger-verified; treasury role owner-confirmed | 60s |
| Total and circulating supply | Derived from outstanding and escrowed supply | derived | 30s |
| AMM reserves, LP supply, trading fee | `amm_info` for the ASTEROID/XRP pool at a validated ledger | ledger-verified | 10s |
| LP balances and account control | `account_lines` against the LP token, `account_info` for flags and RegularKey, `account_objects` (signer_list) | ledger-verified reads of owner-confirmed accounts | 120s |
| Trust lines and non-zero holders | `account_lines` on the issuer, paginated to exhaustion on one ledger | ledger-verified | 120s |
| Indicative AMM estimate | Constant-product mathematics applied to the `amm_info` reserves and fee | derived — never executable | 10s (pool reading) |
| USD price history | Public third-party market API (GeckoTerminal). Not a ledger read. | third-party, indicative | upstream |
Arithmetic and rounding
Exact decimal arithmetic
XRPL issued amounts carry up to 15 significant digits and there is no protocol-level decimals property. Every quantity is carried as an arbitrary-precision scaled integer and transported as an exact decimal string. No value is converted to an IEEE-754 double before transport.
All arithmetic is performed on arbitrary-precision scaled integers. Division truncates toward zero at 30 decimal places. Transported amounts and prices are rounded half-up at 15 decimal places, percentages at 8 decimal places, and the trading-fee percentage at 6 decimal places. No value is ever converted to an IEEE-754 double before transport.
Missing values
An input that could not be read from a validated ledger is transported as null together with a stable degraded code. A missing value is never substituted with zero, with a cached older value presented as current, or with a project-declared figure.
Caching and freshness
Live readings are served through a bounded single-flight server cache: AMM pool 10s, supply 30s, escrows 60s, holder enumeration 120s, account-control reads 120s. A cached reading still carries the validated ledger index and observation timestamp it was produced from, so its age is never hidden.
No execution
No interface on this site signs a transaction, submits a transaction, prepares a transaction for signing, or accepts a key, seed, mnemonic or any other credential. Every price figure is an observation or an estimate and is never executable.
Indicative AMM estimates
The quote surface models one constant-product pool at one observed ledger. It is an estimate, never an executable quote.
Formulas
exact-in: netIn = in x (1 − fee); out = poolOut x netIn / (poolIn + netIn).
exact-out: netIn = poolIn x out / (poolOut − out); in = netIn / (1 − fee).
fee = tradingFeeUnits / 100000, where tradingFeeUnits is the XRPL AMM trading fee in units of 1/100,000 (1000 units = 1%, the protocol maximum). The fee is set by liquidity-provider votes; it is not a token tax.
spotPrice = poolOut / poolIn. effectivePrice = amountOut / amountIn. priceImpactPct = 100 x (1 − effectivePrice / spotPrice), which includes the pool fee. poolUtilisationPct = 100 x amountOut / poolOut.
Quote lifecycle
Every estimate carries a quoteId, the methodology identifier and version, the validated ledgerIndex it was computed at, observedAt, maxAgeMs (10s) and an expiresAt instant after which it must be discarded and the pool re-read.
The quoteId is a correlation handle only. It reserves no liquidity, cannot be redeemed, cannot be executed and confers no right to any price. Expiry marks the end of the freshness window, not the end of an offer — there was never an offer.
The freshness window belongs to the observation, not to the moment of calculation. When an estimate is computed from a cached pool reading, observedAt stays the instant the pool was read from the validated ledger and expiresAt stays observedAt + maxAgeMs; remainingMs reports maxAgeMs minus the cache age. A cache hit therefore never extends the window. An observation older than maxAgeMs is re-read rather than reused, and an estimate is refused with a STALE_OBSERVATION error rather than served from an expired observation.
Auction-slot fee treatment
Every estimate is anonymous and uses the ordinary XRPL AMM trading fee read from `amm_info`. The XLS-30d auction slot can give one account a discounted fee for a limited period, but auction-slot eligibility is a property of the executing account at execution time, and this service accepts no account context of any kind. No account-specific discounted fee is therefore applied or inferred, and an eligible account would pay less than the estimate shows. This is a further reason every estimate here is indicative and non-executable.
Every estimate discloses this as a structured ORDINARY_POOL_FEE_ASSUMED warning, so an agent never has to infer which fee schedule was applied.
- — Indicative only. This is not a quote you can execute, not an offer, and not financial advice.
- — Models the single XRP/ASTEROID AMM pool only. XRPL order-book liquidity, multi-hop paths and path-finding are not modelled.
- — Ignores the XRPL transaction fee, any issuer transfer fee, and any wallet or aggregator spread.
- — The pool moves with every trade and the trading fee can be changed by liquidity-provider votes at any time, so the realised outcome will differ.
- — Uses the ordinary XRPL AMM trading fee returned by `amm_info`. No account-specific auction-slot discounted fee is applied, because auction-slot eligibility depends on the executing account and this service accepts no account context.
- — No transaction is prepared, signed or submitted by this service, and no private key is ever accepted.
Published AMM test vectors
Vector set 1.0.0. Any independent implementation of the formulas above must reproduce these values exactly. They are executed as regression tests against the live quote arithmetic on every build.
Derivation
XLS-30d Automated Market Maker specification and the rippled reference implementation of swapAssetIn/swapAssetOut in src/xrpld/app/misc/AMMHelpers.cpp. Expected values were derived analytically with exact rational arithmetic, independently of this repository's TypeScript implementation, and then rounded by the published transport policy.
Rounding applied
Fee fraction = tradingFeeUnits / 100000 truncated at 12 dp. Division truncates toward zero at 30 dp. Amounts and prices are rounded half-up at 15 dp. priceImpactPct and poolUtilisationPct are rounded half-up at 8 dp. tradingFeePct is rounded half-up at 6 dp.
Exact input, 1% pool fee (XRPL protocol maximum)
v1-exact-in-max-feeChecks the exact-in branch out = poolOut x netIn / (poolIn + netIn) with netIn = in x (1 - fee) at the maximum permitted trading fee.
Input
- poolIn
- 1000
- poolOut
- 2000000
- tradingFeeUnits
- 1000
- side
- exact-in
- amount
- 100
Expected
- amountIn
- 100
- amountOut
- 180163.785259326660601
- feeAmountIn
- 1
- tradingFeePct
- 1
- spotPrice
- 2000
- effectivePrice
- 1801.637852593266606
- priceImpactPct
- 9.91810737
- poolUtilisationPct
- 9.00818926
- poolInAfter
- 1100
- poolOutAfter
- 1819836.214740673339399
- minimumReceived
- null
- maximumPaid
- null
Exact input with the live 0.44% pool fee and a 1% slippage bound
v2-exact-in-live-fee-slippageReverses the direction (ASTEROID paid in) and exercises the slippage bound derivation at the fee the ASTEROID/XRP pool has actually carried.
Input
- poolIn
- 2000000
- poolOut
- 1000
- tradingFeeUnits
- 440
- side
- exact-in
- amount
- 50000
- slippageTolerancePct
- 1
Expected
- amountIn
- 50000
- amountOut
- 24.285533081599001
- feeAmountIn
- 220
- tradingFeePct
- 0.44
- spotPrice
- 0.0005
- effectivePrice
- 0.000485710661632
- priceImpactPct
- 2.85786767
- poolUtilisationPct
- 2.42855331
- poolInAfter
- 2050000
- poolOutAfter
- 975.714466918400999
- minimumReceived
- 24.042677750783011
- maximumPaid
- 50500
Exact output, 0.44% pool fee
v3-exact-outChecks the exact-out branch netIn = poolIn x out / (poolOut - out) and in = netIn / (1 - fee), including the fee grossing-up step.
Input
- poolIn
- 1000
- poolOut
- 2000000
- tradingFeeUnits
- 440
- side
- exact-out
- amount
- 100000
Expected
- amountIn
- 52.864181345287687
- amountOut
- 100000
- feeAmountIn
- 0.232602397919266
- tradingFeePct
- 0.44
- spotPrice
- 2000
- effectivePrice
- 1891.64
- priceImpactPct
- 5.418
- poolUtilisationPct
- 5
- poolInAfter
- 1052.864181345287687
- poolOutAfter
- 1900000
- minimumReceived
- null
- maximumPaid
- null
Exact output of XRP paid for in ASTEROID, 1% fee, 0.5% slippage bound
v4-exact-out-reverse-slippageExercises exact-out in the reverse direction and the maximumPaid bound that an exact-out caller needs.
Input
- poolIn
- 2000000
- poolOut
- 1000
- tradingFeeUnits
- 1000
- side
- exact-out
- amount
- 10
- slippageTolerancePct
- 0.5
Expected
- amountIn
- 20406.081012141618202
- amountOut
- 10
- feeAmountIn
- 204.060810121416182
- tradingFeePct
- 1
- spotPrice
- 0.0005
- effectivePrice
- 0.00049005
- priceImpactPct
- 1.99
- poolUtilisationPct
- 1
- poolInAfter
- 2020406.081012141618202
- poolOutAfter
- 990
- minimumReceived
- 9.95
- maximumPaid
- 20508.111417202326293
Zero fee, small trade — pure curve impact
v5-zero-fee-curve-onlyWith no fee the entire price impact must come from the constant-product curve, isolating the curve term from the fee term.
Input
- poolIn
- 1000
- poolOut
- 2000000
- tradingFeeUnits
- 0
- side
- exact-in
- amount
- 1
Expected
- amountIn
- 1
- amountOut
- 1998.001998001998002
- feeAmountIn
- 0
- tradingFeePct
- 0
- spotPrice
- 2000
- effectivePrice
- 1998.001998001998002
- priceImpactPct
- 0.0999001
- poolUtilisationPct
- 0.0999001
- poolInAfter
- 1001
- poolOutAfter
- 1998001.998001998001998
- minimumReceived
- null
- maximumPaid
- null
LP-lock verification
Accessibility of liquidity is observed from the ledger, never asserted from a label.
Method
Each project-declared LP-holding account is read live: `account_lines` against the AMM LP token for its LP balance, `account_info` for the master-key disable flag and any RegularKey, and `account_objects` (type=signer_list) for an active signer list. An account is reported as having no known signing path only when the master key is disabled, no usable regular key is set and no signer list is active at the observed validated ledger. LP shares and the implied pro-rata XRP and ASTEROID are derived from the same AMM reading with exact decimal arithmetic.
- — A closed signing path is an observation at one validated ledger, not a permanence guarantee and not a proof that the account can never be re-enabled by a path this service does not check.
- — The role of each checked account is an owner-confirmed project declaration. Ledger reads prove the balances and control flags, not the declared role.
- — Only the declared LP accounts are enumerated. LP tokens held by any other account are counted as community-held by difference, not by identification.
- — Locked LP tokens do not lock the underlying assets against price movement, and the AMM trading fee can still be changed by liquidity-provider votes.
- — This is not a safety score, an audit, an endorsement or financial advice.
LP-lock endpoint
https://asteroidxrpl.com/api/v1/liquidity/lockLP-lock schema
https://asteroidxrpl.com/schemas/v1/lp-lock-verification.jsonMachine contracts
OpenAPI 3.1
https://asteroidxrpl.com/openapi.jsonJSON Schema catalogue
https://asteroidxrpl.com/schemas/v1/index.jsonDiscovery manifest
https://asteroidxrpl.com/.well-known/asteroid-agent.jsonMCP endpoint
https://asteroidxrpl.com/mcpASTEROID XRPL is an independent community project. It is not affiliated with Ripple, the XRPL Foundation, SpaceX, Polaris Dawn, or ASTEROID projects on other networks.