Get duration
Get duration

Values · Reads onchain state

Converts a count of time units into seconds. Units are seconds, minutes, hours, days, weeks, months, and years; months are 30 days and years are 365. Reach for it to build a deadline offset from the current timestamp, to compare an elapsed delta against a required interval, or to size a cooldown for a stored timestamp check.

Get Price Running Total

plug
values
math
9actions
  1. 1·Take

    Declares token, a named parameter the caller supplies at execution time.

  2. 2·Take

    Declares today, a caller-supplied parameter, at execution time.

  3. 3·Take

    Adds days_back as a named parameter the caller provides when running.

  4. 4·Take

    Declares price_running_total, the final caller-supplied parameter.

  5. 5·Get duration

    Converts days_back into seconds using the fixed multiplier 0x015180, producing that span in seconds.

  6. 6·Calculate

    Subtracts the day-span-in-seconds from today, yielding an earlier timestamp.

  7. 7·Read nested map value

    Reads the nested map value keyed by token and the earlier timestamp from sma in socket storage.

  8. 8·Calculate

    Adds the stored sma value to price_running_total, accumulating the running total.

  9. 9·Bubble

    Surfaces the accumulated running total as this plug's output.

Take
Take
Take
Take
Get as seconds
Calculate
Read nested map value of in in
Calculate
Bubble
  • Get Price Running Total

    plug
    values
    math
  • Morpho: Get Borrow APR

    plug
    values
    math