diff --git a/contracts/mockups/UsingWitOracle.sol b/contracts/mockups/UsingWitOracle.sol index 09e0e786..6cc3dea5 100644 --- a/contracts/mockups/UsingWitOracle.sol +++ b/contracts/mockups/UsingWitOracle.sol @@ -81,13 +81,14 @@ abstract contract UsingWitOracle } /// @dev Estimate the minimum reward required for posting a data request (based on `tx.gasprice`). - function _witOracleEstimateBaseFee() - virtual internal view - returns (uint256) - { + function _witOracleEstimateBaseFee() virtual internal view returns (uint256) { + return _witOracleEstimateBaseFee(tx.gasprice); + } + + function _witOracleEstimateBaseFee(uint256 _evmGasPrice) virtual internal view returns (uint256) { return ( - (100 + __witOracleBaseFeeOverheadPercentage) - * __witOracle.estimateBaseFee(tx.gasprice) + __witOracle.estimateBaseFee(_evmGasPrice) + * (100 + __witOracleBaseFeeOverheadPercentage) ) / 100; } } diff --git a/contracts/mockups/WitOracleConsumer.sol b/contracts/mockups/WitOracleConsumer.sol index 6abced5c..5b15bcfe 100644 --- a/contracts/mockups/WitOracleConsumer.sol +++ b/contracts/mockups/WitOracleConsumer.sol @@ -34,26 +34,18 @@ abstract contract WitOracleConsumer /// =============================================================================================================== /// --- WitOracleConsumer virtual methods ---------------------------------------------------------------------------- - /// @dev Estimate the minimum reward required for posting a data request (based on `tx.gasprice` and - /// @dev `__witOracleCallbackGasLimit`). - function _witOracleEstimateBaseFee() virtual override internal view returns (uint256) { - return _witOracleEstimateBaseFeeWithCallback(__witOracleCallbackGasLimit); - } - - - /// @dev Estimate the minimum reward required for posting a data request, based on `tx.gasprice` and - /// @dev the given `_witOracleCallbackGasLimit` value. - /// @param _witOracleCallbackGasLimit Maximum gas to be spent when reporting the data request result. - function _witOracleEstimateBaseFeeWithCallback( - uint24 _witOracleCallbackGasLimit - ) - virtual internal view returns (uint256) + /// @dev Estimate the minimum reward required for posting a data request (based on given gas price and + /// @dev immutable `__witOracleCallbackGasLimit`). + function _witOracleEstimateBaseFee(uint256 _evmGasPrice) + virtual override + internal view + returns (uint256) { return ( (100 + __witOracleBaseFeeOverheadPercentage) * __witOracle.estimateBaseFeeWithCallback( - tx.gasprice, - _witOracleCallbackGasLimit + _evmGasPrice, + __witOracleCallbackGasLimit ) ) / 100; } diff --git a/contracts/mockups/WitOracleRequestConsumer.sol b/contracts/mockups/WitOracleRequestConsumer.sol index b4ffb8df..ff82893e 100644 --- a/contracts/mockups/WitOracleRequestConsumer.sol +++ b/contracts/mockups/WitOracleRequestConsumer.sol @@ -24,15 +24,15 @@ abstract contract WitOracleRequestConsumer WitOracleConsumer(_callbackGasLimit) {} - /// @dev Estimate the minimum reward required for posting a data request (based on `tx.gasprice` and - /// @dev `__witOracleCallbackGasLimit`). - function _witOracleEstimateBaseFee() - virtual override(UsingWitOracle, WitOracleConsumer) - internal view + /// @dev Estimate the minimum reward required for posting a data request (based on given gas price and + /// @dev immutable `__witOracleCallbackGasLimit`). + function _witOracleEstimateBaseFee(uint256 _evmGasPrice) + virtual override (UsingWitOracle, WitOracleConsumer) + internal view returns (uint256) { - return WitOracleConsumer._witOracleEstimateBaseFee(); - } + return WitOracleConsumer._witOracleEstimateBaseFee(_evmGasPrice); + } /// @dev Pulls a data update from the Wit/oracle blockchain based on the underlying `witOracleRequest`, /// @dev the default `__witOracleDefaultQuerySLA` data security parameters and the immutable value of diff --git a/contracts/mockups/WitOracleRequestTemplateConsumer.sol b/contracts/mockups/WitOracleRequestTemplateConsumer.sol index d809fe03..11ae2ba2 100644 --- a/contracts/mockups/WitOracleRequestTemplateConsumer.sol +++ b/contracts/mockups/WitOracleRequestTemplateConsumer.sol @@ -24,14 +24,14 @@ abstract contract WitOracleRequestTemplateConsumer WitOracleConsumer(_callbackGasLimit) {} - /// @dev Estimate the minimum reward required for posting a data request (based on `tx.gasprice` and - /// @dev `__witOracleCallbackGasLimit`). - function _witOracleEstimateBaseFee() - virtual override(UsingWitOracle, WitOracleConsumer) - internal view + /// @dev Estimate the minimum reward required for posting a data request (based on given gas price and + /// @dev immutable `__witOracleCallbackGasLimit`). + function _witOracleEstimateBaseFee(uint256 _evmGasPrice) + virtual override (UsingWitOracle, WitOracleConsumer) + internal view returns (uint256) { - return WitOracleConsumer._witOracleEstimateBaseFee(); + return WitOracleConsumer._witOracleEstimateBaseFee(_evmGasPrice); } /// @dev Pulls a fresh update from the Wit/oracle blockchain based on some data request built out