From 69e074cbb326aa3cf8b2e1ce4ab0ffb667751946 Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 11:50:20 -0500 Subject: [PATCH 01/12] Contract setup --- contracts/ChainlinkRateProviderFactory.sol | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 contracts/ChainlinkRateProviderFactory.sol diff --git a/contracts/ChainlinkRateProviderFactory.sol b/contracts/ChainlinkRateProviderFactory.sol new file mode 100644 index 0000000..47c2bfa --- /dev/null +++ b/contracts/ChainlinkRateProviderFactory.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.8.0; + +contract ChainlinkRateProviderFactory { + +} \ No newline at end of file From d94857fadc2a281a37ea6f63f88e528e9cf2a472 Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 12:03:19 -0500 Subject: [PATCH 02/12] Factory code added --- contracts/ChainlinkRateProviderFactory.sol | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/contracts/ChainlinkRateProviderFactory.sol b/contracts/ChainlinkRateProviderFactory.sol index 47c2bfa..af350dd 100644 --- a/contracts/ChainlinkRateProviderFactory.sol +++ b/contracts/ChainlinkRateProviderFactory.sol @@ -14,6 +14,25 @@ pragma solidity ^0.8.0; +import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; + +import "./ChainlinkRateProvider.sol"; + contract ChainlinkRateProviderFactory { - + mapping (address => bool) private _factoryCreatedRateProviders; + + event ChainlinkRateProviderCreated(address indexed provider); + + function create(AggregatorV3Interface feed) external returns (ChainlinkRateProvider) { + ChainlinkRateProvider provider = new ChainlinkRateProvider(feed); + _factoryCreatedRateProviders[address(provider)] = true; + + emit ChainlinkRateProviderCreated(address(provider)); + + return provider; + } + + function isRateProviderFromFactory(address provider) external view returns (bool) { + return _factoryCreatedRateProviders[provider]; + } } \ No newline at end of file From d6468ceea3d7ccd72e2f72db009d2222af8b4e2b Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 12:09:29 -0500 Subject: [PATCH 03/12] Natspec documentation added --- contracts/ChainlinkRateProviderFactory.sol | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/contracts/ChainlinkRateProviderFactory.sol b/contracts/ChainlinkRateProviderFactory.sol index af350dd..930ce94 100644 --- a/contracts/ChainlinkRateProviderFactory.sol +++ b/contracts/ChainlinkRateProviderFactory.sol @@ -18,20 +18,38 @@ import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "./ChainlinkRateProvider.sol"; +/** + * @title Chainlink Rate Provider Factory + * @notice Factory for creating ChainlinkRateProviders + * @dev This contract is used to create ChainlinkRateProvider contracts. + * RateProviders created by this factory are to be used in environments + * where the Chainlink registry is not available. + */ + contract ChainlinkRateProviderFactory { + // Mapping of rate providers created by this factory. mapping (address => bool) private _factoryCreatedRateProviders; event ChainlinkRateProviderCreated(address indexed provider); + /** + * @notice Deploys a new ChainlinkRateProvider contract using a price feed. + * @param feed - The Chainlink price feed contract. + */ function create(AggregatorV3Interface feed) external returns (ChainlinkRateProvider) { ChainlinkRateProvider provider = new ChainlinkRateProvider(feed); _factoryCreatedRateProviders[address(provider)] = true; - + emit ChainlinkRateProviderCreated(address(provider)); return provider; } + /** + * @notice Checks if a rate provider was created by this factory. + * @param provider - Address of the rate provider to check. + * @return bool - True if the rate provider was created by this factory. + */ function isRateProviderFromFactory(address provider) external view returns (bool) { return _factoryCreatedRateProviders[provider]; } From 6b5cb33f47b3d226ed6c48841051e965a4e83109 Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 12:16:17 -0500 Subject: [PATCH 04/12] Clean up variable names --- contracts/ChainlinkRateProviderFactory.sol | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contracts/ChainlinkRateProviderFactory.sol b/contracts/ChainlinkRateProviderFactory.sol index 930ce94..8fe0048 100644 --- a/contracts/ChainlinkRateProviderFactory.sol +++ b/contracts/ChainlinkRateProviderFactory.sol @@ -30,27 +30,27 @@ contract ChainlinkRateProviderFactory { // Mapping of rate providers created by this factory. mapping (address => bool) private _factoryCreatedRateProviders; - event ChainlinkRateProviderCreated(address indexed provider); + event ChainlinkRateProviderCreated(address indexed rateProvider); /** * @notice Deploys a new ChainlinkRateProvider contract using a price feed. * @param feed - The Chainlink price feed contract. */ function create(AggregatorV3Interface feed) external returns (ChainlinkRateProvider) { - ChainlinkRateProvider provider = new ChainlinkRateProvider(feed); - _factoryCreatedRateProviders[address(provider)] = true; + ChainlinkRateProvider rateProvider = new ChainlinkRateProvider(feed); + _factoryCreatedRateProviders[address(rateProvider)] = true; - emit ChainlinkRateProviderCreated(address(provider)); + emit ChainlinkRateProviderCreated(address(rateProvider)); - return provider; + return rateProvider; } /** * @notice Checks if a rate provider was created by this factory. - * @param provider - Address of the rate provider to check. + * @param rateProvider - Address of the rate provider to check. * @return bool - True if the rate provider was created by this factory. */ - function isRateProviderFromFactory(address provider) external view returns (bool) { - return _factoryCreatedRateProviders[provider]; + function isRateProviderFromFactory(address rateProvider) external view returns (bool) { + return _factoryCreatedRateProviders[rateProvider]; } } \ No newline at end of file From 42c5b8e06df89cb5726c22884e163b5dafc95994 Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 12:23:09 -0500 Subject: [PATCH 05/12] Lint Fix --- contracts/ChainlinkRateProviderFactory.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/ChainlinkRateProviderFactory.sol b/contracts/ChainlinkRateProviderFactory.sol index 8fe0048..267e93c 100644 --- a/contracts/ChainlinkRateProviderFactory.sol +++ b/contracts/ChainlinkRateProviderFactory.sol @@ -22,13 +22,13 @@ import "./ChainlinkRateProvider.sol"; * @title Chainlink Rate Provider Factory * @notice Factory for creating ChainlinkRateProviders * @dev This contract is used to create ChainlinkRateProvider contracts. - * RateProviders created by this factory are to be used in environments + * RateProviders created by this factory are to be used in environments * where the Chainlink registry is not available. */ contract ChainlinkRateProviderFactory { // Mapping of rate providers created by this factory. - mapping (address => bool) private _factoryCreatedRateProviders; + mapping(address => bool) private _factoryCreatedRateProviders; event ChainlinkRateProviderCreated(address indexed rateProvider); @@ -41,7 +41,7 @@ contract ChainlinkRateProviderFactory { _factoryCreatedRateProviders[address(rateProvider)] = true; emit ChainlinkRateProviderCreated(address(rateProvider)); - + return rateProvider; } @@ -53,4 +53,4 @@ contract ChainlinkRateProviderFactory { function isRateProviderFromFactory(address rateProvider) external view returns (bool) { return _factoryCreatedRateProviders[rateProvider]; } -} \ No newline at end of file +} From a34ba105466c68b8de6a8f3f09c436936986810d Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 13:59:47 -0500 Subject: [PATCH 06/12] BaseRateProviderFactory added --- contracts/BaseRateProviderFactory.sol | 57 +++++++++++++++++++ contracts/ChainlinkRateProviderFactory.sol | 24 +++----- .../interfaces/IBaseRateProviderFactory.sol | 35 ++++++++++++ 3 files changed, 100 insertions(+), 16 deletions(-) create mode 100644 contracts/BaseRateProviderFactory.sol create mode 100644 contracts/interfaces/IBaseRateProviderFactory.sol diff --git a/contracts/BaseRateProviderFactory.sol b/contracts/BaseRateProviderFactory.sol new file mode 100644 index 0000000..4271367 --- /dev/null +++ b/contracts/BaseRateProviderFactory.sol @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.8.0; + +import "./interfaces/IBaseRateProviderFactory.sol"; + +/** + * @title Chainlink Rate Provider Factory + * @notice Factory for creating ChainlinkRateProviders + * @dev This contract is used to create ChainlinkRateProvider contracts. + * RateProviders created by this factory are to be used in environments + * where the Chainlink registry is not available. + */ +contract BaseRateProviderFactory is IBaseRateProviderFactory { + // Mapping of rate providers created by this factory. + mapping(address => bool) internal _factoryCreatedRateProviders; + bool private _disabled; + + event RateProviderCreated(address indexed rateProvider); + event FactoryDisabled(); + + constructor(address authorizer) { + // solhint-disable-previous-line no-empty-blocks + } + + function isRateProviderFromFactory(address rateProvider) external view returns (bool) { + return _factoryCreatedRateProviders[rateProvider]; + } + + function isDisabled() public view override returns (bool) { + return _disabled; + } + + function disable() external override { + _ensureEnabled(); + + _disabled = true; + + emit FactoryDisabled(); + } + + function _ensureEnabled() internal view { + require(!isDisabled(), "Factory disabled"); + } +} diff --git a/contracts/ChainlinkRateProviderFactory.sol b/contracts/ChainlinkRateProviderFactory.sol index 267e93c..1aae17c 100644 --- a/contracts/ChainlinkRateProviderFactory.sol +++ b/contracts/ChainlinkRateProviderFactory.sol @@ -16,6 +16,7 @@ pragma solidity ^0.8.0; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; +import "./BaseRateProviderFactory.sol"; import "./ChainlinkRateProvider.sol"; /** @@ -25,32 +26,23 @@ import "./ChainlinkRateProvider.sol"; * RateProviders created by this factory are to be used in environments * where the Chainlink registry is not available. */ - -contract ChainlinkRateProviderFactory { - // Mapping of rate providers created by this factory. - mapping(address => bool) private _factoryCreatedRateProviders; - - event ChainlinkRateProviderCreated(address indexed rateProvider); +contract ChainlinkRateProviderFactory is BaseRateProviderFactory { + constructor(address authorizer) BaseRateProviderFactory(authorizer) { + // solhint-disable-previous-line no-empty-blocks + } /** * @notice Deploys a new ChainlinkRateProvider contract using a price feed. * @param feed - The Chainlink price feed contract. */ function create(AggregatorV3Interface feed) external returns (ChainlinkRateProvider) { + _ensureEnabled(); + ChainlinkRateProvider rateProvider = new ChainlinkRateProvider(feed); _factoryCreatedRateProviders[address(rateProvider)] = true; - emit ChainlinkRateProviderCreated(address(rateProvider)); + emit RateProviderCreated(address(rateProvider)); return rateProvider; } - - /** - * @notice Checks if a rate provider was created by this factory. - * @param rateProvider - Address of the rate provider to check. - * @return bool - True if the rate provider was created by this factory. - */ - function isRateProviderFromFactory(address rateProvider) external view returns (bool) { - return _factoryCreatedRateProviders[rateProvider]; - } } diff --git a/contracts/interfaces/IBaseRateProviderFactory.sol b/contracts/interfaces/IBaseRateProviderFactory.sol new file mode 100644 index 0000000..90e0c12 --- /dev/null +++ b/contracts/interfaces/IBaseRateProviderFactory.sol @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.8.0; + +interface IBaseRateProviderFactory { + /** + * @dev Checks if a rate provider was created by the derived factory. + * @param rateProvider - Address of the rate provider to check. + * @return bool - True if the rate provider was created by the derived factory. + */ + function isRateProviderFromFactory(address rateProvider) external view returns (bool); + + /** + * @dev Check whether the derived factory has been disabled. + */ + function isDisabled() external view returns (bool); + + /** + * @dev Disable the factory, preventing the creation of more pools. Already existing pools are unaffected. + * Once a factory is disabled, it cannot be re-enabled. + */ + function disable() external; +} From cd580fba4b378052c5be2c754f4affac9b8fe2d7 Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 14:00:38 -0500 Subject: [PATCH 07/12] Add todo for auth --- contracts/BaseRateProviderFactory.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/contracts/BaseRateProviderFactory.sol b/contracts/BaseRateProviderFactory.sol index 4271367..d523370 100644 --- a/contracts/BaseRateProviderFactory.sol +++ b/contracts/BaseRateProviderFactory.sol @@ -31,6 +31,7 @@ contract BaseRateProviderFactory is IBaseRateProviderFactory { event RateProviderCreated(address indexed rateProvider); event FactoryDisabled(); + // TODO: Implement Authentication constructor(address authorizer) { // solhint-disable-previous-line no-empty-blocks } From c26a5264d8e09a659e6899c0760c27d68403cd13 Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 15:17:30 -0500 Subject: [PATCH 08/12] Remove disable factory --- contracts/BaseRateProviderFactory.sol | 23 ------------------- contracts/ChainlinkRateProviderFactory.sol | 4 +--- .../interfaces/IBaseRateProviderFactory.sol | 11 --------- 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/contracts/BaseRateProviderFactory.sol b/contracts/BaseRateProviderFactory.sol index d523370..480f65f 100644 --- a/contracts/BaseRateProviderFactory.sol +++ b/contracts/BaseRateProviderFactory.sol @@ -26,33 +26,10 @@ import "./interfaces/IBaseRateProviderFactory.sol"; contract BaseRateProviderFactory is IBaseRateProviderFactory { // Mapping of rate providers created by this factory. mapping(address => bool) internal _factoryCreatedRateProviders; - bool private _disabled; event RateProviderCreated(address indexed rateProvider); - event FactoryDisabled(); - - // TODO: Implement Authentication - constructor(address authorizer) { - // solhint-disable-previous-line no-empty-blocks - } function isRateProviderFromFactory(address rateProvider) external view returns (bool) { return _factoryCreatedRateProviders[rateProvider]; } - - function isDisabled() public view override returns (bool) { - return _disabled; - } - - function disable() external override { - _ensureEnabled(); - - _disabled = true; - - emit FactoryDisabled(); - } - - function _ensureEnabled() internal view { - require(!isDisabled(), "Factory disabled"); - } } diff --git a/contracts/ChainlinkRateProviderFactory.sol b/contracts/ChainlinkRateProviderFactory.sol index 1aae17c..e6693ae 100644 --- a/contracts/ChainlinkRateProviderFactory.sol +++ b/contracts/ChainlinkRateProviderFactory.sol @@ -27,7 +27,7 @@ import "./ChainlinkRateProvider.sol"; * where the Chainlink registry is not available. */ contract ChainlinkRateProviderFactory is BaseRateProviderFactory { - constructor(address authorizer) BaseRateProviderFactory(authorizer) { + constructor() BaseRateProviderFactory() { // solhint-disable-previous-line no-empty-blocks } @@ -36,8 +36,6 @@ contract ChainlinkRateProviderFactory is BaseRateProviderFactory { * @param feed - The Chainlink price feed contract. */ function create(AggregatorV3Interface feed) external returns (ChainlinkRateProvider) { - _ensureEnabled(); - ChainlinkRateProvider rateProvider = new ChainlinkRateProvider(feed); _factoryCreatedRateProviders[address(rateProvider)] = true; diff --git a/contracts/interfaces/IBaseRateProviderFactory.sol b/contracts/interfaces/IBaseRateProviderFactory.sol index 90e0c12..5114cb6 100644 --- a/contracts/interfaces/IBaseRateProviderFactory.sol +++ b/contracts/interfaces/IBaseRateProviderFactory.sol @@ -21,15 +21,4 @@ interface IBaseRateProviderFactory { * @return bool - True if the rate provider was created by the derived factory. */ function isRateProviderFromFactory(address rateProvider) external view returns (bool); - - /** - * @dev Check whether the derived factory has been disabled. - */ - function isDisabled() external view returns (bool); - - /** - * @dev Disable the factory, preventing the creation of more pools. Already existing pools are unaffected. - * Once a factory is disabled, it cannot be re-enabled. - */ - function disable() external; } From d8bf17c4bc37dba0003654520dd048345a7f62cd Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 15:19:56 -0500 Subject: [PATCH 09/12] Remove unneeded constructor --- contracts/ChainlinkRateProviderFactory.sol | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/ChainlinkRateProviderFactory.sol b/contracts/ChainlinkRateProviderFactory.sol index e6693ae..5138ff2 100644 --- a/contracts/ChainlinkRateProviderFactory.sol +++ b/contracts/ChainlinkRateProviderFactory.sol @@ -27,10 +27,6 @@ import "./ChainlinkRateProvider.sol"; * where the Chainlink registry is not available. */ contract ChainlinkRateProviderFactory is BaseRateProviderFactory { - constructor() BaseRateProviderFactory() { - // solhint-disable-previous-line no-empty-blocks - } - /** * @notice Deploys a new ChainlinkRateProvider contract using a price feed. * @param feed - The Chainlink price feed contract. From f730a0a7e02117a6041c7f7f8f65ea235fdcf122 Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 15:26:49 -0500 Subject: [PATCH 10/12] Move repeat logic to BaseRateProvider _onCreate --- contracts/BaseRateProviderFactory.sol | 5 +++++ contracts/ChainlinkRateProviderFactory.sol | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/contracts/BaseRateProviderFactory.sol b/contracts/BaseRateProviderFactory.sol index 480f65f..c419e0d 100644 --- a/contracts/BaseRateProviderFactory.sol +++ b/contracts/BaseRateProviderFactory.sol @@ -32,4 +32,9 @@ contract BaseRateProviderFactory is IBaseRateProviderFactory { function isRateProviderFromFactory(address rateProvider) external view returns (bool) { return _factoryCreatedRateProviders[rateProvider]; } + + function _onCreate(address rateProvider) internal { + _factoryCreatedRateProviders[rateProvider] = true; + emit RateProviderCreated(rateProvider); + } } diff --git a/contracts/ChainlinkRateProviderFactory.sol b/contracts/ChainlinkRateProviderFactory.sol index 5138ff2..33f7dba 100644 --- a/contracts/ChainlinkRateProviderFactory.sol +++ b/contracts/ChainlinkRateProviderFactory.sol @@ -33,9 +33,7 @@ contract ChainlinkRateProviderFactory is BaseRateProviderFactory { */ function create(AggregatorV3Interface feed) external returns (ChainlinkRateProvider) { ChainlinkRateProvider rateProvider = new ChainlinkRateProvider(feed); - _factoryCreatedRateProviders[address(rateProvider)] = true; - - emit RateProviderCreated(address(rateProvider)); + _onCreate(address(rateProvider)); return rateProvider; } From 83553cc8fa18113dcaf0b2aa51e3e48c63a50f9c Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 15:37:12 -0500 Subject: [PATCH 11/12] PR Comments addressed --- contracts/BaseRateProviderFactory.sol | 10 ++++------ contracts/ChainlinkRateProviderFactory.sol | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/contracts/BaseRateProviderFactory.sol b/contracts/BaseRateProviderFactory.sol index c419e0d..30be06a 100644 --- a/contracts/BaseRateProviderFactory.sol +++ b/contracts/BaseRateProviderFactory.sol @@ -17,15 +17,13 @@ pragma solidity ^0.8.0; import "./interfaces/IBaseRateProviderFactory.sol"; /** - * @title Chainlink Rate Provider Factory - * @notice Factory for creating ChainlinkRateProviders - * @dev This contract is used to create ChainlinkRateProvider contracts. - * RateProviders created by this factory are to be used in environments - * where the Chainlink registry is not available. + * @title Base Rate Provider Factory + * @notice Base Factory for creating RateProviders + * @dev This is a base contract for building factories that create RateProviders. */ contract BaseRateProviderFactory is IBaseRateProviderFactory { // Mapping of rate providers created by this factory. - mapping(address => bool) internal _factoryCreatedRateProviders; + mapping(address => bool) private _factoryCreatedRateProviders; event RateProviderCreated(address indexed rateProvider); diff --git a/contracts/ChainlinkRateProviderFactory.sol b/contracts/ChainlinkRateProviderFactory.sol index 33f7dba..4e6a5ec 100644 --- a/contracts/ChainlinkRateProviderFactory.sol +++ b/contracts/ChainlinkRateProviderFactory.sol @@ -34,7 +34,6 @@ contract ChainlinkRateProviderFactory is BaseRateProviderFactory { function create(AggregatorV3Interface feed) external returns (ChainlinkRateProvider) { ChainlinkRateProvider rateProvider = new ChainlinkRateProvider(feed); _onCreate(address(rateProvider)); - return rateProvider; } } From 8315a23a947b976825f5dc2fc5ed338f0e0f840c Mon Sep 17 00:00:00 2001 From: baileyspraggins Date: Mon, 17 Jul 2023 15:44:02 -0500 Subject: [PATCH 12/12] Change variable name to match external function --- contracts/BaseRateProviderFactory.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/BaseRateProviderFactory.sol b/contracts/BaseRateProviderFactory.sol index 30be06a..9ae4b4f 100644 --- a/contracts/BaseRateProviderFactory.sol +++ b/contracts/BaseRateProviderFactory.sol @@ -23,16 +23,16 @@ import "./interfaces/IBaseRateProviderFactory.sol"; */ contract BaseRateProviderFactory is IBaseRateProviderFactory { // Mapping of rate providers created by this factory. - mapping(address => bool) private _factoryCreatedRateProviders; + mapping(address => bool) private _isRateProviderFromFactory; event RateProviderCreated(address indexed rateProvider); function isRateProviderFromFactory(address rateProvider) external view returns (bool) { - return _factoryCreatedRateProviders[rateProvider]; + return _isRateProviderFromFactory[rateProvider]; } function _onCreate(address rateProvider) internal { - _factoryCreatedRateProviders[rateProvider] = true; + _isRateProviderFromFactory[rateProvider] = true; emit RateProviderCreated(rateProvider); } }