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

    Take token as a named parameter supplied by the caller at execution time, identifying which token this run concerns.

  2. 2·Take

    Declare today as a caller supplied parameter, the reference point in time for this run.

  3. 3·Take

    Bring in days_back as a parameter the caller provides, a count of days used later.

  4. 4·Take

    Accept price_running_total as a caller supplied parameter, the value to be extended in this run.

  5. 5·Get duration

    Convert [the days_back value] into seconds by treating it as a count of days and multiplying by 0x015180.

  6. 6·Calculate

    Subtract [that seconds duration] from [the today value], producing an earlier point in time.

  7. 7·Read nested map value

    Read a value from the two level map named sma in socket storage, keyed first by [the token] and then by [the computed earlier time].

  8. 8·Calculate

    Add [the value read from sma] to [the price_running_total], extending the total.

  9. 9·Bubble

    Surface [the resulting sum] as the output of this plug.

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