Last active
May 28, 2019 07:09
-
-
Save biigpongsatorn/da197be2ef7dd9b2d599f5019bd99534 to your computer and use it in GitHub Desktop.
Lock P'Brite'DAI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
/** | |
* @title ERC20 | |
* @dev The ERC20 interface has an standard functions and event | |
* for erc20 compatible token on Ethereum blockchain. | |
*/ | |
interface ERC20 { | |
function totalSupply() external view returns (uint supply); | |
function balanceOf(address _owner) external view returns (uint balance); | |
function transfer(address _to, uint _value) external; // Some ERC20 doesn't have return | |
function transferFrom(address _from, address _to, uint _value) external; // Some ERC20 doesn't have return | |
function approve(address _spender, uint _value) external; // Some ERC20 doesn't have return | |
function allowance(address _owner, address _spender) external view returns (uint remaining); | |
function decimals() external view returns(uint digits); | |
event Approval(address indexed _owner, address indexed _spender, uint _value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.22 <0.6.0; | |
import './ERC20Interface.sol'; | |
contract LockBrite { | |
ERC20 public daiERC20; | |
address big; | |
address jeff; | |
address brite; | |
uint256 timeLock = 2537332769; | |
constructor (address _big, address _jeff, address _brite, address _daiContractAddr) public { | |
big = _big; | |
jeff = _jeff; | |
brite = _brite; | |
daiERC20 = ERC20(_daiContractAddr); | |
} | |
function transfer () public { | |
uint256 amount = 250000000000000000000; | |
daiERC20.transferFrom(msg.sender, big, amount); | |
daiERC20.transferFrom(msg.sender, jeff, amount); | |
lock(amount); | |
} | |
function lock(uint256 _amount) public { | |
daiERC20.transferFrom(msg.sender, address(this), _amount); | |
} | |
function unlock () public { | |
if (now >= timeLock) { | |
uint256 amount = 250000000000000000000; | |
daiERC20.transfer(brite, amount); | |
} | |
} | |
} |
Compiler complains: "คนเขียนโค้ตโคตรกาก compile ไม่ผ่านเว้ย"
55555555 ถือซะว่าเป็นการเก็บเงินไว้ใช้ตอนเกษียณนะครับ
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler complains: "คนเขียนโค้ตโคตรกาก compile ไม่ผ่านเว้ย"