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