mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
updated basic connector-all chains
This commit is contained in:
parent
94554c2523
commit
ce457e8c86
|
@ -2,6 +2,24 @@
|
||||||
pragma solidity ^0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract Events {
|
contract Events {
|
||||||
event LogDeposit(address indexed erc20, uint256 tokenAmt, uint256 getId, uint256 setId);
|
event LogDeposit(
|
||||||
event LogWithdraw(address indexed erc20, uint256 tokenAmt, address indexed to, uint256 getId, uint256 setId);
|
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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,34 @@ abstract contract BasicResolver is Events, DSMath, Basic {
|
||||||
_eventParam = abi.encode(token, _amt, getId, setId);
|
_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. (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.
|
||||||
|
* @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);
|
||||||
|
require(token != ethAddr, "eth-not-supported");
|
||||||
|
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)";
|
||||||
|
_eventParam = abi.encode(token, _amt, from, getId, setId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Withdraw Assets from Smart Account
|
* @dev Withdraw Assets from Smart Account
|
||||||
* @notice Withdraw a token from DSA
|
* @notice Withdraw a token from DSA
|
||||||
|
@ -79,5 +107,5 @@ abstract contract BasicResolver is Events, DSMath, Basic {
|
||||||
}
|
}
|
||||||
|
|
||||||
contract ConnectV2BasicArbitrum is BasicResolver {
|
contract ConnectV2BasicArbitrum is BasicResolver {
|
||||||
string constant public name = "Basic-v1";
|
string constant public name = "Basic-v1.1";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,24 @@
|
||||||
pragma solidity ^0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract Events {
|
contract Events {
|
||||||
event LogDeposit(address indexed erc20, uint256 tokenAmt, uint256 getId, uint256 setId);
|
event LogDeposit(
|
||||||
event LogWithdraw(address indexed erc20, uint256 tokenAmt, address indexed to, uint256 getId, uint256 setId);
|
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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,34 @@ abstract contract BasicResolver is Events, DSMath, Basic {
|
||||||
_eventParam = abi.encode(token, _amt, getId, setId);
|
_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. (Note: AVAX 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.
|
||||||
|
* @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);
|
||||||
|
require(token != avaxAddr, "avax-not-supported");
|
||||||
|
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)";
|
||||||
|
_eventParam = abi.encode(token, _amt, from, getId, setId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Withdraw Assets from Smart Account
|
* @dev Withdraw Assets from Smart Account
|
||||||
* @notice Withdraw a token from DSA
|
* @notice Withdraw a token from DSA
|
||||||
|
@ -79,5 +107,5 @@ abstract contract BasicResolver is Events, DSMath, Basic {
|
||||||
}
|
}
|
||||||
|
|
||||||
contract ConnectV2BasicAvalanche is BasicResolver {
|
contract ConnectV2BasicAvalanche is BasicResolver {
|
||||||
string constant public name = "Basic-v1";
|
string constant public name = "Basic-v1.1";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,24 @@
|
||||||
pragma solidity ^0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract Events {
|
contract Events {
|
||||||
event LogDeposit(address indexed erc20, uint256 tokenAmt, uint256 getId, uint256 setId);
|
event LogDeposit(
|
||||||
event LogWithdraw(address indexed erc20, uint256 tokenAmt, address indexed to, uint256 getId, uint256 setId);
|
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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ abstract contract BasicResolver is Events, DSMath, Basic {
|
||||||
/**
|
/**
|
||||||
* @dev Deposit Assets To Smart Account.
|
* @dev Deposit Assets To Smart Account.
|
||||||
* @notice Deposit a token to DSA
|
* @notice Deposit a token to DSA
|
||||||
* @param token The address of the token to deposit. (For MATIC: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
|
* @param token The address of the token to deposit. (For FTM: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
|
||||||
* @param amt The amount of tokens to deposit. (For max: `uint256(-1)` (Not valid for MATIC))
|
* @param amt The amount of tokens to deposit. (For max: `uint256(-1)` (Not valid for MATIC))
|
||||||
* @param getId ID to retrieve amt.
|
* @param getId ID to retrieve amt.
|
||||||
* @param setId ID stores the amount of tokens deposited.
|
* @param setId ID stores the amount of tokens deposited.
|
||||||
|
@ -46,6 +46,34 @@ abstract contract BasicResolver is Events, DSMath, Basic {
|
||||||
_eventParam = abi.encode(token, _amt, getId, setId);
|
_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. (Note: FTM 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.
|
||||||
|
* @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);
|
||||||
|
require(token != ftmAddr, "ftm-not-supported");
|
||||||
|
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)";
|
||||||
|
_eventParam = abi.encode(token, _amt, from, getId, setId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Withdraw Assets from Smart Account
|
* @dev Withdraw Assets from Smart Account
|
||||||
* @notice Withdraw a token from DSA
|
* @notice Withdraw a token from DSA
|
||||||
|
@ -79,5 +107,5 @@ abstract contract BasicResolver is Events, DSMath, Basic {
|
||||||
}
|
}
|
||||||
|
|
||||||
contract ConnectV2BasicFantom is BasicResolver {
|
contract ConnectV2BasicFantom is BasicResolver {
|
||||||
string constant public name = "Basic-v1";
|
string constant public name = "Basic-v1.1";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,24 @@
|
||||||
pragma solidity ^0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract Events {
|
contract Events {
|
||||||
event LogDeposit(address indexed erc20, uint256 tokenAmt, uint256 getId, uint256 setId);
|
event LogDeposit(
|
||||||
event LogWithdraw(address indexed erc20, uint256 tokenAmt, address indexed to, uint256 getId, uint256 setId);
|
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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,34 @@ abstract contract BasicResolver is Events, DSMath, Basic {
|
||||||
_eventParam = abi.encode(token, _amt, getId, setId);
|
_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. (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.
|
||||||
|
* @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);
|
||||||
|
require(token != ethAddr, "eth-not-supported");
|
||||||
|
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)";
|
||||||
|
_eventParam = abi.encode(token, _amt, from, getId, setId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Withdraw Assets from Smart Account
|
* @dev Withdraw Assets from Smart Account
|
||||||
* @notice Withdraw a token from DSA
|
* @notice Withdraw a token from DSA
|
||||||
|
@ -78,5 +106,5 @@ abstract contract BasicResolver is Events, DSMath, Basic {
|
||||||
}
|
}
|
||||||
|
|
||||||
contract ConnectV2BasicOptimism is BasicResolver {
|
contract ConnectV2BasicOptimism is BasicResolver {
|
||||||
string constant public name = "Basic-v1";
|
string constant public name = "Basic-v1.1";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,24 @@
|
||||||
pragma solidity ^0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract Events {
|
contract Events {
|
||||||
event LogDeposit(address indexed erc20, uint256 tokenAmt, uint256 getId, uint256 setId);
|
event LogDeposit(
|
||||||
event LogWithdraw(address indexed erc20, uint256 tokenAmt, address indexed to, uint256 getId, uint256 setId);
|
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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,34 @@ abstract contract BasicResolver is Events, DSMath, Basic {
|
||||||
_eventParam = abi.encode(token, _amt, getId, setId);
|
_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. (Note: MATIC 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.
|
||||||
|
* @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);
|
||||||
|
require(token != maticAddr, "eth-not-supported");
|
||||||
|
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)";
|
||||||
|
_eventParam = abi.encode(token, _amt, from, getId, setId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Withdraw Assets from Smart Account
|
* @dev Withdraw Assets from Smart Account
|
||||||
* @notice Withdraw a token from DSA
|
* @notice Withdraw a token from DSA
|
||||||
|
@ -79,5 +107,5 @@ abstract contract BasicResolver is Events, DSMath, Basic {
|
||||||
}
|
}
|
||||||
|
|
||||||
contract ConnectV2Basic is BasicResolver {
|
contract ConnectV2Basic is BasicResolver {
|
||||||
string constant public name = "Basic-v1";
|
string constant public name = "Basic-v1.1";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user