Yield Risk Engine V2
The Yield Risk Engine V2 is the same design as V1, except it takes time into consideration for the max price.
function _calculateMaxAllowedPrice(
uint256 timestamp
) internal view returns (int256) {
if (timestamp <= initialTimestamp) {
return initialPrice;
}
uint256 timeElapsed = timestamp - initialTimestamp;
uint256 t = (timeElapsed * ONE) / SECONDS_PER_YEAR; // Fixed-point year fraction
// Base = 1 + r
uint256 base = ONE + annualYieldCap;
// growthFactor = (1 + r)^t
UD60x18 baseUD = wrap(base);
UD60x18 tUD = wrap(t);
UD60x18 growthFactor = baseUD.pow(tUD);
// maxPrice = initialPrice * growthFactor / 1e18
return (initialPrice * int256(unwrap(growthFactor))) / int256(ONE);
}
This Risk Engine can be used for similar markets and has gone through a separate audit.
Deployments
Audit
Yield Risk Engine V2 was audited by Three Sigma. You can see the Audit Report Here.
Last updated