mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
added default logic proxy
This commit is contained in:
parent
2e1567b76e
commit
23afda5f44
35
ProxyLogics/default.sol
Normal file
35
ProxyLogics/default.sol
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
pragma solidity ^0.4.23;
|
||||||
|
|
||||||
|
|
||||||
|
interface IERC20 {
|
||||||
|
function transfer(address to, uint256 value) external returns (bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICDP {
|
||||||
|
function give(bytes32 cup, address guy) external;
|
||||||
|
}
|
||||||
|
|
||||||
|
contract ProxyTest {
|
||||||
|
|
||||||
|
event LogTransferETH(address dest, uint amount);
|
||||||
|
event LogTransferERC20(address token, address dest, uint amount);
|
||||||
|
event LogTransferCDP(address dest, uint num);
|
||||||
|
|
||||||
|
function transferETH(address dest, uint amount) public payable {
|
||||||
|
dest.transfer(amount);
|
||||||
|
emit LogTransferETH(dest, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
function transferERC20(address tokenAddr, address dest, address amount) public {
|
||||||
|
IERC20 tkn = IERC20(tokenAddr);
|
||||||
|
tkn.transfer(dest, amount);
|
||||||
|
emit LogTransferERC20(tokenAddr, dest, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
function transferCDP(address tub, address dest, uint num) public {
|
||||||
|
ICDP loanMaster = ICDP(tub);
|
||||||
|
loanMaster.give(bytes32(num), dest);
|
||||||
|
emit LogTransferCDP(dest, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,13 +0,0 @@
|
||||||
pragma solidity ^0.4.23;
|
|
||||||
|
|
||||||
|
|
||||||
contract ProxyTest {
|
|
||||||
|
|
||||||
event ETHSent(uint amt);
|
|
||||||
|
|
||||||
function sendETH() public payable {
|
|
||||||
address(msg.sender).transfer(msg.value);
|
|
||||||
emit ETHSent(msg.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user