Created
July 26, 2018 11:10
-
-
Save fiksn/cd14110f9b873b1f439807653b4eed75 to your computer and use it in GitHub Desktop.
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
// latest version https://github.com/ethereum/solidity/releases 0.4.24 | |
pragma solidity ^0.4.24; | |
contract ERC20 { | |
//string public constant name = "Token Name"; | |
//string public constant symbol = "SYM"; | |
//uint8 public constant decimals = 18; | |
function totalSupply() public constant returns (uint256); | |
function balanceOf(address _owner) public constant returns (uint256); | |
function transfer(address _to, uint256 _value) public returns (bool); | |
function transferFrom(address _from, address _to, uint256 _value) public returns (bool); | |
function approve(address _spender, uint256 _value) public returns (bool); | |
function allowance(address _owner, address _spender) public constant returns (uint256); | |
event Approval(address indexed _owner, address indexed _spender, uint256 _value); | |
event Transfer(address indexed _from, address indexed _to, uint256 _value); | |
} | |
library SafeMath { | |
function mul(uint256 a, uint256 b) internal pure returns (uint256) { | |
uint256 c = a * b; | |
assert(a == 0 || c / a == b); | |
return c; | |
} | |
function div(uint256 a, uint256 b) internal pure returns (uint256) { | |
// assert(b > 0); // Solidity automatically throws when dividing by 0 | |
uint256 c = a / b; | |
// assert(a == b * c + a % b); // There is no case in which this doesn't hold | |
return c; | |
} | |
function sub(uint256 a, uint256 b) internal pure returns (uint256) { | |
assert(b <= a); | |
return a - b; | |
} | |
function add(uint256 a, uint256 b) internal pure returns (uint256) { | |
uint256 c = a + b; | |
assert(c >= a); | |
return c; | |
} | |
} | |
contract Owned { | |
address public owner; | |
address public newOwner; | |
event OwnershipTransferred(address indexed _from, address indexed _to); | |
constructor() public { | |
owner = msg.sender; | |
} | |
modifier onlyOwner { | |
require(msg.sender == owner); | |
_; | |
} | |
function transferOwnership(address _newOwner) public onlyOwner { | |
newOwner = _newOwner; | |
} | |
function acceptOwnership() public { | |
require(msg.sender == newOwner); | |
emit OwnershipTransferred(owner, newOwner); | |
owner = newOwner; | |
newOwner = address(0); | |
} | |
} | |
contract ExampleToken is ERC20, Owned { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment