Get Token Target
0x484428507A212cA56D71baa27Ca6089a6dB63a88

What this does

This plug reads the token and weight stored at a given index in the socket's tokens and weights maps, fetches the token's Chainlink USD price, and composes Get Target Balance to compute the token's target. It asks the caller for the index to resolve and a total_value figure. It runs whenever it is called or composed by another plug during a rebalance. Resolving these values by hand or against a stale Chainlink price yields a target balance that no longer matches the token's current market value.

Actions · 8

  • Read map value
    Read map value of in in
    Reads a value from a keyed map in the socket's persistent storage.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Read map value
    Read map value of in in
    Reads a value from a keyed map in the socket's persistent storage.
  • Set
    Set to
    Assigns a value to a named variable that later steps reference.
  • Get price
    Get price of in
    Reads the latest Chainlink price of a base asset in a quote asset, normalized to 18 decimals.
  • Use
    Use where
    weightis
    total_valueis
    priceis
    Composes another plug inside this one.
  • Bubble
    Bubble
    Surfaces a value as an output of this plug.
  • Bubble
    Bubble
    Surfaces a value as an output of this plug.

Related plugs · 8