Documentation Index
Fetch the complete documentation index at: https://docs.monaris.co/llms.txt
Use this file to discover all available pages before exploring further.
Overview
When a buyer callspayInvoice(invoiceId) on the SettlementRouter, the following waterfall executes in a single atomic transaction. If any step fails, the entire transaction reverts.
Settlement steps
Settlement waterfall diagram
Fee structure
| Component | Calculation | Recipient |
|---|---|---|
| Protocol fee | amount × 0.5% (50 bps) | Treasury address |
| Advance repayment | principal + accrued interest | Vault (via Vault.repay()) |
| Seller payout | amount - fee - repayment | Seller wallet |
Example
Atomicity
The entire waterfall — validation, transfer, fee calculation, distribution, invoice status update, and reputation update — executes in a single transaction. If any step fails (insufficient balance, invalid invoice state, contract revert), the entire transaction reverts. No partial settlements are possible.Events emitted
TheInvoiceSettled event is emitted on successful completion, containing:
- Invoice ID
- Buyer address
- Seller address
- Total amount
- Protocol fee
- Repayment amount (if applicable)
- Seller payout amount
Related
- Smart Contracts Reference — contract addresses and invoice lifecycle
- Invoice Advance — how advances work with the waterfall
- Monaris Credit — credit products that interact with settlement
