Skip to content

Commit

Permalink
Fix unit conversion issue in bitshift operation
Browse files Browse the repository at this point in the history
  • Loading branch information
stevieraykatz committed Aug 11, 2024
1 parent 74310cb commit 1e46dc1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/L2/LaunchAuctionPriceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ contract LaunchAuctionPriceOracle is StablePriceOracle {
constructor(uint256[] memory rentPrices, uint256 startPremium_, uint256 totalHours) StablePriceOracle(rentPrices) {
startPremium = startPremium_;
if ((totalHours * 1 hours) % PRICE_PREMIUM_HALF_LIFE != 0) revert InvalidDuration();
endValue = startPremium >> (totalHours / PRICE_PREMIUM_HALF_LIFE);
endValue = startPremium >> ((totalHours * 1 hours) / PRICE_PREMIUM_HALF_LIFE);
}

/// @notice The internal method for calculating pricing premium
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ contract LaunchAuctionPriceOracleBase is Test {
uint256 startPremium = 100 ether;
uint256 totalHours = 36;

uint256 hoursPerDay = 24;

/// @notice The half-life of the premium price decay
uint256 constant PRICE_PREMIUM_HALF_LIFE = 1.5 hours;
uint256 constant PER_PERIOD_DECAY_PERCENT_WAD = FixedPointMathLib.WAD / 2;
Expand All @@ -33,7 +31,7 @@ contract LaunchAuctionPriceOracleBase is Test {

function test_constructor() public view {
assertEq(oracle.startPremium(), startPremium);
assertEq(oracle.endValue(), startPremium >> (totalHours / PRICE_PREMIUM_HALF_LIFE));
assertEq(oracle.endValue(), startPremium >> ((totalHours * 1 hours) / PRICE_PREMIUM_HALF_LIFE));
assertEq(oracle.price1Letter(), rent1);
assertEq(oracle.price2Letter(), rent2);
assertEq(oracle.price3Letter(), rent3);
Expand Down

0 comments on commit 1e46dc1

Please sign in to comment.