
Database · Acts onchain
Writes a value into a keyed map in the socket's persistent storage. The map and key are both bytes32, so any value can serve as the key. Scope chooses socket storage, shared across every plug the socket runs, or plug storage, private to this plug bundle. Writing zero deletes the entry. Reach for it to record per-token or per-user state across executions, such as the amount deployed into each market or the last run for each recipient, so later runs read it back and act on it.
Set Rebalance Token


1·Take
Declaring token as a named parameter, this leaves the token value for the caller to supply at execution time.
2·Take
A second parameter, weight, is declared for the caller to supply alongside the token.
3·Take
Also declared is index, the slot position the caller names for this write at execution time.
4·Set map value
Keyed by the index, the tokens map in socket storage is set to the token, recording that token at the named slot position.
5·Set map value
Under the same index, the weights map in socket storage is set to the weight, pairing the stored weight with the token written above.