mirror of
https://github.com/luxfi/treasury.git
synced 2026-10-30 15:15:00 +00:00
- pkg/settlement: Cross-broker-dealer trade cash settlement Atomic 5-posting escrow flow (buyer→escrow→seller + commissions) - pkg/api: New ledger service endpoints (balances, tx CRUD, revert) - cmd/treasuryd: DATABASE_URL for Postgres, auto-migrate on startup - go.mod: Added jackc/pgx/v5 - LLM.md: Updated architecture docs
28 lines
1.5 KiB
Go
28 lines
1.5 KiB
Go
package settlement
|
|
|
|
// TradeSettlementRequest is the input for settling a secondary market trade's funds.
|
|
type TradeSettlementRequest struct {
|
|
TradeID string `json:"trade_id"`
|
|
GrossAmount string `json:"gross_amount"` // total buyer payment (decimal string)
|
|
BuyerCommission string `json:"buyer_commission"` // buyer BD commission
|
|
SellerCommission string `json:"seller_commission"` // seller BD commission
|
|
PlatformFee string `json:"platform_fee"` // platform fee (can be "0")
|
|
NetAmount string `json:"net_amount"` // seller receives (gross - seller commission - platform fee)
|
|
Currency string `json:"currency"` // e.g., "USD"
|
|
BuyerWalletID string `json:"buyer_wallet_id"` // buyer ledger account address
|
|
SellerWalletID string `json:"seller_wallet_id"` // seller ledger account address
|
|
SettlementType string `json:"settlement_type"` // bilateral, dvp, free_delivery
|
|
}
|
|
|
|
// TradeSettlementResult is the outcome of a trade settlement.
|
|
type TradeSettlementResult struct {
|
|
TradeID string `json:"trade_id"`
|
|
LedgerTransactionID int64 `json:"ledger_transaction_id"`
|
|
BuyerDebit string `json:"buyer_debit"`
|
|
SellerCredit string `json:"seller_credit"`
|
|
BuyerCommissionDebit string `json:"buyer_commission_debit"`
|
|
SellerCommissionDebit string `json:"seller_commission_debit"`
|
|
PlatformFeeDebit string `json:"platform_fee_debit"`
|
|
Status string `json:"status"` // settled, failed
|
|
}
|