From d46ecdb85315f129abf3ef6b10a5737a05505703 Mon Sep 17 00:00:00 2001 From: Christopher Mooney Date: Fri, 5 Aug 2022 11:50:47 -0400 Subject: [PATCH 1/3] cmooney-20220805: Fixes for CS 5.4 Inconsistencies --- src/pools/D3MAavePool.sol | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pools/D3MAavePool.sol b/src/pools/D3MAavePool.sol index 48cd9b04..41487d87 100644 --- a/src/pools/D3MAavePool.sol +++ b/src/pools/D3MAavePool.sol @@ -87,12 +87,13 @@ contract D3MAavePool is ID3MPool { event Collect(address indexed king, address indexed gift, uint256 amt); constructor(address hub_, address dai_, address pool_) { - pool = LendingPoolLike(pool_); dai = TokenLike(dai_); + pool = LendingPoolLike(pool_); // Fetch the reserve data from Aave - (,,,,,,, address adai_, address stableDebt_, address variableDebt_, ,) = pool.getReserveData(dai_); - require(stableDebt_ != address(0), "D3MAavePool/invalid-stableDebt"); + (,,,,,,, address adai_, address stableDebt_, address variableDebt_,,) = pool.getReserveData(dai_); + require(adai_ != address(0), "D3MAavePool/invalid-adai"); + require(stableDebt_ != address(0), "D3MAavePool/invalid-stableDebt"); require(variableDebt_ != address(0), "D3MAavePool/invalid-variableDebt"); adai = ATokenLike(adai_); From e2bf302792e300c64d123b3f59f09a811646df99 Mon Sep 17 00:00:00 2001 From: Christopher Mooney Date: Fri, 5 Aug 2022 12:38:02 -0400 Subject: [PATCH 2/3] bound bar in AAVE plan to MAX_BORROW_RATE --- src/plans/D3MAavePlan.sol | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plans/D3MAavePlan.sol b/src/plans/D3MAavePlan.sol index 90e59e04..c5e37bb6 100644 --- a/src/plans/D3MAavePlan.sol +++ b/src/plans/D3MAavePlan.sol @@ -66,6 +66,8 @@ contract D3MAavePlan is ID3MPlan { address public immutable adai; uint256 public immutable adaiRevision; + uint256 internal constant MAX_BORROW_RATE = RAY; // 100% + // --- Events --- event Rely(address indexed usr); event Deny(address indexed usr); @@ -118,8 +120,10 @@ contract D3MAavePlan is ID3MPlan { } function file(bytes32 what, uint256 data) external auth { - if (what == "bar") bar = data; - else revert("D3MAavePlan/file-unrecognized-param"); + if (what == "bar") { + require(data <= MAX_BORROW_RATE, "D3MAavePlan/bar-too-high"); + bar = data; + } else revert("D3MAavePlan/file-unrecognized-param"); emit File(what, data); } function file(bytes32 what, address data) external auth { From 1fa764caeef130bc7fa0f8b7452c446959e67269 Mon Sep 17 00:00:00 2001 From: Christopher Mooney Date: Fri, 5 Aug 2022 14:21:48 -0400 Subject: [PATCH 3/3] Revert "bound bar in AAVE plan to MAX_BORROW_RATE" This reverts commit e2bf302792e300c64d123b3f59f09a811646df99. --- src/plans/D3MAavePlan.sol | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/plans/D3MAavePlan.sol b/src/plans/D3MAavePlan.sol index c5e37bb6..90e59e04 100644 --- a/src/plans/D3MAavePlan.sol +++ b/src/plans/D3MAavePlan.sol @@ -66,8 +66,6 @@ contract D3MAavePlan is ID3MPlan { address public immutable adai; uint256 public immutable adaiRevision; - uint256 internal constant MAX_BORROW_RATE = RAY; // 100% - // --- Events --- event Rely(address indexed usr); event Deny(address indexed usr); @@ -120,10 +118,8 @@ contract D3MAavePlan is ID3MPlan { } function file(bytes32 what, uint256 data) external auth { - if (what == "bar") { - require(data <= MAX_BORROW_RATE, "D3MAavePlan/bar-too-high"); - bar = data; - } else revert("D3MAavePlan/file-unrecognized-param"); + if (what == "bar") bar = data; + else revert("D3MAavePlan/file-unrecognized-param"); emit File(what, data); } function file(bytes32 what, address data) external auth {