Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test RYUSD Share Price Oracle Permission #276

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Changes from 1 commit
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
15 changes: 15 additions & 0 deletions src/cellars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Placeholder Registry ID for TEST_RYUSD_ORACLE Still Present

The registry ID for TEST_RYUSD_ORACLE remains as a placeholder value (U256([2, 0, 0, 0])). Please update it with the correct registry ID before deploying to production.

🔗 Analysis chain

Update the placeholder registry ID for TEST_RYUSD_ORACLE

The registry ID for TEST_RYUSD_ORACLE is currently set to a placeholder value (U256([2, 0, 0, 0])). Please update this with the correct registry ID before deploying to production.

To ensure the correct registry ID is used, you can run the following command:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the registry ID for TEST_RYUSD_ORACLE
# Expected: The correct registry ID should be displayed

rg --type rust 'pub const TEST_RYUSD_ORACLE: \(U256, &str\) = \(' src/cellars.rs -A 3

Length of output: 229


pub const ALLOWED_TURBOSWETH_PRICE_ORACLES: [(U256, &str); 6] = [
TURBOSWETH_ORACLE1,
TURBOSWETH_ORACLE2,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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()))
}

Expand Down
Loading