Skip to content

feat: adjusted aggregator contract for price adjustments based on sig…#201

Merged
dmytro-horbatenko merged 1 commit intomainfrom
feat/adjusted-feed
Apr 3, 2026
Merged

feat: adjusted aggregator contract for price adjustments based on sig…#201
dmytro-horbatenko merged 1 commit intomainfrom
feat/adjusted-feed

Conversation

@dmytro-horbatenko
Copy link
Copy Markdown
Contributor

…ned percentage

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the existing discount-based aggregator feed into a more flexible adjustment-based feed, supporting both price lowering and raising via signed percentages. The changes include updating the contract logic, deployment scripts, and test suites to accommodate the new functionality. I have reviewed the implementation and suggest caching the denominator used in the adjustment calculation as an immutable variable during construction to optimize gas usage, as the current implementation performs redundant external calls and exponentiation on every data retrieval.

Comment on lines +133 to 134
int256 adjustment = (_answer * adjustmentPercentage) /
int256(100 * 10**decimals());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The calculation of the adjustment denominator involves an external call to decimals() on every execution of latestRoundData and getRoundData. Since the underlyingFeed is immutable and its decimals are constant for a given feed, this value should be cached in an immutable variable during construction to save gas.

@dmytro-horbatenko dmytro-horbatenko merged commit 963e810 into main Apr 3, 2026
4 checks passed
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.

2 participants