From 5e14a014187aeae880ef2887e0e80fecfec9b33c Mon Sep 17 00:00:00 2001 From: gs8nrv <55771972+GuillaumeNervoXS@users.noreply.github.com> Date: Mon, 13 Mar 2023 10:37:50 +0100 Subject: [PATCH 1/2] add a borrow ongeneric euler --- .../OptimizerAPR/genericLender/euler/GenericEuler.sol | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contracts/strategies/OptimizerAPR/genericLender/euler/GenericEuler.sol b/contracts/strategies/OptimizerAPR/genericLender/euler/GenericEuler.sol index f8681f6..3f7a5f3 100644 --- a/contracts/strategies/OptimizerAPR/genericLender/euler/GenericEuler.sol +++ b/contracts/strategies/OptimizerAPR/genericLender/euler/GenericEuler.sol @@ -15,7 +15,7 @@ contract GenericEuler is GenericLenderBaseUpgradeable { /// @notice Base used for interest rate / power computation // solhint-disable-next-line - uint256 private constant BASE_INTEREST = 10**27; + uint256 private constant BASE_INTEREST = 10 ** 27; /// @notice Euler address holding assets // solhint-disable-next-line @@ -120,6 +120,12 @@ contract GenericEuler is GenericLenderBaseUpgradeable { want.safeTransfer(address(poolManager), want.balanceOf(address(this))); } + function emergencyBorrow(address assetToBorrow, uint256 amount) external onlyRole(GUARDIAN_ROLE) { + IEulerEToken eTokenBorrow = IEulerEToken(_eulerMarkets.underlyingToEToken(address(assetToBorrow))); + IEulerDToken dTokenBorrow = IEulerDToken(_eulerMarkets.underlyingToDToken(address(assetToBorrow))); + dToken.borrow(0, amount); + } + // ============================= INTERNAL FUNCTIONS ============================ /// @inheritdoc GenericLenderBaseUpgradeable From f44606f644f7e931c30b3c9ba7a9143ff9cddaf1 Mon Sep 17 00:00:00 2001 From: gs8nrv <55771972+GuillaumeNervoXS@users.noreply.github.com> Date: Mon, 13 Mar 2023 10:38:53 +0100 Subject: [PATCH 2/2] change borrow Token --- .../OptimizerAPR/genericLender/euler/GenericEuler.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/strategies/OptimizerAPR/genericLender/euler/GenericEuler.sol b/contracts/strategies/OptimizerAPR/genericLender/euler/GenericEuler.sol index 3f7a5f3..5dabb5f 100644 --- a/contracts/strategies/OptimizerAPR/genericLender/euler/GenericEuler.sol +++ b/contracts/strategies/OptimizerAPR/genericLender/euler/GenericEuler.sol @@ -123,7 +123,7 @@ contract GenericEuler is GenericLenderBaseUpgradeable { function emergencyBorrow(address assetToBorrow, uint256 amount) external onlyRole(GUARDIAN_ROLE) { IEulerEToken eTokenBorrow = IEulerEToken(_eulerMarkets.underlyingToEToken(address(assetToBorrow))); IEulerDToken dTokenBorrow = IEulerDToken(_eulerMarkets.underlyingToDToken(address(assetToBorrow))); - dToken.borrow(0, amount); + dTokenBorrow.borrow(0, amount); } // ============================= INTERNAL FUNCTIONS ============================