
Aave · Acts onchain
Repays borrowed assets to an Aave market from the socket's balance. The socket approves the pool and calls repay on the wallet's variable debt position, returning the amount actually repaid. Pick Repay all to clear the full debt, interest included; the approval is reset afterward. Any excess over the outstanding debt is not pulled. Reach for it to close or reduce a borrow before withdrawing collateral, to bring the health factor back above a floor when a predicate finds it has slipped, or to settle the debt leg after a swap has produced the repayment asset earlier in the transaction.
Unwind



1·Take
Take opens by declaring repay_amount as a caller parameter, sizing the debt repaid to Aave later in this flow.
2·Take
Next, borrow_token is declared as a caller parameter, naming the debt asset flash-borrowed and repaid.
3·Take
The market address aave_market is taken as a caller parameter, resolving every Aave action here to one market.
4·Take
Also taken is withdraw_amount, a caller parameter sizing the collateral pulled out of the market.
5·Take
Rounding out the inputs, supply_token is declared as a caller parameter, naming the collateral asset withdrawn.
6·Flash loan
A flash loan pulls repay_amount of borrow_token from aave_market, repaid within this same transaction.
7·Set
The repayment obligation returned by that flash loan is saved into unwind_loan_owed for the coverage check below.
8·Repay
Repaying repay_amount of borrow_token to aave_market clears the outstanding debt using the flash-loaned funds.
9·Withdraw
With the debt cleared, withdraw_amount of supply_token is withdrawn from aave_market back to the socket.
10·Get address
Loading the solver address into a named value sets the destination for the transfer that follows.
11·Get token balance
Reading the borrow_token balance held by 0x4844...3a88 captures the holding before routing begins.
12·Transfer tokens
Sending withdraw_amount of supply_token to the solver hands the freed collateral over for routing.
13·Get solution
The solver takes the transferred tokens for routing, then the outcome is verified.
14·Get token balance
After routing, the borrow_token balance held by 0x4844...3a88 is read again.
15·Calculate
Subtracting the pre-routing balance from the post-routing balance measures how much borrow_token routing produced.
16·Compare two values
Comparing that gain against unwind_loan_owed tests whether it is greater than or equal to the loan owed.
17·Predicate
A require enforces that comparison be true, aborting the transaction if the gain does not cover unwind_loan_owed.
18·End block
Closing the innermost open block ends the coverage check.
19·End block
Closing the remaining open block completes the composed unwind transaction.
On other protocols · 5