Stablecoins as order currencies: check market price against the node's rates, not Yadio

Open
#213 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@grunch is already working on this.

Since Oct 23, 2026.

  • #214 by @grunch — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
56/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
backend, cli

Research direction

Start with execute_new_order in src/cli/new_order.rs and the kind 30078 mostro-rates event format described in the issue; compare the lookup approach with fetch_newest_info_event in src/util/events.rs. Add tests for quoted codes, missing codes, no event, and lowercase input, then update the --fiat-code help and the README and docs/commands.md. Done when market orders use the node's published rates, refusals return an error, and the stablecoin guidance is documented.

Written by the indexing model from the issue text.

Description

enhancement

Problem

MostroP2P/mostro#1081 proposes trading stablecoins as order currencies, each pegged 1:1 to a fiat. USDT, USDC and DOC (all USD) come first, and the design stays open to others such as EURC (EUR). A node that opts in prices a market order from its rate for the coin's fiat, and publishes the coins in its mostro-rates event like any other currency. MostroP2P/app#884 is the app side; this issue is the CLI side.

What already works

  • Fixed-price orders. neworder upper-cases the code and sends it as is, so -c usdt -a 150000 already reaches the node.
  • The order book filter. listorders -c usdt compares codes exactly (src/parser/orders.rs), so it matches.
  • The payment method. -m is a free string, so -m "USDT (Tron)" passes.
  • Amounts. check_fiat_range parses whole units (i64), as the daemon does.

What changes

1. The market-price check asks the node, not Yadio

A market order (-a 0, the default) never leaves the CLI with a stablecoin code. execute_new_order (src/cli/new_order.rs) fetches https://api.yadio.io/currencies and refuses any code missing from that list:

USDT is not present in the fiat market, please specify an amount with -a flag to fix the rate

Yadio lists 145 currencies today, and none of them is USDT, USDC, DOC or EURC. So the order is refused even on a node that quotes the coin.

Yadio's list is no longer the node's list. mostrod prices from several providers (docs/PRICE_PROVIDERS.md), and the rates it actually uses are the ones it publishes: kind 30078, d = mostro-rates, content {"BTC": {"<code>": <price>}}, authored by the node's pubkey.

The check would look the code up in that event instead, newest revision first, as fetch_newest_info_event (src/util/events.rs) does for kind 38385:

  • The event quotes the code: send the order.
  • The event exists but lacks the code: refuse, and say that this node does not quote it at market price, so pass -a to fix the sats amount.
  • No event: send the order and let the node decide. A node may not publish its rates at all (publish_to_nostr = false in [price], or the legacy publish_exchange_rates_to_nostr), or the relays may not have the event.

Two fixes come along:

  • No Yadio call. Today an unreachable Yadio fails every market order with a network error.
  • A refusal returns an error. Today the check ends with process::exit(0), which reports success to a script.
2. Help and docs
  • Help text. --fiat-code (src/cli.rs), docs/commands.md and the README say "fiat currency code". They would also name the stablecoin codes from the protocol book's list.
  • Example. One stablecoin order in the README, with the network in the payment method: mostro-cli neworder -k sell -c usdt -f 100 -m "USDT (Tron)".
  • Tip. A short note to name the network in -m, since a transfer sent on the wrong network can be lost, and to paste the transaction id in the chat. The txid is what a solver checks in a dispute.

Order of work

One PR. It can ship before MostroP2P/mostro#1081:

  • Stablecoins: nothing changes until a node quotes them. A node that publishes rates without them still gets the order refused, now with a clearer message.
  • Fiat codes: they keep working.

Tests

  • The decision is a pure function of the rates event and the code, tested like read_info_tag_from_event:
    • an event with the code allows a market order;
    • an event without it refuses one;
    • no event allows one.
  • The lookup upper-cases the code, so usdt finds USDT.

Out of scope

  • How the node prices the coins: MostroP2P/mostro#1081.
  • Depeg warnings. The node would stop quoting a coin that loses its peg (a follow-up in MostroP2P/mostro#1081). This check already turns that into a refusal.
Dominant language
Rust
Stars
39
Forks
16
Avg merge
6h
Merged PRs (30d)
50

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MostroP2P/mostro-cli

All issues in MostroP2P/mostro-cli

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.