DocumentationOpen App
On this pageHow position-management operations work

Delayed operations

Some assets cannot be redeemed for liquid funds immediately. To understand how Gearbox handles this, first consider the steps that make up a position-management operation.

How position-management operations work

A single operation combines several actions inside the Credit Account:

OperationSteps
DepositAdd the user's funds to the Credit Account → borrow additional underlying → convert the combined funds into the target asset
WithdrawConvert some target assets into underlying → repay the corresponding debt → transfer the remaining proceeds to the recipient
CloseConvert the position's assets into underlying → repay all outstanding debt → transfer the remaining equity to the recipient

The target asset is the asset held for exposure; the underlying is the asset borrowed from the lending pool. Here, convert can mean a market swap or a deposit or redemption through the asset's protocol.

Conversion can block the following steps. If redemption takes time, the underlying is not available yet. Repayment and withdrawal funded by that conversion must wait until the proceeds can be claimed.

When conversion is immediate, those steps can execute together in one transaction.

Intent

An intent is a piece of data recorded onchain for application use. It describes the planned steps after a delayed conversion. For Withdraw, this includes the repayment and transfer parameters, such as the requested withdrawal amount and recipient.

It helps the application prepare the follow-up transaction; it does not obligate the user to follow that plan. After claiming, the user can choose different valid Credit Account operations.

How delayed operations work

If conversion requires a redemption period, the first transaction requests redemption but cannot yet execute the steps that depend on its proceeds. For a withdrawal, the sequence becomes:

Request redemption → Wait for settlement → Claim proceeds → Repay debt → Withdraw remaining proceeds

Repayment and withdrawal funded by those proceeds must wait. The user can still perform other permitted actions, such as adding collateral or repaying debt with wallet funds.

The Credit Account's collateral changes from the original token to a pending redemption claim, then to redemption proceeds after collection.

Borrowing costs continue until repayment; keep monitoring health factor while waiting.

Claims, redeemers, and phantom tokens

The request replaces the redeemed portion of the position asset with a claim on future proceeds. These contracts and accounting concepts serve different roles:

ConceptRole
Redeemeran escrow contract that holds the request and claim rights on behalf of the Credit Account and receives settlement proceeds.
Phantom tokenGearbox's accounting representation of pending and claimable proceeds until claimed. Its value can count as Credit Account collateral under the market's oracle, liquidation threshold, and quota rules; it is not liquid cash sent to the user's wallet

For gateway-based redemptions, the gateway records which account owns each redeemer and controls transfers of its funds. Claiming through the gateway returns the settlement proceeds to the owning account.

Liquidation is one use of this ownership model: it can transfer the redeemer to a liquidator. See redeemers during liquidation.

Monitor settlement

Use the connected sdk and the leveraged position selected in Manage.

TypeScript
const withdrawals = await sdk.positions.getCurrentWithdrawals({ chainId: position.chainId, creditAccount: position.creditAccount, creditManager: position.creditManager, });
FieldTypeMeaning
data.pendingPositionPendingWithdrawal[]Requests still waiting for settlement
data.pending[].claimableAtTimestampExpected claimable time, in Unix seconds; reread status before claiming
data.pending[].expectedOutputsWithdrawalOutputAmount[]Estimated settlement outputs
data.claimablePositionClaimableWithdrawal[]Matured withdrawals available to claim now
data.claimable[].outputsWithdrawalOutputAmount[]Outputs of the claim; isDelayed: true means that output still needs a later claim
data.claimable[].withdrawalPhantomTokenTokenAmountWithdrawal representation and amount burned by the claim
data.claimable[].claimCallTxCallEncoded adapter call to include in a Credit Facade multicall
meta.chainsPer-chain metadataSource, block, timestamp, and read status
  • Match your request using sourceToken and redeemer where available; one Credit Account may have several requests.
  • Proceed when your request appears in a fresh data.claimable response, not merely when claimableAt has passed.

Claim and complete the operation

The claim executes inside a Credit Facade multicall. Choose either path:

  • Follow the intent: use finalize to prepare the claim and remaining steps.
  • Choose different actions: include the claim in a custom multicall.

Follow the intent

finalize prepares the claim together with the remaining steps, such as repaying debt and transferring the requested withdrawal to the wallet. Here, claimableIndex is your application's selection from the fresh response, matched to the request being completed; do not default to the first entry.

TypeScript
const claimable = withdrawals.data.claimable[claimableIndex]; if (!claimable) throw new Error("Selected withdrawal is not claimable"); const sim = await sdk.opportunities.prepare.finalize(position, { claimable, slippage, }); if (!sim.ok) throw sim.error;
FieldTypeMeaning
claimablePositionClaimableWithdrawalFresh matured withdrawal selected above
slippage OptionalnumberSwap slippage in basis points; defaults to 0
quotaReserve OptionalnumberExtra quota buffer in basis points; defaults to 0
intent OptionalResumableIntentOperation to resume; defaults to the intent recorded in the withdrawal

If the reader does not return an intent, pass the saved request's delayed.record as intent to finalize.

Continue with position, sim, and owner in Build, preview, and check. Refresh the leveraged position and its withdrawals after confirmation. If an output has isDelayed: true, some value still awaits settlement; refresh the request and repeat finalization when the next proceeds are claimable. For a full exit, verify zero debt and receipt of the remaining funds by the recorded recipient, as described in Close.

Build a custom multicall

Include claimable.claimCall followed by your chosen actions instead of executing the intent. The claimed token may not count as collateral, so a claim by itself is not always a valid transaction.

See Build a custom multicall for call construction, ordering, and transaction building.

Source