Add the cost and no-negative work to phase B5

This commit is contained in:
ai-bot committed 2026-11-16 19:21:05 +00:00
1 parent fba9fdb64a
commit c18a15d454
1 file changed
+9 -7
+9 -7
View File
@@ -291,16 +291,18 @@ changed to sats. Only the parts that depend on the currency are refreshed (`sync
choice stays.
### B5.3 `validation.py`
A kroner `transfer_out` must have the bank on exactly one side: as `market_id` (a deposit) or as
`to_market_id` (a withdrawal). Kroner between two real accounts are rejected, `to_market_id` is
always required, and a sats transfer may not name the bank. `validation` learns the bank id as a
parameter.
A kroner `transfer_out` must have the bank on exactly one side: as `market_id` (a deposit, the
account is the bank and `Til` is the exchange being filled) or as `to_market_id` (a withdrawal).
Kroner between two real accounts are rejected, `to_market_id` is always required, and a sats
transfer may not name the bank. `validation` learns the bank id as an optional parameter.
**Verify:** six payloads, clean and rejected, each with its Nynorsk message.
### B5.4 `ledger.py`
Refuse a `trade` buy that overdraws the kroner balance, with the same message as a transfer.
**Verify:** the unit tests, plus a hand check of a buy that overdraws and one that a deposit
covers.
Refuse any transaction that would overdraw an account's kroner, a `trade` buy included, with the
same message as a transfer. The bank is covered by the same rule, so a cost without kroner on the
bank is refused.
**Verify:** the unit tests, plus a hand check of a buy that overdraws, a cost that overdraws the
bank, and one that a deposit covers.
### B5.5 `app.py`
Allow the bank as the `market_id` or the `to_market_id` of a kroner `transfer_out` (and keep it