Else branch
Else branch

Logic · Acts onchain

Opens the else branch of a conditional. The steps after it, up to the matching End block, run only when the preceding if, if not, or else if did not take its branch. Reach for it to give a decision two paths, such as supplying to market A when its rate wins and to market B otherwise, so exactly one path executes per run.

Takes nothing — it reads the caller's own position.

Find Value Delta

plug
boolean
evm
14actions
  1. 1·Take

    The caller supplies value_1 at execution time, declared here as a named parameter for later steps to reference.

  2. 2·Take

    A second parameter named value_2 is declared, also filled in by the caller when the plug runs.

  3. 3·Compare two values

    Comparing value_1 against value_2, this step returns true when value_1 is greater than value_2.

  4. 4·Set

    Assigning that comparison result to a named variable called value_1_is_greater lets later steps read it by name.

  5. 5·Set

    Setting value_delta to 0 gives the difference variable a starting value before either branch overwrites it.

  6. 6·Predicate

    Requiring value_1_is_greater to equal true opens a branch that runs only when value_1 exceeded value_2.

  7. 7·Calculate

    Within that branch, value_2 is subtracted from value_1, producing the positive difference.

  8. 8·Set

    Storing that difference into value_delta records the gap for the case where value_1 was larger.

  9. 9·Else branch

    Opening the else branch handles the case where value_1 was not greater than value_2.

  10. 10·Calculate

    Here value_1 is subtracted from value_2, producing the difference in the other direction.

  11. 11·Set

    Writing that difference into the variable delta records the gap for this branch.

  12. 12·End block

    Closing the innermost open block ends the conditional.

  13. 13·Bubble

    Surfacing value_1_is_greater exposes which value was larger as an output.

  14. 14·Bubble

    Also surfaced is value_delta, exposing the computed difference as an output of this plug.

Take
Take
Is
Set to
Set to
Calculate
Set to
Else
Calculate
Set to
End block
Bubble
Bubble
  • Find Value Delta

    plug
    boolean
    evm
  • Aave: Wind or Unwind Position

    plug
    boolean
    aave
  • Target Debt to Debt Delta

    plug
    aave
    boolean
  • Wind or Unwind to Maintain Target HF

    plug
    aave
    math
  • Loop WETH/USDC at Target HF

    aave
    evm
    boolean
  • Swarm: Loop WETH/USDC at Target HF

    boolean
    aave
    evm
  • Loop at Target HF + Trailing Stop Loss

    database
    boolean
    aave
  • Borrow + Term Repayment Schedule

    time
    database
    boolean
  • Loop at Target HF + Borrow Rate Exit Guard

    database
    boolean
    aave
  • Loop at Target HF + Borrow Rate Entry & Exit Guard

    aave
    boolean
    evm