Stablecoins as order currencies: check market price against the node's rates, not Yadio
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 56/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 39
- Fork
- 16
- Merge trung bình
- 4 giờ 6 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MostroP2P/mostro-cli
-
enhancement status: accepted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
MostroP2P/mostro-cli#212 · 1 bình luận ·
-
enhancement status: accepted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
MostroP2P/mostro-cli#211 ·
-
enhancement status: accepted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
MostroP2P/mostro-cli#210 ·
-
enhancement status: accepted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
MostroP2P/mostro-cli#209 ·
-
enhancement status: accepted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
MostroP2P/mostro-cli#208 ·
Tất cả issue của MostroP2P/mostro-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
compiler P4 perf
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
HerringtonDarkholme/hd-lang#1044 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue help wanted r-docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
servo/rust-smallvec#824 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
akitaonrails/ai-usagebar#552 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100