
Values · Reads onchain state
Holds a well-known constant as a named value: max uint256, WAD, RAY, basis points, one, or zero. Each one is echoed into a slot carrying its own decimal tag, so it is a measured value rather than a raw scale word: WAD is one at eighteen decimals, RAY is one at twenty-seven, basis points is one at four. Anything that reconciles against it therefore divides by one. A slot that genuinely wants the raw word 1000000000000000000 has to be written as that literal, because a literal declares no scale and stays whole. Reach for it to state a bound or a sentinel, such as max uint256 as an unlimited amount or zero as an empty floor, rather than to hand a calculation a scale it already reconciles for you.
Get Weight Target



1·Take
Starting with token, this parameter is left for the caller to supply, naming the asset whose moving average will be read.
2·Take
A second parameter, window, is declared as caller-supplied, setting the lookback length passed into the average computation.
3·Use
Composing the Get Simple Moving Average plug inside this one, it computes the average price for the given token over the given window.
4·Get constant
Holding WAD (1e18) as a named constant provides the scale factor for the fixed-point multiply-divide that follows.
5·Multiply then divide
Multiplying the moving average by WAD and dividing by the window, rounded down, produces a scaled target figure from those inputs.
6·Bubble
Surfacing that quotient returns the computed weight target as the output of this plug.