Stablecoins as order currencies: check market price against the node's rates, not Yadio
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 56/100
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
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.
neworderupper-cases the code and sends it as is, so-c usdt -a 150000already reaches the node. - The order book filter.
listorders -c usdtcompares codes exactly (src/parser/orders.rs), so it matches. - The payment method.
-mis a free string, so-m "USDT (Tron)"passes. - Amounts.
check_fiat_rangeparses 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
-ato 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 = falsein[price], or the legacypublish_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.mdand 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
usdtfindsUSDT.
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MostroP2P/mostro-cli
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 25/100
MostroP2P/mostro-cli#272 ·
Maintainers usually reply within 1 day
-
Add a JSON node status command that reads a node's health eventMay be free again @victrvondoom claimed this 14 days ago, and no pull request is open. Openenhancement status: accepted
Difficulty 4/5 3-5 days Newbie friendliness 35/100
MostroP2P/mostro-cli#271 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
MostroP2P/mostro-cli#242 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 Half a day Newbie friendliness 74/100
MostroP2P/mostro-cli#200 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
MostroP2P/mostro-cli#188 ·
Maintainers usually reply within 1 day
All issues in MostroP2P/mostro-cli
Similar issues
-
bug llm translation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
build comp-keeper
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ClickHouse/ClickHouse#137202 ·
Maintainers usually reply within 1 day
-
area:ops chore priority:low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jdrouet/tinyobserve#267 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
storytold/photocraft#20056 ·
Maintainers usually reply within 1 day