diff --git a/script/Common.s.sol b/script/Common.s.sol index ead2747..7ffee53 100644 --- a/script/Common.s.sol +++ b/script/Common.s.sol @@ -4,16 +4,23 @@ pragma solidity 0.7.6; import '@script/Registry.s.sol'; import {Script} from 'forge-std/Script.sol'; import {IAuthorizable} from '@interfaces/utils/IAuthorizable.sol'; +import {RelayerFactory} from '@contracts/factories/RelayerFactory.sol'; +import {ChainlinkRelayerFactory} from '@contracts/factories/ChainlinkRelayerFactory.sol'; +import {DenominatedOracleFactory} from '@contracts/factories/DenominatedOracleFactory.sol'; abstract contract Common is Script { + RelayerFactory public camelotRelayerFactory = RelayerFactory(CAMELOT_RELAYER_FACTORY); + ChainlinkRelayerFactory public chainlinkRelayerFactory = ChainlinkRelayerFactory(CHAINLINK_RELAYER_FACTORY); + DenominatedOracleFactory public denominatedOracleFactory = DenominatedOracleFactory(DENOMINATED_ORACLE_FACTORY); + function _revoke(IAuthorizable _contract, address _authorize, address _deauthorize) internal { _contract.addAuthorization(_authorize); _contract.removeAuthorization(_deauthorize); } - function revokeFactories() external { + function revokeFactories() internal { _revoke(IAuthorizable(address(camelotRelayerFactory)), TEST_GOVERNOR, vm.envAddress('ARB_SEPOLIA_DEPLOYER_PC')); _revoke(IAuthorizable(address(chainlinkRelayerFactory)), TEST_GOVERNOR, vm.envAddress('ARB_SEPOLIA_DEPLOYER_PC')); - _revoke(IAuthorizable(address(densominatedOracleFactory)), TEST_GOVERNOR, vm.envAddress('ARB_SEPOLIA_DEPLOYER_PC')); + _revoke(IAuthorizable(address(denominatedOracleFactory)), TEST_GOVERNOR, vm.envAddress('ARB_SEPOLIA_DEPLOYER_PC')); } } diff --git a/script/postdeployment/SetupPostEnvironment.s.sol b/script/postdeployment/SetupPostEnvironment.s.sol index acacbe3..96d64d7 100644 --- a/script/postdeployment/SetupPostEnvironment.s.sol +++ b/script/postdeployment/SetupPostEnvironment.s.sol @@ -8,9 +8,6 @@ import {IAlgebraFactory} from '@algebra-core/interfaces/IAlgebraFactory.sol'; import {IAlgebraPool} from '@algebra-core/interfaces/IAlgebraPool.sol'; import {IERC20Metadata} from '@algebra-periphery/interfaces/IERC20Metadata.sol'; import {IBaseOracle} from '@interfaces/oracles/IBaseOracle.sol'; -import {RelayerFactory} from '@contracts/factories/RelayerFactory.sol'; -import {ChainlinkRelayerFactory} from '@contracts/factories/ChainlinkRelayerFactory.sol'; -import {DenominatedOracleFactory} from '@contracts/factories/DenominatedOracleFactory.sol'; import {IAuthorizable} from '@interfaces/utils/IAuthorizable.sol'; import {MintableERC20} from '@contracts/for-test/MintableERC20.sol'; @@ -22,9 +19,6 @@ import {MintableERC20} from '@contracts/for-test/MintableERC20.sol'; contract SetupPostEnvironment is Common { IAlgebraFactory public algebraFactory = IAlgebraFactory(SEPOLIA_ALGEBRA_FACTORY); - RelayerFactory public camelotRelayerFactory = RelayerFactory(CAMELOT_RELAYER_FACTORY); - ChainlinkRelayerFactory public chainlinkRelayerFactory = ChainlinkRelayerFactory(CHAINLINK_RELAYER_FACTORY); - DenominatedOracleFactory public denominatedOracleFactory = DenominatedOracleFactory(DENOMINATED_ORACLE_FACTORY); function run() public { vm.startBroadcast(vm.envUint('ARB_SEPOLIA_DEPLOYER_PK')); diff --git a/src/contracts/factories/RelayerChild.sol b/src/contracts/factories/RelayerChild.sol index 4c4f318..4b003ef 100644 --- a/src/contracts/factories/RelayerChild.sol +++ b/src/contracts/factories/RelayerChild.sol @@ -1,15 +1,15 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.6; -import {Relayer} from '@contracts/oracles/Relayer.sol'; +import {CamelotRelayer} from '@contracts/oracles/CamelotRelayer.sol'; import {FactoryChild} from '@contracts/factories/FactoryChild.sol'; -contract RelayerChild is Relayer, FactoryChild { +contract RelayerChild is CamelotRelayer, FactoryChild { // --- Init --- constructor( address _algebraV3Factory, address _baseToken, address _quoteToken, uint32 _quotePeriod - ) Relayer(_algebraV3Factory, _baseToken, _quoteToken, _quotePeriod) {} + ) CamelotRelayer(_algebraV3Factory, _baseToken, _quoteToken, _quotePeriod) {} } diff --git a/src/contracts/oracles/Relayer.sol b/src/contracts/oracles/CamelotRelayer.sol similarity index 99% rename from src/contracts/oracles/Relayer.sol rename to src/contracts/oracles/CamelotRelayer.sol index 9463826..d271f98 100644 --- a/src/contracts/oracles/Relayer.sol +++ b/src/contracts/oracles/CamelotRelayer.sol @@ -7,7 +7,7 @@ import {IAlgebraPool} from '@algebra-core/interfaces/IAlgebraPool.sol'; import {IDataStorageOperator} from '@algebra-core/interfaces/IDataStorageOperator.sol'; import {DataStorageLibrary} from '@algebra-periphery/libraries/DataStorageLibrary.sol'; -contract Relayer { +contract CamelotRelayer { address public algebraPool; address public baseToken; address public quoteToken; diff --git a/test/e2e/SystemOracle.s.sol b/test/e2e/SystemOracle.s.sol index 13821cf..b85588a 100644 --- a/test/e2e/SystemOracle.s.sol +++ b/test/e2e/SystemOracle.s.sol @@ -11,7 +11,7 @@ import { ETH_ARB_POOL } from '@script/Registry.s.sol'; import {DSTestPlus} from '@test/utils/DSTestPlus.t.sol'; -import {Relayer} from '@contracts/oracles/Relayer.sol'; +import {CamelotRelayer} from '@contracts/oracles/CamelotRelayer.sol'; import {IBaseOracle} from '@interfaces/oracles/IBaseOracle.sol'; import {IAlgebraFactory} from '@algebra-core/interfaces/IAlgebraFactory.sol'; import {ChainlinkRelayer} from '@contracts/oracles/ChainlinkRelayer.sol'; @@ -72,8 +72,8 @@ contract OracleSetup is DSTestPlus { ethUsdPriceSource = IBaseOracle(address(new ChainlinkRelayer(CHAINLINK_ETH_USD_FEED, 1 days))); // --- Camelot --- - arbEthPriceSource = IBaseOracle(address(new Relayer(MAINNET_ALGEBRA_FACTORY, ARB, ETH, 1 days))); // correct - ethArbPriceSource = IBaseOracle(address(new Relayer(MAINNET_ALGEBRA_FACTORY, ETH, ARB, 1 days))); // inverted + arbEthPriceSource = IBaseOracle(address(new CamelotRelayer(MAINNET_ALGEBRA_FACTORY, ARB, ETH, 1 days))); // correct + ethArbPriceSource = IBaseOracle(address(new CamelotRelayer(MAINNET_ALGEBRA_FACTORY, ETH, ARB, 1 days))); // inverted // --- Denominated --- arbUsdPriceSource = IDenominatedOracle(address(new DenominatedOracle(arbEthPriceSource, ethUsdPriceSource, false)));