
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



1·Take
Take opens by declaring holder_wallet as a caller parameter, the address whose token balances this run reads and transfers from.
2·Take
Next, count is declared as a caller parameter, the number of registered tokens the two loops iterate over.
3·Use
Composing the Get Total Holdings Value plug pulls in its valuation logic, computing the wallet's aggregate holdings across the token set.
4·Get address
The Solver is held here as a named value, standing ready as the destination for the transfers that follow.
5·Set
Setting index to 0 initializes the loop counter for the first pass.
6·Predicate
A for loop opens, running while index is less than count so it visits every registered token once.
7·Read map value
Reading the map value at index in the tokens map of socket storage pulls the token registered at that slot.
8·Set
That looked-up token is written into the variable token so the next steps reference it by name.
9·Get token balance
Using token, the balance held by holder_wallet is read, capturing what the wallet holds of this token.
10·Transfer tokens
Transferring that read balance of token to the solver moves the wallet's holding out for routing.
11·Calculate
Adding 1 to index advances the loop counter.
12·Set
The incremented value is written back into index, closing the loop step.
13·End block
Closing the innermost open block ends the transfer loop.
14·Get solution
Handing the transferred tokens to the solver runs the routing and verifies the outcome.
15·Set
Resetting index to 0 prepares the counter for the verification pass.
16·Predicate
A second for loop opens, running while index is less than count so it checks every token again.
17·Use
Composing the Get Token Target plug returns the token at this index alongside its target amount.
18·Get token balance
Using that returned token, the balance held by holder_wallet is read after routing.
19·Predicate
Requiring the post-routing balance be greater than or equal to the token's target enforces that each holding reached its goal.
20·Calculate
Adding 1 to index advances the verification counter.
21·Set
The incremented value is written back into index.
22·End block
Closing the innermost open block ends the verification loop.
23·End block
Closing the remaining open block completes the composed rebalance transaction.