From 038442d2628dcf78c6700675630844f932ef940b Mon Sep 17 00:00:00 2001 From: Zer0dot Date: Thu, 26 Jan 2023 10:53:00 -0500 Subject: [PATCH] fix: Adapt maxFlashLoan to match standard. (#252) --- src/contracts/facilitators/flashMinter/GhoFlashMinter.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/contracts/facilitators/flashMinter/GhoFlashMinter.sol b/src/contracts/facilitators/flashMinter/GhoFlashMinter.sol index 0350b7d9..f7d9d3b0 100644 --- a/src/contracts/facilitators/flashMinter/GhoFlashMinter.sol +++ b/src/contracts/facilitators/flashMinter/GhoFlashMinter.sol @@ -77,7 +77,9 @@ contract GhoFlashMinter is IGhoFlashMinter { return 0; } else { IGhoToken.Facilitator memory flashMinterFacilitator = GHO_TOKEN.getFacilitator(address(this)); - return flashMinterFacilitator.bucketCapacity - flashMinterFacilitator.bucketLevel; + uint256 capacity = flashMinterFacilitator.bucketCapacity; + uint256 level = flashMinterFacilitator.bucketLevel; + return capacity > level ? capacity - level : 0; } }