Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix l3 #217

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 2 additions & 3 deletions src/services/debit/AaveService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();

Expand Down
5 changes: 2 additions & 3 deletions src/services/debit/AngleService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions src/services/debit/BalancerService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 2 additions & 3 deletions src/services/debit/FraxlendService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions src/services/debit/GmxService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/services/neutral/FeeCollectorService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 0 additions & 3 deletions test/services/AaveService.economic.test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 0 additions & 3 deletions test/services/AaveService.general.test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 0 additions & 5 deletions test/services/DebitCredit.test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading