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
3 changes: 1 addition & 2 deletions contracts/src/internal/HyperdriveBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ abstract contract HyperdriveBase is IHyperdriveEvents, HyperdriveStorage {
// The global long exposure is the sum of the non-netted longs in each
// checkpoint. To update this value, we subtract the current value
// (`_before.max(0)`) and add the new value (`_after.max(0)`).
int128 delta = (int256(_after.max(0)) - int256(_before.max(0)))
.toInt128();
int128 delta = (_after.max(0) - _before.max(0)).toInt128();
if (delta > 0) {
_marketState.longExposure += uint128(delta);
} else if (delta < 0) {
Expand Down
5 changes: 2 additions & 3 deletions contracts/src/internal/HyperdriveLP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,9 @@ abstract contract HyperdriveLP is
// NOTE: Round down to underestimate the share proceeds.
//
// The LP gets the pro-rata amount of the collected proceeds.
uint128 proceeds_ = _withdrawPool.proceeds;
uint256 shareProceeds = withdrawalSharesRedeemed.mulDivDown(
uint128(proceeds_),
uint128(readyToWithdraw_)
_withdrawPool.proceeds,
readyToWithdraw_
);

// Apply the update to the withdrawal pool.
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/internal/HyperdriveLong.sol
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ abstract contract HyperdriveLong is IHyperdriveEvents, HyperdriveLP {
_marketState.longAverageMaturityTime
)
.updateWeightedAverage(
uint256(longsOutstanding_),
longsOutstanding_,
_maturityTime * ONE, // scale up to fixed point scale
_bondReservesDelta,
true
Expand Down
10 changes: 4 additions & 6 deletions contracts/src/libraries/AssetId.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ library AssetId {
} else if (prefix == AssetIdPrefix.Short) {
_name = string(abi.encodePacked("Hyperdrive Short: ", _timestamp));
} else if (prefix == AssetIdPrefix.WithdrawalShare) {
_name = string(abi.encodePacked("Hyperdrive Withdrawal Share"));
_name = "Hyperdrive Withdrawal Share";
}
}

Expand All @@ -97,7 +97,7 @@ library AssetId {
} else if (prefix == AssetIdPrefix.Short) {
_name = string(abi.encodePacked("HYPERDRIVE-SHORT:", _timestamp));
} else if (prefix == AssetIdPrefix.WithdrawalShare) {
_name = string(abi.encodePacked("HYPERDRIVE-WS"));
_name = "HYPERDRIVE-WS";
}
}

Expand All @@ -115,14 +115,12 @@ library AssetId {

// Loop through the integer and add each digit to the raw result,
// starting at the end of the string and working towards the beginning.
rawResult[maxStringLength - 1] = bytes1(
uint8(uint256((_num % 10) + 48))
);
rawResult[maxStringLength - 1] = bytes1(uint8((_num % 10) + 48));
_num /= 10;
uint256 digits = 1;
while (_num != 0) {
rawResult[maxStringLength - digits - 1] = bytes1(
uint8(uint256((_num % 10) + 48))
uint8((_num % 10) + 48)
);
_num /= 10;
digits++;
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/libraries/LPMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ library LPMath {
// NOTE: Rounding down to avoid introducing dust into the
// computation.
shareAdjustment = int256(
uint256(shareReserves).mulDivDown(
shareReserves.mulDivDown(
uint256(_shareAdjustment),
_shareReserves
)
Expand All @@ -86,7 +86,7 @@ library LPMath {
// NOTE: Rounding down to avoid introducing dust into the
// computation.
shareAdjustment = -int256(
uint256(shareReserves).mulDivDown(
shareReserves.mulDivDown(
uint256(-_shareAdjustment),
_shareReserves
)
Expand Down