From dd380e587fc8f9295095e4caa6e7ea83874480d2 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Wed, 25 Sep 2024 11:40:30 -0500 Subject: [PATCH 1/3] Test RYUSD Share Price Oracle Permission --- src/cellars.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cellars.rs b/src/cellars.rs index 383751f8..90e204eb 100644 --- a/src/cellars.rs +++ b/src/cellars.rs @@ -66,6 +66,14 @@ pub const TURBOSWETH_ORACLE6: (U256, &str) = ( "0acdb8096e51b2730387977bad340b9efde61342", ); +pub const TEST_RYUSD_ORACLE: (U256, &str) = ( + // need the real id + U256([2, 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, @@ -228,6 +236,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 @@ -369,6 +378,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())) } From a8b0ccdcf402c1aa3712985be97ae528304de531 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Thu, 26 Sep 2024 08:53:25 -0500 Subject: [PATCH 2/3] Add test RYUSD cellar share price oracle permission --- src/cellars.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cellars.rs b/src/cellars.rs index 90e204eb..b2928044 100644 --- a/src/cellars.rs +++ b/src/cellars.rs @@ -68,7 +68,7 @@ pub const TURBOSWETH_ORACLE6: (U256, &str) = ( pub const TEST_RYUSD_ORACLE: (U256, &str) = ( // need the real id - U256([2, 0, 0, 0]), + U256([4, 0, 0, 0]), "ddf603866d6d8d207c6200552655df1ebde5a641", ); From fd8e38504bc390cbca25c4ea4859de61c55ba3db Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Fri, 27 Sep 2024 09:46:54 -0500 Subject: [PATCH 3/3] Remove old comment --- src/cellars.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cellars.rs b/src/cellars.rs index b2928044..080d0e8e 100644 --- a/src/cellars.rs +++ b/src/cellars.rs @@ -67,7 +67,6 @@ pub const TURBOSWETH_ORACLE6: (U256, &str) = ( ); pub const TEST_RYUSD_ORACLE: (U256, &str) = ( - // need the real id U256([4, 0, 0, 0]), "ddf603866d6d8d207c6200552655df1ebde5a641", );