emj
shrx

Reference · State machine

What moves, and when?

Collateral and principal move at different steps. Acceptance never moves collateral.

StepWho actsAsset A (collateral)Asset B (principal)
Propose Borrower Borrower → covenant (locked)
Accept Lender Stays locked Lender → borrower
Repay Borrower Covenant → borrower Borrower → lender (+ protocol fee)
Cancel (pending only) Borrower Covenant → borrower
Liquidate Lender Covenant → lender Unrepaid portion stays with lender
Memory hook Collateral is the borrower's pledge — it moves once at propose (into the covenant), then again only at the end (back to borrower or to lender). Principal is the lender's funding — it moves only at accept and repay.