Get solution
Get solution

Plug · Acts onchain

Hands tokens already transferred to the solver over for routing, then verifies the outcome. The action opens a block. The solver's route settles inside it, and the steps between this and its End block are the acceptance checks: read balances, compare against your targets, and require the outcome you signed for. The transaction only completes when every check passes. Reach for it when the swap action's fixed shape does not fit, such as multi-token inputs or custom acceptance logic, and you want the solver's execution bounded by your own reads.

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

Rebalance Holdings to Target

plug
values
evm
23actions
  1. 1·Take

    The caller supplies holder_wallet, a named parameter naming the wallet whose holdings this plug rebalances at execution time.

  2. 2·Take

    Next count is declared as a caller parameter, setting how many tokens the loops iterate over.

  3. 3·Use

    Composing the Get Total Holdings Value plug pulls its valuation logic into this transaction.

  4. 4·Get address

    The Solver is held here as a named value, standing ready as the destination for the transfers that follow.

  5. 5·Set

    Setting index to 0 initializes the loop counter for the first pass.

  6. 6·Predicate

    A loop opens while index is less than count, iterating once per token in the set.

  7. 7·Read map value

    Reading the map value at index in the tokens map of socket storage pulls the token registered at this position.

  8. 8·Set

    That map value is written into the variable token, so the balance and transfer steps reference this entry by name.

  9. 9·Get token balance

    Using token, the balance held by holder_wallet is read, capturing what the wallet holds of this token.

  10. 10·Transfer tokens

    Transferring that read balance of token to the solver moves the full holding out for routing.

  11. 11·Calculate

    Adding 1 to index advances the counter.

  12. 12·Set

    Writing that sum back into index sets up the next iteration.

  13. 13·End block

    Ending the loop block closes the first pass over the token set.

  14. 14·Get solution

    Handing the transferred tokens to the solver runs the routing and verifies the outcome.

  15. 15·Set

    Resetting index to 0 restarts the counter for a second pass.

  16. 16·Predicate

    A loop opens again while index is less than count, iterating once per token to check targets.

  17. 17·Use

    Composing the Get Token Target plug resolves the target for the token at this index.

  18. 18·Get token balance

    Using the token from the target result, the balance held by holder_wallet is read after routing.

  19. 19·Predicate

    A require enforces that the post-routing balance is greater than or equal to the token's target, reverting otherwise.

  20. 20·Calculate

    Adding 1 to index advances the counter.

  21. 21·Set

    Writing that sum back into index sets up the next check.

  22. 22·End block

    Ending the inner loop block closes the target-verification pass.

  23. 23·End block

    Closing the remaining open block completes the composed rebalance transaction.

Take
Take
Use where
holder_walletis
countis
Get
Set to
Read map value of in in
Set to
Get balance of held by
Transfer to
Calculate
Set to
End block
Get solution
Set to
Use where
indexis
total_valueis
Get balance of held by
Calculate
Set to
End block
End block
  • Rebalance Holdings to Target

    plug
    values
    evm
  • Swap at Floor

    plug
    evm
    values
  • Swap

    plug
    values
    evm
  • Morpho Pendle Expiry Deleveraging

    pendle
    time
    boolean
  • Aave: Wind or Unwind Position

    plug
    boolean
    aave
  • Wind

    plug
    aave
    evm
  • Unwind

    plug
    aave
    evm