You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Incorrect Order of Operations in _commitmentPrice Function
Summary
The ChainlinkFactory contract includes a _commitmentPrice function used to calculate the commitment price for Chainlink oracle updates. This function applies both a surcharge and a discount to the native quantity to determine the final fee.
Issue Details
The current implementation of the _commitmentPrice function applies the surcharge before the discount. This order of operations leads to higher fees compared to applying the discount first, potentially disadvantaging users.
The text was updated successfully, but these errors were encountered:
sherlock-admin3
changed the title
Crazy Chartreuse Viper - Incorrect Order of Operations in _commitmentPrice Function
0xloophole - Incorrect Order of Operations in _commitmentPrice Function
Sep 23, 2024
0xloophole
Medium
Incorrect Order of Operations in _commitmentPrice Function
Summary
The
ChainlinkFactory
contract includes a_commitmentPrice
function used to calculate the commitment price for Chainlink oracle updates. This function applies both a surcharge and a discount to the native quantity to determine the final fee.Issue Details
The current implementation of the
_commitmentPrice
function applies the surcharge before the discount. This order of operations leads to higher fees compared to applying the discount first, potentially disadvantaging users.Code Snippet
Impact
Scenario
Consider the following scenario:
Current calculation:
If we reverse the order:
In this case, the result is the same, but for larger numbers and different discount/surcharge rates, the difference can be significant.
Proposed Fix
Reverse the order of operations in the
_commitmentPrice
function:The text was updated successfully, but these errors were encountered: