Orbitprotocol

Orbitprotocol partial and full loan repayment

Orbitprotocol supported partial loan repayment and full payoff, including accrued interest, through its published lending contracts. Repayment reduced the debt recorded for the borrower in the selected market. Retrieving supplied collateral required redemption under separate conditions. Blast is winding down, so paying a loan and moving released assets to Ethereum involve different operations.

Updated on

The published OErc20 and OEther implementations also distinguished the address funding a payment from the borrower receiving debt credit. Their repayment inputs differed. Those differences mattered when selecting an amount, authorizing token spending and interpreting the remaining loan balance.

Borrower balances and the market controller

An asset-specific lending market held the borrowing ledger and accepted its underlying asset for repayment. SpaceStation supplied the permission check, which required that market to be listed. The market then calculated the amount owed and connected incoming assets to the borrower’s debt record. Selecting the market and borrower identified the obligation that the payment would reduce. The ordinary repayment functions updated debt without redeeming the supplied position. Repayment brought assets into the pool, so its routine did not require enough existing cash to fund a collateral withdrawal.

The payer and borrower could be different addresses. Self-repayment credited the caller; repayment on behalf credited the specified borrower.

What remained after a partial repayment?

A partial repayment left the accrued loan balance minus the amount credited by the market. The remaining debt continued to participate in the market’s interest accounting. Its saved balance and interest index reflected the repayment checkpoint, so later interest calculations used the reduced outstanding debt.

Collateral headroom could improve when debt fell, provided asset valuations and collateral settings remained unchanged. That improvement did not establish that an account’s shortfall had disappeared.

SpaceStation evaluated the account across its entered markets using borrowing balances, collateral factors and oracle prices. A reduced loan could still leave the account below its collateral requirement. The account’s broader collateral position determined whether a proposed withdrawal remained permissible.


Interest before the repayment calculation

The published OToken repayment path accrued interest before applying the repayment. The borrower’s saved debt scaled with the updated borrowing index relative to the account’s saved index. This brought accrued interest into the amount owed. An amount copied from an older balance could consequently repay less than the debt calculated during execution. A token approval did not lock the debt calculation to the block when permission was granted.

The stored borrowing-balance query used existing accounting data. The current-balance method first accrued interest, then calculated the account’s debt. This distinction affected a full payoff that relied on a specified amount: the result reflected debt in the calculation block, while a later repayment could execute after additional blocks. The ERC-20 full-balance setting addressed amount selection within the repayment call itself.

Repaying only the original borrowed quantity could leave accrued interest outstanding.


Choosing a repayment amount

A repayment choice depended on whether the borrower intended to retain some debt or clear the selected market. The supported payment method then constrained how the amount entered the contract.

A full-balance request still depended on sufficient funds and a successful transfer.

Full payoff of an ERC-20 loan

The published OErc20 interface accepted a repayment amount through repayBorrow(uint repayAmount) . A specified amount could clear the debt when the credited payment matched the accrued balance. The shared implementation also recognized a special full-balance value, which selected the borrower’s debt after interest accrual.

Amount selection and spending permission

The full-balance value

The shared repayment implementation interpreted type(uint).max as the borrower’s full accrued debt. This was an integer sentinel, not a request to transfer that enormous token quantity. The implementation replaced it with the calculated borrowing balance before requesting the transfer.

A fixed repayment amount followed a different branch. The routine did not automatically cap that request at the outstanding debt. If the amount actually credited exceeded the borrower’s balance, the checked subtraction reverted. Selecting the full-balance sentinel avoided that particular oversized fixed-amount request.

Funds and allowance

The ERC-20 transfer still required enough underlying tokens and sufficient spending allowance. The special repayment parameter and token allowance were separate inputs. Full-debt selection did not require setting the allowance itself to the integer maximum. The allowance needed to cover the amount transferred for the accrued debt.

The accounting credited the amount actually received by the market. If an underlying token deducted a transfer fee, that amount could be smaller than requested, leaving debt even after a full-balance request.


Repayment records and remaining debt

The RepayBorrow event recorded the payer, borrower and actual repayment amount. It also recorded the borrower’s new debt and the market’s total borrowing balance. The market-wide total described all borrowing in that pool; the borrower-specific figure described the loan affected by the payment. A successful repayment that credited a nonzero amount and left debt outstanding represented a reduction, while a zero balance represented payoff for that borrower in that market.

Transaction submission alone did not establish either result. A pending transaction had not yet completed the accounting update. A reverted repayment did not preserve its attempted debt reduction. The event described the debt immediately after that repayment. Later borrowing could create new debt after a completed payoff. A later balance reading also needed to belong to the same borrower and market.

Native ETH payment differences

