refactor(v2): rename net_sats → principal_sats for semantic clarity
`net` is financial-accounting ambiguous (net of what?). In the
bitSpire/DCA context this column is specifically the principal the
operator distributes to LPs (gross − commission), not a generic net
amount. Renaming locally before any bitSpire firmware locks the
wire-level name; lamassu-next#44 should adopt the same name.
Scope:
- migrations.py: m003 ALTER TABLE … RENAME COLUMN, idempotent probe
pattern matching m002. Also updates the m001 canonical schema so
fresh installs land on the new column directly.
- models.py: `CreateDcaSettlementData.principal_sats` /
`DcaSettlement.principal_sats`. Field-doc comment updated.
- bitspire.py: both happy path and fallback path return
`principal_sats=…`. Reads `extra.get("principal_sats")` from the
bitSpire payload (lamassu-next#44 should follow this rename).
- crud.py: INSERT column list + `apply_partial_dispense(
new_principal_sats=…)` keyword.
- distribution.py: every `settlement.net_sats` → `settlement.
principal_sats`; partial-dispense memo + helper signatures updated;
the leg-order docblock at the top reads "principal_sats".
- tasks.py: landed-settlement log line.
- static/js/index.js: settlements-table column `principal_sats` with
label "Principal (→ LPs)".
- templates/satmachineadmin/index.html: q-td key + binding.
All 86 unit tests still pass. No backwards-compat shim — v2-bitspire
isn't released; the rename is a clean break.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9414a18f82
commit
1feaba80ed
8 changed files with 97 additions and 106 deletions
10
models.py
10
models.py
|
|
@ -29,9 +29,9 @@ class CreateMachineData(BaseModel):
|
|||
name: Optional[str] = None
|
||||
location: Optional[str] = None
|
||||
fiat_code: str = "GTQ"
|
||||
# Used only when bitSpire's settlement event omits net_sats/fee_sats
|
||||
# in Payment.extra (older bitSpire or edge cases). See plan's
|
||||
# lamassu-next informational issue #1.
|
||||
# Used only when bitSpire's settlement event omits principal_sats/
|
||||
# fee_sats in Payment.extra (older bitSpire or edge cases). See
|
||||
# plan's lamassu-next informational issue #1.
|
||||
fallback_commission_pct: float = 0.05
|
||||
|
||||
@validator("fallback_commission_pct")
|
||||
|
|
@ -192,7 +192,7 @@ class CreateDcaSettlementData(BaseModel):
|
|||
fiat_amount: float
|
||||
fiat_code: str = "GTQ"
|
||||
exchange_rate: float
|
||||
net_sats: int
|
||||
principal_sats: int
|
||||
commission_sats: int
|
||||
platform_fee_sats: int
|
||||
operator_fee_sats: int
|
||||
|
|
@ -212,7 +212,7 @@ class DcaSettlement(BaseModel):
|
|||
fiat_amount: float
|
||||
fiat_code: str
|
||||
exchange_rate: float
|
||||
net_sats: int
|
||||
principal_sats: int
|
||||
commission_sats: int
|
||||
platform_fee_sats: int
|
||||
operator_fee_sats: int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue