Skip to content

Managing Positions

Mihai edited this page Sep 6, 2026 · 1 revision

Managing Positions

Supply, borrow, repay, and withdraw change the assets and debt in a lending account. Before borrowing or removing collateral, review Health Factor and Collateral to understand the account's borrowing capacity and liquidation risk.

Account ownership and permissions

An account belongs to one spoke and holds supply and debt positions. Supplying into a new account creates a position NFT for the caller. The NFT's current owner controls the account; transferring it transfers control of the whole position, including its collateral and outstanding debt.

Borrowing and withdrawing require the owner's authorization or an authorized delegate. Only the owner can grant or remove delegates. A delegate must also be registered by governance as an active position manager, both when the grant is created and when it is used.

Delegation gives the manager permission to borrow, withdraw, and use account strategies. Borrowed or withdrawn assets can be sent to another address, so this permission gives substantial control over funds.

Grants apply only while the NFT belongs to the granting owner. Transferring the NFT does not delete stored grants: they can apply again if it returns to that owner. Removing grants before a transfer prevents that reactivation.

Anyone can repay an account's debt using their own funds. A third party can also add supply to an asset position the account already holds. Adding a different asset to an existing account requires the owner or an authorized delegate. These contributions give the payer no ownership or withdrawal rights.

Supplying assets

Choose a spoke and an asset listed there for collateral supply. Supply credits the account with the tokens the pool actually receives. An existing account must use its own spoke.

Supply requires an active hub and spoke, an available asset listing, room under the spoke's supply cap, and a backed pool market. Adding another asset must also fit the account's supply-position limit. Adding to an existing asset position does not consume another slot.

Supplying generally needs no oracle price. An addition to an account with debt can require prices when the position's liquidation settings need a guarded refresh. See Health Factor and Collateral for how configuration changes affect held positions.

Borrowing assets

Borrowing sends assets to the chosen recipient and adds interest-bearing debt to the account. The asset must permit borrowing, and the hub, spoke, and listing must allow new exposure.

The completed transaction must satisfy all of these conditions:

  • Debt is covered by LTV-weighted collateral.
  • Health factor is at least 1.
  • LTV-weighted collateral meets the configured minimum value when that minimum is enabled.
  • The spoke's borrow cap and the account's debt-position limit are respected.
  • The pool has sufficient cash, remains within its utilization limit, and retains its reserved liquidation liquidity.

Borrowing requires valid prices for the account's valued positions. Interest accrual and price changes can reduce the available borrowing amount between a preview and execution. Keeping a margin below the maximum reduces the chance of a failed transaction or liquidation.

Repaying debt

Repayment reduces an existing debt position using tokens supplied by the payer. It does not require ownership, a healthy account, or oracle prices.

The pool applies the amount it actually receives. If that amount exceeds the debt required to close the position, the pool refunds the excess to the payer. Repayment does not transfer collateral or change account ownership.

A full repayment includes interest accrued through execution and rounds the final debt up to the token's smallest unit. A displayed balance or an earlier quote may leave a small residual debt. A sufficient positive payment closes the debt position; excess is refunded.

Withdrawing assets

Withdrawing removes supply and sends tokens to the chosen recipient. If debt remains, the resulting account must pass the same collateral-coverage, health-factor, and minimum-collateral checks as borrowing. Repaying debt first can increase the amount available to withdraw.

A debt-free withdrawal does not need oracle prices. Every withdrawal still needs sufficient pool liquidity and must satisfy the pool's utilization and solvency rules. A supplied balance is therefore not a guarantee that the entire amount can be withdrawn immediately.

A full withdrawal closes that asset's supply position and pays its value rounded down to the token's smallest unit. A position worth less than one unit can close with no token payout. Withdrawing the remaining supply after all debt is repaid removes the empty account and burns its NFT.

Limits and restricted markets

Supply and borrow caps apply to the combined exposure of all accounts for that spoke and hub-asset. They are not personal limits. Accrued interest counts toward cap usage, and a cap of zero leaves no room for positive entries. Lowering a position-count limit does not block additions to an asset position already held, but opening another slot must fit the limit.

Restrictions affect actions differently:

Restriction Supply and borrow Repay and withdraw
Controller-wide pause Blocked Remain available, subject to other checks
Listing marked frozen Blocked Remain available, subject to other checks
Listing marked paused Blocked Blocked for that asset
Inactive hub, deprecated spoke, or removed listing No new exposure Existing positions can be unwound, subject to other checks

An oracle failure blocks actions that need prices. Repayment remains independent of prices; supplying has the refresh exception described above, and withdrawal needs prices while debt remains. A listing's separate no_seize flag concerns liquidation, as explained in Risk and Liquidations.

Contract integration

Call the controller for user actions. Asset amounts use each token's native integer units, and every asset entry includes both a hub ID and token address. The same token in different hubs represents separate positions.

Input or result Meaning
supply(account_id = 0, ...) Creates an account and returns its ID. A nonzero ID supplies an existing account in the matching spoke.
withdraw(..., amount = 0) Withdraws the full position for that hub-asset. Zero is rejected by supply, borrow, and repay.
Repeated hub-asset entries Aggregated in first-seen order. In a withdrawal, any zero entry makes that hub-asset a full withdrawal.
to = None on borrow or withdraw Sends tokens to the caller, including when the caller is a delegate. An explicit recipient cannot be the controller or pool.
Withdrawal return value One actual pool payout per deduplicated hub-asset. It does not measure the recipient's net balance increase.
Supply and repayment amounts Credit measured pool receipts. Borrowing records the requested draw as debt; it does not reduce debt to match a recipient's net receipt.

Payment batches must be nonempty and contain no negative amounts. At the pool, a positive amount that rounds to zero accounting shares is rejected. Use the full-withdrawal sentinel to close supply dust and a sufficient positive repayment to close debt; repayment has no zero-valued “repay all” sentinel.

All checks run again during execution. If any leg fails, the transaction reverts, including its token transfers and account changes. Account owners can call renew_account to extend storage lifetime for the account and its NFT ownership record.

For ABI signatures, use the controller interface. The position flows, account permissions, and rounding rules define execution behavior.

Continue to Risk and Liquidations for what happens when an account becomes unhealthy.

Clone this wiki locally