From 2071a4055e28fe58ca394310eb2331c7c3735e16 Mon Sep 17 00:00:00 2001 From: Veliko Minkov <2662912+vminkov@users.noreply.github.com> Date: Fri, 8 Mar 2024 08:47:42 +0200 Subject: [PATCH 1/8] redstone oracle contract skeleton --- .../default/RedstoneLayerBankPriceOracle.sol | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 contracts/oracles/default/RedstoneLayerBankPriceOracle.sol diff --git a/contracts/oracles/default/RedstoneLayerBankPriceOracle.sol b/contracts/oracles/default/RedstoneLayerBankPriceOracle.sol new file mode 100644 index 00000000..f77d9545 --- /dev/null +++ b/contracts/oracles/default/RedstoneLayerBankPriceOracle.sol @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.8.0; + +import "openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol"; + +import "../BasePriceOracle.sol"; +import { SafeOwnableUpgradeable } from "../../ionic/SafeOwnableUpgradeable.sol"; + +/** + * @title RedstoneLayerBankPriceOracle + * @notice Returns prices from Redstone. + * @dev Implements `BasePriceOracle`. + * @author Veliko Minkov (https://github.com/vminkov) + */ +contract RedstoneLayerBankPriceOracle is SafeOwnableUpgradeable, BasePriceOracle { + + /** + * @notice Redstone NATIVE/USD price feed contracts. + */ + address public NATIVE_TOKEN_USD_PRICE_FEED; + + /** + * @notice The USD Token of the chain + */ + address public USD_TOKEN; + + /** + * @dev Constructor to set admin, wtoken address and native token USD price feed address + * @param _usdToken The Wrapped native asset address + * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token. + */ + function initialize(address _usdToken, address nativeTokenUsd) public initializer { + __SafeOwnable_init(msg.sender); + USD_TOKEN = _usdToken; + NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd; + } + + + /** + * @notice Internal function returning the price in of `underlying`. + * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE + * this will return a price denominated in USD otherwise in the native token + */ + function _price(address underlying) internal view returns (uint256) { + return 0; + } + + + /** + * @notice Returns the price in of `underlying` either in the + * native token (implements `BasePriceOracle`). + */ + function price(address underlying) external view override returns (uint256) { + return _price(underlying); + } + + + /** + * @notice Returns the price in WNATIVE of the token underlying `cToken`. + * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2). + * @return Price in WNATIVE of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`. + */ + function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) { + // Get underlying token address + address underlying = cToken.underlying(); + + uint256 oraclePrice = _price(underlying); + + uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals()); + return + underlyingDecimals <= 18 + ? uint256(oraclePrice) * (10**(18 - underlyingDecimals)) + : uint256(oraclePrice) / (10**(underlyingDecimals - 18)); + } +} \ No newline at end of file From 85e6c96fd00f24c5c2e3e0db06de452fd08e1cef Mon Sep 17 00:00:00 2001 From: Veliko Minkov <2662912+vminkov@users.noreply.github.com> Date: Fri, 8 Mar 2024 08:48:11 +0200 Subject: [PATCH 2/8] prettier --- .../oracles/default/RedstoneLayerBankPriceOracle.sol | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/contracts/oracles/default/RedstoneLayerBankPriceOracle.sol b/contracts/oracles/default/RedstoneLayerBankPriceOracle.sol index f77d9545..2cf119a5 100644 --- a/contracts/oracles/default/RedstoneLayerBankPriceOracle.sol +++ b/contracts/oracles/default/RedstoneLayerBankPriceOracle.sol @@ -13,7 +13,6 @@ import { SafeOwnableUpgradeable } from "../../ionic/SafeOwnableUpgradeable.sol"; * @author Veliko Minkov (https://github.com/vminkov) */ contract RedstoneLayerBankPriceOracle is SafeOwnableUpgradeable, BasePriceOracle { - /** * @notice Redstone NATIVE/USD price feed contracts. */ @@ -35,7 +34,6 @@ contract RedstoneLayerBankPriceOracle is SafeOwnableUpgradeable, BasePriceOracle NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd; } - /** * @notice Internal function returning the price in of `underlying`. * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE @@ -45,7 +43,6 @@ contract RedstoneLayerBankPriceOracle is SafeOwnableUpgradeable, BasePriceOracle return 0; } - /** * @notice Returns the price in of `underlying` either in the * native token (implements `BasePriceOracle`). @@ -54,7 +51,6 @@ contract RedstoneLayerBankPriceOracle is SafeOwnableUpgradeable, BasePriceOracle return _price(underlying); } - /** * @notice Returns the price in WNATIVE of the token underlying `cToken`. * @dev Implements the `BasePriceOracle` interface for Ionic pools (and Compound v2). @@ -68,8 +64,8 @@ contract RedstoneLayerBankPriceOracle is SafeOwnableUpgradeable, BasePriceOracle uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals()); return - underlyingDecimals <= 18 - ? uint256(oraclePrice) * (10**(18 - underlyingDecimals)) - : uint256(oraclePrice) / (10**(underlyingDecimals - 18)); + underlyingDecimals <= 18 + ? uint256(oraclePrice) * (10**(18 - underlyingDecimals)) + : uint256(oraclePrice) / (10**(underlyingDecimals - 18)); } -} \ No newline at end of file +} From 9f723adea447f6c56a52c7e5a5b60c26d3d50383 Mon Sep 17 00:00:00 2001 From: Veliko Minkov <2662912+vminkov@users.noreply.github.com> Date: Fri, 8 Mar 2024 08:52:53 +0200 Subject: [PATCH 3/8] redstone oracle address and name --- ...PriceOracle.sol => RedstonePriceOracle.sol} | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) rename contracts/oracles/default/{RedstoneLayerBankPriceOracle.sol => RedstonePriceOracle.sol} (77%) diff --git a/contracts/oracles/default/RedstoneLayerBankPriceOracle.sol b/contracts/oracles/default/RedstonePriceOracle.sol similarity index 77% rename from contracts/oracles/default/RedstoneLayerBankPriceOracle.sol rename to contracts/oracles/default/RedstonePriceOracle.sol index 2cf119a5..f6853144 100644 --- a/contracts/oracles/default/RedstoneLayerBankPriceOracle.sol +++ b/contracts/oracles/default/RedstonePriceOracle.sol @@ -7,12 +7,12 @@ import "../BasePriceOracle.sol"; import { SafeOwnableUpgradeable } from "../../ionic/SafeOwnableUpgradeable.sol"; /** - * @title RedstoneLayerBankPriceOracle + * @title RedstonePriceOracle * @notice Returns prices from Redstone. * @dev Implements `BasePriceOracle`. * @author Veliko Minkov (https://github.com/vminkov) */ -contract RedstoneLayerBankPriceOracle is SafeOwnableUpgradeable, BasePriceOracle { +contract RedstonePriceOracle is SafeOwnableUpgradeable, BasePriceOracle { /** * @notice Redstone NATIVE/USD price feed contracts. */ @@ -23,21 +23,25 @@ contract RedstoneLayerBankPriceOracle is SafeOwnableUpgradeable, BasePriceOracle */ address public USD_TOKEN; + /** + * @notice The address of the Redstone oracle on Mode network + */ + address public constant REDSTONE_ORACLE_ADDRESS = 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256; + /** * @dev Constructor to set admin, wtoken address and native token USD price feed address * @param _usdToken The Wrapped native asset address - * @param nativeTokenUsd Will this oracle return prices denominated in USD or in the native token. + * @param nativeTokenUsdFeed Will this oracle return prices denominated in USD or in the native token. */ - function initialize(address _usdToken, address nativeTokenUsd) public initializer { + function initialize(address _usdToken, address nativeTokenUsdFeed) public initializer { __SafeOwnable_init(msg.sender); USD_TOKEN = _usdToken; - NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd; + NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsdFeed; } /** * @notice Internal function returning the price in of `underlying`. - * @dev If the oracle got constructed with `nativeTokenUsd` = TRUE - * this will return a price denominated in USD otherwise in the native token + * @dev will return a price denominated in the native token */ function _price(address underlying) internal view returns (uint256) { return 0; From d86d2b9b25b50c1c850e5a13780df5a0ffd747b0 Mon Sep 17 00:00:00 2001 From: Veliko Minkov <2662912+vminkov@users.noreply.github.com> Date: Fri, 8 Mar 2024 09:27:35 +0200 Subject: [PATCH 4/8] small fixes --- .../external/redstone/IRedstoneOracle.sol | 6 ++++++ ...cle.sol => RedstoneAdapterPriceOracle.sol} | 21 ++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 contracts/external/redstone/IRedstoneOracle.sol rename contracts/oracles/default/{RedstonePriceOracle.sol => RedstoneAdapterPriceOracle.sol} (77%) diff --git a/contracts/external/redstone/IRedstoneOracle.sol b/contracts/external/redstone/IRedstoneOracle.sol new file mode 100644 index 00000000..5f9b3612 --- /dev/null +++ b/contracts/external/redstone/IRedstoneOracle.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0; + +interface IRedstoneOracle { + +} \ No newline at end of file diff --git a/contracts/oracles/default/RedstonePriceOracle.sol b/contracts/oracles/default/RedstoneAdapterPriceOracle.sol similarity index 77% rename from contracts/oracles/default/RedstonePriceOracle.sol rename to contracts/oracles/default/RedstoneAdapterPriceOracle.sol index f6853144..3591732a 100644 --- a/contracts/oracles/default/RedstonePriceOracle.sol +++ b/contracts/oracles/default/RedstoneAdapterPriceOracle.sol @@ -3,16 +3,22 @@ pragma solidity >=0.8.0; import "openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol"; +import "../../external/redstone/IRedstoneOracle.sol"; import "../BasePriceOracle.sol"; import { SafeOwnableUpgradeable } from "../../ionic/SafeOwnableUpgradeable.sol"; /** - * @title RedstonePriceOracle + * @title RedstoneAdapterPriceOracle * @notice Returns prices from Redstone. * @dev Implements `BasePriceOracle`. * @author Veliko Minkov (https://github.com/vminkov) */ -contract RedstonePriceOracle is SafeOwnableUpgradeable, BasePriceOracle { +contract RedstoneAdapterPriceOracle is SafeOwnableUpgradeable, BasePriceOracle { + /** + * @notice Maps ERC20 token addresses to USD-based Redstone price feed ids. + */ + mapping(address => bytes32) public priceFeeds; + /** * @notice Redstone NATIVE/USD price feed contracts. */ @@ -24,19 +30,24 @@ contract RedstonePriceOracle is SafeOwnableUpgradeable, BasePriceOracle { address public USD_TOKEN; /** - * @notice The address of the Redstone oracle on Mode network + * @notice The Redstone oracle contract */ - address public constant REDSTONE_ORACLE_ADDRESS = 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256; + IRedstoneOracle public REDSTONE_ORACLE_ADDRESS; /** * @dev Constructor to set admin, wtoken address and native token USD price feed address * @param _usdToken The Wrapped native asset address * @param nativeTokenUsdFeed Will this oracle return prices denominated in USD or in the native token. */ - function initialize(address _usdToken, address nativeTokenUsdFeed) public initializer { + function initialize( + address _usdToken, + address nativeTokenUsdFeed, + address redstoneOracle + ) public initializer { __SafeOwnable_init(msg.sender); USD_TOKEN = _usdToken; NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsdFeed; + REDSTONE_ORACLE_ADDRESS = IRedstoneOracle(redstoneOracle); // 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256 on Mode } /** From 26244113104b58dc6f9fef5074d3abaf4db8611f Mon Sep 17 00:00:00 2001 From: Veliko Minkov <2662912+vminkov@users.noreply.github.com> Date: Fri, 8 Mar 2024 09:28:58 +0200 Subject: [PATCH 5/8] prettier --- contracts/external/redstone/IRedstoneOracle.sol | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contracts/external/redstone/IRedstoneOracle.sol b/contracts/external/redstone/IRedstoneOracle.sol index 5f9b3612..dae58bab 100644 --- a/contracts/external/redstone/IRedstoneOracle.sol +++ b/contracts/external/redstone/IRedstoneOracle.sol @@ -1,6 +1,4 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; -interface IRedstoneOracle { - -} \ No newline at end of file +interface IRedstoneOracle {} From 3cd6b07f267c771a8182591834791f6eeaf3ecab Mon Sep 17 00:00:00 2001 From: Veliko Minkov <2662912+vminkov@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:38:40 +0200 Subject: [PATCH 6/8] redstone oracle forge test --- .../external/redstone/IRedstoneOracle.sol | 10 +++++- .../default/RedstoneAdapterPriceOracle.sol | 30 ++++++------------ .../oracles/RedstoneAdapterOracleTest.t.sol | 31 +++++++++++++++++++ 3 files changed, 49 insertions(+), 22 deletions(-) create mode 100644 contracts/test/oracles/RedstoneAdapterOracleTest.t.sol diff --git a/contracts/external/redstone/IRedstoneOracle.sol b/contracts/external/redstone/IRedstoneOracle.sol index dae58bab..59ff1310 100644 --- a/contracts/external/redstone/IRedstoneOracle.sol +++ b/contracts/external/redstone/IRedstoneOracle.sol @@ -1,4 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; -interface IRedstoneOracle {} +interface IRedstoneOracle { + function priceOf(address asset) external view returns (uint256); + + function priceOfETH() external view returns (uint256); + + function getDataFeedIdForAsset(address asset) external view returns(bytes32); + + function getDataFeedIds() external view returns (bytes32[] memory dataFeedIds); +} diff --git a/contracts/oracles/default/RedstoneAdapterPriceOracle.sol b/contracts/oracles/default/RedstoneAdapterPriceOracle.sol index 3591732a..93d1ee3a 100644 --- a/contracts/oracles/default/RedstoneAdapterPriceOracle.sol +++ b/contracts/oracles/default/RedstoneAdapterPriceOracle.sol @@ -5,7 +5,6 @@ import "openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeabl import "../../external/redstone/IRedstoneOracle.sol"; import "../BasePriceOracle.sol"; -import { SafeOwnableUpgradeable } from "../../ionic/SafeOwnableUpgradeable.sol"; /** * @title RedstoneAdapterPriceOracle @@ -13,17 +12,7 @@ import { SafeOwnableUpgradeable } from "../../ionic/SafeOwnableUpgradeable.sol"; * @dev Implements `BasePriceOracle`. * @author Veliko Minkov (https://github.com/vminkov) */ -contract RedstoneAdapterPriceOracle is SafeOwnableUpgradeable, BasePriceOracle { - /** - * @notice Maps ERC20 token addresses to USD-based Redstone price feed ids. - */ - mapping(address => bytes32) public priceFeeds; - - /** - * @notice Redstone NATIVE/USD price feed contracts. - */ - address public NATIVE_TOKEN_USD_PRICE_FEED; - +contract RedstoneAdapterPriceOracle is BasePriceOracle { /** * @notice The USD Token of the chain */ @@ -32,22 +21,19 @@ contract RedstoneAdapterPriceOracle is SafeOwnableUpgradeable, BasePriceOracle { /** * @notice The Redstone oracle contract */ - IRedstoneOracle public REDSTONE_ORACLE_ADDRESS; + IRedstoneOracle public REDSTONE_ORACLE; /** * @dev Constructor to set admin, wtoken address and native token USD price feed address * @param _usdToken The Wrapped native asset address - * @param nativeTokenUsdFeed Will this oracle return prices denominated in USD or in the native token. + * @param redstoneOracle The Redstone oracle contract address */ - function initialize( + constructor( address _usdToken, - address nativeTokenUsdFeed, address redstoneOracle - ) public initializer { - __SafeOwnable_init(msg.sender); + ) { USD_TOKEN = _usdToken; - NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsdFeed; - REDSTONE_ORACLE_ADDRESS = IRedstoneOracle(redstoneOracle); // 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256 on Mode + REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle); } /** @@ -55,7 +41,9 @@ contract RedstoneAdapterPriceOracle is SafeOwnableUpgradeable, BasePriceOracle { * @dev will return a price denominated in the native token */ function _price(address underlying) internal view returns (uint256) { - return 0; + uint256 priceInUsd = REDSTONE_ORACLE.priceOf(underlying); + uint256 priceOfNativeInUsd = REDSTONE_ORACLE.priceOfETH(); + return (priceInUsd * 1e18) / priceOfNativeInUsd; } /** diff --git a/contracts/test/oracles/RedstoneAdapterOracleTest.t.sol b/contracts/test/oracles/RedstoneAdapterOracleTest.t.sol new file mode 100644 index 00000000..a7c237f3 --- /dev/null +++ b/contracts/test/oracles/RedstoneAdapterOracleTest.t.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.8.0; + +import { TransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; + +import { RedstoneAdapterPriceOracle } from "../../oracles/default/RedstoneAdapterPriceOracle.sol"; + +import { BaseTest } from "../config/BaseTest.t.sol"; + +contract RedstoneAdapterOracleTest is BaseTest { + RedstoneAdapterPriceOracle public oracle; + address public redstoneOracleAddress; + address public usdTokenAddress; + address MODE_USDC = 0xd988097fb8612cc24eeC14542bC03424c656005f; + address MODE_EZETH = 0x2416092f143378750bb29b79eD961ab195CcEea5; + address MODE_WBTC = 0xcDd475325D6F564d27247D1DddBb0DAc6fA0a5CF; + + function afterForkSetUp() internal override { + if (block.chainid == MODE_MAINNET) { + redstoneOracleAddress = 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256; + usdTokenAddress = MODE_USDC; + } + + oracle = new RedstoneAdapterPriceOracle(usdTokenAddress, redstoneOracleAddress); + } + + function testPrintPricesMode() public fork(MODE_MAINNET) { + emit log_named_uint("ezETH price (18 dec)", oracle.price(MODE_EZETH)); + emit log_named_uint("WBTC price (8 dec)", oracle.price(MODE_WBTC)); + } +} \ No newline at end of file From 5c5082372d3a206595d3c9119c8d63849947f82a Mon Sep 17 00:00:00 2001 From: Veliko Minkov <2662912+vminkov@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:39:07 +0200 Subject: [PATCH 7/8] prettier --- contracts/external/redstone/IRedstoneOracle.sol | 2 +- contracts/oracles/default/RedstoneAdapterPriceOracle.sol | 5 +---- contracts/test/oracles/RedstoneAdapterOracleTest.t.sol | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/contracts/external/redstone/IRedstoneOracle.sol b/contracts/external/redstone/IRedstoneOracle.sol index 59ff1310..f7fafd8f 100644 --- a/contracts/external/redstone/IRedstoneOracle.sol +++ b/contracts/external/redstone/IRedstoneOracle.sol @@ -6,7 +6,7 @@ interface IRedstoneOracle { function priceOfETH() external view returns (uint256); - function getDataFeedIdForAsset(address asset) external view returns(bytes32); + function getDataFeedIdForAsset(address asset) external view returns (bytes32); function getDataFeedIds() external view returns (bytes32[] memory dataFeedIds); } diff --git a/contracts/oracles/default/RedstoneAdapterPriceOracle.sol b/contracts/oracles/default/RedstoneAdapterPriceOracle.sol index 93d1ee3a..2e045ca0 100644 --- a/contracts/oracles/default/RedstoneAdapterPriceOracle.sol +++ b/contracts/oracles/default/RedstoneAdapterPriceOracle.sol @@ -28,10 +28,7 @@ contract RedstoneAdapterPriceOracle is BasePriceOracle { * @param _usdToken The Wrapped native asset address * @param redstoneOracle The Redstone oracle contract address */ - constructor( - address _usdToken, - address redstoneOracle - ) { + constructor(address _usdToken, address redstoneOracle) { USD_TOKEN = _usdToken; REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle); } diff --git a/contracts/test/oracles/RedstoneAdapterOracleTest.t.sol b/contracts/test/oracles/RedstoneAdapterOracleTest.t.sol index a7c237f3..e2b2cd4c 100644 --- a/contracts/test/oracles/RedstoneAdapterOracleTest.t.sol +++ b/contracts/test/oracles/RedstoneAdapterOracleTest.t.sol @@ -28,4 +28,4 @@ contract RedstoneAdapterOracleTest is BaseTest { emit log_named_uint("ezETH price (18 dec)", oracle.price(MODE_EZETH)); emit log_named_uint("WBTC price (8 dec)", oracle.price(MODE_WBTC)); } -} \ No newline at end of file +} From 333f67dc74db6e0237a12872c279d6772147262a Mon Sep 17 00:00:00 2001 From: Veliko Minkov <2662912+vminkov@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:42:29 +0200 Subject: [PATCH 8/8] removed unused param --- contracts/oracles/default/RedstoneAdapterPriceOracle.sol | 9 +-------- contracts/test/oracles/RedstoneAdapterOracleTest.t.sol | 4 +--- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/contracts/oracles/default/RedstoneAdapterPriceOracle.sol b/contracts/oracles/default/RedstoneAdapterPriceOracle.sol index 2e045ca0..6ed7a9c1 100644 --- a/contracts/oracles/default/RedstoneAdapterPriceOracle.sol +++ b/contracts/oracles/default/RedstoneAdapterPriceOracle.sol @@ -13,11 +13,6 @@ import "../BasePriceOracle.sol"; * @author Veliko Minkov (https://github.com/vminkov) */ contract RedstoneAdapterPriceOracle is BasePriceOracle { - /** - * @notice The USD Token of the chain - */ - address public USD_TOKEN; - /** * @notice The Redstone oracle contract */ @@ -25,11 +20,9 @@ contract RedstoneAdapterPriceOracle is BasePriceOracle { /** * @dev Constructor to set admin, wtoken address and native token USD price feed address - * @param _usdToken The Wrapped native asset address * @param redstoneOracle The Redstone oracle contract address */ - constructor(address _usdToken, address redstoneOracle) { - USD_TOKEN = _usdToken; + constructor(address redstoneOracle) { REDSTONE_ORACLE = IRedstoneOracle(redstoneOracle); } diff --git a/contracts/test/oracles/RedstoneAdapterOracleTest.t.sol b/contracts/test/oracles/RedstoneAdapterOracleTest.t.sol index e2b2cd4c..5c2745df 100644 --- a/contracts/test/oracles/RedstoneAdapterOracleTest.t.sol +++ b/contracts/test/oracles/RedstoneAdapterOracleTest.t.sol @@ -10,7 +10,6 @@ import { BaseTest } from "../config/BaseTest.t.sol"; contract RedstoneAdapterOracleTest is BaseTest { RedstoneAdapterPriceOracle public oracle; address public redstoneOracleAddress; - address public usdTokenAddress; address MODE_USDC = 0xd988097fb8612cc24eeC14542bC03424c656005f; address MODE_EZETH = 0x2416092f143378750bb29b79eD961ab195CcEea5; address MODE_WBTC = 0xcDd475325D6F564d27247D1DddBb0DAc6fA0a5CF; @@ -18,10 +17,9 @@ contract RedstoneAdapterOracleTest is BaseTest { function afterForkSetUp() internal override { if (block.chainid == MODE_MAINNET) { redstoneOracleAddress = 0x7C1DAAE7BB0688C9bfE3A918A4224041c7177256; - usdTokenAddress = MODE_USDC; } - oracle = new RedstoneAdapterPriceOracle(usdTokenAddress, redstoneOracleAddress); + oracle = new RedstoneAdapterPriceOracle(redstoneOracleAddress); } function testPrintPricesMode() public fork(MODE_MAINNET) {