From 8ebbeaae42ca913d9c22ede4e0d3b60ad4d4ecf4 Mon Sep 17 00:00:00 2001 From: Shriya Tyagi Date: Sun, 1 May 2022 15:13:25 +0400 Subject: [PATCH] Revert "paybackOnBehalfOf added - Mainnet Aave V2" This reverts commit 963248d0d041c9aef34947df0ce4ea2b87f4dde6. --- .../mainnet/connectors/aave/v2/events.sol | 8 ---- .../mainnet/connectors/aave/v2/helpers.sol | 15 ------- contracts/mainnet/connectors/aave/v2/main.sol | 45 ------------------- 3 files changed, 68 deletions(-) diff --git a/contracts/mainnet/connectors/aave/v2/events.sol b/contracts/mainnet/connectors/aave/v2/events.sol index ab4df395..a89e15e4 100644 --- a/contracts/mainnet/connectors/aave/v2/events.sol +++ b/contracts/mainnet/connectors/aave/v2/events.sol @@ -8,12 +8,4 @@ contract Events { event LogPayback(address indexed token, uint256 tokenAmt, uint256 indexed rateMode, uint256 getId, uint256 setId); event LogEnableCollateral(address[] tokens); event LogSwapRateMode(address indexed token, uint256 rateMode); - event LogPaybackOnBehalfOf( - address token, - uint256 amt, - uint256 rateMode, - address onBehalfOf, - uint256 getId, - uint256 setId - ); } diff --git a/contracts/mainnet/connectors/aave/v2/helpers.sol b/contracts/mainnet/connectors/aave/v2/helpers.sol index edd8c462..75242db2 100644 --- a/contracts/mainnet/connectors/aave/v2/helpers.sol +++ b/contracts/mainnet/connectors/aave/v2/helpers.sol @@ -40,21 +40,6 @@ abstract contract Helpers is DSMath, Basic { return rateMode == 1 ? stableDebt : variableDebt; } - /** - * @dev Get OnBehalfOf user's total debt balance & fee for an asset - * @param token token address of the debt.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) - * @param rateMode Borrow rate mode (Stable = 1, Variable = 2) - */ - function getOnBehalfOfPaybackBalance(address token, uint256 rateMode, address onBehalfOf) - internal - view - returns (uint256) - { - (, uint256 stableDebt, uint256 variableDebt, , , , , , ) = aaveData - .getUserReserveData(token, onBehalfOf); - return rateMode == 1 ? stableDebt : variableDebt; - } - /** * @dev Get total collateral balance for an asset * @param token token address of the collateral.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) diff --git a/contracts/mainnet/connectors/aave/v2/main.sol b/contracts/mainnet/connectors/aave/v2/main.sol index 8044180f..6319d10d 100644 --- a/contracts/mainnet/connectors/aave/v2/main.sol +++ b/contracts/mainnet/connectors/aave/v2/main.sol @@ -164,51 +164,6 @@ abstract contract AaveResolver is Events, Helpers { _eventParam = abi.encode(token, _amt, rateMode, getId, setId); } - /** - * @dev Payback borrowed ETH/ERC20_Token on behalf of a user. - * @notice Payback debt owed on behalf os a user. - * @param token The address of the token to payback.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) - * @param amt The amount of the token to payback. (For max: `uint256(-1)`) - * @param rateMode The type of debt paying back. (For Stable: 1, Variable: 2) - * @param onBehalfOf Address of user who's debt to repay. - * @param getId ID to retrieve amt. - * @param setId ID stores the amount of tokens paid back. - */ - function paybackOnBehalfOf( - address token, - uint256 amt, - uint256 rateMode, - address onBehalfOf, - uint256 getId, - uint256 setId - ) - external - payable - returns (string memory _eventName, bytes memory _eventParam) - { - uint256 _amt = getUint(getId, amt); - - AaveInterface aave = AaveInterface(aaveProvider.getLendingPool()); - - bool isEth = token == ethAddr; - address _token = isEth ? wethAddr : token; - - TokenInterface tokenContract = TokenInterface(_token); - - _amt = _amt == uint256(-1) ? getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf) : _amt; - - if (isEth) convertEthToWeth(isEth, tokenContract, _amt); - - approve(tokenContract, address(aave), _amt); - - aave.repay(_token, _amt, rateMode, onBehalfOf); - - setUint(setId, _amt); - - _eventName = "LogPaybackOnBehalfOf(address,uint256,uint256,address,uint256,uint256)"; - _eventParam = abi.encode(token, _amt, rateMode, onBehalfOf, getId, setId); - } - /** * @dev Enable collateral * @notice Enable an array of tokens as collateral