Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions contracts/src/deployers/HyperdriveDeployerCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IHyperdrive } from "../interfaces/IHyperdrive.sol";
import { IHyperdriveCoreDeployer } from "../interfaces/IHyperdriveCoreDeployer.sol";
import { IHyperdriveDeployerCoordinator } from "../interfaces/IHyperdriveDeployerCoordinator.sol";
import { IHyperdriveTargetDeployer } from "../interfaces/IHyperdriveTargetDeployer.sol";
import { ONE } from "../libraries/FixedPointMath.sol";

/// @author DELV
/// @title HyperdriveDeployerCoordinator
Expand Down Expand Up @@ -342,10 +343,10 @@ abstract contract HyperdriveDeployerCoordinator is

// Ensure that the fees don't exceed 100%.
if (
_deployConfig.fees.curve > 1e18 ||
_deployConfig.fees.flat > 1e18 ||
_deployConfig.fees.governanceLP > 1e18 ||
_deployConfig.fees.governanceZombie > 1e18
_deployConfig.fees.curve > ONE ||
_deployConfig.fees.flat > ONE ||
_deployConfig.fees.governanceLP > ONE ||
_deployConfig.fees.governanceZombie > ONE
) {
revert IHyperdriveDeployerCoordinator.InvalidFeeAmounts();
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/internal/HyperdriveLong.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IHyperdrive } from "../interfaces/IHyperdrive.sol";
import { IHyperdriveEvents } from "../interfaces/IHyperdriveEvents.sol";
import { AssetId } from "../libraries/AssetId.sol";
import { Errors } from "../libraries/Errors.sol";
import { FixedPointMath } from "../libraries/FixedPointMath.sol";
import { FixedPointMath, ONE } from "../libraries/FixedPointMath.sol";
import { HyperdriveMath } from "../libraries/HyperdriveMath.sol";
import { SafeCast } from "../libraries/SafeCast.sol";
import { HyperdriveLP } from "./HyperdriveLP.sol";
Expand Down Expand Up @@ -256,7 +256,7 @@ abstract contract HyperdriveLong is IHyperdriveEvents, HyperdriveLP {
)
.updateWeightedAverage(
uint256(longsOutstanding_),
_maturityTime * 1e18, // scale up to fixed point scale
_maturityTime * ONE, // scale up to fixed point scale
_bondReservesDelta,
true
)
Expand Down Expand Up @@ -346,7 +346,7 @@ abstract contract HyperdriveLong is IHyperdriveEvents, HyperdriveLP {
)
.updateWeightedAverage(
longsOutstanding,
_maturityTime * 1e18, // scale up to fixed point scale
_maturityTime * ONE, // scale up to fixed point scale
_bondAmount,
false
)
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/internal/HyperdriveShort.sol
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ abstract contract HyperdriveShort is IHyperdriveEvents, HyperdriveLP {
)
.updateWeightedAverage(
_marketState.shortsOutstanding,
_maturityTime * 1e18, // scale up to fixed point scale
_maturityTime * ONE, // scale up to fixed point scale
_bondAmount,
true
)
Expand Down Expand Up @@ -360,7 +360,7 @@ abstract contract HyperdriveShort is IHyperdriveEvents, HyperdriveLP {
)
.updateWeightedAverage(
shortsOutstanding_,
_maturityTime * 1e18, // scale up to fixed point scale
_maturityTime * ONE, // scale up to fixed point scale
_bondAmount,
false
)
Expand Down
8 changes: 4 additions & 4 deletions contracts/src/libraries/FixedPointMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ library FixedPointMath {
/// @param b Fixed point number in 1e18 format.
/// @return Result of a * b rounded down.
function mulDown(uint256 a, uint256 b) internal pure returns (uint256) {
return (mulDivDown(a, b, 1e18));
return (mulDivDown(a, b, ONE));
}

/// @param a Fixed point number in 1e18 format.
/// @param b Fixed point number in 1e18 format.
/// @return Result of a / b rounded down.
function divDown(uint256 a, uint256 b) internal pure returns (uint256) {
return (mulDivDown(a, 1e18, b)); // Equivalent to (a * 1e18) / b rounded down.
return (mulDivDown(a, ONE, b)); // Equivalent to (a * 1e18) / b rounded down.
}

/// @param x Fixed point number in 1e18 format.
Expand Down Expand Up @@ -84,14 +84,14 @@ library FixedPointMath {
/// @param b Fixed point number in 1e18 format.
/// @return The result of a * b rounded up.
function mulUp(uint256 a, uint256 b) internal pure returns (uint256) {
return (mulDivUp(a, b, 1e18));
return (mulDivUp(a, b, ONE));
}

/// @param a Fixed point number in 1e18 format.
/// @param b Fixed point number in 1e18 format.
/// @return The result of a / b rounded up.
function divUp(uint256 a, uint256 b) internal pure returns (uint256) {
return (mulDivUp(a, 1e18, b));
return (mulDivUp(a, ONE, b));
}

/// @dev Exponentiation (x^y) with unsigned 18 decimal fixed point base and exponent.
Expand Down