The published OEther implementation used the call’s ETH value as the repayment amount in its payable entry point. Its repayBorrow() function had no amount argument. The corresponding repayment-on-behalf function accepted the borrower address and used the ETH accompanying that call. An ERC-20 repayment instead supplied an amount argument and transferred the market’s underlying token through its allowance mechanism.

The native ETH entry point did not expose the ERC-20 full-balance selector. A fixed ETH payment below the accrued balance left debt. An amount exceeding the debt caused the checked subtraction to revert in this implementation. Matching the balance at execution therefore mattered for exact payoff; adding an arbitrary excess was not an automatic refund mechanism.

Did full repayment automatically withdraw collateral?

Full repayment did not automatically withdraw collateral. The repayment path updated borrowing balances; redemption handled the return of supplied assets. A borrower could retain a supply position after clearing a loan. The OTokens representing that position remained separate from the borrowing record, which explained why a zero debt balance did not imply an empty supplied balance.

Redemption in the published OToken implementation required enough underlying cash in the market. A supplied balance did not establish that the pool held all corresponding assets as immediately available cash.

Visual summary: Orbitprotocol: Did full repayment automatically withdraw collateral?

View image file

When an account used the market for collateral, SpaceStation also checked whether the proposed redemption would create a shortfall. Accounts outside that market’s membership bypassed that particular liquidity check, while the market-listing and cash requirements still applied.

Loan settlement during Blast’s wind-down

Blast is winding down and directs holders to move assets to Ethereum. Its bridge withdrawal period concerns network withdrawals, with processing that depends on the asset. That period does not describe the time required to repay an Orbitprotocol loan or redeem supplied collateral. Outstanding debt and assets already released from a lending market remain different states; a bridge procedure does not itself perform the lending market’s repayment calculation.

Paying another address’s debt did not transfer its supplied collateral to the payer. The borrowing and supplied-position records remained distinct.

Withdrawal access also depends on the account holding the released assets. Blast’s regular-wallet bridge procedure covers externally owned accounts, which are controlled through a private key. Funds held in a smart contract wallet require a separate withdrawal procedure.

Did an ERC-20 approval reduce an Orbitprotocol loan balance?

An ERC-20 approval did not reduce the borrowing balance. It authorized the relevant market contract to spend the approved asset from the approving address. Debt changed through a successful repayment call and the resulting accounting update. An approval transaction could therefore succeed while the loan remained outstanding, including any interest subsequently incorporated into its balance.

Whose allowance applied when another address paid the debt?

The funding address’s allowance applied to an ERC-20 repayment made on another borrower’s behalf. The market transferred underlying tokens from the payer and credited the borrower named in the call. An allowance granted by the borrower did not authorize spending a different payer’s assets. The native ETH repayment path instead used ETH accompanying the payable call.

Could a borrowing pause also block repayment?

A borrowing pause alone did not reject repayment in the published SpaceStation permission check. That repayment check required a listed market and did not apply the borrowing-pause flag. Successful repayment still depended on the relevant market implementation, a successful asset transfer and transaction execution. A paused borrowing flag did not establish whether a frontend remained accessible.

Was ordinary repayment restricted by the liquidation close factor?

Ordinary repayment was not restricted by the liquidation close factor in the published implementation. That parameter limited repayment through the separate liquidation path for a nondeprecated borrowed market. The controller used different conditions for deprecated markets. A voluntary partial payment therefore did not inherit a liquidation percentage limit; voluntary full payoff remained a distinct operation.

Were repayment amounts measured in OTokens?

Repayment amounts represented the market’s underlying asset, not OToken shares. OTokens represented supplied positions and had their own redemption accounting. The repayment calculation reduced debt using the underlying amount credited to the market. Confusing a supply-token balance with the underlying loan amount could therefore select the wrong quantity without changing what the repayment function expected.

Would repaying one market also settle loans in other markets?

A repayment updated the named borrower’s debt in the selected market only. Other lending markets maintained their own borrowing records. A zero balance for one market consequently did not establish that the account had no other debt. SpaceStation’s account-level collateral calculation could still include borrowing in those other entered markets.

What did a plain ETH transfer do in the published OEther implementation?

A plain ETH transfer to OEther entered its supply path. The receive handler called mintInternal, which handled supplying ETH and minting OTokens under the applicable market conditions. Debt repayment used the payable repayBorrow function or its repayment-on-behalf counterpart. Sending ETH without invoking that repayment entry point did not select the loan-repayment operation.

How was transaction gas treated during repayment?

Transaction gas did not count toward the amount credited against the loan. An ERC-20 repayment used underlying tokens for the debt payment and ETH for transaction gas on Blast. Native ETH repayment used the call’s ETH value for the debt payment, while the transaction fee remained a separate cost. An asset balance sufficient for repayment did not itself cover that separate gas requirement.