DSValue
Simple price feed setter and getter
1. Summary
This is a simple contract where authorized addresses can set a price and anyone can read it.
2. Contract Variables & Functions
Variables
isValid
- boolean that signals whether the currently stored value is valid (greater than zero) or notmedianPrice
- the current price feed
Modifiers
auth
- modifier that checks whether an address can set theresult
. Inherited from ds-thing.
Functions
getResultWithValidity() external view returns (bytes32, bool)
- returnsresult
andisValid
read() external view returns (uint256)
- getter that only returns theresult
updateResult(newResult: bytes32)
- set a newresult
restartValue()
- setisValid
tofalse
3. Walkthrough
Authorized functions can set a new medianPrice
by calling updateResult
. Anyone can read
the medianPrice
or read both the medianPrice
and whether it isValid
by calling read
orgetResultWithValidity
.
4. Gotchas
This oracle is entirely dependent on authed addresses to update them. They will not flag if they are stale.
5. Failure Modes (Bounds on Operating Conditions & External Risk Factors)
Authed address can set any arbitrary price. This will impact other components reading from the oracle.
Last updated