Docs Técnicas
Corrections
Corrections are first-class accounting events.
O conteúdo abaixo vem das fontes técnicas do repositório e é prerenderizado no site para leitura direta por pessoas, crawlers e agentes.
Corrections are first-class accounting events.
Use correction helpers instead of inventing negative transfers.
Corrections are not generic retries. They carry explicit lineage to a prior transaction through source_tx_id.
Reversal
python
@tx
def reverse_bad_post(source_tx_id: Hash256, amount: u128):
post(reverse(source_tx_id, ctx.asset, reversal,
line_generator(self.lender, receivable_long, dec, amount),
line_generator(self.borrower, payable_long, dec, amount)))Use reversal when the original accounting meaning should be unwound.
Counterpost
python
@tx
def counterpost_entry(source_tx_id: Hash256, amount: u128):
post(counterpost(source_tx_id, ctx.asset, counterpost,
line_generator(self.lender, receivable_long, dec, amount),
line_generator(self.borrower, payable_long, dec, amount)))Use counterpost when the original posting must remain visible and a new compensating intent should be recorded.
Reclassification
python
@tx
def reclassify_receivable(source_tx_id: Hash256, amount: u128):
post(reclassify(source_tx_id, ctx.asset,
line_generator(self.lender, receivable_short, dec, amount),
line_generator(self.lender, receivable_long, inc, amount)))Use reclassification when accounting meaning remains valid but bucket placement changes.
When To Use Each Form
reversal: cancel the original accounting effect;counterpost: offset the original effect with a new balancing posting;reclassify: move value between supported buckets without erasing economic history.
Execution Rules
- the contract builds a correction plan with explicit
source_tx_id; - the runtime records correction lineage in the effects plan;
- the ledger validates the resulting posting route;
- the final settlement metadata preserves both correction type and source reference.
Review Checklist
Every correction should preserve source lineage through source_tx_id.
Review each correction for:
- correct correction type;
- correct source transaction reference;
- bucket route validity;
- preserved audit trace.