From e22b0bff0cf87bc5f9bc5ed255297fe7793dabce Mon Sep 17 00:00:00 2001 From: Shriya Tyagi Date: Tue, 18 Oct 2022 03:38:20 +0400 Subject: [PATCH] Removed claim func + fix cETH --- .../mainnet/connectors/morpho-aave/events.sol | 6 --- .../connectors/morpho-aave/interface.sol | 4 -- .../mainnet/connectors/morpho-aave/main.sol | 27 ------------ .../connectors/morpho-compound/events.sol | 6 --- .../connectors/morpho-compound/interface.sol | 5 --- .../connectors/morpho-compound/main.sol | 43 ++++--------------- 6 files changed, 8 insertions(+), 83 deletions(-) diff --git a/contracts/mainnet/connectors/morpho-aave/events.sol b/contracts/mainnet/connectors/morpho-aave/events.sol index ce802964..3783a80f 100644 --- a/contracts/mainnet/connectors/morpho-aave/events.sol +++ b/contracts/mainnet/connectors/morpho-aave/events.sol @@ -70,10 +70,4 @@ contract Events { uint256 getId, uint256 setId ); - - event LogClaimed( - address[] tokenAddresses, - bool tradeForMorphoToken, - uint256 claimedAmount - ); } diff --git a/contracts/mainnet/connectors/morpho-aave/interface.sol b/contracts/mainnet/connectors/morpho-aave/interface.sol index 0510c795..6e144d2c 100644 --- a/contracts/mainnet/connectors/morpho-aave/interface.sol +++ b/contracts/mainnet/connectors/morpho-aave/interface.sol @@ -31,10 +31,6 @@ interface IMorphoCore { address _onBehalf, uint256 _amount ) external; - - function claimRewards(address[] calldata _assets, bool _tradeForMorphoToken) - external - returns (uint256 claimedAmount); } interface IMorphoAaveLens { diff --git a/contracts/mainnet/connectors/morpho-aave/main.sol b/contracts/mainnet/connectors/morpho-aave/main.sol index ab46b492..05c70fa4 100644 --- a/contracts/mainnet/connectors/morpho-aave/main.sol +++ b/contracts/mainnet/connectors/morpho-aave/main.sol @@ -375,33 +375,6 @@ abstract contract MorphoAaveV2 is Helpers, Events { _setId ); } - - /** - * @dev Claim rewards. - * @notice Claim rewards for the given assets from underlying protocol. - * @param _poolTokenAddresses The assets to claim rewards from (aToken or variable debt token).(For ETH: aToken or variable debt token address of WETH) - * @param _tradeForMorphoToken Whether or not to trade reward tokens for MORPHO tokens. - */ - function claim( - address[] calldata _poolTokenAddresses, - bool _tradeForMorphoToken - ) - external - payable - returns (string memory _eventName, bytes memory _eventParam) - { - uint256 _claimedAmount = MORPHO_AAVE.claimRewards( - _poolTokenAddresses, - _tradeForMorphoToken - ); - - _eventName = "LogClaimed(address[],bool,uint256)"; - _eventParam = abi.encode( - _poolTokenAddresses, - _tradeForMorphoToken, - _claimedAmount - ); - } } contract ConnectV2MorphoAaveV2 is MorphoAaveV2 { diff --git a/contracts/mainnet/connectors/morpho-compound/events.sol b/contracts/mainnet/connectors/morpho-compound/events.sol index 41bec370..970c3f84 100644 --- a/contracts/mainnet/connectors/morpho-compound/events.sol +++ b/contracts/mainnet/connectors/morpho-compound/events.sol @@ -70,10 +70,4 @@ contract Events { uint256 getId, uint256 setId ); - - event LogClaimed( - address[] tokenAddresses, - bool tradeForMorphoToken, - uint256 amountOfRewards - ); } diff --git a/contracts/mainnet/connectors/morpho-compound/interface.sol b/contracts/mainnet/connectors/morpho-compound/interface.sol index 5a98876a..f2ec3df3 100644 --- a/contracts/mainnet/connectors/morpho-compound/interface.sol +++ b/contracts/mainnet/connectors/morpho-compound/interface.sol @@ -31,11 +31,6 @@ interface IMorphoCore { address _onBehalf, uint256 _amount ) external; - - function claimRewards( - address[] calldata _cTokenAddresses, - bool _tradeForMorphoToken - ) external returns (uint256 amountOfRewards); } interface IMorphoCompoundLens { diff --git a/contracts/mainnet/connectors/morpho-compound/main.sol b/contracts/mainnet/connectors/morpho-compound/main.sol index 4a8d61f1..15dc66f2 100644 --- a/contracts/mainnet/connectors/morpho-compound/main.sol +++ b/contracts/mainnet/connectors/morpho-compound/main.sol @@ -9,7 +9,7 @@ abstract contract MorphoCompound is Helpers, Events { * @dev Deposit ETH/ERC20_Token. * @notice Deposit a token to Morpho Compound for lending / collaterization. * @param _tokenAddress The address of underlying token to deposit.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) - * @param _poolTokenAddress The address of cToken to deposit.(For ETH: cWETH address) + * @param _poolTokenAddress The address of cToken to deposit.(For ETH: cETH address) * @param _amount The amount of the token (in underlying) to deposit. (For max: `uint256(-1)`) * @param _getId ID to retrieve amt. * @param _setId ID stores the amount of tokens deposited. @@ -50,7 +50,7 @@ abstract contract MorphoCompound is Helpers, Events { * @dev Deposit ETH/ERC20_Token. * @notice Deposit a token to Morpho Compound for lending / collaterization with max gas. * @param _tokenAddress The address of underlying token to deposit.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) - * @param _poolTokenAddress The address of cToken to deposit.(For ETH: cWETH address). + * @param _poolTokenAddress The address of cToken to deposit.(For ETH: cETH address). * @param _amount The amount of the token (in underlying) to deposit. (For max: `uint256(-1)`). * @param _maxGasForMatching The maximum amount of gas to consume within a matching engine loop. * @param _getId ID to retrieve amt. @@ -99,7 +99,7 @@ abstract contract MorphoCompound is Helpers, Events { * @dev Deposit ETH/ERC20_Token. * @notice Deposit a token to Morpho Compound for lending / collaterization on behalf of a user. * @param _tokenAddress The address of underlying token to deposit.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) - * @param _poolTokenAddress The address of cToken to deposit.(For ETH: cWETH address) + * @param _poolTokenAddress The address of cToken to deposit.(For ETH: cETH address) * @param _onBehalf The address of user on behalf to deposit. * @param _amount The amount of the token (in underlying) to deposit. (For max: `uint256(-1)`) * @param _getId ID to retrieve amt. @@ -143,7 +143,7 @@ abstract contract MorphoCompound is Helpers, Events { * @dev Borrow ETH/ERC20_Token. * @notice Borrow a token from Morpho Compound. * @param _tokenAddress The address of underlying token to borrow.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) - * @param _poolTokenAddress The address of cToken to borrow.(For ETH: cWETH address) + * @param _poolTokenAddress The address of cToken to borrow.(For ETH: cETH address) * @param _amount The amount of the token (in underlying) to borrow. * @param _getId ID to retrieve amt. * @param _setId ID stores the amount of tokens borrowed. @@ -181,7 +181,7 @@ abstract contract MorphoCompound is Helpers, Events { * @dev Borrow ETH/ERC20_Token. * @notice Borrow a token from Morpho Compound with max gas. * @param _tokenAddress The address of underlying token to borrow.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) - * @param _poolTokenAddress The address of cToken to borrow.(For ETH: cWETH address) + * @param _poolTokenAddress The address of cToken to borrow.(For ETH: cETH address) * @param _amount The amount of the token (in underlying) to borrow. * @param _maxGasForMatching The maximum amount of gas to consume within a matching engine loop. * @param _getId ID to retrieve amt. @@ -222,7 +222,7 @@ abstract contract MorphoCompound is Helpers, Events { * @dev Withdraw ETH/ERC20_Token. * @notice Withdraw a token from Morpho Compound. * @param _tokenAddress The address of underlying token to withdraw.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) - * @param _poolTokenAddress The address of cToken to withdraw.(For ETH: cWETH address) + * @param _poolTokenAddress The address of cToken to withdraw.(For ETH: cETH address) * @param _amount The amount of the token (in underlying) to withdraw. (For max: `uint256(-1)`) * @param _getId ID to retrieve amt. * @param _setId ID stores the amount of tokens withdrawed. @@ -268,7 +268,7 @@ abstract contract MorphoCompound is Helpers, Events { * @dev Payback ETH/ERC20_Token. * @notice Payback a token to Morpho Compound. * @param _tokenAddress The address of underlying token to payback.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) - * @param _poolTokenAddress The address of cToken to payback.(For ETH: cWETH address) + * @param _poolTokenAddress The address of cToken to payback.(For ETH: cETH address) * @param _amount The amount of the token (in underlying) to payback. (For max: `uint256(-1)`) * @param _getId ID to retrieve amt. * @param _setId ID stores the amount of tokens paid back. @@ -324,7 +324,7 @@ abstract contract MorphoCompound is Helpers, Events { * @dev Payback ETH/ERC20_Token. * @notice Payback a token to Morpho Compound on behalf of a user. * @param _tokenAddress The address of underlying token to payback.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) - * @param _poolTokenAddress The address of cToken to payback.(For ETH: cWETH address) + * @param _poolTokenAddress The address of cToken to payback.(For ETH: cETH address) * @param _onBehalf The address of user who's debt to repay. * @param _amount The amount of the token (in underlying) to payback. (For max: `uint256(-1)`) * @param _getId ID to retrieve amt. @@ -378,33 +378,6 @@ abstract contract MorphoCompound is Helpers, Events { _setId ); } - - /** - * @dev Claim rewards. - * @notice Claim rewards for the given assets from underlying protocol. - * @param _poolTokenAddresses The cToken addresses to claim rewards from..(For ETH: cToken address of WETH) - * @param _tradeForMorphoToken Whether or not to trade COMP tokens for MORPHO tokens. - */ - function claim( - address[] calldata _poolTokenAddresses, - bool _tradeForMorphoToken - ) - external - payable - returns (string memory _eventName, bytes memory _eventParam) - { - uint256 _amountOfRewards = MORPHO_COMPOUND.claimRewards( - _poolTokenAddresses, - _tradeForMorphoToken - ); - - _eventName = "LogClaimed(address[],bool,uint256)"; - _eventParam = abi.encode( - _poolTokenAddresses, - _tradeForMorphoToken, - _amountOfRewards - ); - } } contract ConnectV2MorphoCompound is MorphoCompound {