From 243d731d867b93ac3dcc25844b32545de30e2d77 Mon Sep 17 00:00:00 2001 From: padraic Date: Wed, 8 Feb 2023 11:09:41 +0000 Subject: [PATCH] Compute baseReserves using FixedPointMath --- contracts/Hyperdrive.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/Hyperdrive.sol b/contracts/Hyperdrive.sol index e1c02f872..4452d7386 100644 --- a/contracts/Hyperdrive.sol +++ b/contracts/Hyperdrive.sol @@ -280,7 +280,7 @@ contract Hyperdrive is MultiToken { // Since the base buffer may have increased relative to the base // reserves and the bond reserves decreased, we must ensure that the // base reserves are greater than the longsOutstanding. - if (sharePrice * shareReserves >= longsOutstanding) { + if (sharePrice.mulDown(shareReserves) >= longsOutstanding) { revert Errors.BaseBufferExceedsShareReserves(); } @@ -381,7 +381,7 @@ contract Hyperdrive is MultiToken { // Since the share reserves are reduced, we need to verify that the base // reserves are greater than or equal to the amount of longs outstanding. - if (sharePrice * shareReserves >= longsOutstanding) { + if (sharePrice.mulDown(shareReserves) >= longsOutstanding) { revert Errors.BaseBufferExceedsShareReserves(); }