From 8bc347abb509230a74c88aed31ca8651b505abf3 Mon Sep 17 00:00:00 2001 From: Shriya Tyagi Date: Mon, 2 May 2022 04:08:28 +0400 Subject: [PATCH 01/14] payback & paybackOnBehalfOf updated --- .../mainnet/connectors/aave/v2/events.sol | 8 +++ .../mainnet/connectors/aave/v2/helpers.sol | 15 +++++ contracts/mainnet/connectors/aave/v2/main.sol | 55 ++++++++++++++++++- 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/contracts/mainnet/connectors/aave/v2/events.sol b/contracts/mainnet/connectors/aave/v2/events.sol index a89e15e4..ab4df395 100644 --- a/contracts/mainnet/connectors/aave/v2/events.sol +++ b/contracts/mainnet/connectors/aave/v2/events.sol @@ -8,4 +8,12 @@ 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 75242db2..edd8c462 100644 --- a/contracts/mainnet/connectors/aave/v2/helpers.sol +++ b/contracts/mainnet/connectors/aave/v2/helpers.sol @@ -40,6 +40,21 @@ 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 6319d10d..e1a07635 100644 --- a/contracts/mainnet/connectors/aave/v2/main.sol +++ b/contracts/mainnet/connectors/aave/v2/main.sol @@ -150,7 +150,11 @@ abstract contract AaveResolver is Events, Helpers { TokenInterface tokenContract = TokenInterface(_token); - _amt = _amt == uint(-1) ? getPaybackBalance(_token, rateMode) : _amt; + if (_amt == uint(-1)) { + uint _amtDSA = tokenContract.balanceOf(address(this)); + uint _amtDebt = getPaybackBalance(_token, rateMode); + _amt = _amtDSA <= _amtDebt ? _amtDSA : _amtDebt; + } if (isEth) convertEthToWeth(isEth, tokenContract, _amt); @@ -164,6 +168,55 @@ 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); + + if (_amt == uint(-1)) { + uint _amtDSA = tokenContract.balanceOf(onBehalfOf); + uint _amtDebt = getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf); + _amt = _amtDSA <= _amtDebt ? _amtDSA : _amtDebt; + } + + 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 From fb9abb204216aab8a1fae7350cac952032f65b58 Mon Sep 17 00:00:00 2001 From: Shriya Tyagi Date: Mon, 2 May 2022 19:22:20 +0400 Subject: [PATCH 02/14] minor update --- contracts/mainnet/connectors/aave/v2/main.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/mainnet/connectors/aave/v2/main.sol b/contracts/mainnet/connectors/aave/v2/main.sol index e1a07635..dea3fade 100644 --- a/contracts/mainnet/connectors/aave/v2/main.sol +++ b/contracts/mainnet/connectors/aave/v2/main.sol @@ -149,9 +149,9 @@ abstract contract AaveResolver is Events, Helpers { address _token = isEth ? wethAddr : token; TokenInterface tokenContract = TokenInterface(_token); - + if (_amt == uint(-1)) { - uint _amtDSA = tokenContract.balanceOf(address(this)); + uint _amtDSA = isEth ? address(this).balance : tokenContract.balanceOf(address(this)); uint _amtDebt = getPaybackBalance(_token, rateMode); _amt = _amtDSA <= _amtDebt ? _amtDSA : _amtDebt; } @@ -200,7 +200,7 @@ abstract contract AaveResolver is Events, Helpers { TokenInterface tokenContract = TokenInterface(_token); if (_amt == uint(-1)) { - uint _amtDSA = tokenContract.balanceOf(onBehalfOf); + uint _amtDSA = isEth ? onBehalfOf.balance : tokenContract.balanceOf(onBehalfOf); uint _amtDebt = getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf); _amt = _amtDSA <= _amtDebt ? _amtDSA : _amtDebt; } From 503c541d664b42d17f5b2a63d6597720a6e404f6 Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Mon, 2 May 2022 21:54:25 +0530 Subject: [PATCH 03/14] Update contracts/mainnet/connectors/aave/v2/main.sol --- contracts/mainnet/connectors/aave/v2/main.sol | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/mainnet/connectors/aave/v2/main.sol b/contracts/mainnet/connectors/aave/v2/main.sol index dea3fade..e0968eec 100644 --- a/contracts/mainnet/connectors/aave/v2/main.sol +++ b/contracts/mainnet/connectors/aave/v2/main.sol @@ -199,11 +199,11 @@ abstract contract AaveResolver is Events, Helpers { TokenInterface tokenContract = TokenInterface(_token); - if (_amt == uint(-1)) { - uint _amtDSA = isEth ? onBehalfOf.balance : tokenContract.balanceOf(onBehalfOf); - uint _amtDebt = getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf); - _amt = _amtDSA <= _amtDebt ? _amtDSA : _amtDebt; - } + if (_amt == uint(-1)) { + uint _amtDSA = isEth ? onBehalfOf.balance : tokenContract.balanceOf(onBehalfOf); + uint _amtDebt = getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf); + _amt = _amtDSA <= _amtDebt ? _amtDSA : _amtDebt; + } if (isEth) convertEthToWeth(isEth, tokenContract, _amt); From d8ce48fbe91cac6a90169f7c6c68f7094a9415b6 Mon Sep 17 00:00:00 2001 From: Shriya Tyagi <47134275+shriyatyagii@users.noreply.github.com> Date: Mon, 2 May 2022 20:59:29 +0400 Subject: [PATCH 04/14] Update contracts/mainnet/connectors/aave/v2/main.sol Co-authored-by: Thrilok kumar --- contracts/mainnet/connectors/aave/v2/main.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/mainnet/connectors/aave/v2/main.sol b/contracts/mainnet/connectors/aave/v2/main.sol index e0968eec..864e75a2 100644 --- a/contracts/mainnet/connectors/aave/v2/main.sol +++ b/contracts/mainnet/connectors/aave/v2/main.sol @@ -200,7 +200,7 @@ abstract contract AaveResolver is Events, Helpers { TokenInterface tokenContract = TokenInterface(_token); if (_amt == uint(-1)) { - uint _amtDSA = isEth ? onBehalfOf.balance : tokenContract.balanceOf(onBehalfOf); + uint _amtDSA = isEth ? address(this).balance : tokenContract.balanceOf(address(this)); uint _amtDebt = getOnBehalfOfPaybackBalance(_token, rateMode, onBehalfOf); _amt = _amtDSA <= _amtDebt ? _amtDSA : _amtDebt; } From 341004b6f47d77d94c361403b73c053b4147a311 Mon Sep 17 00:00:00 2001 From: Shriya Tyagi Date: Tue, 3 May 2022 21:46:02 +0400 Subject: [PATCH 05/14] Added depositFrom in Basic --- contracts/mainnet/connectors/basic/events.sol | 1 + contracts/mainnet/connectors/basic/main.sol | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/contracts/mainnet/connectors/basic/events.sol b/contracts/mainnet/connectors/basic/events.sol index 6ce85a22..14e60147 100644 --- a/contracts/mainnet/connectors/basic/events.sol +++ b/contracts/mainnet/connectors/basic/events.sol @@ -4,4 +4,5 @@ pragma solidity ^0.7.0; contract Events { event LogDeposit(address indexed erc20, uint256 tokenAmt, uint256 getId, uint256 setId); event LogWithdraw(address indexed erc20, uint256 tokenAmt, address indexed to, uint256 getId, uint256 setId); + event LogDepositFrom(address indexed erc20, uint256 tokenAmt, address indexed from, uint256 getId, uint256 setId); } diff --git a/contracts/mainnet/connectors/basic/main.sol b/contracts/mainnet/connectors/basic/main.sol index 383de493..b08e17bd 100644 --- a/contracts/mainnet/connectors/basic/main.sol +++ b/contracts/mainnet/connectors/basic/main.sol @@ -45,6 +45,37 @@ abstract contract BasicResolver is Events, DSMath, Basic { _eventParam = abi.encode(token, _amt, getId, setId); } + /** + * @dev Deposit Assets To Smart Account From any user. + * @notice Deposit a token to DSA from any user. + * @param token The address of the token to deposit.
(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE and need to pass `value` parameter equal to `amt` in cast function ```dsa.cast({..., value: amt})```.
For ERC20: Need to give allowance prior casting spells.) + * @param amt The amount of tokens to deposit. (For max: `uint256(-1)` (Not valid for ETH)) + * @param from The address depositing the token. + * @param getId ID to retrieve amt. + * @param setId ID stores the amount of tokens deposited. + */ + function depositFrom( + address token, + uint256 amt, + address from, + uint256 getId, + uint256 setId + ) public payable returns (string memory _eventName, bytes memory _eventParam) { + uint _amt = getUint(getId, amt); + if (token != ethAddr) { + IERC20 tokenContract = IERC20(token); + _amt = _amt == uint(-1) ? tokenContract.balanceOf(from) : _amt; + tokenContract.safeTransferFrom(from, address(this), _amt); + } else { + require(msg.value == _amt || _amt == uint(-1), "invalid-ether-amount"); + _amt = msg.value; + } + setUint(setId, _amt); + + _eventName = "LogDepositFrom(address,uint256,address,uint256,uint256)"; + _eventParam = abi.encode(token, _amt, from, getId, setId); + } + /** * @dev Withdraw Assets from Smart Account * @notice Withdraw a token from DSA From d232ed5c72038305ad9237d9db01544adcc869e6 Mon Sep 17 00:00:00 2001 From: Shriya Tyagi Date: Wed, 4 May 2022 01:38:15 +0400 Subject: [PATCH 06/14] Revert "Added depositFrom in Basic" This reverts commit 341004b6f47d77d94c361403b73c053b4147a311. --- contracts/mainnet/connectors/basic/events.sol | 1 - contracts/mainnet/connectors/basic/main.sol | 31 ------------------- 2 files changed, 32 deletions(-) diff --git a/contracts/mainnet/connectors/basic/events.sol b/contracts/mainnet/connectors/basic/events.sol index 14e60147..6ce85a22 100644 --- a/contracts/mainnet/connectors/basic/events.sol +++ b/contracts/mainnet/connectors/basic/events.sol @@ -4,5 +4,4 @@ pragma solidity ^0.7.0; contract Events { event LogDeposit(address indexed erc20, uint256 tokenAmt, uint256 getId, uint256 setId); event LogWithdraw(address indexed erc20, uint256 tokenAmt, address indexed to, uint256 getId, uint256 setId); - event LogDepositFrom(address indexed erc20, uint256 tokenAmt, address indexed from, uint256 getId, uint256 setId); } diff --git a/contracts/mainnet/connectors/basic/main.sol b/contracts/mainnet/connectors/basic/main.sol index b08e17bd..383de493 100644 --- a/contracts/mainnet/connectors/basic/main.sol +++ b/contracts/mainnet/connectors/basic/main.sol @@ -45,37 +45,6 @@ abstract contract BasicResolver is Events, DSMath, Basic { _eventParam = abi.encode(token, _amt, getId, setId); } - /** - * @dev Deposit Assets To Smart Account From any user. - * @notice Deposit a token to DSA from any user. - * @param token The address of the token to deposit.
(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE and need to pass `value` parameter equal to `amt` in cast function ```dsa.cast({..., value: amt})```.
For ERC20: Need to give allowance prior casting spells.) - * @param amt The amount of tokens to deposit. (For max: `uint256(-1)` (Not valid for ETH)) - * @param from The address depositing the token. - * @param getId ID to retrieve amt. - * @param setId ID stores the amount of tokens deposited. - */ - function depositFrom( - address token, - uint256 amt, - address from, - uint256 getId, - uint256 setId - ) public payable returns (string memory _eventName, bytes memory _eventParam) { - uint _amt = getUint(getId, amt); - if (token != ethAddr) { - IERC20 tokenContract = IERC20(token); - _amt = _amt == uint(-1) ? tokenContract.balanceOf(from) : _amt; - tokenContract.safeTransferFrom(from, address(this), _amt); - } else { - require(msg.value == _amt || _amt == uint(-1), "invalid-ether-amount"); - _amt = msg.value; - } - setUint(setId, _amt); - - _eventName = "LogDepositFrom(address,uint256,address,uint256,uint256)"; - _eventParam = abi.encode(token, _amt, from, getId, setId); - } - /** * @dev Withdraw Assets from Smart Account * @notice Withdraw a token from DSA From 98c6989b22a281e535f2173fb51920763bbe073d Mon Sep 17 00:00:00 2001 From: Shriya Tyagi Date: Wed, 4 May 2022 01:41:13 +0400 Subject: [PATCH 07/14] Revert "Revert "Added depositFrom in Basic"" This reverts commit d232ed5c72038305ad9237d9db01544adcc869e6. --- contracts/mainnet/connectors/basic/events.sol | 1 + contracts/mainnet/connectors/basic/main.sol | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/contracts/mainnet/connectors/basic/events.sol b/contracts/mainnet/connectors/basic/events.sol index 6ce85a22..14e60147 100644 --- a/contracts/mainnet/connectors/basic/events.sol +++ b/contracts/mainnet/connectors/basic/events.sol @@ -4,4 +4,5 @@ pragma solidity ^0.7.0; contract Events { event LogDeposit(address indexed erc20, uint256 tokenAmt, uint256 getId, uint256 setId); event LogWithdraw(address indexed erc20, uint256 tokenAmt, address indexed to, uint256 getId, uint256 setId); + event LogDepositFrom(address indexed erc20, uint256 tokenAmt, address indexed from, uint256 getId, uint256 setId); } diff --git a/contracts/mainnet/connectors/basic/main.sol b/contracts/mainnet/connectors/basic/main.sol index 383de493..b08e17bd 100644 --- a/contracts/mainnet/connectors/basic/main.sol +++ b/contracts/mainnet/connectors/basic/main.sol @@ -45,6 +45,37 @@ abstract contract BasicResolver is Events, DSMath, Basic { _eventParam = abi.encode(token, _amt, getId, setId); } + /** + * @dev Deposit Assets To Smart Account From any user. + * @notice Deposit a token to DSA from any user. + * @param token The address of the token to deposit.
(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE and need to pass `value` parameter equal to `amt` in cast function ```dsa.cast({..., value: amt})```.
For ERC20: Need to give allowance prior casting spells.) + * @param amt The amount of tokens to deposit. (For max: `uint256(-1)` (Not valid for ETH)) + * @param from The address depositing the token. + * @param getId ID to retrieve amt. + * @param setId ID stores the amount of tokens deposited. + */ + function depositFrom( + address token, + uint256 amt, + address from, + uint256 getId, + uint256 setId + ) public payable returns (string memory _eventName, bytes memory _eventParam) { + uint _amt = getUint(getId, amt); + if (token != ethAddr) { + IERC20 tokenContract = IERC20(token); + _amt = _amt == uint(-1) ? tokenContract.balanceOf(from) : _amt; + tokenContract.safeTransferFrom(from, address(this), _amt); + } else { + require(msg.value == _amt || _amt == uint(-1), "invalid-ether-amount"); + _amt = msg.value; + } + setUint(setId, _amt); + + _eventName = "LogDepositFrom(address,uint256,address,uint256,uint256)"; + _eventParam = abi.encode(token, _amt, from, getId, setId); + } + /** * @dev Withdraw Assets from Smart Account * @notice Withdraw a token from DSA From 19a01722eea6e6682e237fcc28935cf329c73955 Mon Sep 17 00:00:00 2001 From: Shriya Tyagi Date: Wed, 4 May 2022 01:44:32 +0400 Subject: [PATCH 08/14] minor updates --- contracts/mainnet/connectors/basic/main.sol | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/contracts/mainnet/connectors/basic/main.sol b/contracts/mainnet/connectors/basic/main.sol index b08e17bd..9731f6d6 100644 --- a/contracts/mainnet/connectors/basic/main.sol +++ b/contracts/mainnet/connectors/basic/main.sol @@ -62,14 +62,11 @@ abstract contract BasicResolver is Events, DSMath, Basic { uint256 setId ) public payable returns (string memory _eventName, bytes memory _eventParam) { uint _amt = getUint(getId, amt); - if (token != ethAddr) { - IERC20 tokenContract = IERC20(token); - _amt = _amt == uint(-1) ? tokenContract.balanceOf(from) : _amt; - tokenContract.safeTransferFrom(from, address(this), _amt); - } else { - require(msg.value == _amt || _amt == uint(-1), "invalid-ether-amount"); - _amt = msg.value; - } + require(token != ethAddr, "Use deposit function to send ether"); + IERC20 tokenContract = IERC20(token); + _amt = _amt == uint(-1) ? tokenContract.balanceOf(from) : _amt; + tokenContract.safeTransferFrom(from, address(this), _amt); + setUint(setId, _amt); _eventName = "LogDepositFrom(address,uint256,address,uint256,uint256)"; From dfb89f33f50acca4b59d026c3deb4eb4155d9ccf Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Wed, 4 May 2022 03:22:14 +0530 Subject: [PATCH 09/14] Update contracts/mainnet/connectors/basic/main.sol --- contracts/mainnet/connectors/basic/main.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/mainnet/connectors/basic/main.sol b/contracts/mainnet/connectors/basic/main.sol index 9731f6d6..52a377a3 100644 --- a/contracts/mainnet/connectors/basic/main.sol +++ b/contracts/mainnet/connectors/basic/main.sol @@ -48,7 +48,7 @@ abstract contract BasicResolver is Events, DSMath, Basic { /** * @dev Deposit Assets To Smart Account From any user. * @notice Deposit a token to DSA from any user. - * @param token The address of the token to deposit.
(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE and need to pass `value` parameter equal to `amt` in cast function ```dsa.cast({..., value: amt})```.
For ERC20: Need to give allowance prior casting spells.) + * @param token The address of the token to deposit. (Note: ETH is not supported) * @param amt The amount of tokens to deposit. (For max: `uint256(-1)` (Not valid for ETH)) * @param from The address depositing the token. * @param getId ID to retrieve amt. From 8c64f28ae6a18ec6b6c4475edd89124151ccfa9c Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Wed, 4 May 2022 03:22:22 +0530 Subject: [PATCH 10/14] Update contracts/mainnet/connectors/basic/main.sol --- contracts/mainnet/connectors/basic/main.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/mainnet/connectors/basic/main.sol b/contracts/mainnet/connectors/basic/main.sol index 52a377a3..0ee1f023 100644 --- a/contracts/mainnet/connectors/basic/main.sol +++ b/contracts/mainnet/connectors/basic/main.sol @@ -49,7 +49,7 @@ abstract contract BasicResolver is Events, DSMath, Basic { * @dev Deposit Assets To Smart Account From any user. * @notice Deposit a token to DSA from any user. * @param token The address of the token to deposit. (Note: ETH is not supported) - * @param amt The amount of tokens to deposit. (For max: `uint256(-1)` (Not valid for ETH)) + * @param amt The amount of tokens to deposit. (For max: `uint256(-1)`) * @param from The address depositing the token. * @param getId ID to retrieve amt. * @param setId ID stores the amount of tokens deposited. From 83bd25883cb886d05cf653d487813a392b56aaf7 Mon Sep 17 00:00:00 2001 From: Shriya Tyagi <47134275+shriyatyagii@users.noreply.github.com> Date: Wed, 4 May 2022 01:55:16 +0400 Subject: [PATCH 11/14] Update contracts/mainnet/connectors/basic/main.sol Co-authored-by: Thrilok kumar --- contracts/mainnet/connectors/basic/main.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/mainnet/connectors/basic/main.sol b/contracts/mainnet/connectors/basic/main.sol index 0ee1f023..ff16043c 100644 --- a/contracts/mainnet/connectors/basic/main.sol +++ b/contracts/mainnet/connectors/basic/main.sol @@ -48,7 +48,7 @@ abstract contract BasicResolver is Events, DSMath, Basic { /** * @dev Deposit Assets To Smart Account From any user. * @notice Deposit a token to DSA from any user. - * @param token The address of the token to deposit. (Note: ETH is not supported) + * @param token The address of the token to deposit. (Note: ETH is not supported. Use `deposit()`) * @param amt The amount of tokens to deposit. (For max: `uint256(-1)`) * @param from The address depositing the token. * @param getId ID to retrieve amt. From 1d887e3d35d046b0dad492de79d18b6da4c78dc6 Mon Sep 17 00:00:00 2001 From: Thrilok kumar Date: Wed, 4 May 2022 03:26:00 +0530 Subject: [PATCH 12/14] Update contracts/mainnet/connectors/basic/main.sol --- contracts/mainnet/connectors/basic/main.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/mainnet/connectors/basic/main.sol b/contracts/mainnet/connectors/basic/main.sol index ff16043c..f9e09af4 100644 --- a/contracts/mainnet/connectors/basic/main.sol +++ b/contracts/mainnet/connectors/basic/main.sol @@ -62,7 +62,7 @@ abstract contract BasicResolver is Events, DSMath, Basic { uint256 setId ) public payable returns (string memory _eventName, bytes memory _eventParam) { uint _amt = getUint(getId, amt); - require(token != ethAddr, "Use deposit function to send ether"); + require(token != ethAddr, "eth-not-supported"); IERC20 tokenContract = IERC20(token); _amt = _amt == uint(-1) ? tokenContract.balanceOf(from) : _amt; tokenContract.safeTransferFrom(from, address(this), _amt); From a25b28b6d972be93cf64eba38063baa1efadf28e Mon Sep 17 00:00:00 2001 From: Shriya Tyagi Date: Wed, 4 May 2022 02:03:32 +0400 Subject: [PATCH 13/14] Updated connector version --- contracts/mainnet/connectors/aave/v2/main.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/mainnet/connectors/aave/v2/main.sol b/contracts/mainnet/connectors/aave/v2/main.sol index 864e75a2..ec7b557b 100644 --- a/contracts/mainnet/connectors/aave/v2/main.sol +++ b/contracts/mainnet/connectors/aave/v2/main.sol @@ -265,5 +265,5 @@ abstract contract AaveResolver is Events, Helpers { } contract ConnectV2AaveV2 is AaveResolver { - string constant public name = "AaveV2-v1.1"; + string constant public name = "AaveV2-v1.2"; } From f055d8b918d79a17976ad5a03c34d37903d9e060 Mon Sep 17 00:00:00 2001 From: Shriya Tyagi Date: Wed, 4 May 2022 02:05:12 +0400 Subject: [PATCH 14/14] Updated basic version --- contracts/mainnet/connectors/basic/main.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/mainnet/connectors/basic/main.sol b/contracts/mainnet/connectors/basic/main.sol index f9e09af4..577faf05 100644 --- a/contracts/mainnet/connectors/basic/main.sol +++ b/contracts/mainnet/connectors/basic/main.sol @@ -106,5 +106,5 @@ abstract contract BasicResolver is Events, DSMath, Basic { } contract ConnectV2Basic is BasicResolver { - string constant public name = "Basic-v1"; + string constant public name = "Basic-v1.1"; }