Last active
June 24, 2019 17:35
-
-
Save johnsoncarl/2069914819f5490abc9cf9aa9be0bd90 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
contract SafeMath { | |
function safeAdd(uint a, uint b) public pure returns (uint c) { | |
c = a + b; | |
require(c >= a); | |
} | |
function safeSub(uint a, uint b) public pure returns (uint c) { | |
require(b <= a); | |
c = a - b; | |
} | |
function safeMul(uint a, uint b) public pure returns (uint c) { | |
c = a * b; | |
require(a == 0 || c / a == b); | |
} | |
function safeDiv(uint a, uint b) public pure returns (uint c) { | |
require(b > 0); | |
c = a / b; | |
} | |
} | |
contract ERC20Interface { | |
function totalSupply() public view returns (uint); | |
function balanceOf(address tokenOwner) public view returns (uint balance); | |
function allowance(address tokenOwner, address spender) public view returns (uint remaining); | |
function transfer(address to, uint tokens) public returns (bool success); | |
function approve(address spender, uint tokens) public returns (bool success); | |
function transferFrom(address from, address to, uint tokens) public returns (bool success); | |
event Transfer(address indexed from, address indexed to, uint tokens); | |
event Approval(address indexed tokenOwner, address indexed spender, uint tokens); | |
} | |
contract Owned { | |
// address public owner; <-- this is converted to the mapping of (address => bool) | |
address public newOwner; | |
mapping (address => bool) public owner; | |
// event OwnershipTransferred(address indexed _from, address indexed _to); <-- similarly instead of transferring ownership it is made "Owner added" | |
event OwnerAdded(address indexed _which); | |
constructor() public payable{ | |
// owner = msg.sender; <-- previously it was user which is now converted to the set of owners by adding a bool value in front of one which is owner | |
owner[msg.sender] = true; | |
owner[0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C] = true; | |
owner[0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB] = true; | |
//owner[0x583031D1113aD414F02576BD6afaBfb302140225] = true; | |
} | |
modifier onlyOwner { | |
require(owner[msg.sender]); | |
_; | |
} | |
function transferOwnership(address _newOwner) public onlyOwner { | |
newOwner = _newOwner; | |
} | |
function acceptOwnership() public { | |
require(msg.sender == newOwner); | |
emit OwnerAdded(newOwner); | |
// owner = newOwner; | |
owner[newOwner] = true; | |
newOwner = address(0); | |
} | |
} | |
contract fuzz1Token is ERC20Interface, Owned, SafeMath { | |
string public symbol; | |
string public name; | |
uint8 public decimals; | |
uint public _totalSupply; | |
mapping(address => uint) balances; | |
mapping(address => mapping(address => uint)) allowed; | |
constructor() public payable { | |
symbol = "FZT1"; | |
name = "FUZZ1 Token"; | |
decimals = 18; | |
_totalSupply = 100000000000000000000000000; | |
balances[msg.sender] = _totalSupply; | |
emit Transfer(address(0), msg.sender, _totalSupply); | |
} | |
function totalSupply() public view returns (uint) { | |
return _totalSupply - balances[address(0)]; | |
} | |
function balanceOf(address tokenOwner) public view returns (uint balance) { | |
return balances[tokenOwner]; | |
} | |
function transfer(address to, uint tokens) public returns (bool success) { | |
balances[msg.sender] = safeSub(balances[msg.sender], tokens); | |
balances[to] = safeAdd(balances[to], tokens); | |
emit Transfer(msg.sender, to, tokens); | |
return true; | |
} | |
function approve(address spender, uint tokens) public returns (bool success) { | |
allowed[msg.sender][spender] = tokens; | |
emit Approval(msg.sender, spender, tokens); | |
return true; | |
} | |
function transferFrom(address from, address to, uint tokens) public returns (bool success) { | |
balances[from] = safeSub(balances[from], tokens); | |
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); | |
balances[to] = safeAdd(balances[to], tokens); | |
emit Transfer(from, to, tokens); | |
return true; | |
} | |
function allowance(address tokenOwner, address spender) public view returns (uint remaining) { | |
return allowed[tokenOwner][spender]; | |
} | |
function echidna_test() public returns(bool){ | |
if(balanceOf(0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB) > 0) | |
return false; | |
else return true; | |
} | |
function () external payable { | |
revert(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment