
Boolean · Acts onchain
Steers control flow by comparing two values: branch, loop, or require the condition holds. The verb decides the shape. if, if not, and else if open a branch; for and until open a loop that re-evaluates the comparison every iteration; require reverts the whole transaction when the condition is false. Operators cover equal, not equal, greater, greater or equal, less, less or equal, and, and or. Reach for it to guard a write behind a read, such as requiring a health factor stays above a floor, to branch between two strategies on a price, or to repeat a step until a balance target is met. Use the comparison action when you need the boolean as a value.
Aave: Wind or Unwind Position



1·Take
Declares supply_amount as a caller-supplied parameter whose value is provided at execution time.
2·Take
Adds supply_token as a caller-supplied parameter naming the asset to supply.
3·Take
Names aave_market as a caller-supplied parameter identifying the market used throughout.
4·Take
Introduces borrow_amount as a caller-supplied parameter, the quantity to borrow.
5·Take
Declares borrow_token as a caller-supplied parameter naming the asset to borrow.
6·Take
Rounds out the inputs with is_winding, a caller-supplied flag that selects between the wind and unwind paths.
7·Predicate
An if opens on the is_winding flag being equal to 1, entering the wind path when the caller set it true.
8·Flash loan
Takes a flash loan of the supply_amount in the supply_token from the aave_market, to be repaid within this same transaction.
9·Set
Saves the flash loan repayment obligation into wind_loan_owed for a later check.
10·Supply
Supplies the supply_amount of the supply_token into the aave_market, minting aTokens to the socket as collateral.
11·Borrow
Borrows the borrow_amount of the borrow_token from the aave_market against the collateral just supplied.
12·Get address
Loads the solver address into a named value for use as a transfer destination.
13·Get token balance
Reads the supply_token balance held by 0x4844...3a88 before routing.
14·Transfer tokens
Sends the borrow_amount of the borrow_token to the solver to be routed.
15·Get solution
Hands the transferred tokens to the solver for routing, then verifies the outcome.
16·Get token balance
Reads the supply_token balance held by 0x4844...3a88 again after routing.
17·Calculate
Subtracts the pre-routing balance from the post-routing balance to measure how much supply_token was gained.
18·Compare two values
Checks whether that gain is greater than or equal to wind_loan_owed.
19·Predicate
Requires that comparison to hold true, aborting the transaction if the gain does not cover the loan owed.
20·End block
Closes the wind branch opened above.
21·Else branch
Opens the else branch for the case where is_winding is not true, the unwind path.
22·Flash loan
Takes a flash loan of the borrow_amount in the borrow_token from the aave_market, to be repaid within this same transaction.
23·Set
Saves the flash loan repayment obligation into unwind_loan_owed for a later check.
24·Withdraw
Withdraws the supply_amount of the supply_token from the aave_market back to the socket now that the borrow is covered by the flash loan.
25·Get address
Loads the solver address into a named value for use as a transfer destination.
26·Get token balance
Reads the borrow_token balance held by 0x4844...3a88 before routing.
27·Transfer tokens
Sends the supply_amount of the supply_token to the solver to be routed.
28·Get solution
Hands the transferred tokens to the solver for routing, then verifies the outcome.
29·Get token balance
Reads the borrow_token balance held by 0x4844...3a88 again after routing.
30·Calculate
Subtracts the pre-routing balance from the post-routing balance to measure how much borrow_token came back from routing.
31·Compare two values
Checks whether that gain is greater than or equal to unwind_loan_owed.
32·Predicate
Requires that comparison to hold true, aborting the transaction if the gain does not cover the loan owed.
33·End block
Closes the unwind branch.
34·End block
Closes the remaining open conditional block.