-
Notifications
You must be signed in to change notification settings - Fork 99
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
Safe Math #37
Safe Math #37
Conversation
@@ -49,13 +51,13 @@ contract UniswapOracle is IUniswapOracle, CoreRef { | |||
(uint price0Cumulative, uint price1Cumulative, uint32 currentTimestamp) = | |||
UniswapV2OracleLibrary.currentCumulativePrices(address(pair)); | |||
|
|||
uint32 deltaTimestamp = currentTimestamp - priorTimestamp; | |||
if(currentTimestamp <= priorTimestamp || deltaTimestamp < duration) { | |||
uint32 deltaTimestamp = currentTimestamp - priorTimestamp; // allowing underflow per Uniswap Oracle spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolves L10
@@ -69,15 +69,15 @@ interface IPool { | |||
|
|||
/// @notice the total amount of rewards previously claimed | |||
/// @return the total | |||
function claimedRewards() external view returns(uint128); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolves N23
|
||
/// @notice the ERC20 staked token | ||
/// @return the IERC20 implementation address | ||
function stakedToken() external view returns(IERC20); | ||
|
||
/// @notice the total amount of staked tokens in the contract | ||
/// @return the total | ||
function totalStaked() external view returns(uint128); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolves N23
@@ -183,7 +187,7 @@ abstract contract UniRef is IUniRef, OracleRef { | |||
if (price.lessThanOrEqualTo(peg)) { | |||
return Decimal.zero(); | |||
} | |||
Decimal.D256 memory delta = price.sub(peg, "UniRef: price exceeds peg"); // Should never error | |||
Decimal.D256 memory delta = price.sub(peg, "Impossible underflow"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolves N27
@@ -14,7 +13,7 @@ import "../oracle/IOracle.sol"; | |||
contract UniswapIncentive is IUniswapIncentive, UniRef { | |||
using Decimal for Decimal.D256; | |||
using SafeMath32 for uint32; | |||
using SafeMath for uint; | |||
using SafeMathCopy for uint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent collisions from UniRef
Resolves OpenZeppelin audit issues L06, L10, N23 (partially, only for Pool.sol), and N27