Verified contractPartial
HYD
Address0xc4796a5bfc6fa56ea42b5e7c7889abcf724c44fd
- Balance
0 ETH
- Transactions
7
- Compiler
solc 0.4.19
- Same code
Only this contract
Details
- Compiler
- solc 0.4.19+commit.c4cbbb05
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 5,092,505
- Creation transaction
- 0x55b0e97281…a38caeb7a5
HYD.sol
pragma solidity 0.4.19;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
address public creator;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
creator = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner || msg.sender == creator);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(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 ERC20{
uint public totalSupply;
function balanceOf(address who) constant public returns (uint);
function allowance(address owner, address spender) constant public returns (uint);
function transfer(address to, uint value) public returns (bool ok);
function transferFrom(address from, address to, uint value) public returns (bool ok);
function approve(address spender, uint value) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract TokenSpender {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public;
}
contract HYD is ERC20, SafeMath, Ownable{
string public name;
string public symbol;
uint8 public decimals;
uint public initialSupply;
uint public totalSupply;
bool public locked;
mapping(address => uint) balances;
mapping (address => mapping (address => uint)) allowed;
// lock transfer during the ICO
modifier onlyUnlocked() {
require(msg.sender == owner || msg.sender == creator || locked==false);
_;
}
/*
* The RLC Token created with the time at which the crowdsale end
*/
function HYD() public{
locked = true;
initialSupply = 50000000000000;
totalSupply = initialSupply;
balances[msg.sender] = initialSupply;// Give the creator all initial tokens
name = 'Hyde & Co. Token'; // Set the name for display purposes
symbol = 'HYD'; // Set the symbol for display purposes
decimals = 6; // Amount of decimals for display purposes
}
function unlock() public onlyOwner {
locked = false;
}
function burn(uint256 _value) public onlyOwner returns (bool){
balances[msg.sender] = sub(balances[msg.sender], _value) ;
totalSupply = sub(totalSupply, _value);
Transfer(msg.sender, 0x0, _value);
return true;
}
function transfer(address _to, uint _value) public onlyUnlocked returns (bool) {
uint fromBalance = balances[msg.sender];
require((_value > 0) && (_value <= fromBalance));
balances[msg.sender] = sub(balances[msg.sender], _value);
balances[_to] = add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint _value) public onlyUnlocked returns (bool) {
uint _allowance = allowed[_from][msg.sender];
uint fromBalance = balances[_from];
require(_value <= _allowance && _value <= fromBalance && _value > 0);
balances[_to] = add(balances[_to], _value);
balances[_from] = sub(balances[_from], _value);
allowed[_from][msg.sender] = sub(_allowance, _value);
Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
function approve(address _spender, uint _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/* Approve and then comunicate the approved contract in a single tx */
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public {
TokenSpender spender = TokenSpender(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
}
}
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}Compiler settingsShow
{
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.