
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



1·Take
Declares token, a named parameter the caller supplies at execution time.
2·Take
Declares today, a caller-supplied parameter, at execution time.
3·Take
Adds days_back as a named parameter the caller provides when running.
4·Take
Declares price_running_total, the final caller-supplied parameter.
5·Get duration
Converts days_back into seconds using the fixed multiplier 0x015180, producing that span in seconds.
6·Calculate
Subtracts the day-span-in-seconds from today, yielding an earlier timestamp.
7·Read nested map value
Reads the nested map value keyed by token and the earlier timestamp from sma in socket storage.
8·Calculate
Adds the stored sma value to price_running_total, accumulating the running total.
9·Bubble
Surfaces the accumulated running total as this plug's output.