Set map value

Set map value on Database

Ethereum
Ethereum
Base
Base

Acts onchain

Ready to run on Base

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.

Plug lets you combine onchain actions like this one into a single transaction, without writing a smart contract. Use in App opens a new plug with this action already in it.

Set Rebalance Token

plug
database
5actions
  1. 1·Take

    Declaring token as a named parameter, this leaves the token value for the caller to supply at execution time.

  2. 2·Take

    A second parameter, weight, is declared for the caller to supply alongside the token.

  3. 3·Take

    Also declared is index, the slot position the caller names for this write at execution time.

  4. 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. 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.

Take
Take
Take
Set map value of in in to
Set map value of in in to

More on Database · 5