Skip to content

Instantly share code, notes, and snippets.

@biigpongsatorn
Last active May 28, 2019 07:09
Show Gist options
  • Save biigpongsatorn/da197be2ef7dd9b2d599f5019bd99534 to your computer and use it in GitHub Desktop.
Save biigpongsatorn/da197be2ef7dd9b2d599f5019bd99534 to your computer and use it in GitHub Desktop.
Lock P'Brite'DAI
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);
}
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);
}
}
}
@serial-coder
Copy link

Compiler complains: "คนเขียนโค้ตโคตรกาก compile ไม่ผ่านเว้ย"

@biigpongsatorn
Copy link
Author

Compiler complains: "คนเขียนโค้ตโคตรกาก compile ไม่ผ่านเว้ย"

55555555 ถือซะว่าเป็นการเก็บเงินไว้ใช้ตอนเกษียณนะครับ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment