Skip to main content

Transfer Reasons

Every pending transfer in GHOST has a reason field that identifies why the fund movement was queued. This enables auditing, debugging, and correct routing of funds.

Reason Codes

ReasonDescriptionSource Action
cancel-lendReturn funds to a lender who cancelled their intentLender calls POST /cancel-lend
cancel-borrowReturn collateral to a borrower (95% on rejection, 100% on cancellation)Borrower calls POST /cancel-borrow or POST /reject-proposal
disburseSend matched principal from pool to borrowerProposal accepted (explicit or auto)
return-collateralReturn full collateral to borrower after loan repaymentBorrower calls POST /repay
return-collateral-repaySend principal plus interest payout to a lenderBorrower calls POST /repay
liquidateDistribute seized collateral to lenders or protocolCRE calls POST /internal/liquidate-loans

Flow by Reason

cancel-lend

Lender cancels intent
-> Server queues transfer: pool -> lender, amount = deposit, reason = "cancel-lend"
-> CRE executes via vault private transfer

cancel-borrow

Two transfers are queued when a borrower rejects a proposal:

Borrower rejects proposal
-> Server queues transfer: pool -> borrower, amount = 95% collateral, reason = "cancel-borrow"
-> Server queues transfer: pool -> protocol, amount = 5% collateral, reason = "cancel-borrow"

When a borrower cancels a pending intent (before matching):

Borrower cancels intent
-> Server queues transfer: pool -> borrower, amount = 100% collateral, reason = "cancel-borrow"

disburse

Proposal accepted (explicit or auto-accept)
-> Server queues transfer: pool -> borrower, amount = principal, reason = "disburse"

return-collateral

Borrower repays loan in full
-> Server queues transfer: pool -> borrower, amount = collateral, reason = "return-collateral"

return-collateral-repay

One transfer per matched tick:

Borrower repays loan
-> For each tick:
Server queues transfer: pool -> lender, amount = tick principal + interest, reason = "return-collateral-repay"

liquidate

Multiple transfers per liquidation:

CRE triggers liquidation
-> Server queues transfer: pool -> protocol, amount = 5% collateral, reason = "liquidate"
-> For each tick:
Server queues transfer: pool -> lender, amount = pro-rata share of 95%, reason = "liquidate"

Transfer Lifecycle

All transfers follow the same lifecycle:

StatusDescription
pendingTransfer has been queued by the server. Waiting for CRE pickup.
completedCRE has executed the transfer through the vault and confirmed it.

The execute-transfers workflow polls for pending transfers every 15 seconds, executes up to 3 per cycle, and marks them completed via the confirm-transfers endpoint.