Skip to content

Commit

Permalink
Merge pull request #276 from PeggyJV/collin/share-price-oracle-permis…
Browse files Browse the repository at this point in the history
…sion

Test RYUSD Share Price Oracle Permission
  • Loading branch information
cbrit authored Sep 27, 2024
2 parents 5ebaf9b + fd8e385 commit c3b7a0f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/cellars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ pub const TURBOSWETH_ORACLE6: (U256, &str) = (
"0acdb8096e51b2730387977bad340b9efde61342",
);

pub const TEST_RYUSD_ORACLE: (U256, &str) = (
U256([4, 0, 0, 0]),
"ddf603866d6d8d207c6200552655df1ebde5a641",
);

pub const ALLOWED_TEST_RYUSD_PRICE_ORACLES: [(U256, &str); 1] = [TEST_RYUSD_ORACLE];

pub const ALLOWED_TURBOSWETH_PRICE_ORACLES: [(U256, &str); 6] = [
TURBOSWETH_ORACLE1,
TURBOSWETH_ORACLE2,
Expand Down Expand Up @@ -228,6 +235,7 @@ pub const CELLAR_TURBO_SOMM: &str = "5195222f69c5821f8095ec565e71e18ab6a2298f";
pub const CELLAR_TURBO_EETH_DEPLOYMENT_1: &str = "9a7b4980c6f0fcaa50cd5f288ad7038f434c692e";
pub const CELLAR_TURBO_EETH_DEPLOYMENT_2: &str = "dadc82e26b3739750e036dfd9defd3ed459b877a";
pub const CELLAR_ETH_GROWTH: &str = "6c51041a91c91c86f3f08a72cb4d3f67f1208897";
pub const CELLAR_TEST_RYUSD: &str = "01a4a3e1e730d245f210eebc6aee54f2381cac63";

// deprecated adaptors

Expand Down Expand Up @@ -369,6 +377,12 @@ pub fn validate_oracle(
return Ok(());
}

if cellar_id_normalized.eq(CELLAR_TEST_RYUSD)
&& ALLOWED_TEST_RYUSD_PRICE_ORACLES.contains(&(registry_id_in, oracle_in.as_str()))
{
return Ok(());
}

Err(sp_call_error("unauthorized oracle update".to_string()))
}

Expand Down

0 comments on commit c3b7a0f

Please sign in to comment.