Stablecoins as order currencies: check market price against the node's rates, not Yadio
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 56/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Rust
- Estrellas
- 39
- Forks
- 16
- Merge medio
- 4 h 6 min
- PR fusionados (30 d)
- 3
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de MostroP2P/mostro-cli
-
enhancement status: accepted
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
MostroP2P/mostro-cli#212 · 1 comentario ·
-
enhancement status: accepted
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
MostroP2P/mostro-cli#211 ·
-
enhancement status: accepted
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
MostroP2P/mostro-cli#210 ·
-
enhancement status: accepted
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
MostroP2P/mostro-cli#209 ·
-
enhancement status: accepted
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
MostroP2P/mostro-cli#208 ·
Todos los issues de MostroP2P/mostro-cli
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
compiler P4 perf
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
HerringtonDarkholme/hd-lang#1044 ·
Los mantenedores suelen responder en 1 día
-
good first issue help wanted r-docs
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
servo/rust-smallvec#824 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
akitaonrails/ai-usagebar#552 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100