Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions contracts/vault/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ pub enum DataKeyExt {
// Issue #1174: gate for the contract telemetry / debugging hook
DiagnosticsEnabled,

// Issue #1173 / #1231: nested to stay within DataKeyExt variant limits
Risk(RiskExtKey),
// Issue #1230: Performance fee switch for strategy performance incentives
PerformanceFeeBps,
PerformanceIncentivePool,
Expand Down Expand Up @@ -1375,12 +1377,22 @@ impl YieldVault {
let token = Self::token(env.clone());
let price_data = oracle_client.get_price(&token, &token);
let max_age = Self::oracle_heartbeat(env.clone());
let last: Option<oracle::PriceData> = env
.storage()
.instance()
.get(&DataKeyExt::Risk(RiskExtKey::LastPx));
let last_price = Self::last_oracle_price(&env);
oracle::OracleValidator::validate_price_data(
&env,
&price_data,
max_age,
Some(oracle::MAX_PRICE_DEVIATION_BPS),
last.as_ref(),
)
.expect("OracleValidationFailed");
env.storage()
.instance()
.set(&DataKeyExt::Risk(RiskExtKey::LastPx), &price_data);
last_price.as_ref(),
)
.map_err(|_| VaultError::OracleValidationFailed)?;
Expand Down
Loading