From cdd35555d9ba89918996d174590b9e8ec1bab5ca Mon Sep 17 00:00:00 2001 From: OxMarco <> Date: Fri, 15 Dec 2023 18:42:08 +0100 Subject: [PATCH] fix l3 --- src/services/debit/AaveService.sol | 5 ++--- src/services/debit/AngleService.sol | 5 ++--- src/services/debit/BalancerService.sol | 3 +-- src/services/debit/FraxlendService.sol | 5 ++--- src/services/debit/GmxService.sol | 3 +-- src/services/neutral/FeeCollectorService.sol | 1 - test/services/AaveService.economic.test.sol | 3 --- test/services/AaveService.general.test.sol | 3 --- test/services/DebitCredit.test.sol | 5 ----- 9 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/services/debit/AaveService.sol b/src/services/debit/AaveService.sol index 87b91beb..92e07331 100644 --- a/src/services/debit/AaveService.sol +++ b/src/services/debit/AaveService.sol @@ -7,12 +7,11 @@ import { IAToken } from "../../interfaces/external/aave/IAToken.sol"; import { AuctionRateModel } from "../../irmodels/AuctionRateModel.sol"; import { DebitService } from "../DebitService.sol"; import { Service } from "../Service.sol"; -import { Whitelisted } from "../Whitelisted.sol"; /// @title AaveService contract /// @author Ithil /// @notice A service to perform leveraged staking on any Aave markets -contract AaveService is Whitelisted, AuctionRateModel, DebitService { +contract AaveService is AuctionRateModel, DebitService { using SafeERC20 for IERC20; IPool public immutable aave; @@ -31,7 +30,7 @@ contract AaveService is Whitelisted, AuctionRateModel, DebitService { aave = IPool(_aave); } - function _open(Agreement memory agreement, bytes memory /*data*/) internal override onlyWhitelisted { + function _open(Agreement memory agreement, bytes memory /*data*/) internal override { if (agreement.loans.length != 1) revert InvalidArguments(); if (agreement.collaterals.length != 1) revert InvalidArguments(); diff --git a/src/services/debit/AngleService.sol b/src/services/debit/AngleService.sol index 49fa252b..b87d14d3 100644 --- a/src/services/debit/AngleService.sol +++ b/src/services/debit/AngleService.sol @@ -6,12 +6,11 @@ import { IERC4626 } from "@openzeppelin/contracts/interfaces/IERC4626.sol"; import { AuctionRateModel } from "../../irmodels/AuctionRateModel.sol"; import { DebitService } from "../DebitService.sol"; import { Service } from "../Service.sol"; -import { Whitelisted } from "../Whitelisted.sol"; /// @title AngleService contract /// @author Ithil /// @notice A service to perform leveraged staking of agEur on Angle -contract AngleService is Whitelisted, AuctionRateModel, DebitService { +contract AngleService is AuctionRateModel, DebitService { using SafeERC20 for IERC20; IERC4626 public immutable stEur; @@ -32,7 +31,7 @@ contract AngleService is Whitelisted, AuctionRateModel, DebitService { agEur.approve(address(stEur), type(uint256).max); } - function _open(Agreement memory agreement, bytes memory /*data*/) internal override onlyWhitelisted { + function _open(Agreement memory agreement, bytes memory /*data*/) internal override { if (agreement.loans.length != 1) revert InvalidArguments(); if (agreement.collaterals.length != 1) revert InvalidArguments(); if (agreement.loans[0].token != address(agEur)) revert IncorrectProvidedToken(); diff --git a/src/services/debit/BalancerService.sol b/src/services/debit/BalancerService.sol index d8e185c4..c178f759 100644 --- a/src/services/debit/BalancerService.sol +++ b/src/services/debit/BalancerService.sol @@ -16,12 +16,11 @@ import { WeightedMath } from "../../libraries/external/Balancer/WeightedMath.sol import { AuctionRateModel } from "../../irmodels/AuctionRateModel.sol"; import { Service } from "../Service.sol"; import { DebitService } from "../DebitService.sol"; -import { Whitelisted } from "../Whitelisted.sol"; /// @title BalancerService contract /// @author Ithil /// @notice A service to perform leveraged lping on any Balancer pool -contract BalancerService is Whitelisted, AuctionRateModel, DebitService { +contract BalancerService is AuctionRateModel, DebitService { using SafeERC20 for IERC20; using SafeERC20 for IBalancerPool; diff --git a/src/services/debit/FraxlendService.sol b/src/services/debit/FraxlendService.sol index ebca06de..dba10edc 100644 --- a/src/services/debit/FraxlendService.sol +++ b/src/services/debit/FraxlendService.sol @@ -6,12 +6,11 @@ import { IERC4626 } from "@openzeppelin/contracts/interfaces/IERC4626.sol"; import { AuctionRateModel } from "../../irmodels/AuctionRateModel.sol"; import { DebitService } from "../DebitService.sol"; import { Service } from "../Service.sol"; -import { Whitelisted } from "../Whitelisted.sol"; /// @title FraxlendService contract /// @author Ithil /// @notice A service to perform leveraged staking of FRAX on Fraxlend -contract FraxlendService is Whitelisted, AuctionRateModel, DebitService { +contract FraxlendService is AuctionRateModel, DebitService { using SafeERC20 for IERC20; IERC4626 public immutable fraxLend; @@ -32,7 +31,7 @@ contract FraxlendService is Whitelisted, AuctionRateModel, DebitService { frax.approve(address(fraxLend), type(uint256).max); } - function _open(Agreement memory agreement, bytes memory /*data*/) internal override onlyWhitelisted { + function _open(Agreement memory agreement, bytes memory /*data*/) internal override { if (agreement.loans.length != 1) revert InvalidArguments(); if (agreement.collaterals.length != 1) revert InvalidArguments(); if (agreement.loans[0].token != address(frax)) revert IncorrectProvidedToken(); diff --git a/src/services/debit/GmxService.sol b/src/services/debit/GmxService.sol index a9c459ac..cbeeab02 100644 --- a/src/services/debit/GmxService.sol +++ b/src/services/debit/GmxService.sol @@ -12,12 +12,11 @@ import { import { AuctionRateModel } from "../../irmodels/AuctionRateModel.sol"; import { DebitService } from "../DebitService.sol"; import { Service } from "../Service.sol"; -import { Whitelisted } from "../Whitelisted.sol"; /// @title GmxService contract /// @author Ithil /// @notice A service to perform margin trading on the GLP token -contract GmxService is Whitelisted, AuctionRateModel, DebitService { +contract GmxService is AuctionRateModel, DebitService { using SafeERC20 for IERC20; IRewardRouter public immutable router; diff --git a/src/services/neutral/FeeCollectorService.sol b/src/services/neutral/FeeCollectorService.sol index 284f669e..9759fb3d 100644 --- a/src/services/neutral/FeeCollectorService.sol +++ b/src/services/neutral/FeeCollectorService.sol @@ -8,7 +8,6 @@ import { IVault } from "../../interfaces/IVault.sol"; import { IOracle } from "../../interfaces/IOracle.sol"; import { IFactory } from "../../interfaces/external/wizardex/IFactory.sol"; import { IPool } from "../../interfaces/external/wizardex/IPool.sol"; -import { Whitelisted } from "../Whitelisted.sol"; import { Service } from "../Service.sol"; import { VeIthil } from "../../VeIthil.sol"; diff --git a/test/services/AaveService.economic.test.sol b/test/services/AaveService.economic.test.sol index 26a971dd..b2d2a188 100644 --- a/test/services/AaveService.economic.test.sol +++ b/test/services/AaveService.economic.test.sol @@ -63,9 +63,6 @@ contract AaveEconomicTest is Test, IERC721Receiver { service.setRiskParams(loanTokens[0], 5e15, 1e16, 365 * 30); vm.stopPrank(); } - vm.prank(admin); - (bool success, ) = address(service).call(abi.encodeWithSignature("toggleWhitelistFlag()")); - require(success, "toggleWhitelistFlag failed"); } function onERC721Received( diff --git a/test/services/AaveService.general.test.sol b/test/services/AaveService.general.test.sol index 2e0301c8..77071a63 100644 --- a/test/services/AaveService.general.test.sol +++ b/test/services/AaveService.general.test.sol @@ -65,9 +65,6 @@ contract AaveGeneralTest is Test, IERC721Receiver { service.setMinMargin(loanTokens[0], 1e6); // Minimum 1 DAI vm.stopPrank(); } - vm.prank(admin); - (bool success, ) = address(service).call(abi.encodeWithSignature("toggleWhitelistFlag()")); - require(success, "toggleWhitelistFlag failed"); } function onERC721Received( diff --git a/test/services/DebitCredit.test.sol b/test/services/DebitCredit.test.sol index be3ca181..bcdaeebd 100644 --- a/test/services/DebitCredit.test.sol +++ b/test/services/DebitCredit.test.sol @@ -125,11 +125,6 @@ contract DebitCreditTest is Test, IERC721Receiver { callOptionService.allocateIthil(1e7 * 1e18); callOptionService.transferOwnership(treasury); - // whitelist user for Aave and Gmx - address[] memory whitelistedUsers = new address[](1); - whitelistedUsers[0] = aaveUser; - aaveService.addToWhitelist(whitelistedUsers); - // whitelist Aave strategy for 20% exposure in USDC manager.setCap(address(aaveService), address(usdc), 2e17, type(uint256).max); // we also need to whitelist call option and fee collector