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

add piTokenCallback to PowerIndexRouter.sol #12

Merged
merged 12 commits into from
Aug 5, 2022

Conversation

defi-dev
Copy link
Contributor

@defi-dev defi-dev commented May 1, 2022

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented May 1, 2022

Codecov Report

Merging #12 (b35977d) into master (cd80fac) will decrease coverage by 0.36%.
The diff coverage is 79.16%.

@@            Coverage Diff             @@
##           master      #12      +/-   ##
==========================================
- Coverage   84.18%   83.82%   -0.37%     
==========================================
  Files          11       11              
  Lines         569      581      +12     
  Branches       95       99       +4     
==========================================
+ Hits          479      487       +8     
- Misses         90       94       +4     
Impacted Files Coverage Δ
contracts/connectors/TornPowerIndexConnector.sol 80.55% <ø> (-0.27%) ⬇️
contracts/PowerIndexRouter.sol 90.34% <77.27%> (-1.16%) ⬇️
contracts/WrappedPiErc20.sol 85.56% <100.00%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cd80fac...b35977d. Read the comment docs.

Copy link

@eMarchenko eMarchenko left a comment

Choose a reason for hiding this comment

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

Please check the comment, it describes a potential minor issue.

Besides, PowerIndexRouter contract includes HUNDRED_PCT = 1 ether constant. However, the code includes 1 ether and 0.1 ether multipliers. Consider replacing them with HUNDRED_PCT-based values.

@@ -766,6 +794,7 @@ contract PowerIndexRouter is PowerIndexRouterInterface, PowerIndexNaiveRouter {
{
require(_reserveRatioPct <= HUNDRED_PCT, "RR_GREATER_THAN_100_PCT");
expectedStakeAmount = getExpectedStakeAmount(_reserveRatioPct, _leftOnPiToken, _totalStakedBalance, _share);
expectedStakeAmount = expectedStakeAmount.add(_addToExpectedStakeAmount.mul(_share).div(1 ether));

Choose a reason for hiding this comment

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

It seems that _addToExpectedStakeAmount value is processed incorrectly, as this line doesn't account for reserve %.
In this case consider adding _addToExpectedStakeAmount value to either _leftOnPiToken of _totalStakedBalance at the line above.

@defi-dev defi-dev force-pushed the torn-connector-audit-fixes branch from ac00a61 to 283320c Compare May 3, 2022 13:50
@defi-lead defi-lead merged commit d7104f8 into master Aug 5, 2022
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.

4 participants