Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChainlinkBoundedCompositeOracle #440

Merged
merged 17 commits into from
Dec 31, 2024
Merged

ChainlinkBoundedCompositeOracle #440

merged 17 commits into from
Dec 31, 2024

Conversation

ElliotFriedman
Copy link
Collaborator

No description provided.

@ElliotFriedman
Copy link
Collaborator Author

@lyoungblood what do we want our upper and lower parameters to be for this?

Copy link

openzeppelin-code bot commented Dec 11, 2024

ChainlinkBoundedCompositeOracle

Generated at commit: 8365a3f9c7d699012b79fb56a8e28b6f7cf1e0dd

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
3
3
0
12
45
63
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

src/oracles/ChainlinkBoundedCompositeOracle.sol Outdated Show resolved Hide resolved
src/oracles/ChainlinkBoundedCompositeOracle.sol Outdated Show resolved Hide resolved
src/oracles/ChainlinkBoundedCompositeOracle.sol Outdated Show resolved Hide resolved
int256 _upperBound
) external onlyOwner {
require(
_lowerBound < _upperBound,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weak inequity also here

fallbackLBTCOracle = AggregatorV3Interface(_fallbackOracle);

require(
_lowerBound < _upperBound,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not an unlikely scenario that one might want to set _lowerBound = _upperBound = 1, and currently it is not possible.
Currently it is not our plan, and can also easily workaround it with a 1 wei delta, but consider using <= instead of <.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really?

then once the oracle reserves change, the oracle will fallback

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that the idea

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't reserves increase over time though as LBTC is yield bearing, so the lower and upper bound being the same would mean that once the oracle updates and price increases, we use the fallback price, which isn't really intended behavior?

int256 public upperBound;

/// @notice Scaling factor for price calculations
uint8 public constant decimals = 18;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my mistake, it should be 8, to match redstone's PoR.
it would also work with 18, but then we might get confused with lower/upper bound configuration, as they will have to be with 18 decimals and not 8.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I can move to 8 decimals.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then I can remove decimal normalization

@ElliotFriedman ElliotFriedman marked this pull request as ready for review December 31, 2024 17:37
Copy link

Compiling 4 files with Solc 0.8.19
Solc 0.8.19 finished in 9.10ms
Compiler run successful!
Script ran successfully.
Gas used: 33319663

If you wish to simulate on-chain transactions pass a RPC URL.

Copy link
Collaborator

@anajuliabit anajuliabit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@anajuliabit anajuliabit merged commit c4befa5 into main Dec 31, 2024
22 checks passed
@anajuliabit anajuliabit deleted the feat/lbtc-oracle branch December 31, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants