contract_name
stringlengths
1
61
file_path
stringlengths
5
50.4k
contract_address
stringlengths
42
42
language
stringclasses
1 value
class_name
stringlengths
1
61
class_code
stringlengths
4
330k
class_documentation
stringlengths
0
29.1k
class_documentation_type
stringclasses
6 values
func_name
stringlengths
0
62
func_code
stringlengths
1
303k
func_documentation
stringlengths
2
14.9k
func_documentation_type
stringclasses
4 values
compiler_version
stringlengths
15
42
license_type
stringclasses
14 values
swarm_source
stringlengths
0
71
meta
dict
__index_level_0__
int64
0
60.4k
KEKEcon
KEKEcon.sol
0x3d7e4eb0facef2aaffaa07b7a61c7c1c49ffa2d4
Solidity
KEKEcon
contract KEKEcon{ /* Public variables of the token */ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function KEKEcon(){ balanceOf[msg.sender] = 100000000000000000; // Give the creator all initial tokens totalSupply = 100000000000000000; // Update total supply name = "KEKEcon"; // Set the name for display purposes symbol = "KEKEcon"; // Set the symbol for display purposes decimals = 8; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } function getBalance(address addr) public view returns(uint256) { return balanceOf[addr]; } }
KEKEcon
function KEKEcon(){ balanceOf[msg.sender] = 100000000000000000; // Give the creator all initial tokens totalSupply = 100000000000000000; // Update total supply name = "KEKEcon"; // Set the name for display purposes symbol = "KEKEcon"; // Set the symbol for display purposes decimals = 8; // Amount of decimals for display purposes }
/* Initializes contract with initial supply tokens to the creator of the contract */
Comment
v0.4.23-nightly.2018.4.17+commit.5499db01
bzzr://1d3b178f91e40d136cf4e04a3ba2615aa41be6c40e35dec09e0f910960426751
{ "func_code_index": [ 719, 1218 ] }
0
KEKEcon
KEKEcon.sol
0x3d7e4eb0facef2aaffaa07b7a61c7c1c49ffa2d4
Solidity
KEKEcon
contract KEKEcon{ /* Public variables of the token */ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function KEKEcon(){ balanceOf[msg.sender] = 100000000000000000; // Give the creator all initial tokens totalSupply = 100000000000000000; // Update total supply name = "KEKEcon"; // Set the name for display purposes symbol = "KEKEcon"; // Set the symbol for display purposes decimals = 8; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } function getBalance(address addr) public view returns(uint256) { return balanceOf[addr]; } }
_transfer
function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); }
/* Internal transfer, only can be called by this contract */
Comment
v0.4.23-nightly.2018.4.17+commit.5499db01
bzzr://1d3b178f91e40d136cf4e04a3ba2615aa41be6c40e35dec09e0f910960426751
{ "func_code_index": [ 1287, 1888 ] }
1
KEKEcon
KEKEcon.sol
0x3d7e4eb0facef2aaffaa07b7a61c7c1c49ffa2d4
Solidity
KEKEcon
contract KEKEcon{ /* Public variables of the token */ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function KEKEcon(){ balanceOf[msg.sender] = 100000000000000000; // Give the creator all initial tokens totalSupply = 100000000000000000; // Update total supply name = "KEKEcon"; // Set the name for display purposes symbol = "KEKEcon"; // Set the symbol for display purposes decimals = 8; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } function getBalance(address addr) public view returns(uint256) { return balanceOf[addr]; } }
transfer
function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); }
/// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send
NatSpecSingleLine
v0.4.23-nightly.2018.4.17+commit.5499db01
bzzr://1d3b178f91e40d136cf4e04a3ba2615aa41be6c40e35dec09e0f910960426751
{ "func_code_index": [ 2047, 2152 ] }
2
KEKEcon
KEKEcon.sol
0x3d7e4eb0facef2aaffaa07b7a61c7c1c49ffa2d4
Solidity
KEKEcon
contract KEKEcon{ /* Public variables of the token */ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function KEKEcon(){ balanceOf[msg.sender] = 100000000000000000; // Give the creator all initial tokens totalSupply = 100000000000000000; // Update total supply name = "KEKEcon"; // Set the name for display purposes symbol = "KEKEcon"; // Set the symbol for display purposes decimals = 8; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } function getBalance(address addr) public view returns(uint256) { return balanceOf[addr]; } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; }
/// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send
NatSpecSingleLine
v0.4.23-nightly.2018.4.17+commit.5499db01
bzzr://1d3b178f91e40d136cf4e04a3ba2615aa41be6c40e35dec09e0f910960426751
{ "func_code_index": [ 2362, 2657 ] }
3
KEKEcon
KEKEcon.sol
0x3d7e4eb0facef2aaffaa07b7a61c7c1c49ffa2d4
Solidity
KEKEcon
contract KEKEcon{ /* Public variables of the token */ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function KEKEcon(){ balanceOf[msg.sender] = 100000000000000000; // Give the creator all initial tokens totalSupply = 100000000000000000; // Update total supply name = "KEKEcon"; // Set the name for display purposes symbol = "KEKEcon"; // Set the symbol for display purposes decimals = 8; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } function getBalance(address addr) public view returns(uint256) { return balanceOf[addr]; } }
approve
function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; }
/// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend
NatSpecSingleLine
v0.4.23-nightly.2018.4.17+commit.5499db01
bzzr://1d3b178f91e40d136cf4e04a3ba2615aa41be6c40e35dec09e0f910960426751
{ "func_code_index": [ 2858, 3027 ] }
4
KEKEcon
KEKEcon.sol
0x3d7e4eb0facef2aaffaa07b7a61c7c1c49ffa2d4
Solidity
KEKEcon
contract KEKEcon{ /* Public variables of the token */ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function KEKEcon(){ balanceOf[msg.sender] = 100000000000000000; // Give the creator all initial tokens totalSupply = 100000000000000000; // Update total supply name = "KEKEcon"; // Set the name for display purposes symbol = "KEKEcon"; // Set the symbol for display purposes decimals = 8; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } function getBalance(address addr) public view returns(uint256) { return balanceOf[addr]; } }
approveAndCall
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } }
/// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract
NatSpecSingleLine
v0.4.23-nightly.2018.4.17+commit.5499db01
bzzr://1d3b178f91e40d136cf4e04a3ba2615aa41be6c40e35dec09e0f910960426751
{ "func_code_index": [ 3348, 3684 ] }
5
KEKEcon
KEKEcon.sol
0x3d7e4eb0facef2aaffaa07b7a61c7c1c49ffa2d4
Solidity
KEKEcon
contract KEKEcon{ /* Public variables of the token */ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function KEKEcon(){ balanceOf[msg.sender] = 100000000000000000; // Give the creator all initial tokens totalSupply = 100000000000000000; // Update total supply name = "KEKEcon"; // Set the name for display purposes symbol = "KEKEcon"; // Set the symbol for display purposes decimals = 8; // Amount of decimals for display purposes } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Send `_value` tokens to `_to` from your account /// @param _to The address of the recipient /// @param _value the amount to send function transfer(address _to, uint256 _value) { _transfer(msg.sender, _to, _value); } /// @notice Send `_value` tokens to `_to` in behalf of `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value the amount to send function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf /// @param _spender The address authorized to spend /// @param _value the max amount they can spend function approve(address _spender, uint256 _value) returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it /// @param _spender The address authorized to spend /// @param _value the max amount they can spend /// @param _extraData some extra information to send to the approved contract function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } function getBalance(address addr) public view returns(uint256) { return balanceOf[addr]; } }
burn
function burn(uint256 _value) returns (bool success) { require (balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; }
/// @notice Remove `_value` tokens from the system irreversibly /// @param _value the amount of money to burn
NatSpecSingleLine
v0.4.23-nightly.2018.4.17+commit.5499db01
bzzr://1d3b178f91e40d136cf4e04a3ba2615aa41be6c40e35dec09e0f910960426751
{ "func_code_index": [ 3807, 4204 ] }
6
Presale
contracts/IPricingStrategy.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
IPricingStrategy
interface IPricingStrategy { function isPricingStrategy() public view returns (bool); /** Calculate the current price for buy in amount. */ function calculateTokenAmount(uint weiAmount, uint tokensSold) public view returns (uint tokenAmount); }
calculateTokenAmount
function calculateTokenAmount(uint weiAmount, uint tokensSold) public view returns (uint tokenAmount);
/** Calculate the current price for buy in amount. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 155, 262 ] }
7
ZCDistribution
contracts/ZCDistribution.sol
0x8c58694bffb6d61fc335c5ff7b6831df88a2961f
Solidity
ZCDistribution
contract ZCDistribution is Claimable { // Total amount of airdrops that happend uint256 public numDrops; // Total amount of tokens dropped uint256 public dropAmount; // Address of the Token address public tokenAddress; /** * @param _tokenAddr The Address of the Token */ constructor(address _tokenAddr) public { assert(_tokenAddr != address(0)); tokenAddress = _tokenAddr; } /** * @dev Event when reward is distributed to consumer * @param receiver Consumer address * @param amount Amount of tokens distributed */ event RewardDistributed(address receiver, uint amount); /** * @dev Distributes the rewards to the consumers. Returns the amount of customers that received tokens. Can only be called by Owner * @param dests Array of cosumer addresses * @param values Array of token amounts to distribute to each client */ function multisend(address[] dests, uint256[] values) public onlyOwner returns (uint256) { assert(dests.length == values.length); uint256 i = 0; while (i < dests.length) { assert(ERC20Basic(tokenAddress).transfer(dests[i], values[i])); emit RewardDistributed(dests[i], values[i]); dropAmount += values[i]; i += 1; } numDrops += dests.length; return i; } /** * @dev Returns the Amount of tokens issued to consumers */ function getSentAmount() external view returns (uint256) { return dropAmount; } }
/** * @title ZCDistribution * * Used to distribute rewards to consumers * * (c) Philip Louw / Zero Carbon Project 2018. The MIT Licence. */
NatSpecMultiLine
multisend
function multisend(address[] dests, uint256[] values) public onlyOwner returns (uint256) { assert(dests.length == values.length); uint256 i = 0; while (i < dests.length) { assert(ERC20Basic(tokenAddress).transfer(dests[i], values[i])); emit RewardDistributed(dests[i], values[i]); dropAmount += values[i]; i += 1; } numDrops += dests.length; return i; }
/** * @dev Distributes the rewards to the consumers. Returns the amount of customers that received tokens. Can only be called by Owner * @param dests Array of cosumer addresses * @param values Array of token amounts to distribute to each client */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://ddc4a1ebf9801a8697e26b95dec80d39d4c376a538bb3bf50597ec12a4b6ac8d
{ "func_code_index": [ 957, 1426 ] }
8
ZCDistribution
contracts/ZCDistribution.sol
0x8c58694bffb6d61fc335c5ff7b6831df88a2961f
Solidity
ZCDistribution
contract ZCDistribution is Claimable { // Total amount of airdrops that happend uint256 public numDrops; // Total amount of tokens dropped uint256 public dropAmount; // Address of the Token address public tokenAddress; /** * @param _tokenAddr The Address of the Token */ constructor(address _tokenAddr) public { assert(_tokenAddr != address(0)); tokenAddress = _tokenAddr; } /** * @dev Event when reward is distributed to consumer * @param receiver Consumer address * @param amount Amount of tokens distributed */ event RewardDistributed(address receiver, uint amount); /** * @dev Distributes the rewards to the consumers. Returns the amount of customers that received tokens. Can only be called by Owner * @param dests Array of cosumer addresses * @param values Array of token amounts to distribute to each client */ function multisend(address[] dests, uint256[] values) public onlyOwner returns (uint256) { assert(dests.length == values.length); uint256 i = 0; while (i < dests.length) { assert(ERC20Basic(tokenAddress).transfer(dests[i], values[i])); emit RewardDistributed(dests[i], values[i]); dropAmount += values[i]; i += 1; } numDrops += dests.length; return i; } /** * @dev Returns the Amount of tokens issued to consumers */ function getSentAmount() external view returns (uint256) { return dropAmount; } }
/** * @title ZCDistribution * * Used to distribute rewards to consumers * * (c) Philip Louw / Zero Carbon Project 2018. The MIT Licence. */
NatSpecMultiLine
getSentAmount
function getSentAmount() external view returns (uint256) { return dropAmount; }
/** * @dev Returns the Amount of tokens issued to consumers */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
bzzr://ddc4a1ebf9801a8697e26b95dec80d39d4c376a538bb3bf50597ec12a4b6ac8d
{ "func_code_index": [ 1510, 1608 ] }
9
Breakbits
Breakbits.sol
0x89f3cda50198aca4adde4d2a1a32c6d378eef380
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); }
totalSupply
function totalSupply() constant returns (uint256 supply) {}
/// @return total amount of tokens
NatSpecSingleLine
v0.4.25+commit.59dbf8f1
bzzr://bcbbe5b08c4231f1a6e361f37f8464328618282025c98de5a51db7ecc95782b9
{ "func_code_index": [ 64, 128 ] }
10
Breakbits
Breakbits.sol
0x89f3cda50198aca4adde4d2a1a32c6d378eef380
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); }
balanceOf
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @param _owner The address from which the balance will be retrieved /// @return The balance
NatSpecSingleLine
v0.4.25+commit.59dbf8f1
bzzr://bcbbe5b08c4231f1a6e361f37f8464328618282025c98de5a51db7ecc95782b9
{ "func_code_index": [ 242, 319 ] }
11
Breakbits
Breakbits.sol
0x89f3cda50198aca4adde4d2a1a32c6d378eef380
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); }
transfer
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not
NatSpecSingleLine
v0.4.25+commit.59dbf8f1
bzzr://bcbbe5b08c4231f1a6e361f37f8464328618282025c98de5a51db7ecc95782b9
{ "func_code_index": [ 566, 643 ] }
12
Breakbits
Breakbits.sol
0x89f3cda50198aca4adde4d2a1a32c6d378eef380
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not
NatSpecSingleLine
v0.4.25+commit.59dbf8f1
bzzr://bcbbe5b08c4231f1a6e361f37f8464328618282025c98de5a51db7ecc95782b9
{ "func_code_index": [ 978, 1074 ] }
13
Breakbits
Breakbits.sol
0x89f3cda50198aca4adde4d2a1a32c6d378eef380
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); }
approve
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not
NatSpecSingleLine
v0.4.25+commit.59dbf8f1
bzzr://bcbbe5b08c4231f1a6e361f37f8464328618282025c98de5a51db7ecc95782b9
{ "func_code_index": [ 1368, 1449 ] }
14
Breakbits
Breakbits.sol
0x89f3cda50198aca4adde4d2a1a32c6d378eef380
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); }
allowance
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
/// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent
NatSpecSingleLine
v0.4.25+commit.59dbf8f1
bzzr://bcbbe5b08c4231f1a6e361f37f8464328618282025c98de5a51db7ecc95782b9
{ "func_code_index": [ 1665, 1762 ] }
15
Breakbits
Breakbits.sol
0x89f3cda50198aca4adde4d2a1a32c6d378eef380
Solidity
Breakbits
contract Breakbits is StandardToken { function () { //if ether is sent to this address, send it back. throw; } /* Public variables of the token */ /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; //fancy name: eg Simon Bucks uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = 'H1.0'; //human 0.1 standard. Just an arbitrary versioning scheme. // // CHANGE THESE VALUES FOR YOUR TOKEN // //make sure this function name matches the contract name above. So if you're token is called TutorialToken, make sure the //contract name above is also TutorialToken instead of ERC20Token function Breakbits( ) { balances[msg.sender] = 900000; // Give the creator all initial tokens (100000 for example) totalSupply = 900000; // Update total supply (100000 for example) name = "Breakbits"; // Set the name for display purposes decimals = 0; // Amount of decimals for display purposes symbol = "BR20"; // Set the symbol for display purposes } /* Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
//name this contract whatever you'd like
LineComment
Breakbits
function Breakbits( ) { balances[msg.sender] = 900000; // Give the creator all initial tokens (100000 for example) totalSupply = 900000; // Update total supply (100000 for example) name = "Breakbits"; // Set the name for display purposes decimals = 0; // Amount of decimals for display purposes symbol = "BR20"; // Set the symbol for display purposes }
//human 0.1 standard. Just an arbitrary versioning scheme. // // CHANGE THESE VALUES FOR YOUR TOKEN // //make sure this function name matches the contract name above. So if you're token is called TutorialToken, make sure the //contract name above is also TutorialToken instead of ERC20Token
LineComment
v0.4.25+commit.59dbf8f1
bzzr://bcbbe5b08c4231f1a6e361f37f8464328618282025c98de5a51db7ecc95782b9
{ "func_code_index": [ 1198, 1756 ] }
16
Breakbits
Breakbits.sol
0x89f3cda50198aca4adde4d2a1a32c6d378eef380
Solidity
Breakbits
contract Breakbits is StandardToken { function () { //if ether is sent to this address, send it back. throw; } /* Public variables of the token */ /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; //fancy name: eg Simon Bucks uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = 'H1.0'; //human 0.1 standard. Just an arbitrary versioning scheme. // // CHANGE THESE VALUES FOR YOUR TOKEN // //make sure this function name matches the contract name above. So if you're token is called TutorialToken, make sure the //contract name above is also TutorialToken instead of ERC20Token function Breakbits( ) { balances[msg.sender] = 900000; // Give the creator all initial tokens (100000 for example) totalSupply = 900000; // Update total supply (100000 for example) name = "Breakbits"; // Set the name for display purposes decimals = 0; // Amount of decimals for display purposes symbol = "BR20"; // Set the symbol for display purposes } /* Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
//name this contract whatever you'd like
LineComment
approveAndCall
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; }
/* Approves and then calls the receiving contract */
Comment
v0.4.25+commit.59dbf8f1
bzzr://bcbbe5b08c4231f1a6e361f37f8464328618282025c98de5a51db7ecc95782b9
{ "func_code_index": [ 1821, 2642 ] }
17
Crowdsale
Crowdsale.sol
0x0069e491f2ed9e562a7c9c92ba40f73d946718e0
Solidity
SafeMath
contract SafeMath { //internals function safeMul(uint a, uint b) internal returns(uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) internal returns(uint) { assert(b <= a); return a - b; } function safeAdd(uint a, uint b) internal returns(uint) { uint c = a + b; assert(c >= a && c >= b); return c; } }
safeMul
function safeMul(uint a, uint b) internal returns(uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; }
//internals
LineComment
v0.4.24+commit.e67f0147
bzzr://c98d29b66a132aa590ecef7727d8f421be44503e0c062933e4b703c914875cb1
{ "func_code_index": [ 40, 192 ] }
18
Crowdsale
Crowdsale.sol
0x0069e491f2ed9e562a7c9c92ba40f73d946718e0
Solidity
Crowdsale
contract Crowdsale is owned, SafeMath { address public beneficiary; uint public fundingGoal; uint public amountRaised; //The amount being raised by the crowdsale uint public deadline; /* the end date of the crowdsale*/ uint public rate; //rate for the crowdsale uint public tokenDecimals; token public tokenReward; // uint public tokensSold = 0; //the amount of UzmanbuCoin sold uint public start; /* the start date of the crowdsale*/ uint public bonusEndDate; mapping(address => uint256) public balanceOf; //Ether deposited by the investor bool crowdsaleClosed = false; //It will be true when the crowsale gets closed event GoalReached(address beneficiary, uint capital); event FundTransfer(address backer, uint amount, bool isContribution); /** * Constrctor function * * Setup the owner */ function Crowdsale( ) { beneficiary = 0xe579891b98a3f58e26c4b2edb54e22250899363c; rate = 80000; // 8.000.000 TORC/Ether tokenDecimals=8; fundingGoal = 2500000000 * (10 ** tokenDecimals); start = 1536537600; // deadline = 1539129600; // bonusEndDate =1537156800; tokenReward = token(0xBD64a0d7330bc16c30aA1AE34eD2C329F6DB49C9); //Token address. Modify by the current token address } /** * Fallback function * * The function without name is the default function that is called whenever anyone sends funds to a contract */ /* */ function () payable { uint amount = msg.value; //amount received by the contract uint numTokens; //number of token which will be send to the investor numTokens = getNumTokens(amount); //It will be true if the soft capital was reached require(numTokens>0 && !crowdsaleClosed && now > start && now < deadline); balanceOf[msg.sender] = safeAdd(balanceOf[msg.sender], amount); amountRaised = safeAdd(amountRaised, amount); //Amount raised increments with the amount received by the investor tokensSold += numTokens; //Tokens sold increased too tokenReward.transfer(msg.sender, numTokens); //The contract sends the corresponding tokens to the investor beneficiary.transfer(amount); //Forward ether to beneficiary FundTransfer(msg.sender, amount, true); } /* It calculates the amount of tokens to send to the investor */ function getNumTokens(uint _value) internal returns(uint numTokens) { require(_value>=10000000000000000 * 1 wei); //Min amount to invest: 0.01 ETH numTokens = safeMul(_value,rate)/(10 ** tokenDecimals); //Number of tokens to give is equal to the amount received by the rate if(now <= bonusEndDate){ if(_value>= 1 ether && _value< 5 * 1 ether){ // +15% tokens numTokens += safeMul(numTokens,15)/100; }else if(_value>=5 * 1 ether){ // +35% tokens numTokens += safeMul(numTokens,35)/100; } } return numTokens; } function changeBeneficiary(address newBeneficiary) onlyOwner { beneficiary = newBeneficiary; } modifier afterDeadline() { if (now >= deadline) _; } /** * Check if goal was reached * * Checks if the goal or time limit has been reached and ends the campaign and burn the tokens */ function checkGoalReached() afterDeadline { require(msg.sender == owner); //Checks if the one who executes the function is the owner of the contract if (tokensSold >=fundingGoal){ GoalReached(beneficiary, amountRaised); } tokenReward.burn(tokenReward.balanceOf(this)); //Burns all the remaining tokens in the contract crowdsaleClosed = true; //The crowdsale gets closed if it has expired } }
Crowdsale
function Crowdsale( ) { beneficiary = 0xe579891b98a3f58e26c4b2edb54e22250899363c; rate = 80000; // 8.000.000 TORC/Ether tokenDecimals=8; fundingGoal = 2500000000 * (10 ** tokenDecimals); start = 1536537600; // deadline = 1539129600; // bonusEndDate =1537156800; tokenReward = token(0xBD64a0d7330bc16c30aA1AE34eD2C329F6DB49C9); //Token address. Modify by the current token address }
/** * Constrctor function * * Setup the owner */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://c98d29b66a132aa590ecef7727d8f421be44503e0c062933e4b703c914875cb1
{ "func_code_index": [ 901, 1380 ] }
19
Crowdsale
Crowdsale.sol
0x0069e491f2ed9e562a7c9c92ba40f73d946718e0
Solidity
Crowdsale
contract Crowdsale is owned, SafeMath { address public beneficiary; uint public fundingGoal; uint public amountRaised; //The amount being raised by the crowdsale uint public deadline; /* the end date of the crowdsale*/ uint public rate; //rate for the crowdsale uint public tokenDecimals; token public tokenReward; // uint public tokensSold = 0; //the amount of UzmanbuCoin sold uint public start; /* the start date of the crowdsale*/ uint public bonusEndDate; mapping(address => uint256) public balanceOf; //Ether deposited by the investor bool crowdsaleClosed = false; //It will be true when the crowsale gets closed event GoalReached(address beneficiary, uint capital); event FundTransfer(address backer, uint amount, bool isContribution); /** * Constrctor function * * Setup the owner */ function Crowdsale( ) { beneficiary = 0xe579891b98a3f58e26c4b2edb54e22250899363c; rate = 80000; // 8.000.000 TORC/Ether tokenDecimals=8; fundingGoal = 2500000000 * (10 ** tokenDecimals); start = 1536537600; // deadline = 1539129600; // bonusEndDate =1537156800; tokenReward = token(0xBD64a0d7330bc16c30aA1AE34eD2C329F6DB49C9); //Token address. Modify by the current token address } /** * Fallback function * * The function without name is the default function that is called whenever anyone sends funds to a contract */ /* */ function () payable { uint amount = msg.value; //amount received by the contract uint numTokens; //number of token which will be send to the investor numTokens = getNumTokens(amount); //It will be true if the soft capital was reached require(numTokens>0 && !crowdsaleClosed && now > start && now < deadline); balanceOf[msg.sender] = safeAdd(balanceOf[msg.sender], amount); amountRaised = safeAdd(amountRaised, amount); //Amount raised increments with the amount received by the investor tokensSold += numTokens; //Tokens sold increased too tokenReward.transfer(msg.sender, numTokens); //The contract sends the corresponding tokens to the investor beneficiary.transfer(amount); //Forward ether to beneficiary FundTransfer(msg.sender, amount, true); } /* It calculates the amount of tokens to send to the investor */ function getNumTokens(uint _value) internal returns(uint numTokens) { require(_value>=10000000000000000 * 1 wei); //Min amount to invest: 0.01 ETH numTokens = safeMul(_value,rate)/(10 ** tokenDecimals); //Number of tokens to give is equal to the amount received by the rate if(now <= bonusEndDate){ if(_value>= 1 ether && _value< 5 * 1 ether){ // +15% tokens numTokens += safeMul(numTokens,15)/100; }else if(_value>=5 * 1 ether){ // +35% tokens numTokens += safeMul(numTokens,35)/100; } } return numTokens; } function changeBeneficiary(address newBeneficiary) onlyOwner { beneficiary = newBeneficiary; } modifier afterDeadline() { if (now >= deadline) _; } /** * Check if goal was reached * * Checks if the goal or time limit has been reached and ends the campaign and burn the tokens */ function checkGoalReached() afterDeadline { require(msg.sender == owner); //Checks if the one who executes the function is the owner of the contract if (tokensSold >=fundingGoal){ GoalReached(beneficiary, amountRaised); } tokenReward.burn(tokenReward.balanceOf(this)); //Burns all the remaining tokens in the contract crowdsaleClosed = true; //The crowdsale gets closed if it has expired } }
function () payable { uint amount = msg.value; //amount received by the contract uint numTokens; //number of token which will be send to the investor numTokens = getNumTokens(amount); //It will be true if the soft capital was reached require(numTokens>0 && !crowdsaleClosed && now > start && now < deadline); balanceOf[msg.sender] = safeAdd(balanceOf[msg.sender], amount); amountRaised = safeAdd(amountRaised, amount); //Amount raised increments with the amount received by the investor tokensSold += numTokens; //Tokens sold increased too tokenReward.transfer(msg.sender, numTokens); //The contract sends the corresponding tokens to the investor beneficiary.transfer(amount); //Forward ether to beneficiary FundTransfer(msg.sender, amount, true); }
/* */
Comment
v0.4.24+commit.e67f0147
bzzr://c98d29b66a132aa590ecef7727d8f421be44503e0c062933e4b703c914875cb1
{ "func_code_index": [ 1573, 2439 ] }
20
Crowdsale
Crowdsale.sol
0x0069e491f2ed9e562a7c9c92ba40f73d946718e0
Solidity
Crowdsale
contract Crowdsale is owned, SafeMath { address public beneficiary; uint public fundingGoal; uint public amountRaised; //The amount being raised by the crowdsale uint public deadline; /* the end date of the crowdsale*/ uint public rate; //rate for the crowdsale uint public tokenDecimals; token public tokenReward; // uint public tokensSold = 0; //the amount of UzmanbuCoin sold uint public start; /* the start date of the crowdsale*/ uint public bonusEndDate; mapping(address => uint256) public balanceOf; //Ether deposited by the investor bool crowdsaleClosed = false; //It will be true when the crowsale gets closed event GoalReached(address beneficiary, uint capital); event FundTransfer(address backer, uint amount, bool isContribution); /** * Constrctor function * * Setup the owner */ function Crowdsale( ) { beneficiary = 0xe579891b98a3f58e26c4b2edb54e22250899363c; rate = 80000; // 8.000.000 TORC/Ether tokenDecimals=8; fundingGoal = 2500000000 * (10 ** tokenDecimals); start = 1536537600; // deadline = 1539129600; // bonusEndDate =1537156800; tokenReward = token(0xBD64a0d7330bc16c30aA1AE34eD2C329F6DB49C9); //Token address. Modify by the current token address } /** * Fallback function * * The function without name is the default function that is called whenever anyone sends funds to a contract */ /* */ function () payable { uint amount = msg.value; //amount received by the contract uint numTokens; //number of token which will be send to the investor numTokens = getNumTokens(amount); //It will be true if the soft capital was reached require(numTokens>0 && !crowdsaleClosed && now > start && now < deadline); balanceOf[msg.sender] = safeAdd(balanceOf[msg.sender], amount); amountRaised = safeAdd(amountRaised, amount); //Amount raised increments with the amount received by the investor tokensSold += numTokens; //Tokens sold increased too tokenReward.transfer(msg.sender, numTokens); //The contract sends the corresponding tokens to the investor beneficiary.transfer(amount); //Forward ether to beneficiary FundTransfer(msg.sender, amount, true); } /* It calculates the amount of tokens to send to the investor */ function getNumTokens(uint _value) internal returns(uint numTokens) { require(_value>=10000000000000000 * 1 wei); //Min amount to invest: 0.01 ETH numTokens = safeMul(_value,rate)/(10 ** tokenDecimals); //Number of tokens to give is equal to the amount received by the rate if(now <= bonusEndDate){ if(_value>= 1 ether && _value< 5 * 1 ether){ // +15% tokens numTokens += safeMul(numTokens,15)/100; }else if(_value>=5 * 1 ether){ // +35% tokens numTokens += safeMul(numTokens,35)/100; } } return numTokens; } function changeBeneficiary(address newBeneficiary) onlyOwner { beneficiary = newBeneficiary; } modifier afterDeadline() { if (now >= deadline) _; } /** * Check if goal was reached * * Checks if the goal or time limit has been reached and ends the campaign and burn the tokens */ function checkGoalReached() afterDeadline { require(msg.sender == owner); //Checks if the one who executes the function is the owner of the contract if (tokensSold >=fundingGoal){ GoalReached(beneficiary, amountRaised); } tokenReward.burn(tokenReward.balanceOf(this)); //Burns all the remaining tokens in the contract crowdsaleClosed = true; //The crowdsale gets closed if it has expired } }
getNumTokens
function getNumTokens(uint _value) internal returns(uint numTokens) { require(_value>=10000000000000000 * 1 wei); //Min amount to invest: 0.01 ETH numTokens = safeMul(_value,rate)/(10 ** tokenDecimals); //Number of tokens to give is equal to the amount received by the rate if(now <= bonusEndDate){ if(_value>= 1 ether && _value< 5 * 1 ether){ // +15% tokens numTokens += safeMul(numTokens,15)/100; }else if(_value>=5 * 1 ether){ // +35% tokens numTokens += safeMul(numTokens,35)/100; } } return numTokens; }
/* It calculates the amount of tokens to send to the investor */
Comment
v0.4.24+commit.e67f0147
bzzr://c98d29b66a132aa590ecef7727d8f421be44503e0c062933e4b703c914875cb1
{ "func_code_index": [ 2521, 3183 ] }
21
Crowdsale
Crowdsale.sol
0x0069e491f2ed9e562a7c9c92ba40f73d946718e0
Solidity
Crowdsale
contract Crowdsale is owned, SafeMath { address public beneficiary; uint public fundingGoal; uint public amountRaised; //The amount being raised by the crowdsale uint public deadline; /* the end date of the crowdsale*/ uint public rate; //rate for the crowdsale uint public tokenDecimals; token public tokenReward; // uint public tokensSold = 0; //the amount of UzmanbuCoin sold uint public start; /* the start date of the crowdsale*/ uint public bonusEndDate; mapping(address => uint256) public balanceOf; //Ether deposited by the investor bool crowdsaleClosed = false; //It will be true when the crowsale gets closed event GoalReached(address beneficiary, uint capital); event FundTransfer(address backer, uint amount, bool isContribution); /** * Constrctor function * * Setup the owner */ function Crowdsale( ) { beneficiary = 0xe579891b98a3f58e26c4b2edb54e22250899363c; rate = 80000; // 8.000.000 TORC/Ether tokenDecimals=8; fundingGoal = 2500000000 * (10 ** tokenDecimals); start = 1536537600; // deadline = 1539129600; // bonusEndDate =1537156800; tokenReward = token(0xBD64a0d7330bc16c30aA1AE34eD2C329F6DB49C9); //Token address. Modify by the current token address } /** * Fallback function * * The function without name is the default function that is called whenever anyone sends funds to a contract */ /* */ function () payable { uint amount = msg.value; //amount received by the contract uint numTokens; //number of token which will be send to the investor numTokens = getNumTokens(amount); //It will be true if the soft capital was reached require(numTokens>0 && !crowdsaleClosed && now > start && now < deadline); balanceOf[msg.sender] = safeAdd(balanceOf[msg.sender], amount); amountRaised = safeAdd(amountRaised, amount); //Amount raised increments with the amount received by the investor tokensSold += numTokens; //Tokens sold increased too tokenReward.transfer(msg.sender, numTokens); //The contract sends the corresponding tokens to the investor beneficiary.transfer(amount); //Forward ether to beneficiary FundTransfer(msg.sender, amount, true); } /* It calculates the amount of tokens to send to the investor */ function getNumTokens(uint _value) internal returns(uint numTokens) { require(_value>=10000000000000000 * 1 wei); //Min amount to invest: 0.01 ETH numTokens = safeMul(_value,rate)/(10 ** tokenDecimals); //Number of tokens to give is equal to the amount received by the rate if(now <= bonusEndDate){ if(_value>= 1 ether && _value< 5 * 1 ether){ // +15% tokens numTokens += safeMul(numTokens,15)/100; }else if(_value>=5 * 1 ether){ // +35% tokens numTokens += safeMul(numTokens,35)/100; } } return numTokens; } function changeBeneficiary(address newBeneficiary) onlyOwner { beneficiary = newBeneficiary; } modifier afterDeadline() { if (now >= deadline) _; } /** * Check if goal was reached * * Checks if the goal or time limit has been reached and ends the campaign and burn the tokens */ function checkGoalReached() afterDeadline { require(msg.sender == owner); //Checks if the one who executes the function is the owner of the contract if (tokensSold >=fundingGoal){ GoalReached(beneficiary, amountRaised); } tokenReward.burn(tokenReward.balanceOf(this)); //Burns all the remaining tokens in the contract crowdsaleClosed = true; //The crowdsale gets closed if it has expired } }
checkGoalReached
function checkGoalReached() afterDeadline { require(msg.sender == owner); //Checks if the one who executes the function is the owner of the contract if (tokensSold >=fundingGoal){ GoalReached(beneficiary, amountRaised); } tokenReward.burn(tokenReward.balanceOf(this)); //Burns all the remaining tokens in the contract crowdsaleClosed = true; //The crowdsale gets closed if it has expired }
/** * Check if goal was reached * * Checks if the goal or time limit has been reached and ends the campaign and burn the tokens */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://c98d29b66a132aa590ecef7727d8f421be44503e0c062933e4b703c914875cb1
{ "func_code_index": [ 3522, 3980 ] }
22
TangentStake
TangentStake.sol
0x5db4b520284049d7dcb21c6317664190791bb8e5
Solidity
TangentStake
contract TangentStake is Owned { // prevents overflows using SafeMath for uint; // represents a purchase object // addr is the buying address // amount is the number of wei in the purchase // sf is the sum of (purchase amount / sum of previous purchase amounts) struct Purchase { address addr; uint amount; uint sf; } // Purchase object array that holds entire purchase history Purchase[] purchases; // tangents are rewarded along with Ether upon cashing out Tangent tokenContract; // the rate of tangents to ether is multiplier / divisor uint multiplier; uint divisor; // accuracy multiplier uint acm; uint netStakes; // logged when a purchase is made event PurchaseEvent(uint index, address addr, uint eth, uint sf); // logged when a person cashes out or the contract is destroyed event CashOutEvent(uint index, address addr, uint eth, uint tangles); event NetStakesChange(uint netStakes); // logged when the rate of tangents to ether is decreased event Revaluation(uint oldMul, uint oldDiv, uint newMul, uint newDiv); // constructor, sets initial rate to 1000 TAN per 1 Ether function TangentStake(address tokenAddress) public { tokenContract = Tangent(tokenAddress); multiplier = 1000; divisor = 1; acm = 10**18; netStakes = 0; } // decreases the rate of Tangents to Ether, the contract cannot be told // to give out more Tangents per Ether, only fewer. function revalue(uint newMul, uint newDiv) public onlyOwner { require( (newMul.div(newDiv)) <= (multiplier.div(divisor)) ); Revaluation(multiplier, divisor, newMul, newDiv); multiplier = newMul; divisor = newDiv; return; } // returns the current amount of wei that will be given for the purchase // at purchases[index] function getEarnings(uint index) public constant returns (uint earnings, uint amount) { Purchase memory cpurchase; Purchase memory lpurchase; cpurchase = purchases[index]; amount = cpurchase.amount; if (cpurchase.addr == address(0)) { return (0, amount); } earnings = (index == 0) ? acm : 0; lpurchase = purchases[purchases.length-1]; earnings = earnings.add( lpurchase.sf.sub(cpurchase.sf) ); earnings = earnings.mul(amount).div(acm); return (earnings, amount); } // Cash out Ether and Tangent at for the purchase at index "index". // All of the Ether and Tangent associated with with that purchase will // be sent to recipient, and no future withdrawals can be made for the // purchase. function cashOut(uint index) public { require(0 <= index && index < purchases.length); require(purchases[index].addr == msg.sender); uint earnings; uint amount; uint tangles; (earnings, amount) = getEarnings(index); purchases[index].addr = address(0); require(earnings != 0 && amount != 0); netStakes = netStakes.sub(amount); tangles = earnings.mul(multiplier).div(divisor); CashOutEvent(index, msg.sender, earnings, tangles); NetStakesChange(netStakes); tokenContract.transfer(msg.sender, tangles); msg.sender.transfer(earnings); return; } // The fallback function used to purchase stakes // sf is the sum of the proportions of: // (ether of current purchase / sum of ether prior to purchase) // It is used to calculate earnings upon withdrawal. function () public payable { require(msg.value != 0); uint index = purchases.length; uint sf; uint f; if (index == 0) { sf = 0; } else { f = msg.value.mul(acm).div(netStakes); sf = purchases[index-1].sf.add(f); } netStakes = netStakes.add(msg.value); purchases.push(Purchase(msg.sender, msg.value, sf)); NetStakesChange(netStakes); PurchaseEvent(index, msg.sender, msg.value, sf); return; } }
TangentStake
function TangentStake(address tokenAddress) public { tokenContract = Tangent(tokenAddress); multiplier = 1000; divisor = 1; acm = 10**18; netStakes = 0; }
// constructor, sets initial rate to 1000 TAN per 1 Ether
LineComment
v0.4.20+commit.3155dd80
bzzr://fd10ee54578c0b64fc35a5085b768db7aa513868eae12cd89826e489514eb8ef
{ "func_code_index": [ 1303, 1512 ] }
23
TangentStake
TangentStake.sol
0x5db4b520284049d7dcb21c6317664190791bb8e5
Solidity
TangentStake
contract TangentStake is Owned { // prevents overflows using SafeMath for uint; // represents a purchase object // addr is the buying address // amount is the number of wei in the purchase // sf is the sum of (purchase amount / sum of previous purchase amounts) struct Purchase { address addr; uint amount; uint sf; } // Purchase object array that holds entire purchase history Purchase[] purchases; // tangents are rewarded along with Ether upon cashing out Tangent tokenContract; // the rate of tangents to ether is multiplier / divisor uint multiplier; uint divisor; // accuracy multiplier uint acm; uint netStakes; // logged when a purchase is made event PurchaseEvent(uint index, address addr, uint eth, uint sf); // logged when a person cashes out or the contract is destroyed event CashOutEvent(uint index, address addr, uint eth, uint tangles); event NetStakesChange(uint netStakes); // logged when the rate of tangents to ether is decreased event Revaluation(uint oldMul, uint oldDiv, uint newMul, uint newDiv); // constructor, sets initial rate to 1000 TAN per 1 Ether function TangentStake(address tokenAddress) public { tokenContract = Tangent(tokenAddress); multiplier = 1000; divisor = 1; acm = 10**18; netStakes = 0; } // decreases the rate of Tangents to Ether, the contract cannot be told // to give out more Tangents per Ether, only fewer. function revalue(uint newMul, uint newDiv) public onlyOwner { require( (newMul.div(newDiv)) <= (multiplier.div(divisor)) ); Revaluation(multiplier, divisor, newMul, newDiv); multiplier = newMul; divisor = newDiv; return; } // returns the current amount of wei that will be given for the purchase // at purchases[index] function getEarnings(uint index) public constant returns (uint earnings, uint amount) { Purchase memory cpurchase; Purchase memory lpurchase; cpurchase = purchases[index]; amount = cpurchase.amount; if (cpurchase.addr == address(0)) { return (0, amount); } earnings = (index == 0) ? acm : 0; lpurchase = purchases[purchases.length-1]; earnings = earnings.add( lpurchase.sf.sub(cpurchase.sf) ); earnings = earnings.mul(amount).div(acm); return (earnings, amount); } // Cash out Ether and Tangent at for the purchase at index "index". // All of the Ether and Tangent associated with with that purchase will // be sent to recipient, and no future withdrawals can be made for the // purchase. function cashOut(uint index) public { require(0 <= index && index < purchases.length); require(purchases[index].addr == msg.sender); uint earnings; uint amount; uint tangles; (earnings, amount) = getEarnings(index); purchases[index].addr = address(0); require(earnings != 0 && amount != 0); netStakes = netStakes.sub(amount); tangles = earnings.mul(multiplier).div(divisor); CashOutEvent(index, msg.sender, earnings, tangles); NetStakesChange(netStakes); tokenContract.transfer(msg.sender, tangles); msg.sender.transfer(earnings); return; } // The fallback function used to purchase stakes // sf is the sum of the proportions of: // (ether of current purchase / sum of ether prior to purchase) // It is used to calculate earnings upon withdrawal. function () public payable { require(msg.value != 0); uint index = purchases.length; uint sf; uint f; if (index == 0) { sf = 0; } else { f = msg.value.mul(acm).div(netStakes); sf = purchases[index-1].sf.add(f); } netStakes = netStakes.add(msg.value); purchases.push(Purchase(msg.sender, msg.value, sf)); NetStakesChange(netStakes); PurchaseEvent(index, msg.sender, msg.value, sf); return; } }
revalue
function revalue(uint newMul, uint newDiv) public onlyOwner { require( (newMul.div(newDiv)) <= (multiplier.div(divisor)) ); Revaluation(multiplier, divisor, newMul, newDiv); multiplier = newMul; divisor = newDiv; return; }
// decreases the rate of Tangents to Ether, the contract cannot be told // to give out more Tangents per Ether, only fewer.
LineComment
v0.4.20+commit.3155dd80
bzzr://fd10ee54578c0b64fc35a5085b768db7aa513868eae12cd89826e489514eb8ef
{ "func_code_index": [ 1653, 1930 ] }
24
TangentStake
TangentStake.sol
0x5db4b520284049d7dcb21c6317664190791bb8e5
Solidity
TangentStake
contract TangentStake is Owned { // prevents overflows using SafeMath for uint; // represents a purchase object // addr is the buying address // amount is the number of wei in the purchase // sf is the sum of (purchase amount / sum of previous purchase amounts) struct Purchase { address addr; uint amount; uint sf; } // Purchase object array that holds entire purchase history Purchase[] purchases; // tangents are rewarded along with Ether upon cashing out Tangent tokenContract; // the rate of tangents to ether is multiplier / divisor uint multiplier; uint divisor; // accuracy multiplier uint acm; uint netStakes; // logged when a purchase is made event PurchaseEvent(uint index, address addr, uint eth, uint sf); // logged when a person cashes out or the contract is destroyed event CashOutEvent(uint index, address addr, uint eth, uint tangles); event NetStakesChange(uint netStakes); // logged when the rate of tangents to ether is decreased event Revaluation(uint oldMul, uint oldDiv, uint newMul, uint newDiv); // constructor, sets initial rate to 1000 TAN per 1 Ether function TangentStake(address tokenAddress) public { tokenContract = Tangent(tokenAddress); multiplier = 1000; divisor = 1; acm = 10**18; netStakes = 0; } // decreases the rate of Tangents to Ether, the contract cannot be told // to give out more Tangents per Ether, only fewer. function revalue(uint newMul, uint newDiv) public onlyOwner { require( (newMul.div(newDiv)) <= (multiplier.div(divisor)) ); Revaluation(multiplier, divisor, newMul, newDiv); multiplier = newMul; divisor = newDiv; return; } // returns the current amount of wei that will be given for the purchase // at purchases[index] function getEarnings(uint index) public constant returns (uint earnings, uint amount) { Purchase memory cpurchase; Purchase memory lpurchase; cpurchase = purchases[index]; amount = cpurchase.amount; if (cpurchase.addr == address(0)) { return (0, amount); } earnings = (index == 0) ? acm : 0; lpurchase = purchases[purchases.length-1]; earnings = earnings.add( lpurchase.sf.sub(cpurchase.sf) ); earnings = earnings.mul(amount).div(acm); return (earnings, amount); } // Cash out Ether and Tangent at for the purchase at index "index". // All of the Ether and Tangent associated with with that purchase will // be sent to recipient, and no future withdrawals can be made for the // purchase. function cashOut(uint index) public { require(0 <= index && index < purchases.length); require(purchases[index].addr == msg.sender); uint earnings; uint amount; uint tangles; (earnings, amount) = getEarnings(index); purchases[index].addr = address(0); require(earnings != 0 && amount != 0); netStakes = netStakes.sub(amount); tangles = earnings.mul(multiplier).div(divisor); CashOutEvent(index, msg.sender, earnings, tangles); NetStakesChange(netStakes); tokenContract.transfer(msg.sender, tangles); msg.sender.transfer(earnings); return; } // The fallback function used to purchase stakes // sf is the sum of the proportions of: // (ether of current purchase / sum of ether prior to purchase) // It is used to calculate earnings upon withdrawal. function () public payable { require(msg.value != 0); uint index = purchases.length; uint sf; uint f; if (index == 0) { sf = 0; } else { f = msg.value.mul(acm).div(netStakes); sf = purchases[index-1].sf.add(f); } netStakes = netStakes.add(msg.value); purchases.push(Purchase(msg.sender, msg.value, sf)); NetStakesChange(netStakes); PurchaseEvent(index, msg.sender, msg.value, sf); return; } }
getEarnings
function getEarnings(uint index) public constant returns (uint earnings, uint amount) { Purchase memory cpurchase; Purchase memory lpurchase; cpurchase = purchases[index]; amount = cpurchase.amount; if (cpurchase.addr == address(0)) { return (0, amount); } earnings = (index == 0) ? acm : 0; lpurchase = purchases[purchases.length-1]; earnings = earnings.add( lpurchase.sf.sub(cpurchase.sf) ); earnings = earnings.mul(amount).div(acm); return (earnings, amount); }
// returns the current amount of wei that will be given for the purchase // at purchases[index]
LineComment
v0.4.20+commit.3155dd80
bzzr://fd10ee54578c0b64fc35a5085b768db7aa513868eae12cd89826e489514eb8ef
{ "func_code_index": [ 2044, 2660 ] }
25
TangentStake
TangentStake.sol
0x5db4b520284049d7dcb21c6317664190791bb8e5
Solidity
TangentStake
contract TangentStake is Owned { // prevents overflows using SafeMath for uint; // represents a purchase object // addr is the buying address // amount is the number of wei in the purchase // sf is the sum of (purchase amount / sum of previous purchase amounts) struct Purchase { address addr; uint amount; uint sf; } // Purchase object array that holds entire purchase history Purchase[] purchases; // tangents are rewarded along with Ether upon cashing out Tangent tokenContract; // the rate of tangents to ether is multiplier / divisor uint multiplier; uint divisor; // accuracy multiplier uint acm; uint netStakes; // logged when a purchase is made event PurchaseEvent(uint index, address addr, uint eth, uint sf); // logged when a person cashes out or the contract is destroyed event CashOutEvent(uint index, address addr, uint eth, uint tangles); event NetStakesChange(uint netStakes); // logged when the rate of tangents to ether is decreased event Revaluation(uint oldMul, uint oldDiv, uint newMul, uint newDiv); // constructor, sets initial rate to 1000 TAN per 1 Ether function TangentStake(address tokenAddress) public { tokenContract = Tangent(tokenAddress); multiplier = 1000; divisor = 1; acm = 10**18; netStakes = 0; } // decreases the rate of Tangents to Ether, the contract cannot be told // to give out more Tangents per Ether, only fewer. function revalue(uint newMul, uint newDiv) public onlyOwner { require( (newMul.div(newDiv)) <= (multiplier.div(divisor)) ); Revaluation(multiplier, divisor, newMul, newDiv); multiplier = newMul; divisor = newDiv; return; } // returns the current amount of wei that will be given for the purchase // at purchases[index] function getEarnings(uint index) public constant returns (uint earnings, uint amount) { Purchase memory cpurchase; Purchase memory lpurchase; cpurchase = purchases[index]; amount = cpurchase.amount; if (cpurchase.addr == address(0)) { return (0, amount); } earnings = (index == 0) ? acm : 0; lpurchase = purchases[purchases.length-1]; earnings = earnings.add( lpurchase.sf.sub(cpurchase.sf) ); earnings = earnings.mul(amount).div(acm); return (earnings, amount); } // Cash out Ether and Tangent at for the purchase at index "index". // All of the Ether and Tangent associated with with that purchase will // be sent to recipient, and no future withdrawals can be made for the // purchase. function cashOut(uint index) public { require(0 <= index && index < purchases.length); require(purchases[index].addr == msg.sender); uint earnings; uint amount; uint tangles; (earnings, amount) = getEarnings(index); purchases[index].addr = address(0); require(earnings != 0 && amount != 0); netStakes = netStakes.sub(amount); tangles = earnings.mul(multiplier).div(divisor); CashOutEvent(index, msg.sender, earnings, tangles); NetStakesChange(netStakes); tokenContract.transfer(msg.sender, tangles); msg.sender.transfer(earnings); return; } // The fallback function used to purchase stakes // sf is the sum of the proportions of: // (ether of current purchase / sum of ether prior to purchase) // It is used to calculate earnings upon withdrawal. function () public payable { require(msg.value != 0); uint index = purchases.length; uint sf; uint f; if (index == 0) { sf = 0; } else { f = msg.value.mul(acm).div(netStakes); sf = purchases[index-1].sf.add(f); } netStakes = netStakes.add(msg.value); purchases.push(Purchase(msg.sender, msg.value, sf)); NetStakesChange(netStakes); PurchaseEvent(index, msg.sender, msg.value, sf); return; } }
cashOut
function cashOut(uint index) public { require(0 <= index && index < purchases.length); require(purchases[index].addr == msg.sender); uint earnings; uint amount; uint tangles; (earnings, amount) = getEarnings(index); purchases[index].addr = address(0); require(earnings != 0 && amount != 0); netStakes = netStakes.sub(amount); tangles = earnings.mul(multiplier).div(divisor); CashOutEvent(index, msg.sender, earnings, tangles); NetStakesChange(netStakes); tokenContract.transfer(msg.sender, tangles); msg.sender.transfer(earnings); return; }
// Cash out Ether and Tangent at for the purchase at index "index". // All of the Ether and Tangent associated with with that purchase will // be sent to recipient, and no future withdrawals can be made for the // purchase.
LineComment
v0.4.20+commit.3155dd80
bzzr://fd10ee54578c0b64fc35a5085b768db7aa513868eae12cd89826e489514eb8ef
{ "func_code_index": [ 2911, 3636 ] }
26
TangentStake
TangentStake.sol
0x5db4b520284049d7dcb21c6317664190791bb8e5
Solidity
TangentStake
contract TangentStake is Owned { // prevents overflows using SafeMath for uint; // represents a purchase object // addr is the buying address // amount is the number of wei in the purchase // sf is the sum of (purchase amount / sum of previous purchase amounts) struct Purchase { address addr; uint amount; uint sf; } // Purchase object array that holds entire purchase history Purchase[] purchases; // tangents are rewarded along with Ether upon cashing out Tangent tokenContract; // the rate of tangents to ether is multiplier / divisor uint multiplier; uint divisor; // accuracy multiplier uint acm; uint netStakes; // logged when a purchase is made event PurchaseEvent(uint index, address addr, uint eth, uint sf); // logged when a person cashes out or the contract is destroyed event CashOutEvent(uint index, address addr, uint eth, uint tangles); event NetStakesChange(uint netStakes); // logged when the rate of tangents to ether is decreased event Revaluation(uint oldMul, uint oldDiv, uint newMul, uint newDiv); // constructor, sets initial rate to 1000 TAN per 1 Ether function TangentStake(address tokenAddress) public { tokenContract = Tangent(tokenAddress); multiplier = 1000; divisor = 1; acm = 10**18; netStakes = 0; } // decreases the rate of Tangents to Ether, the contract cannot be told // to give out more Tangents per Ether, only fewer. function revalue(uint newMul, uint newDiv) public onlyOwner { require( (newMul.div(newDiv)) <= (multiplier.div(divisor)) ); Revaluation(multiplier, divisor, newMul, newDiv); multiplier = newMul; divisor = newDiv; return; } // returns the current amount of wei that will be given for the purchase // at purchases[index] function getEarnings(uint index) public constant returns (uint earnings, uint amount) { Purchase memory cpurchase; Purchase memory lpurchase; cpurchase = purchases[index]; amount = cpurchase.amount; if (cpurchase.addr == address(0)) { return (0, amount); } earnings = (index == 0) ? acm : 0; lpurchase = purchases[purchases.length-1]; earnings = earnings.add( lpurchase.sf.sub(cpurchase.sf) ); earnings = earnings.mul(amount).div(acm); return (earnings, amount); } // Cash out Ether and Tangent at for the purchase at index "index". // All of the Ether and Tangent associated with with that purchase will // be sent to recipient, and no future withdrawals can be made for the // purchase. function cashOut(uint index) public { require(0 <= index && index < purchases.length); require(purchases[index].addr == msg.sender); uint earnings; uint amount; uint tangles; (earnings, amount) = getEarnings(index); purchases[index].addr = address(0); require(earnings != 0 && amount != 0); netStakes = netStakes.sub(amount); tangles = earnings.mul(multiplier).div(divisor); CashOutEvent(index, msg.sender, earnings, tangles); NetStakesChange(netStakes); tokenContract.transfer(msg.sender, tangles); msg.sender.transfer(earnings); return; } // The fallback function used to purchase stakes // sf is the sum of the proportions of: // (ether of current purchase / sum of ether prior to purchase) // It is used to calculate earnings upon withdrawal. function () public payable { require(msg.value != 0); uint index = purchases.length; uint sf; uint f; if (index == 0) { sf = 0; } else { f = msg.value.mul(acm).div(netStakes); sf = purchases[index-1].sf.add(f); } netStakes = netStakes.add(msg.value); purchases.push(Purchase(msg.sender, msg.value, sf)); NetStakesChange(netStakes); PurchaseEvent(index, msg.sender, msg.value, sf); return; } }
function () public payable { require(msg.value != 0); uint index = purchases.length; uint sf; uint f; if (index == 0) { sf = 0; } else { f = msg.value.mul(acm).div(netStakes); sf = purchases[index-1].sf.add(f); } netStakes = netStakes.add(msg.value); purchases.push(Purchase(msg.sender, msg.value, sf)); NetStakesChange(netStakes); PurchaseEvent(index, msg.sender, msg.value, sf); return; }
// The fallback function used to purchase stakes // sf is the sum of the proportions of: // (ether of current purchase / sum of ether prior to purchase) // It is used to calculate earnings upon withdrawal.
LineComment
v0.4.20+commit.3155dd80
bzzr://fd10ee54578c0b64fc35a5085b768db7aa513868eae12cd89826e489514eb8ef
{ "func_code_index": [ 3875, 4462 ] }
27
StakingInfo
contracts/common/Registry.sol
0x3929ffab35937ab32f6ea0d9849174161d9d20c7
Solidity
Registry
contract Registry is Governable { // @todo hardcode constants bytes32 private constant WETH_TOKEN = keccak256("wethToken"); bytes32 private constant DEPOSIT_MANAGER = keccak256("depositManager"); bytes32 private constant STAKE_MANAGER = keccak256("stakeManager"); bytes32 private constant VALIDATOR_SHARE = keccak256("validatorShare"); bytes32 private constant WITHDRAW_MANAGER = keccak256("withdrawManager"); bytes32 private constant CHILD_CHAIN = keccak256("childChain"); bytes32 private constant STATE_SENDER = keccak256("stateSender"); bytes32 private constant SLASHING_MANAGER = keccak256("slashingManager"); address public erc20Predicate; address public erc721Predicate; mapping(bytes32 => address) public contractMap; mapping(address => address) public rootToChildToken; mapping(address => address) public childToRootToken; mapping(address => bool) public proofValidatorContracts; mapping(address => bool) public isERC721; enum Type {Invalid, ERC20, ERC721, Custom} struct Predicate { Type _type; } mapping(address => Predicate) public predicates; event TokenMapped(address indexed rootToken, address indexed childToken); event ProofValidatorAdded(address indexed validator, address indexed from); event ProofValidatorRemoved(address indexed validator, address indexed from); event PredicateAdded(address indexed predicate, address indexed from); event PredicateRemoved(address indexed predicate, address indexed from); event ContractMapUpdated(bytes32 indexed key, address indexed previousContract, address indexed newContract); constructor(address _governance) public Governable(_governance) {} function updateContractMap(bytes32 _key, address _address) external onlyGovernance { emit ContractMapUpdated(_key, contractMap[_key], _address); contractMap[_key] = _address; } /** * @dev Map root token to child token * @param _rootToken Token address on the root chain * @param _childToken Token address on the child chain * @param _isERC721 Is the token being mapped ERC721 */ function mapToken( address _rootToken, address _childToken, bool _isERC721 ) external onlyGovernance { require(_rootToken != address(0x0) && _childToken != address(0x0), "INVALID_TOKEN_ADDRESS"); rootToChildToken[_rootToken] = _childToken; childToRootToken[_childToken] = _rootToken; isERC721[_rootToken] = _isERC721; IWithdrawManager(contractMap[WITHDRAW_MANAGER]).createExitQueue(_rootToken); emit TokenMapped(_rootToken, _childToken); } function addErc20Predicate(address predicate) public onlyGovernance { require(predicate != address(0x0), "Can not add null address as predicate"); erc20Predicate = predicate; addPredicate(predicate, Type.ERC20); } function addErc721Predicate(address predicate) public onlyGovernance { erc721Predicate = predicate; addPredicate(predicate, Type.ERC721); } function addPredicate(address predicate, Type _type) public onlyGovernance { require(predicates[predicate]._type == Type.Invalid, "Predicate already added"); predicates[predicate]._type = _type; emit PredicateAdded(predicate, msg.sender); } function removePredicate(address predicate) public onlyGovernance { require(predicates[predicate]._type != Type.Invalid, "Predicate does not exist"); delete predicates[predicate]; emit PredicateRemoved(predicate, msg.sender); } function getValidatorShareAddress() public view returns (address) { return contractMap[VALIDATOR_SHARE]; } function getWethTokenAddress() public view returns (address) { return contractMap[WETH_TOKEN]; } function getDepositManagerAddress() public view returns (address) { return contractMap[DEPOSIT_MANAGER]; } function getStakeManagerAddress() public view returns (address) { return contractMap[STAKE_MANAGER]; } function getSlashingManagerAddress() public view returns (address) { return contractMap[SLASHING_MANAGER]; } function getWithdrawManagerAddress() public view returns (address) { return contractMap[WITHDRAW_MANAGER]; } function getChildChainAndStateSender() public view returns (address, address) { return (contractMap[CHILD_CHAIN], contractMap[STATE_SENDER]); } function isTokenMapped(address _token) public view returns (bool) { return rootToChildToken[_token] != address(0x0); } function isTokenMappedAndIsErc721(address _token) public view returns (bool) { require(isTokenMapped(_token), "TOKEN_NOT_MAPPED"); return isERC721[_token]; } function isTokenMappedAndGetPredicate(address _token) public view returns (address) { if (isTokenMappedAndIsErc721(_token)) { return erc721Predicate; } return erc20Predicate; } function isChildTokenErc721(address childToken) public view returns (bool) { address rootToken = childToRootToken[childToken]; require(rootToken != address(0x0), "Child token is not mapped"); return isERC721[rootToken]; } }
mapToken
function mapToken( address _rootToken, address _childToken, bool _isERC721 ) external onlyGovernance { require(_rootToken != address(0x0) && _childToken != address(0x0), "INVALID_TOKEN_ADDRESS"); rootToChildToken[_rootToken] = _childToken; childToRootToken[_childToken] = _rootToken; isERC721[_rootToken] = _isERC721; IWithdrawManager(contractMap[WITHDRAW_MANAGER]).createExitQueue(_rootToken); emit TokenMapped(_rootToken, _childToken); }
/** * @dev Map root token to child token * @param _rootToken Token address on the root chain * @param _childToken Token address on the child chain * @param _isERC721 Is the token being mapped ERC721 */
NatSpecMultiLine
v0.5.17+commit.d19bba13
None
{ "func_code_index": [ 2159, 2682 ] }
28
TootyrTokenSale
TootyrTokenSale.sol
0x7150bf55144f12cb12ecde2064ae4a06e297bf37
Solidity
TootyrTokenSale
contract TootyrTokenSale is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public startDate; uint public bonusEnds; uint public endDate; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function TootyrTokenSale() public { symbol = "TRT"; name = "TootyrToken"; decimals = 18; bonusEnds = now + 5 weeks; endDate = now + 10 weeks; } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ 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); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // 10,000 TRT Tokens per 1 ETH // ------------------------------------------------------------------------ function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 13000; } else { tokens = msg.value * 10000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(address(0), msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
TootyrTokenSale
function TootyrTokenSale() public { symbol = "TRT"; name = "TootyrToken"; decimals = 18; bonusEnds = now + 5 weeks; endDate = now + 10 weeks; }
// ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
bzzr://7b5223d85f714a55740dc3ecdf6fac5860d249631f7aab8beebd50be3ad70ef0
{ "func_code_index": [ 544, 744 ] }
29
TootyrTokenSale
TootyrTokenSale.sol
0x7150bf55144f12cb12ecde2064ae4a06e297bf37
Solidity
TootyrTokenSale
contract TootyrTokenSale is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public startDate; uint public bonusEnds; uint public endDate; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function TootyrTokenSale() public { symbol = "TRT"; name = "TootyrToken"; decimals = 18; bonusEnds = now + 5 weeks; endDate = now + 10 weeks; } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ 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); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // 10,000 TRT Tokens per 1 ETH // ------------------------------------------------------------------------ function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 13000; } else { tokens = msg.value * 10000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(address(0), msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
totalSupply
function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; }
// ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
bzzr://7b5223d85f714a55740dc3ecdf6fac5860d249631f7aab8beebd50be3ad70ef0
{ "func_code_index": [ 932, 1048 ] }
30
TootyrTokenSale
TootyrTokenSale.sol
0x7150bf55144f12cb12ecde2064ae4a06e297bf37
Solidity
TootyrTokenSale
contract TootyrTokenSale is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public startDate; uint public bonusEnds; uint public endDate; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function TootyrTokenSale() public { symbol = "TRT"; name = "TootyrToken"; decimals = 18; bonusEnds = now + 5 weeks; endDate = now + 10 weeks; } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ 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); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // 10,000 TRT Tokens per 1 ETH // ------------------------------------------------------------------------ function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 13000; } else { tokens = msg.value * 10000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(address(0), msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
balanceOf
function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; }
// ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
bzzr://7b5223d85f714a55740dc3ecdf6fac5860d249631f7aab8beebd50be3ad70ef0
{ "func_code_index": [ 1270, 1395 ] }
31
TootyrTokenSale
TootyrTokenSale.sol
0x7150bf55144f12cb12ecde2064ae4a06e297bf37
Solidity
TootyrTokenSale
contract TootyrTokenSale is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public startDate; uint public bonusEnds; uint public endDate; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function TootyrTokenSale() public { symbol = "TRT"; name = "TootyrToken"; decimals = 18; bonusEnds = now + 5 weeks; endDate = now + 10 weeks; } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ 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); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // 10,000 TRT Tokens per 1 ETH // ------------------------------------------------------------------------ function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 13000; } else { tokens = msg.value * 10000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(address(0), msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transfer
function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; }
// ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
bzzr://7b5223d85f714a55740dc3ecdf6fac5860d249631f7aab8beebd50be3ad70ef0
{ "func_code_index": [ 1741, 2018 ] }
32
TootyrTokenSale
TootyrTokenSale.sol
0x7150bf55144f12cb12ecde2064ae4a06e297bf37
Solidity
TootyrTokenSale
contract TootyrTokenSale is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public startDate; uint public bonusEnds; uint public endDate; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function TootyrTokenSale() public { symbol = "TRT"; name = "TootyrToken"; decimals = 18; bonusEnds = now + 5 weeks; endDate = now + 10 weeks; } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ 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); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // 10,000 TRT Tokens per 1 ETH // ------------------------------------------------------------------------ function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 13000; } else { tokens = msg.value * 10000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(address(0), msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
approve
function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; }
// ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
bzzr://7b5223d85f714a55740dc3ecdf6fac5860d249631f7aab8beebd50be3ad70ef0
{ "func_code_index": [ 2529, 2737 ] }
33
TootyrTokenSale
TootyrTokenSale.sol
0x7150bf55144f12cb12ecde2064ae4a06e297bf37
Solidity
TootyrTokenSale
contract TootyrTokenSale is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public startDate; uint public bonusEnds; uint public endDate; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function TootyrTokenSale() public { symbol = "TRT"; name = "TootyrToken"; decimals = 18; bonusEnds = now + 5 weeks; endDate = now + 10 weeks; } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ 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); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // 10,000 TRT Tokens per 1 ETH // ------------------------------------------------------------------------ function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 13000; } else { tokens = msg.value * 10000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(address(0), msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transferFrom
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); Transfer(from, to, tokens); return true; }
// ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
bzzr://7b5223d85f714a55740dc3ecdf6fac5860d249631f7aab8beebd50be3ad70ef0
{ "func_code_index": [ 3275, 3633 ] }
34
TootyrTokenSale
TootyrTokenSale.sol
0x7150bf55144f12cb12ecde2064ae4a06e297bf37
Solidity
TootyrTokenSale
contract TootyrTokenSale is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public startDate; uint public bonusEnds; uint public endDate; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function TootyrTokenSale() public { symbol = "TRT"; name = "TootyrToken"; decimals = 18; bonusEnds = now + 5 weeks; endDate = now + 10 weeks; } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ 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); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // 10,000 TRT Tokens per 1 ETH // ------------------------------------------------------------------------ function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 13000; } else { tokens = msg.value * 10000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(address(0), msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
allowance
function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; }
// ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
bzzr://7b5223d85f714a55740dc3ecdf6fac5860d249631f7aab8beebd50be3ad70ef0
{ "func_code_index": [ 3916, 4068 ] }
35
TootyrTokenSale
TootyrTokenSale.sol
0x7150bf55144f12cb12ecde2064ae4a06e297bf37
Solidity
TootyrTokenSale
contract TootyrTokenSale is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public startDate; uint public bonusEnds; uint public endDate; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function TootyrTokenSale() public { symbol = "TRT"; name = "TootyrToken"; decimals = 18; bonusEnds = now + 5 weeks; endDate = now + 10 weeks; } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ 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); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // 10,000 TRT Tokens per 1 ETH // ------------------------------------------------------------------------ function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 13000; } else { tokens = msg.value * 10000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(address(0), msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
approveAndCall
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; }
// ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
bzzr://7b5223d85f714a55740dc3ecdf6fac5860d249631f7aab8beebd50be3ad70ef0
{ "func_code_index": [ 4431, 4748 ] }
36
TootyrTokenSale
TootyrTokenSale.sol
0x7150bf55144f12cb12ecde2064ae4a06e297bf37
Solidity
TootyrTokenSale
contract TootyrTokenSale is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public startDate; uint public bonusEnds; uint public endDate; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function TootyrTokenSale() public { symbol = "TRT"; name = "TootyrToken"; decimals = 18; bonusEnds = now + 5 weeks; endDate = now + 10 weeks; } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ 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); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // 10,000 TRT Tokens per 1 ETH // ------------------------------------------------------------------------ function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 13000; } else { tokens = msg.value * 10000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(address(0), msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 13000; } else { tokens = msg.value * 10000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(address(0), msg.sender, tokens); owner.transfer(msg.value); }
// ------------------------------------------------------------------------ // 10,000 TRT Tokens per 1 ETH // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
bzzr://7b5223d85f714a55740dc3ecdf6fac5860d249631f7aab8beebd50be3ad70ef0
{ "func_code_index": [ 4949, 5422 ] }
37
TootyrTokenSale
TootyrTokenSale.sol
0x7150bf55144f12cb12ecde2064ae4a06e297bf37
Solidity
TootyrTokenSale
contract TootyrTokenSale is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public startDate; uint public bonusEnds; uint public endDate; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function TootyrTokenSale() public { symbol = "TRT"; name = "TootyrToken"; decimals = 18; bonusEnds = now + 5 weeks; endDate = now + 10 weeks; } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ 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); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // 10,000 TRT Tokens per 1 ETH // ------------------------------------------------------------------------ function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 13000; } else { tokens = msg.value * 10000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupply = safeAdd(_totalSupply, tokens); Transfer(address(0), msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transferAnyERC20Token
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); }
// ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------
LineComment
v0.4.24+commit.e67f0147
bzzr://7b5223d85f714a55740dc3ecdf6fac5860d249631f7aab8beebd50be3ad70ef0
{ "func_code_index": [ 5657, 5846 ] }
38
SunCoinToken
SunCoinToken.sol
0x606764b8eb3db766e0b3919dde491725d4a4a6c7
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint remaining) {} event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); }
totalSupply
function totalSupply() constant returns (uint supply) {}
/// @return total amount of tokens
NatSpecSingleLine
v0.4.19+commit.c4cbbb05
None
bzzr://8d743c49c918628e998dfcda38d2188530dc8958a8a16e1c95a7144ceee650c0
{ "func_code_index": [ 60, 121 ] }
39
SunCoinToken
SunCoinToken.sol
0x606764b8eb3db766e0b3919dde491725d4a4a6c7
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint remaining) {} event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); }
balanceOf
function balanceOf(address _owner) constant returns (uint balance) {}
/// @param _owner The address from which the balance will be retrieved /// @return The balance
NatSpecSingleLine
v0.4.19+commit.c4cbbb05
None
bzzr://8d743c49c918628e998dfcda38d2188530dc8958a8a16e1c95a7144ceee650c0
{ "func_code_index": [ 229, 303 ] }
40
SunCoinToken
SunCoinToken.sol
0x606764b8eb3db766e0b3919dde491725d4a4a6c7
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint remaining) {} event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); }
transfer
function transfer(address _to, uint _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not
NatSpecSingleLine
v0.4.19+commit.c4cbbb05
None
bzzr://8d743c49c918628e998dfcda38d2188530dc8958a8a16e1c95a7144ceee650c0
{ "func_code_index": [ 540, 614 ] }
41
SunCoinToken
SunCoinToken.sol
0x606764b8eb3db766e0b3919dde491725d4a4a6c7
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint remaining) {} event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); }
transferFrom
function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not
NatSpecSingleLine
v0.4.19+commit.c4cbbb05
None
bzzr://8d743c49c918628e998dfcda38d2188530dc8958a8a16e1c95a7144ceee650c0
{ "func_code_index": [ 937, 1030 ] }
42
SunCoinToken
SunCoinToken.sol
0x606764b8eb3db766e0b3919dde491725d4a4a6c7
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint remaining) {} event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); }
approve
function approve(address _spender, uint _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not
NatSpecSingleLine
v0.4.19+commit.c4cbbb05
None
bzzr://8d743c49c918628e998dfcda38d2188530dc8958a8a16e1c95a7144ceee650c0
{ "func_code_index": [ 1314, 1392 ] }
43
SunCoinToken
SunCoinToken.sol
0x606764b8eb3db766e0b3919dde491725d4a4a6c7
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint remaining) {} event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); }
allowance
function allowance(address _owner, address _spender) constant returns (uint remaining) {}
/// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent
NatSpecSingleLine
v0.4.19+commit.c4cbbb05
None
bzzr://8d743c49c918628e998dfcda38d2188530dc8958a8a16e1c95a7144ceee650c0
{ "func_code_index": [ 1600, 1694 ] }
44
SunCoinToken
SunCoinToken.sol
0x606764b8eb3db766e0b3919dde491725d4a4a6c7
Solidity
UnboundedRegularToken
contract UnboundedRegularToken is RegularToken { uint constant MAX_UINT = 2**256 - 1; /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited amount. /// @param _from Address to transfer from. /// @param _to Address to transfer to. /// @param _value Amount to transfer. /// @return Success of transfer. function transferFrom(address _from, address _to, uint _value) public returns (bool) { uint allowance = allowed[_from][msg.sender]; if (balances[_from] >= _value && allowance >= _value && balances[_to] + _value >= balances[_to] ) { balances[_to] += _value; balances[_from] -= _value; if (allowance < MAX_UINT) { allowed[_from][msg.sender] -= _value; } Transfer(_from, _to, _value); return true; } else { return false; } } }
transferFrom
function transferFrom(address _from, address _to, uint _value) public returns (bool) { uint allowance = allowed[_from][msg.sender]; if (balances[_from] >= _value && allowance >= _value && balances[_to] + _value >= balances[_to] ) { balances[_to] += _value; balances[_from] -= _value; if (allowance < MAX_UINT) { allowed[_from][msg.sender] -= _value; } Transfer(_from, _to, _value); return true; } else { return false; } }
/// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited amount. /// @param _from Address to transfer from. /// @param _to Address to transfer to. /// @param _value Amount to transfer. /// @return Success of transfer.
NatSpecSingleLine
v0.4.19+commit.c4cbbb05
None
bzzr://8d743c49c918628e998dfcda38d2188530dc8958a8a16e1c95a7144ceee650c0
{ "func_code_index": [ 383, 1016 ] }
45
Huhu
contracts/Huhu.sol
0x1c69a454bd92974ffaf67a8a5203dd8223d8fd37
Solidity
Huhu
contract Huhu is ERC721A, Ownable { using Strings for uint256; string baseURI; string public baseExtension = ".json"; uint256 public cost = 0.05 ether; uint256 public maxSupply = 2022; uint256 public maxMintAmount = 8; bool public paused = false; bool public revealed = true; string public notRevealedUri; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721A(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { require(msg.value >= cost * _mintAmount); } _safeMint(msg.sender, _mintAmount); // for (uint256 i = 1; i <= _mintAmount; i++) { // _safeMint(msg.sender, supply + i); // } } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); if(revealed == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } //only owner function reveal() public onlyOwner { revealed = true; } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner { paused = _state; } function withdraw() public payable onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } }
_baseURI
function _baseURI() internal view virtual override returns (string memory) { return baseURI; }
// internal
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://dae1c1b32ad1698ff8dffd0a373c6677a953cacb1bc698f3db4e6576117eb95e
{ "func_code_index": [ 609, 714 ] }
46
Huhu
contracts/Huhu.sol
0x1c69a454bd92974ffaf67a8a5203dd8223d8fd37
Solidity
Huhu
contract Huhu is ERC721A, Ownable { using Strings for uint256; string baseURI; string public baseExtension = ".json"; uint256 public cost = 0.05 ether; uint256 public maxSupply = 2022; uint256 public maxMintAmount = 8; bool public paused = false; bool public revealed = true; string public notRevealedUri; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721A(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { require(msg.value >= cost * _mintAmount); } _safeMint(msg.sender, _mintAmount); // for (uint256 i = 1; i <= _mintAmount; i++) { // _safeMint(msg.sender, supply + i); // } } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); if(revealed == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } //only owner function reveal() public onlyOwner { revealed = true; } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner { paused = _state; } function withdraw() public payable onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } }
mint
function mint(uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { require(msg.value >= cost * _mintAmount); } _safeMint(msg.sender, _mintAmount); // for (uint256 i = 1; i <= _mintAmount; i++) { // _safeMint(msg.sender, supply + i); // } }
// public
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://dae1c1b32ad1698ff8dffd0a373c6677a953cacb1bc698f3db4e6576117eb95e
{ "func_code_index": [ 730, 1214 ] }
47
Huhu
contracts/Huhu.sol
0x1c69a454bd92974ffaf67a8a5203dd8223d8fd37
Solidity
Huhu
contract Huhu is ERC721A, Ownable { using Strings for uint256; string baseURI; string public baseExtension = ".json"; uint256 public cost = 0.05 ether; uint256 public maxSupply = 2022; uint256 public maxMintAmount = 8; bool public paused = false; bool public revealed = true; string public notRevealedUri; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721A(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { require(msg.value >= cost * _mintAmount); } _safeMint(msg.sender, _mintAmount); // for (uint256 i = 1; i <= _mintAmount; i++) { // _safeMint(msg.sender, supply + i); // } } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); if(revealed == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } //only owner function reveal() public onlyOwner { revealed = true; } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner { paused = _state; } function withdraw() public payable onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } }
reveal
function reveal() public onlyOwner { revealed = true; }
//only owner
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://dae1c1b32ad1698ff8dffd0a373c6677a953cacb1bc698f3db4e6576117eb95e
{ "func_code_index": [ 2090, 2158 ] }
48
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
transfer
function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); }
/** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 1166, 1320 ] }
49
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
transfer
function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; }
/** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 1527, 2238 ] }
50
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
balanceOf
function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; }
/** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 2451, 2568 ] }
51
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
transferFrom
function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); }
/** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 2857, 3041 ] }
52
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
transferFrom
function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; }
/** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 3370, 4131 ] }
53
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
approve
function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 4783, 5055 ] }
54
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
allowance
function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; }
/** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 5388, 5524 ] }
55
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
increaseApproval
function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 6010, 6290 ] }
56
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
decreaseApproval
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 6781, 7231 ] }
57
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
mint
function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; }
/** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 7486, 7866 ] }
58
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
finishMinting
function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; }
/** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 7991, 8155 ] }
59
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
setMinter
function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; }
/** * Minter can pass it's role to another address */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 8233, 8363 ] }
60
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
removeFromFreezedList
function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; }
/** * Owner can unfreeze any address */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 8423, 8536 ] }
61
Presale
contracts/token/PlayHallToken.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
PlayHallToken
contract PlayHallToken is ERC223, Contactable { using SafeMath for uint; string constant public name = "PlayHall Token"; string constant public symbol = "PHT"; uint constant public decimals = 18; bool public isActivated = false; mapping (address => uint) balances; mapping (address => mapping (address => uint)) internal allowed; mapping (address => bool) public freezedList; // address, who is allowed to issue new tokens (presale and sale contracts) address public minter; bool public mintingFinished = false; event Mint(address indexed to, uint amount); event MintingFinished(); modifier onlyMinter() { require(msg.sender == minter); _; } modifier canMint() { require(!mintingFinished); _; } modifier whenActivated() { require(isActivated); _; } function PlayHallToken() public { minter = msg.sender; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint _value) public returns (bool) { bytes memory empty; return transfer(_to, _value, empty); } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Optional metadata. */ function transfer(address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!freezedList[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(msg.sender, _value, _data); } Transfer(msg.sender, _to, _value); Transfer(msg.sender, _to, _value, _data); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint balance) { return balances[_owner]; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint _value) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _value, empty); } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint the amount of tokens to be transferred * @param _data Optional metadata. */ function transferFrom(address _from, address _to, uint _value, bytes _data) public whenActivated returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(!freezedList[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); if (isContract(_to)) { TokenReciever receiver = TokenReciever(_to); receiver.tokenFallback(_from, _value, _data); } Transfer(_from, _to, _value); Transfer(_from, _to, _value, _data); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint _value) public returns (bool) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); if (freeze) { freezedList[_to] = true; } Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() canMint onlyMinter external returns (bool) { mintingFinished = true; MintingFinished(); return true; } /** * Minter can pass it's role to another address */ function setMinter(address _minter) external onlyMinter { require(_minter != 0x0); minter = _minter; } /** * Owner can unfreeze any address */ function removeFromFreezedList(address user) external onlyOwner { freezedList[user] = false; } /** * Activation of the token allows all tokenholders to operate with the token */ function activate() external onlyOwner returns (bool) { isActivated = true; return true; } function isContract(address _addr) private view returns (bool) { uint length; assembly { //retrieve the size of the code on target address, this needs assembly length := extcodesize(_addr) } return (length>0); } }
activate
function activate() external onlyOwner returns (bool) { isActivated = true; return true; }
/** * Activation of the token allows all tokenholders to operate with the token */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 8639, 8757 ] }
62
Presale
contracts/SaleBase.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
SaleBase
contract SaleBase is Pausable, Contactable { using SafeMath for uint; // The token being sold PlayHallToken public token; // start and end timestamps where purchases are allowed (both inclusive) uint public startTime; uint public endTime; // address where funds are collected address public wallet; // the contract, which determine how many token units a buyer gets per wei IPricingStrategy public pricingStrategy; // amount of raised money in wei uint public weiRaised; // amount of tokens that was sold on the crowdsale uint public tokensSold; // maximum amount of wei in total, that can be bought uint public weiMaximumGoal; // if weiMinimumGoal will not be reached till endTime, buyers will be able to refund ETH uint public weiMinimumGoal; // minimum amount of wel, that can be contributed uint public weiMinimumAmount; // How many distinct addresses have bought uint public buyerCount; // how much wei we have returned back to the contract after a failed crowdfund uint public loadedRefund; // how much wei we have given back to buyers uint public weiRefunded; // how much ETH each address has bought to this crowdsale mapping (address => uint) public boughtAmountOf; // whether a buyer already bought some tokens mapping (address => bool) public isBuyer; // whether a buyer bought tokens through other currencies mapping (address => bool) public isExternalBuyer; address public admin; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param tokenAmount amount of tokens purchased */ event TokenPurchase( address indexed purchaser, address indexed beneficiary, uint value, uint tokenAmount ); // a refund was processed for an buyer event Refund(address buyer, uint weiAmount); event RefundLoaded(uint amount); function SaleBase( uint _startTime, uint _endTime, IPricingStrategy _pricingStrategy, PlayHallToken _token, address _wallet, uint _weiMaximumGoal, uint _weiMinimumGoal, uint _weiMinimumAmount, address _admin ) public { require(_startTime >= now); require(_endTime >= _startTime); require(_pricingStrategy.isPricingStrategy()); require(address(_token) != 0x0); require(_wallet != 0x0); require(_weiMaximumGoal > 0); require(_admin != 0x0); startTime = _startTime; endTime = _endTime; pricingStrategy = _pricingStrategy; token = _token; wallet = _wallet; weiMaximumGoal = _weiMaximumGoal; weiMinimumGoal = _weiMinimumGoal; weiMinimumAmount = _weiMinimumAmount; admin = _admin; } modifier onlyOwnerOrAdmin() { require(msg.sender == owner || msg.sender == admin); _; } // fallback function can be used to buy tokens function () external payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) public whenNotPaused payable returns (bool) { uint weiAmount = msg.value; require(beneficiary != 0x0); require(weiAmount >= weiMinimumAmount); require(validPurchase(msg.value)); // calculate token amount to be created uint tokenAmount = pricingStrategy.calculateTokenAmount(weiAmount, weiRaised); mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); wallet.transfer(msg.value); return true; } function mintTokenToBuyer(address beneficiary, uint tokenAmount, uint weiAmount) internal { if (!isBuyer[beneficiary]) { // A new buyer buyerCount++; isBuyer[beneficiary] = true; } boughtAmountOf[beneficiary] = boughtAmountOf[beneficiary].add(weiAmount); weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokenAmount); token.mint(beneficiary, tokenAmount, true); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); } // return true if the transaction can buy tokens function validPurchase(uint weiAmount) internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool withinCap = weiRaised.add(weiAmount) <= weiMaximumGoal; return withinPeriod && withinCap; } // return true if crowdsale event has ended function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; } // get the amount of unsold tokens allocated to this contract; function getWeiLeft() external constant returns (uint) { return weiMaximumGoal - weiRaised; } // return true if the crowdsale has raised enough money to be a successful. function isMinimumGoalReached() public constant returns (bool) { return weiRaised >= weiMinimumGoal; } // allows to update tokens rate for owner function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) { pricingStrategy = _pricingStrategy; return true; } /** * Allow load refunds back on the contract for the refunding. * * The team can transfer the funds back on the smart contract in the case the minimum goal was not reached.. */ function loadRefund() external payable { require(msg.sender == wallet); require(msg.value > 0); require(!isMinimumGoalReached()); loadedRefund = loadedRefund.add(msg.value); RefundLoaded(msg.value); } /** * Buyers can claim refund. * * Note that any refunds from proxy buyers should be handled separately, * and not through this contract. */ function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); } function registerPayment(address beneficiary, uint tokenAmount, uint weiAmount) public onlyOwnerOrAdmin { require(validPurchase(weiAmount)); isExternalBuyer[beneficiary] = true; mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); } function registerPayments(address[] beneficiaries, uint[] tokenAmounts, uint[] weiAmounts) external onlyOwnerOrAdmin { require(beneficiaries.length == tokenAmounts.length); require(tokenAmounts.length == weiAmounts.length); for (uint i = 0; i < beneficiaries.length; i++) { registerPayment(beneficiaries[i], tokenAmounts[i], weiAmounts[i]); } } function setAdmin(address adminAddress) external onlyOwner { admin = adminAddress; } }
function () external payable { buyTokens(msg.sender); }
// fallback function can be used to buy tokens
LineComment
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 3244, 3318 ] }
63
Presale
contracts/SaleBase.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
SaleBase
contract SaleBase is Pausable, Contactable { using SafeMath for uint; // The token being sold PlayHallToken public token; // start and end timestamps where purchases are allowed (both inclusive) uint public startTime; uint public endTime; // address where funds are collected address public wallet; // the contract, which determine how many token units a buyer gets per wei IPricingStrategy public pricingStrategy; // amount of raised money in wei uint public weiRaised; // amount of tokens that was sold on the crowdsale uint public tokensSold; // maximum amount of wei in total, that can be bought uint public weiMaximumGoal; // if weiMinimumGoal will not be reached till endTime, buyers will be able to refund ETH uint public weiMinimumGoal; // minimum amount of wel, that can be contributed uint public weiMinimumAmount; // How many distinct addresses have bought uint public buyerCount; // how much wei we have returned back to the contract after a failed crowdfund uint public loadedRefund; // how much wei we have given back to buyers uint public weiRefunded; // how much ETH each address has bought to this crowdsale mapping (address => uint) public boughtAmountOf; // whether a buyer already bought some tokens mapping (address => bool) public isBuyer; // whether a buyer bought tokens through other currencies mapping (address => bool) public isExternalBuyer; address public admin; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param tokenAmount amount of tokens purchased */ event TokenPurchase( address indexed purchaser, address indexed beneficiary, uint value, uint tokenAmount ); // a refund was processed for an buyer event Refund(address buyer, uint weiAmount); event RefundLoaded(uint amount); function SaleBase( uint _startTime, uint _endTime, IPricingStrategy _pricingStrategy, PlayHallToken _token, address _wallet, uint _weiMaximumGoal, uint _weiMinimumGoal, uint _weiMinimumAmount, address _admin ) public { require(_startTime >= now); require(_endTime >= _startTime); require(_pricingStrategy.isPricingStrategy()); require(address(_token) != 0x0); require(_wallet != 0x0); require(_weiMaximumGoal > 0); require(_admin != 0x0); startTime = _startTime; endTime = _endTime; pricingStrategy = _pricingStrategy; token = _token; wallet = _wallet; weiMaximumGoal = _weiMaximumGoal; weiMinimumGoal = _weiMinimumGoal; weiMinimumAmount = _weiMinimumAmount; admin = _admin; } modifier onlyOwnerOrAdmin() { require(msg.sender == owner || msg.sender == admin); _; } // fallback function can be used to buy tokens function () external payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) public whenNotPaused payable returns (bool) { uint weiAmount = msg.value; require(beneficiary != 0x0); require(weiAmount >= weiMinimumAmount); require(validPurchase(msg.value)); // calculate token amount to be created uint tokenAmount = pricingStrategy.calculateTokenAmount(weiAmount, weiRaised); mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); wallet.transfer(msg.value); return true; } function mintTokenToBuyer(address beneficiary, uint tokenAmount, uint weiAmount) internal { if (!isBuyer[beneficiary]) { // A new buyer buyerCount++; isBuyer[beneficiary] = true; } boughtAmountOf[beneficiary] = boughtAmountOf[beneficiary].add(weiAmount); weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokenAmount); token.mint(beneficiary, tokenAmount, true); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); } // return true if the transaction can buy tokens function validPurchase(uint weiAmount) internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool withinCap = weiRaised.add(weiAmount) <= weiMaximumGoal; return withinPeriod && withinCap; } // return true if crowdsale event has ended function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; } // get the amount of unsold tokens allocated to this contract; function getWeiLeft() external constant returns (uint) { return weiMaximumGoal - weiRaised; } // return true if the crowdsale has raised enough money to be a successful. function isMinimumGoalReached() public constant returns (bool) { return weiRaised >= weiMinimumGoal; } // allows to update tokens rate for owner function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) { pricingStrategy = _pricingStrategy; return true; } /** * Allow load refunds back on the contract for the refunding. * * The team can transfer the funds back on the smart contract in the case the minimum goal was not reached.. */ function loadRefund() external payable { require(msg.sender == wallet); require(msg.value > 0); require(!isMinimumGoalReached()); loadedRefund = loadedRefund.add(msg.value); RefundLoaded(msg.value); } /** * Buyers can claim refund. * * Note that any refunds from proxy buyers should be handled separately, * and not through this contract. */ function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); } function registerPayment(address beneficiary, uint tokenAmount, uint weiAmount) public onlyOwnerOrAdmin { require(validPurchase(weiAmount)); isExternalBuyer[beneficiary] = true; mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); } function registerPayments(address[] beneficiaries, uint[] tokenAmounts, uint[] weiAmounts) external onlyOwnerOrAdmin { require(beneficiaries.length == tokenAmounts.length); require(tokenAmounts.length == weiAmounts.length); for (uint i = 0; i < beneficiaries.length; i++) { registerPayment(beneficiaries[i], tokenAmounts[i], weiAmounts[i]); } } function setAdmin(address adminAddress) external onlyOwner { admin = adminAddress; } }
buyTokens
function buyTokens(address beneficiary) public whenNotPaused payable returns (bool) { uint weiAmount = msg.value; require(beneficiary != 0x0); require(weiAmount >= weiMinimumAmount); require(validPurchase(msg.value)); // calculate token amount to be created uint tokenAmount = pricingStrategy.calculateTokenAmount(weiAmount, weiRaised); mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); wallet.transfer(msg.value); return true; }
// low level token purchase function
LineComment
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 3363, 3918 ] }
64
Presale
contracts/SaleBase.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
SaleBase
contract SaleBase is Pausable, Contactable { using SafeMath for uint; // The token being sold PlayHallToken public token; // start and end timestamps where purchases are allowed (both inclusive) uint public startTime; uint public endTime; // address where funds are collected address public wallet; // the contract, which determine how many token units a buyer gets per wei IPricingStrategy public pricingStrategy; // amount of raised money in wei uint public weiRaised; // amount of tokens that was sold on the crowdsale uint public tokensSold; // maximum amount of wei in total, that can be bought uint public weiMaximumGoal; // if weiMinimumGoal will not be reached till endTime, buyers will be able to refund ETH uint public weiMinimumGoal; // minimum amount of wel, that can be contributed uint public weiMinimumAmount; // How many distinct addresses have bought uint public buyerCount; // how much wei we have returned back to the contract after a failed crowdfund uint public loadedRefund; // how much wei we have given back to buyers uint public weiRefunded; // how much ETH each address has bought to this crowdsale mapping (address => uint) public boughtAmountOf; // whether a buyer already bought some tokens mapping (address => bool) public isBuyer; // whether a buyer bought tokens through other currencies mapping (address => bool) public isExternalBuyer; address public admin; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param tokenAmount amount of tokens purchased */ event TokenPurchase( address indexed purchaser, address indexed beneficiary, uint value, uint tokenAmount ); // a refund was processed for an buyer event Refund(address buyer, uint weiAmount); event RefundLoaded(uint amount); function SaleBase( uint _startTime, uint _endTime, IPricingStrategy _pricingStrategy, PlayHallToken _token, address _wallet, uint _weiMaximumGoal, uint _weiMinimumGoal, uint _weiMinimumAmount, address _admin ) public { require(_startTime >= now); require(_endTime >= _startTime); require(_pricingStrategy.isPricingStrategy()); require(address(_token) != 0x0); require(_wallet != 0x0); require(_weiMaximumGoal > 0); require(_admin != 0x0); startTime = _startTime; endTime = _endTime; pricingStrategy = _pricingStrategy; token = _token; wallet = _wallet; weiMaximumGoal = _weiMaximumGoal; weiMinimumGoal = _weiMinimumGoal; weiMinimumAmount = _weiMinimumAmount; admin = _admin; } modifier onlyOwnerOrAdmin() { require(msg.sender == owner || msg.sender == admin); _; } // fallback function can be used to buy tokens function () external payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) public whenNotPaused payable returns (bool) { uint weiAmount = msg.value; require(beneficiary != 0x0); require(weiAmount >= weiMinimumAmount); require(validPurchase(msg.value)); // calculate token amount to be created uint tokenAmount = pricingStrategy.calculateTokenAmount(weiAmount, weiRaised); mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); wallet.transfer(msg.value); return true; } function mintTokenToBuyer(address beneficiary, uint tokenAmount, uint weiAmount) internal { if (!isBuyer[beneficiary]) { // A new buyer buyerCount++; isBuyer[beneficiary] = true; } boughtAmountOf[beneficiary] = boughtAmountOf[beneficiary].add(weiAmount); weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokenAmount); token.mint(beneficiary, tokenAmount, true); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); } // return true if the transaction can buy tokens function validPurchase(uint weiAmount) internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool withinCap = weiRaised.add(weiAmount) <= weiMaximumGoal; return withinPeriod && withinCap; } // return true if crowdsale event has ended function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; } // get the amount of unsold tokens allocated to this contract; function getWeiLeft() external constant returns (uint) { return weiMaximumGoal - weiRaised; } // return true if the crowdsale has raised enough money to be a successful. function isMinimumGoalReached() public constant returns (bool) { return weiRaised >= weiMinimumGoal; } // allows to update tokens rate for owner function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) { pricingStrategy = _pricingStrategy; return true; } /** * Allow load refunds back on the contract for the refunding. * * The team can transfer the funds back on the smart contract in the case the minimum goal was not reached.. */ function loadRefund() external payable { require(msg.sender == wallet); require(msg.value > 0); require(!isMinimumGoalReached()); loadedRefund = loadedRefund.add(msg.value); RefundLoaded(msg.value); } /** * Buyers can claim refund. * * Note that any refunds from proxy buyers should be handled separately, * and not through this contract. */ function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); } function registerPayment(address beneficiary, uint tokenAmount, uint weiAmount) public onlyOwnerOrAdmin { require(validPurchase(weiAmount)); isExternalBuyer[beneficiary] = true; mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); } function registerPayments(address[] beneficiaries, uint[] tokenAmounts, uint[] weiAmounts) external onlyOwnerOrAdmin { require(beneficiaries.length == tokenAmounts.length); require(tokenAmounts.length == weiAmounts.length); for (uint i = 0; i < beneficiaries.length; i++) { registerPayment(beneficiaries[i], tokenAmounts[i], weiAmounts[i]); } } function setAdmin(address adminAddress) external onlyOwner { admin = adminAddress; } }
validPurchase
function validPurchase(uint weiAmount) internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool withinCap = weiRaised.add(weiAmount) <= weiMaximumGoal; return withinPeriod && withinCap; }
// return true if the transaction can buy tokens
LineComment
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 4542, 4807 ] }
65
Presale
contracts/SaleBase.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
SaleBase
contract SaleBase is Pausable, Contactable { using SafeMath for uint; // The token being sold PlayHallToken public token; // start and end timestamps where purchases are allowed (both inclusive) uint public startTime; uint public endTime; // address where funds are collected address public wallet; // the contract, which determine how many token units a buyer gets per wei IPricingStrategy public pricingStrategy; // amount of raised money in wei uint public weiRaised; // amount of tokens that was sold on the crowdsale uint public tokensSold; // maximum amount of wei in total, that can be bought uint public weiMaximumGoal; // if weiMinimumGoal will not be reached till endTime, buyers will be able to refund ETH uint public weiMinimumGoal; // minimum amount of wel, that can be contributed uint public weiMinimumAmount; // How many distinct addresses have bought uint public buyerCount; // how much wei we have returned back to the contract after a failed crowdfund uint public loadedRefund; // how much wei we have given back to buyers uint public weiRefunded; // how much ETH each address has bought to this crowdsale mapping (address => uint) public boughtAmountOf; // whether a buyer already bought some tokens mapping (address => bool) public isBuyer; // whether a buyer bought tokens through other currencies mapping (address => bool) public isExternalBuyer; address public admin; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param tokenAmount amount of tokens purchased */ event TokenPurchase( address indexed purchaser, address indexed beneficiary, uint value, uint tokenAmount ); // a refund was processed for an buyer event Refund(address buyer, uint weiAmount); event RefundLoaded(uint amount); function SaleBase( uint _startTime, uint _endTime, IPricingStrategy _pricingStrategy, PlayHallToken _token, address _wallet, uint _weiMaximumGoal, uint _weiMinimumGoal, uint _weiMinimumAmount, address _admin ) public { require(_startTime >= now); require(_endTime >= _startTime); require(_pricingStrategy.isPricingStrategy()); require(address(_token) != 0x0); require(_wallet != 0x0); require(_weiMaximumGoal > 0); require(_admin != 0x0); startTime = _startTime; endTime = _endTime; pricingStrategy = _pricingStrategy; token = _token; wallet = _wallet; weiMaximumGoal = _weiMaximumGoal; weiMinimumGoal = _weiMinimumGoal; weiMinimumAmount = _weiMinimumAmount; admin = _admin; } modifier onlyOwnerOrAdmin() { require(msg.sender == owner || msg.sender == admin); _; } // fallback function can be used to buy tokens function () external payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) public whenNotPaused payable returns (bool) { uint weiAmount = msg.value; require(beneficiary != 0x0); require(weiAmount >= weiMinimumAmount); require(validPurchase(msg.value)); // calculate token amount to be created uint tokenAmount = pricingStrategy.calculateTokenAmount(weiAmount, weiRaised); mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); wallet.transfer(msg.value); return true; } function mintTokenToBuyer(address beneficiary, uint tokenAmount, uint weiAmount) internal { if (!isBuyer[beneficiary]) { // A new buyer buyerCount++; isBuyer[beneficiary] = true; } boughtAmountOf[beneficiary] = boughtAmountOf[beneficiary].add(weiAmount); weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokenAmount); token.mint(beneficiary, tokenAmount, true); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); } // return true if the transaction can buy tokens function validPurchase(uint weiAmount) internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool withinCap = weiRaised.add(weiAmount) <= weiMaximumGoal; return withinPeriod && withinCap; } // return true if crowdsale event has ended function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; } // get the amount of unsold tokens allocated to this contract; function getWeiLeft() external constant returns (uint) { return weiMaximumGoal - weiRaised; } // return true if the crowdsale has raised enough money to be a successful. function isMinimumGoalReached() public constant returns (bool) { return weiRaised >= weiMinimumGoal; } // allows to update tokens rate for owner function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) { pricingStrategy = _pricingStrategy; return true; } /** * Allow load refunds back on the contract for the refunding. * * The team can transfer the funds back on the smart contract in the case the minimum goal was not reached.. */ function loadRefund() external payable { require(msg.sender == wallet); require(msg.value > 0); require(!isMinimumGoalReached()); loadedRefund = loadedRefund.add(msg.value); RefundLoaded(msg.value); } /** * Buyers can claim refund. * * Note that any refunds from proxy buyers should be handled separately, * and not through this contract. */ function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); } function registerPayment(address beneficiary, uint tokenAmount, uint weiAmount) public onlyOwnerOrAdmin { require(validPurchase(weiAmount)); isExternalBuyer[beneficiary] = true; mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); } function registerPayments(address[] beneficiaries, uint[] tokenAmounts, uint[] weiAmounts) external onlyOwnerOrAdmin { require(beneficiaries.length == tokenAmounts.length); require(tokenAmounts.length == weiAmounts.length); for (uint i = 0; i < beneficiaries.length; i++) { registerPayment(beneficiaries[i], tokenAmounts[i], weiAmounts[i]); } } function setAdmin(address adminAddress) external onlyOwner { admin = adminAddress; } }
hasEnded
function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; }
// return true if crowdsale event has ended
LineComment
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 4859, 5077 ] }
66
Presale
contracts/SaleBase.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
SaleBase
contract SaleBase is Pausable, Contactable { using SafeMath for uint; // The token being sold PlayHallToken public token; // start and end timestamps where purchases are allowed (both inclusive) uint public startTime; uint public endTime; // address where funds are collected address public wallet; // the contract, which determine how many token units a buyer gets per wei IPricingStrategy public pricingStrategy; // amount of raised money in wei uint public weiRaised; // amount of tokens that was sold on the crowdsale uint public tokensSold; // maximum amount of wei in total, that can be bought uint public weiMaximumGoal; // if weiMinimumGoal will not be reached till endTime, buyers will be able to refund ETH uint public weiMinimumGoal; // minimum amount of wel, that can be contributed uint public weiMinimumAmount; // How many distinct addresses have bought uint public buyerCount; // how much wei we have returned back to the contract after a failed crowdfund uint public loadedRefund; // how much wei we have given back to buyers uint public weiRefunded; // how much ETH each address has bought to this crowdsale mapping (address => uint) public boughtAmountOf; // whether a buyer already bought some tokens mapping (address => bool) public isBuyer; // whether a buyer bought tokens through other currencies mapping (address => bool) public isExternalBuyer; address public admin; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param tokenAmount amount of tokens purchased */ event TokenPurchase( address indexed purchaser, address indexed beneficiary, uint value, uint tokenAmount ); // a refund was processed for an buyer event Refund(address buyer, uint weiAmount); event RefundLoaded(uint amount); function SaleBase( uint _startTime, uint _endTime, IPricingStrategy _pricingStrategy, PlayHallToken _token, address _wallet, uint _weiMaximumGoal, uint _weiMinimumGoal, uint _weiMinimumAmount, address _admin ) public { require(_startTime >= now); require(_endTime >= _startTime); require(_pricingStrategy.isPricingStrategy()); require(address(_token) != 0x0); require(_wallet != 0x0); require(_weiMaximumGoal > 0); require(_admin != 0x0); startTime = _startTime; endTime = _endTime; pricingStrategy = _pricingStrategy; token = _token; wallet = _wallet; weiMaximumGoal = _weiMaximumGoal; weiMinimumGoal = _weiMinimumGoal; weiMinimumAmount = _weiMinimumAmount; admin = _admin; } modifier onlyOwnerOrAdmin() { require(msg.sender == owner || msg.sender == admin); _; } // fallback function can be used to buy tokens function () external payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) public whenNotPaused payable returns (bool) { uint weiAmount = msg.value; require(beneficiary != 0x0); require(weiAmount >= weiMinimumAmount); require(validPurchase(msg.value)); // calculate token amount to be created uint tokenAmount = pricingStrategy.calculateTokenAmount(weiAmount, weiRaised); mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); wallet.transfer(msg.value); return true; } function mintTokenToBuyer(address beneficiary, uint tokenAmount, uint weiAmount) internal { if (!isBuyer[beneficiary]) { // A new buyer buyerCount++; isBuyer[beneficiary] = true; } boughtAmountOf[beneficiary] = boughtAmountOf[beneficiary].add(weiAmount); weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokenAmount); token.mint(beneficiary, tokenAmount, true); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); } // return true if the transaction can buy tokens function validPurchase(uint weiAmount) internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool withinCap = weiRaised.add(weiAmount) <= weiMaximumGoal; return withinPeriod && withinCap; } // return true if crowdsale event has ended function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; } // get the amount of unsold tokens allocated to this contract; function getWeiLeft() external constant returns (uint) { return weiMaximumGoal - weiRaised; } // return true if the crowdsale has raised enough money to be a successful. function isMinimumGoalReached() public constant returns (bool) { return weiRaised >= weiMinimumGoal; } // allows to update tokens rate for owner function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) { pricingStrategy = _pricingStrategy; return true; } /** * Allow load refunds back on the contract for the refunding. * * The team can transfer the funds back on the smart contract in the case the minimum goal was not reached.. */ function loadRefund() external payable { require(msg.sender == wallet); require(msg.value > 0); require(!isMinimumGoalReached()); loadedRefund = loadedRefund.add(msg.value); RefundLoaded(msg.value); } /** * Buyers can claim refund. * * Note that any refunds from proxy buyers should be handled separately, * and not through this contract. */ function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); } function registerPayment(address beneficiary, uint tokenAmount, uint weiAmount) public onlyOwnerOrAdmin { require(validPurchase(weiAmount)); isExternalBuyer[beneficiary] = true; mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); } function registerPayments(address[] beneficiaries, uint[] tokenAmounts, uint[] weiAmounts) external onlyOwnerOrAdmin { require(beneficiaries.length == tokenAmounts.length); require(tokenAmounts.length == weiAmounts.length); for (uint i = 0; i < beneficiaries.length; i++) { registerPayment(beneficiaries[i], tokenAmounts[i], weiAmounts[i]); } } function setAdmin(address adminAddress) external onlyOwner { admin = adminAddress; } }
getWeiLeft
function getWeiLeft() external constant returns (uint) { return weiMaximumGoal - weiRaised; }
// get the amount of unsold tokens allocated to this contract;
LineComment
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 5148, 5260 ] }
67
Presale
contracts/SaleBase.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
SaleBase
contract SaleBase is Pausable, Contactable { using SafeMath for uint; // The token being sold PlayHallToken public token; // start and end timestamps where purchases are allowed (both inclusive) uint public startTime; uint public endTime; // address where funds are collected address public wallet; // the contract, which determine how many token units a buyer gets per wei IPricingStrategy public pricingStrategy; // amount of raised money in wei uint public weiRaised; // amount of tokens that was sold on the crowdsale uint public tokensSold; // maximum amount of wei in total, that can be bought uint public weiMaximumGoal; // if weiMinimumGoal will not be reached till endTime, buyers will be able to refund ETH uint public weiMinimumGoal; // minimum amount of wel, that can be contributed uint public weiMinimumAmount; // How many distinct addresses have bought uint public buyerCount; // how much wei we have returned back to the contract after a failed crowdfund uint public loadedRefund; // how much wei we have given back to buyers uint public weiRefunded; // how much ETH each address has bought to this crowdsale mapping (address => uint) public boughtAmountOf; // whether a buyer already bought some tokens mapping (address => bool) public isBuyer; // whether a buyer bought tokens through other currencies mapping (address => bool) public isExternalBuyer; address public admin; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param tokenAmount amount of tokens purchased */ event TokenPurchase( address indexed purchaser, address indexed beneficiary, uint value, uint tokenAmount ); // a refund was processed for an buyer event Refund(address buyer, uint weiAmount); event RefundLoaded(uint amount); function SaleBase( uint _startTime, uint _endTime, IPricingStrategy _pricingStrategy, PlayHallToken _token, address _wallet, uint _weiMaximumGoal, uint _weiMinimumGoal, uint _weiMinimumAmount, address _admin ) public { require(_startTime >= now); require(_endTime >= _startTime); require(_pricingStrategy.isPricingStrategy()); require(address(_token) != 0x0); require(_wallet != 0x0); require(_weiMaximumGoal > 0); require(_admin != 0x0); startTime = _startTime; endTime = _endTime; pricingStrategy = _pricingStrategy; token = _token; wallet = _wallet; weiMaximumGoal = _weiMaximumGoal; weiMinimumGoal = _weiMinimumGoal; weiMinimumAmount = _weiMinimumAmount; admin = _admin; } modifier onlyOwnerOrAdmin() { require(msg.sender == owner || msg.sender == admin); _; } // fallback function can be used to buy tokens function () external payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) public whenNotPaused payable returns (bool) { uint weiAmount = msg.value; require(beneficiary != 0x0); require(weiAmount >= weiMinimumAmount); require(validPurchase(msg.value)); // calculate token amount to be created uint tokenAmount = pricingStrategy.calculateTokenAmount(weiAmount, weiRaised); mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); wallet.transfer(msg.value); return true; } function mintTokenToBuyer(address beneficiary, uint tokenAmount, uint weiAmount) internal { if (!isBuyer[beneficiary]) { // A new buyer buyerCount++; isBuyer[beneficiary] = true; } boughtAmountOf[beneficiary] = boughtAmountOf[beneficiary].add(weiAmount); weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokenAmount); token.mint(beneficiary, tokenAmount, true); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); } // return true if the transaction can buy tokens function validPurchase(uint weiAmount) internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool withinCap = weiRaised.add(weiAmount) <= weiMaximumGoal; return withinPeriod && withinCap; } // return true if crowdsale event has ended function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; } // get the amount of unsold tokens allocated to this contract; function getWeiLeft() external constant returns (uint) { return weiMaximumGoal - weiRaised; } // return true if the crowdsale has raised enough money to be a successful. function isMinimumGoalReached() public constant returns (bool) { return weiRaised >= weiMinimumGoal; } // allows to update tokens rate for owner function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) { pricingStrategy = _pricingStrategy; return true; } /** * Allow load refunds back on the contract for the refunding. * * The team can transfer the funds back on the smart contract in the case the minimum goal was not reached.. */ function loadRefund() external payable { require(msg.sender == wallet); require(msg.value > 0); require(!isMinimumGoalReached()); loadedRefund = loadedRefund.add(msg.value); RefundLoaded(msg.value); } /** * Buyers can claim refund. * * Note that any refunds from proxy buyers should be handled separately, * and not through this contract. */ function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); } function registerPayment(address beneficiary, uint tokenAmount, uint weiAmount) public onlyOwnerOrAdmin { require(validPurchase(weiAmount)); isExternalBuyer[beneficiary] = true; mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); } function registerPayments(address[] beneficiaries, uint[] tokenAmounts, uint[] weiAmounts) external onlyOwnerOrAdmin { require(beneficiaries.length == tokenAmounts.length); require(tokenAmounts.length == weiAmounts.length); for (uint i = 0; i < beneficiaries.length; i++) { registerPayment(beneficiaries[i], tokenAmounts[i], weiAmounts[i]); } } function setAdmin(address adminAddress) external onlyOwner { admin = adminAddress; } }
isMinimumGoalReached
function isMinimumGoalReached() public constant returns (bool) { return weiRaised >= weiMinimumGoal; }
// return true if the crowdsale has raised enough money to be a successful.
LineComment
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 5344, 5465 ] }
68
Presale
contracts/SaleBase.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
SaleBase
contract SaleBase is Pausable, Contactable { using SafeMath for uint; // The token being sold PlayHallToken public token; // start and end timestamps where purchases are allowed (both inclusive) uint public startTime; uint public endTime; // address where funds are collected address public wallet; // the contract, which determine how many token units a buyer gets per wei IPricingStrategy public pricingStrategy; // amount of raised money in wei uint public weiRaised; // amount of tokens that was sold on the crowdsale uint public tokensSold; // maximum amount of wei in total, that can be bought uint public weiMaximumGoal; // if weiMinimumGoal will not be reached till endTime, buyers will be able to refund ETH uint public weiMinimumGoal; // minimum amount of wel, that can be contributed uint public weiMinimumAmount; // How many distinct addresses have bought uint public buyerCount; // how much wei we have returned back to the contract after a failed crowdfund uint public loadedRefund; // how much wei we have given back to buyers uint public weiRefunded; // how much ETH each address has bought to this crowdsale mapping (address => uint) public boughtAmountOf; // whether a buyer already bought some tokens mapping (address => bool) public isBuyer; // whether a buyer bought tokens through other currencies mapping (address => bool) public isExternalBuyer; address public admin; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param tokenAmount amount of tokens purchased */ event TokenPurchase( address indexed purchaser, address indexed beneficiary, uint value, uint tokenAmount ); // a refund was processed for an buyer event Refund(address buyer, uint weiAmount); event RefundLoaded(uint amount); function SaleBase( uint _startTime, uint _endTime, IPricingStrategy _pricingStrategy, PlayHallToken _token, address _wallet, uint _weiMaximumGoal, uint _weiMinimumGoal, uint _weiMinimumAmount, address _admin ) public { require(_startTime >= now); require(_endTime >= _startTime); require(_pricingStrategy.isPricingStrategy()); require(address(_token) != 0x0); require(_wallet != 0x0); require(_weiMaximumGoal > 0); require(_admin != 0x0); startTime = _startTime; endTime = _endTime; pricingStrategy = _pricingStrategy; token = _token; wallet = _wallet; weiMaximumGoal = _weiMaximumGoal; weiMinimumGoal = _weiMinimumGoal; weiMinimumAmount = _weiMinimumAmount; admin = _admin; } modifier onlyOwnerOrAdmin() { require(msg.sender == owner || msg.sender == admin); _; } // fallback function can be used to buy tokens function () external payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) public whenNotPaused payable returns (bool) { uint weiAmount = msg.value; require(beneficiary != 0x0); require(weiAmount >= weiMinimumAmount); require(validPurchase(msg.value)); // calculate token amount to be created uint tokenAmount = pricingStrategy.calculateTokenAmount(weiAmount, weiRaised); mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); wallet.transfer(msg.value); return true; } function mintTokenToBuyer(address beneficiary, uint tokenAmount, uint weiAmount) internal { if (!isBuyer[beneficiary]) { // A new buyer buyerCount++; isBuyer[beneficiary] = true; } boughtAmountOf[beneficiary] = boughtAmountOf[beneficiary].add(weiAmount); weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokenAmount); token.mint(beneficiary, tokenAmount, true); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); } // return true if the transaction can buy tokens function validPurchase(uint weiAmount) internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool withinCap = weiRaised.add(weiAmount) <= weiMaximumGoal; return withinPeriod && withinCap; } // return true if crowdsale event has ended function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; } // get the amount of unsold tokens allocated to this contract; function getWeiLeft() external constant returns (uint) { return weiMaximumGoal - weiRaised; } // return true if the crowdsale has raised enough money to be a successful. function isMinimumGoalReached() public constant returns (bool) { return weiRaised >= weiMinimumGoal; } // allows to update tokens rate for owner function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) { pricingStrategy = _pricingStrategy; return true; } /** * Allow load refunds back on the contract for the refunding. * * The team can transfer the funds back on the smart contract in the case the minimum goal was not reached.. */ function loadRefund() external payable { require(msg.sender == wallet); require(msg.value > 0); require(!isMinimumGoalReached()); loadedRefund = loadedRefund.add(msg.value); RefundLoaded(msg.value); } /** * Buyers can claim refund. * * Note that any refunds from proxy buyers should be handled separately, * and not through this contract. */ function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); } function registerPayment(address beneficiary, uint tokenAmount, uint weiAmount) public onlyOwnerOrAdmin { require(validPurchase(weiAmount)); isExternalBuyer[beneficiary] = true; mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); } function registerPayments(address[] beneficiaries, uint[] tokenAmounts, uint[] weiAmounts) external onlyOwnerOrAdmin { require(beneficiaries.length == tokenAmounts.length); require(tokenAmounts.length == weiAmounts.length); for (uint i = 0; i < beneficiaries.length; i++) { registerPayment(beneficiaries[i], tokenAmounts[i], weiAmounts[i]); } } function setAdmin(address adminAddress) external onlyOwner { admin = adminAddress; } }
setPricingStrategy
function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) { pricingStrategy = _pricingStrategy; return true; }
// allows to update tokens rate for owner
LineComment
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 5519, 5696 ] }
69
Presale
contracts/SaleBase.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
SaleBase
contract SaleBase is Pausable, Contactable { using SafeMath for uint; // The token being sold PlayHallToken public token; // start and end timestamps where purchases are allowed (both inclusive) uint public startTime; uint public endTime; // address where funds are collected address public wallet; // the contract, which determine how many token units a buyer gets per wei IPricingStrategy public pricingStrategy; // amount of raised money in wei uint public weiRaised; // amount of tokens that was sold on the crowdsale uint public tokensSold; // maximum amount of wei in total, that can be bought uint public weiMaximumGoal; // if weiMinimumGoal will not be reached till endTime, buyers will be able to refund ETH uint public weiMinimumGoal; // minimum amount of wel, that can be contributed uint public weiMinimumAmount; // How many distinct addresses have bought uint public buyerCount; // how much wei we have returned back to the contract after a failed crowdfund uint public loadedRefund; // how much wei we have given back to buyers uint public weiRefunded; // how much ETH each address has bought to this crowdsale mapping (address => uint) public boughtAmountOf; // whether a buyer already bought some tokens mapping (address => bool) public isBuyer; // whether a buyer bought tokens through other currencies mapping (address => bool) public isExternalBuyer; address public admin; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param tokenAmount amount of tokens purchased */ event TokenPurchase( address indexed purchaser, address indexed beneficiary, uint value, uint tokenAmount ); // a refund was processed for an buyer event Refund(address buyer, uint weiAmount); event RefundLoaded(uint amount); function SaleBase( uint _startTime, uint _endTime, IPricingStrategy _pricingStrategy, PlayHallToken _token, address _wallet, uint _weiMaximumGoal, uint _weiMinimumGoal, uint _weiMinimumAmount, address _admin ) public { require(_startTime >= now); require(_endTime >= _startTime); require(_pricingStrategy.isPricingStrategy()); require(address(_token) != 0x0); require(_wallet != 0x0); require(_weiMaximumGoal > 0); require(_admin != 0x0); startTime = _startTime; endTime = _endTime; pricingStrategy = _pricingStrategy; token = _token; wallet = _wallet; weiMaximumGoal = _weiMaximumGoal; weiMinimumGoal = _weiMinimumGoal; weiMinimumAmount = _weiMinimumAmount; admin = _admin; } modifier onlyOwnerOrAdmin() { require(msg.sender == owner || msg.sender == admin); _; } // fallback function can be used to buy tokens function () external payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) public whenNotPaused payable returns (bool) { uint weiAmount = msg.value; require(beneficiary != 0x0); require(weiAmount >= weiMinimumAmount); require(validPurchase(msg.value)); // calculate token amount to be created uint tokenAmount = pricingStrategy.calculateTokenAmount(weiAmount, weiRaised); mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); wallet.transfer(msg.value); return true; } function mintTokenToBuyer(address beneficiary, uint tokenAmount, uint weiAmount) internal { if (!isBuyer[beneficiary]) { // A new buyer buyerCount++; isBuyer[beneficiary] = true; } boughtAmountOf[beneficiary] = boughtAmountOf[beneficiary].add(weiAmount); weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokenAmount); token.mint(beneficiary, tokenAmount, true); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); } // return true if the transaction can buy tokens function validPurchase(uint weiAmount) internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool withinCap = weiRaised.add(weiAmount) <= weiMaximumGoal; return withinPeriod && withinCap; } // return true if crowdsale event has ended function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; } // get the amount of unsold tokens allocated to this contract; function getWeiLeft() external constant returns (uint) { return weiMaximumGoal - weiRaised; } // return true if the crowdsale has raised enough money to be a successful. function isMinimumGoalReached() public constant returns (bool) { return weiRaised >= weiMinimumGoal; } // allows to update tokens rate for owner function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) { pricingStrategy = _pricingStrategy; return true; } /** * Allow load refunds back on the contract for the refunding. * * The team can transfer the funds back on the smart contract in the case the minimum goal was not reached.. */ function loadRefund() external payable { require(msg.sender == wallet); require(msg.value > 0); require(!isMinimumGoalReached()); loadedRefund = loadedRefund.add(msg.value); RefundLoaded(msg.value); } /** * Buyers can claim refund. * * Note that any refunds from proxy buyers should be handled separately, * and not through this contract. */ function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); } function registerPayment(address beneficiary, uint tokenAmount, uint weiAmount) public onlyOwnerOrAdmin { require(validPurchase(weiAmount)); isExternalBuyer[beneficiary] = true; mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); } function registerPayments(address[] beneficiaries, uint[] tokenAmounts, uint[] weiAmounts) external onlyOwnerOrAdmin { require(beneficiaries.length == tokenAmounts.length); require(tokenAmounts.length == weiAmounts.length); for (uint i = 0; i < beneficiaries.length; i++) { registerPayment(beneficiaries[i], tokenAmounts[i], weiAmounts[i]); } } function setAdmin(address adminAddress) external onlyOwner { admin = adminAddress; } }
loadRefund
function loadRefund() external payable { require(msg.sender == wallet); require(msg.value > 0); require(!isMinimumGoalReached()); loadedRefund = loadedRefund.add(msg.value); RefundLoaded(msg.value); }
/** * Allow load refunds back on the contract for the refunding. * * The team can transfer the funds back on the smart contract in the case the minimum goal was not reached.. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 5902, 6169 ] }
70
Presale
contracts/SaleBase.sol
0x0062179227c03efc81301ade144f447f2561edd5
Solidity
SaleBase
contract SaleBase is Pausable, Contactable { using SafeMath for uint; // The token being sold PlayHallToken public token; // start and end timestamps where purchases are allowed (both inclusive) uint public startTime; uint public endTime; // address where funds are collected address public wallet; // the contract, which determine how many token units a buyer gets per wei IPricingStrategy public pricingStrategy; // amount of raised money in wei uint public weiRaised; // amount of tokens that was sold on the crowdsale uint public tokensSold; // maximum amount of wei in total, that can be bought uint public weiMaximumGoal; // if weiMinimumGoal will not be reached till endTime, buyers will be able to refund ETH uint public weiMinimumGoal; // minimum amount of wel, that can be contributed uint public weiMinimumAmount; // How many distinct addresses have bought uint public buyerCount; // how much wei we have returned back to the contract after a failed crowdfund uint public loadedRefund; // how much wei we have given back to buyers uint public weiRefunded; // how much ETH each address has bought to this crowdsale mapping (address => uint) public boughtAmountOf; // whether a buyer already bought some tokens mapping (address => bool) public isBuyer; // whether a buyer bought tokens through other currencies mapping (address => bool) public isExternalBuyer; address public admin; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param tokenAmount amount of tokens purchased */ event TokenPurchase( address indexed purchaser, address indexed beneficiary, uint value, uint tokenAmount ); // a refund was processed for an buyer event Refund(address buyer, uint weiAmount); event RefundLoaded(uint amount); function SaleBase( uint _startTime, uint _endTime, IPricingStrategy _pricingStrategy, PlayHallToken _token, address _wallet, uint _weiMaximumGoal, uint _weiMinimumGoal, uint _weiMinimumAmount, address _admin ) public { require(_startTime >= now); require(_endTime >= _startTime); require(_pricingStrategy.isPricingStrategy()); require(address(_token) != 0x0); require(_wallet != 0x0); require(_weiMaximumGoal > 0); require(_admin != 0x0); startTime = _startTime; endTime = _endTime; pricingStrategy = _pricingStrategy; token = _token; wallet = _wallet; weiMaximumGoal = _weiMaximumGoal; weiMinimumGoal = _weiMinimumGoal; weiMinimumAmount = _weiMinimumAmount; admin = _admin; } modifier onlyOwnerOrAdmin() { require(msg.sender == owner || msg.sender == admin); _; } // fallback function can be used to buy tokens function () external payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) public whenNotPaused payable returns (bool) { uint weiAmount = msg.value; require(beneficiary != 0x0); require(weiAmount >= weiMinimumAmount); require(validPurchase(msg.value)); // calculate token amount to be created uint tokenAmount = pricingStrategy.calculateTokenAmount(weiAmount, weiRaised); mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); wallet.transfer(msg.value); return true; } function mintTokenToBuyer(address beneficiary, uint tokenAmount, uint weiAmount) internal { if (!isBuyer[beneficiary]) { // A new buyer buyerCount++; isBuyer[beneficiary] = true; } boughtAmountOf[beneficiary] = boughtAmountOf[beneficiary].add(weiAmount); weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokenAmount); token.mint(beneficiary, tokenAmount, true); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); } // return true if the transaction can buy tokens function validPurchase(uint weiAmount) internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool withinCap = weiRaised.add(weiAmount) <= weiMaximumGoal; return withinPeriod && withinCap; } // return true if crowdsale event has ended function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; } // get the amount of unsold tokens allocated to this contract; function getWeiLeft() external constant returns (uint) { return weiMaximumGoal - weiRaised; } // return true if the crowdsale has raised enough money to be a successful. function isMinimumGoalReached() public constant returns (bool) { return weiRaised >= weiMinimumGoal; } // allows to update tokens rate for owner function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) { pricingStrategy = _pricingStrategy; return true; } /** * Allow load refunds back on the contract for the refunding. * * The team can transfer the funds back on the smart contract in the case the minimum goal was not reached.. */ function loadRefund() external payable { require(msg.sender == wallet); require(msg.value > 0); require(!isMinimumGoalReached()); loadedRefund = loadedRefund.add(msg.value); RefundLoaded(msg.value); } /** * Buyers can claim refund. * * Note that any refunds from proxy buyers should be handled separately, * and not through this contract. */ function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); } function registerPayment(address beneficiary, uint tokenAmount, uint weiAmount) public onlyOwnerOrAdmin { require(validPurchase(weiAmount)); isExternalBuyer[beneficiary] = true; mintTokenToBuyer(beneficiary, tokenAmount, weiAmount); } function registerPayments(address[] beneficiaries, uint[] tokenAmounts, uint[] weiAmounts) external onlyOwnerOrAdmin { require(beneficiaries.length == tokenAmounts.length); require(tokenAmounts.length == weiAmounts.length); for (uint i = 0; i < beneficiaries.length; i++) { registerPayment(beneficiaries[i], tokenAmounts[i], weiAmounts[i]); } } function setAdmin(address adminAddress) external onlyOwner { admin = adminAddress; } }
refund
function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); }
/** * Buyers can claim refund. * * Note that any refunds from proxy buyers should be handled separately, * and not through this contract. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://ba3c28fc7c70f348a38a5db1f33070032de92318ad1c5d463b543499c5492020
{ "func_code_index": [ 6343, 6761 ] }
71
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
Owned
contract Owned { // ------------------------------------------------------------------------ // Current owner, and proposed new owner // ------------------------------------------------------------------------ address public owner; address public newOwner; // ------------------------------------------------------------------------ // Constructor - assign creator as the owner // ------------------------------------------------------------------------ function Owned() { owner = msg.sender; } // ------------------------------------------------------------------------ // Modifier to mark that a function can only be executed by the owner // ------------------------------------------------------------------------ modifier onlyOwner { require(msg.sender == owner); _; } // ------------------------------------------------------------------------ // Owner can initiate transfer of contract to a new owner // ------------------------------------------------------------------------ function transferOwnership(address _newOwner) onlyOwner { newOwner = _newOwner; } // ------------------------------------------------------------------------ // New owner has to accept transfer of contract // ------------------------------------------------------------------------ function acceptOwnership() { require(msg.sender == newOwner); OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = 0x0; } event OwnershipTransferred(address indexed _from, address indexed _to); }
// ---------------------------------------------------------------------------- // Owned contract // ----------------------------------------------------------------------------
LineComment
Owned
function Owned() { owner = msg.sender; }
// ------------------------------------------------------------------------ // Constructor - assign creator as the owner // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 499, 558 ] }
72
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
Owned
contract Owned { // ------------------------------------------------------------------------ // Current owner, and proposed new owner // ------------------------------------------------------------------------ address public owner; address public newOwner; // ------------------------------------------------------------------------ // Constructor - assign creator as the owner // ------------------------------------------------------------------------ function Owned() { owner = msg.sender; } // ------------------------------------------------------------------------ // Modifier to mark that a function can only be executed by the owner // ------------------------------------------------------------------------ modifier onlyOwner { require(msg.sender == owner); _; } // ------------------------------------------------------------------------ // Owner can initiate transfer of contract to a new owner // ------------------------------------------------------------------------ function transferOwnership(address _newOwner) onlyOwner { newOwner = _newOwner; } // ------------------------------------------------------------------------ // New owner has to accept transfer of contract // ------------------------------------------------------------------------ function acceptOwnership() { require(msg.sender == newOwner); OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = 0x0; } event OwnershipTransferred(address indexed _from, address indexed _to); }
// ---------------------------------------------------------------------------- // Owned contract // ----------------------------------------------------------------------------
LineComment
transferOwnership
function transferOwnership(address _newOwner) onlyOwner { newOwner = _newOwner; }
// ------------------------------------------------------------------------ // Owner can initiate transfer of contract to a new owner // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 1113, 1213 ] }
73
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
Owned
contract Owned { // ------------------------------------------------------------------------ // Current owner, and proposed new owner // ------------------------------------------------------------------------ address public owner; address public newOwner; // ------------------------------------------------------------------------ // Constructor - assign creator as the owner // ------------------------------------------------------------------------ function Owned() { owner = msg.sender; } // ------------------------------------------------------------------------ // Modifier to mark that a function can only be executed by the owner // ------------------------------------------------------------------------ modifier onlyOwner { require(msg.sender == owner); _; } // ------------------------------------------------------------------------ // Owner can initiate transfer of contract to a new owner // ------------------------------------------------------------------------ function transferOwnership(address _newOwner) onlyOwner { newOwner = _newOwner; } // ------------------------------------------------------------------------ // New owner has to accept transfer of contract // ------------------------------------------------------------------------ function acceptOwnership() { require(msg.sender == newOwner); OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = 0x0; } event OwnershipTransferred(address indexed _from, address indexed _to); }
// ---------------------------------------------------------------------------- // Owned contract // ----------------------------------------------------------------------------
LineComment
acceptOwnership
function acceptOwnership() { require(msg.sender == newOwner); OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = 0x0; }
// ------------------------------------------------------------------------ // New owner has to accept transfer of contract // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 1434, 1616 ] }
74
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
SafeMath
library SafeMath { // ------------------------------------------------------------------------ // Add a number to another number, checking for overflows // ------------------------------------------------------------------------ function add(uint a, uint b) internal returns (uint) { uint c = a + b; assert(c >= a && c >= b); return c; } // ------------------------------------------------------------------------ // Subtract a number from another number, checking for underflows // ------------------------------------------------------------------------ function sub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; } }
// ---------------------------------------------------------------------------- // Safe maths, borrowed from OpenZeppelin // ----------------------------------------------------------------------------
LineComment
add
function add(uint a, uint b) internal returns (uint) { uint c = a + b; assert(c >= a && c >= b); return c; }
// ------------------------------------------------------------------------ // Add a number to another number, checking for overflows // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 247, 392 ] }
75
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
SafeMath
library SafeMath { // ------------------------------------------------------------------------ // Add a number to another number, checking for overflows // ------------------------------------------------------------------------ function add(uint a, uint b) internal returns (uint) { uint c = a + b; assert(c >= a && c >= b); return c; } // ------------------------------------------------------------------------ // Subtract a number from another number, checking for underflows // ------------------------------------------------------------------------ function sub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; } }
// ---------------------------------------------------------------------------- // Safe maths, borrowed from OpenZeppelin // ----------------------------------------------------------------------------
LineComment
sub
function sub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; }
// ------------------------------------------------------------------------ // Subtract a number from another number, checking for underflows // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 628, 742 ] }
76
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
PhillionToken
contract PhillionToken is ERC20Interface, Owned { using SafeMath for uint; // ------------------------------------------------------------------------ // Token parameters // ------------------------------------------------------------------------ string public constant symbol = "PHN"; string public constant name = "Phillion"; uint8 public decimals = 18; uint public constant totalSupply = 5 * 10**9 * 10**18; // ------------------------------------------------------------------------ // Balances for each account // ------------------------------------------------------------------------ mapping(address => uint) balances; // ------------------------------------------------------------------------ // Owner of account approves the transfer of an amount to another account // ------------------------------------------------------------------------ mapping(address => mapping (address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function PhillionToken() Owned() { balances[owner] = totalSupply; } // ------------------------------------------------------------------------ // Get the account balance of another account with address _owner // ------------------------------------------------------------------------ function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } // ------------------------------------------------------------------------ // Transfer the balance from owner's account to another account // ------------------------------------------------------------------------ function transfer(address _to, uint _amount) returns (bool success) { if (balances[msg.sender] >= _amount // User has balance && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Allow _spender to withdraw from your account, multiple times, up to the // _value amount. If this function is called again it overwrites the // current allowance with _value. // ------------------------------------------------------------------------ function approve( address _spender, uint _amount ) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } // ------------------------------------------------------------------------ // Spender of tokens transfer an amount of tokens from the token owner's // balance to another account. The owner of the tokens must already // have approve(...)-d this transfer // ------------------------------------------------------------------------ function transferFrom( address _from, address _to, uint _amount ) returns (bool success) { if (balances[_from] >= _amount // From a/c has balance && allowed[_from][msg.sender] >= _amount // Transfer approved && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance( address _owner, address _spender ) constant returns (uint remaining) { return allowed[_owner][_spender]; } // ------------------------------------------------------------------------ // Don't accept ethers - no payable modifier // ------------------------------------------------------------------------ function () { } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint amount) onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, amount); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals // ----------------------------------------------------------------------------
LineComment
PhillionToken
function PhillionToken() Owned() { balances[owner] = totalSupply; }
// ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 1187, 1273 ] }
77
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
PhillionToken
contract PhillionToken is ERC20Interface, Owned { using SafeMath for uint; // ------------------------------------------------------------------------ // Token parameters // ------------------------------------------------------------------------ string public constant symbol = "PHN"; string public constant name = "Phillion"; uint8 public decimals = 18; uint public constant totalSupply = 5 * 10**9 * 10**18; // ------------------------------------------------------------------------ // Balances for each account // ------------------------------------------------------------------------ mapping(address => uint) balances; // ------------------------------------------------------------------------ // Owner of account approves the transfer of an amount to another account // ------------------------------------------------------------------------ mapping(address => mapping (address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function PhillionToken() Owned() { balances[owner] = totalSupply; } // ------------------------------------------------------------------------ // Get the account balance of another account with address _owner // ------------------------------------------------------------------------ function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } // ------------------------------------------------------------------------ // Transfer the balance from owner's account to another account // ------------------------------------------------------------------------ function transfer(address _to, uint _amount) returns (bool success) { if (balances[msg.sender] >= _amount // User has balance && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Allow _spender to withdraw from your account, multiple times, up to the // _value amount. If this function is called again it overwrites the // current allowance with _value. // ------------------------------------------------------------------------ function approve( address _spender, uint _amount ) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } // ------------------------------------------------------------------------ // Spender of tokens transfer an amount of tokens from the token owner's // balance to another account. The owner of the tokens must already // have approve(...)-d this transfer // ------------------------------------------------------------------------ function transferFrom( address _from, address _to, uint _amount ) returns (bool success) { if (balances[_from] >= _amount // From a/c has balance && allowed[_from][msg.sender] >= _amount // Transfer approved && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance( address _owner, address _spender ) constant returns (uint remaining) { return allowed[_owner][_spender]; } // ------------------------------------------------------------------------ // Don't accept ethers - no payable modifier // ------------------------------------------------------------------------ function () { } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint amount) onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, amount); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals // ----------------------------------------------------------------------------
LineComment
balanceOf
function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; }
// ------------------------------------------------------------------------ // Get the account balance of another account with address _owner // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 1511, 1625 ] }
78
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
PhillionToken
contract PhillionToken is ERC20Interface, Owned { using SafeMath for uint; // ------------------------------------------------------------------------ // Token parameters // ------------------------------------------------------------------------ string public constant symbol = "PHN"; string public constant name = "Phillion"; uint8 public decimals = 18; uint public constant totalSupply = 5 * 10**9 * 10**18; // ------------------------------------------------------------------------ // Balances for each account // ------------------------------------------------------------------------ mapping(address => uint) balances; // ------------------------------------------------------------------------ // Owner of account approves the transfer of an amount to another account // ------------------------------------------------------------------------ mapping(address => mapping (address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function PhillionToken() Owned() { balances[owner] = totalSupply; } // ------------------------------------------------------------------------ // Get the account balance of another account with address _owner // ------------------------------------------------------------------------ function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } // ------------------------------------------------------------------------ // Transfer the balance from owner's account to another account // ------------------------------------------------------------------------ function transfer(address _to, uint _amount) returns (bool success) { if (balances[msg.sender] >= _amount // User has balance && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Allow _spender to withdraw from your account, multiple times, up to the // _value amount. If this function is called again it overwrites the // current allowance with _value. // ------------------------------------------------------------------------ function approve( address _spender, uint _amount ) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } // ------------------------------------------------------------------------ // Spender of tokens transfer an amount of tokens from the token owner's // balance to another account. The owner of the tokens must already // have approve(...)-d this transfer // ------------------------------------------------------------------------ function transferFrom( address _from, address _to, uint _amount ) returns (bool success) { if (balances[_from] >= _amount // From a/c has balance && allowed[_from][msg.sender] >= _amount // Transfer approved && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance( address _owner, address _spender ) constant returns (uint remaining) { return allowed[_owner][_spender]; } // ------------------------------------------------------------------------ // Don't accept ethers - no payable modifier // ------------------------------------------------------------------------ function () { } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint amount) onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, amount); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals // ----------------------------------------------------------------------------
LineComment
transfer
function transfer(address _to, uint _amount) returns (bool success) { if (balances[msg.sender] >= _amount // User has balance && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } else { return false; } }
// ------------------------------------------------------------------------ // Transfer the balance from owner's account to another account // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 1861, 2444 ] }
79
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
PhillionToken
contract PhillionToken is ERC20Interface, Owned { using SafeMath for uint; // ------------------------------------------------------------------------ // Token parameters // ------------------------------------------------------------------------ string public constant symbol = "PHN"; string public constant name = "Phillion"; uint8 public decimals = 18; uint public constant totalSupply = 5 * 10**9 * 10**18; // ------------------------------------------------------------------------ // Balances for each account // ------------------------------------------------------------------------ mapping(address => uint) balances; // ------------------------------------------------------------------------ // Owner of account approves the transfer of an amount to another account // ------------------------------------------------------------------------ mapping(address => mapping (address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function PhillionToken() Owned() { balances[owner] = totalSupply; } // ------------------------------------------------------------------------ // Get the account balance of another account with address _owner // ------------------------------------------------------------------------ function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } // ------------------------------------------------------------------------ // Transfer the balance from owner's account to another account // ------------------------------------------------------------------------ function transfer(address _to, uint _amount) returns (bool success) { if (balances[msg.sender] >= _amount // User has balance && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Allow _spender to withdraw from your account, multiple times, up to the // _value amount. If this function is called again it overwrites the // current allowance with _value. // ------------------------------------------------------------------------ function approve( address _spender, uint _amount ) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } // ------------------------------------------------------------------------ // Spender of tokens transfer an amount of tokens from the token owner's // balance to another account. The owner of the tokens must already // have approve(...)-d this transfer // ------------------------------------------------------------------------ function transferFrom( address _from, address _to, uint _amount ) returns (bool success) { if (balances[_from] >= _amount // From a/c has balance && allowed[_from][msg.sender] >= _amount // Transfer approved && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance( address _owner, address _spender ) constant returns (uint remaining) { return allowed[_owner][_spender]; } // ------------------------------------------------------------------------ // Don't accept ethers - no payable modifier // ------------------------------------------------------------------------ function () { } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint amount) onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, amount); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals // ----------------------------------------------------------------------------
LineComment
approve
function approve( address _spender, uint _amount ) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; }
// ------------------------------------------------------------------------ // Allow _spender to withdraw from your account, multiple times, up to the // _value amount. If this function is called again it overwrites the // current allowance with _value. // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 2804, 3036 ] }
80
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
PhillionToken
contract PhillionToken is ERC20Interface, Owned { using SafeMath for uint; // ------------------------------------------------------------------------ // Token parameters // ------------------------------------------------------------------------ string public constant symbol = "PHN"; string public constant name = "Phillion"; uint8 public decimals = 18; uint public constant totalSupply = 5 * 10**9 * 10**18; // ------------------------------------------------------------------------ // Balances for each account // ------------------------------------------------------------------------ mapping(address => uint) balances; // ------------------------------------------------------------------------ // Owner of account approves the transfer of an amount to another account // ------------------------------------------------------------------------ mapping(address => mapping (address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function PhillionToken() Owned() { balances[owner] = totalSupply; } // ------------------------------------------------------------------------ // Get the account balance of another account with address _owner // ------------------------------------------------------------------------ function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } // ------------------------------------------------------------------------ // Transfer the balance from owner's account to another account // ------------------------------------------------------------------------ function transfer(address _to, uint _amount) returns (bool success) { if (balances[msg.sender] >= _amount // User has balance && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Allow _spender to withdraw from your account, multiple times, up to the // _value amount. If this function is called again it overwrites the // current allowance with _value. // ------------------------------------------------------------------------ function approve( address _spender, uint _amount ) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } // ------------------------------------------------------------------------ // Spender of tokens transfer an amount of tokens from the token owner's // balance to another account. The owner of the tokens must already // have approve(...)-d this transfer // ------------------------------------------------------------------------ function transferFrom( address _from, address _to, uint _amount ) returns (bool success) { if (balances[_from] >= _amount // From a/c has balance && allowed[_from][msg.sender] >= _amount // Transfer approved && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance( address _owner, address _spender ) constant returns (uint remaining) { return allowed[_owner][_spender]; } // ------------------------------------------------------------------------ // Don't accept ethers - no payable modifier // ------------------------------------------------------------------------ function () { } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint amount) onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, amount); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals // ----------------------------------------------------------------------------
LineComment
transferFrom
function transferFrom( address _from, address _to, uint _amount ) returns (bool success) { if (balances[_from] >= _amount // From a/c has balance && allowed[_from][msg.sender] >= _amount // Transfer approved && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } else { return false; } }
// ------------------------------------------------------------------------ // Spender of tokens transfer an amount of tokens from the token owner's // balance to another account. The owner of the tokens must already // have approve(...)-d this transfer // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 3396, 4182 ] }
81
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
PhillionToken
contract PhillionToken is ERC20Interface, Owned { using SafeMath for uint; // ------------------------------------------------------------------------ // Token parameters // ------------------------------------------------------------------------ string public constant symbol = "PHN"; string public constant name = "Phillion"; uint8 public decimals = 18; uint public constant totalSupply = 5 * 10**9 * 10**18; // ------------------------------------------------------------------------ // Balances for each account // ------------------------------------------------------------------------ mapping(address => uint) balances; // ------------------------------------------------------------------------ // Owner of account approves the transfer of an amount to another account // ------------------------------------------------------------------------ mapping(address => mapping (address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function PhillionToken() Owned() { balances[owner] = totalSupply; } // ------------------------------------------------------------------------ // Get the account balance of another account with address _owner // ------------------------------------------------------------------------ function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } // ------------------------------------------------------------------------ // Transfer the balance from owner's account to another account // ------------------------------------------------------------------------ function transfer(address _to, uint _amount) returns (bool success) { if (balances[msg.sender] >= _amount // User has balance && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Allow _spender to withdraw from your account, multiple times, up to the // _value amount. If this function is called again it overwrites the // current allowance with _value. // ------------------------------------------------------------------------ function approve( address _spender, uint _amount ) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } // ------------------------------------------------------------------------ // Spender of tokens transfer an amount of tokens from the token owner's // balance to another account. The owner of the tokens must already // have approve(...)-d this transfer // ------------------------------------------------------------------------ function transferFrom( address _from, address _to, uint _amount ) returns (bool success) { if (balances[_from] >= _amount // From a/c has balance && allowed[_from][msg.sender] >= _amount // Transfer approved && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance( address _owner, address _spender ) constant returns (uint remaining) { return allowed[_owner][_spender]; } // ------------------------------------------------------------------------ // Don't accept ethers - no payable modifier // ------------------------------------------------------------------------ function () { } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint amount) onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, amount); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals // ----------------------------------------------------------------------------
LineComment
allowance
function allowance( address _owner, address _spender ) constant returns (uint remaining) { return allowed[_owner][_spender]; }
// ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 4465, 4634 ] }
82
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
PhillionToken
contract PhillionToken is ERC20Interface, Owned { using SafeMath for uint; // ------------------------------------------------------------------------ // Token parameters // ------------------------------------------------------------------------ string public constant symbol = "PHN"; string public constant name = "Phillion"; uint8 public decimals = 18; uint public constant totalSupply = 5 * 10**9 * 10**18; // ------------------------------------------------------------------------ // Balances for each account // ------------------------------------------------------------------------ mapping(address => uint) balances; // ------------------------------------------------------------------------ // Owner of account approves the transfer of an amount to another account // ------------------------------------------------------------------------ mapping(address => mapping (address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function PhillionToken() Owned() { balances[owner] = totalSupply; } // ------------------------------------------------------------------------ // Get the account balance of another account with address _owner // ------------------------------------------------------------------------ function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } // ------------------------------------------------------------------------ // Transfer the balance from owner's account to another account // ------------------------------------------------------------------------ function transfer(address _to, uint _amount) returns (bool success) { if (balances[msg.sender] >= _amount // User has balance && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Allow _spender to withdraw from your account, multiple times, up to the // _value amount. If this function is called again it overwrites the // current allowance with _value. // ------------------------------------------------------------------------ function approve( address _spender, uint _amount ) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } // ------------------------------------------------------------------------ // Spender of tokens transfer an amount of tokens from the token owner's // balance to another account. The owner of the tokens must already // have approve(...)-d this transfer // ------------------------------------------------------------------------ function transferFrom( address _from, address _to, uint _amount ) returns (bool success) { if (balances[_from] >= _amount // From a/c has balance && allowed[_from][msg.sender] >= _amount // Transfer approved && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance( address _owner, address _spender ) constant returns (uint remaining) { return allowed[_owner][_spender]; } // ------------------------------------------------------------------------ // Don't accept ethers - no payable modifier // ------------------------------------------------------------------------ function () { } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint amount) onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, amount); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals // ----------------------------------------------------------------------------
LineComment
function () { }
// ------------------------------------------------------------------------ // Don't accept ethers - no payable modifier // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 4851, 4876 ] }
83
PhillionToken
PhillionToken.sol
0xfbba9060549f565e0ee102057b47db4d2284c2ad
Solidity
PhillionToken
contract PhillionToken is ERC20Interface, Owned { using SafeMath for uint; // ------------------------------------------------------------------------ // Token parameters // ------------------------------------------------------------------------ string public constant symbol = "PHN"; string public constant name = "Phillion"; uint8 public decimals = 18; uint public constant totalSupply = 5 * 10**9 * 10**18; // ------------------------------------------------------------------------ // Balances for each account // ------------------------------------------------------------------------ mapping(address => uint) balances; // ------------------------------------------------------------------------ // Owner of account approves the transfer of an amount to another account // ------------------------------------------------------------------------ mapping(address => mapping (address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function PhillionToken() Owned() { balances[owner] = totalSupply; } // ------------------------------------------------------------------------ // Get the account balance of another account with address _owner // ------------------------------------------------------------------------ function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } // ------------------------------------------------------------------------ // Transfer the balance from owner's account to another account // ------------------------------------------------------------------------ function transfer(address _to, uint _amount) returns (bool success) { if (balances[msg.sender] >= _amount // User has balance && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(msg.sender, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Allow _spender to withdraw from your account, multiple times, up to the // _value amount. If this function is called again it overwrites the // current allowance with _value. // ------------------------------------------------------------------------ function approve( address _spender, uint _amount ) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } // ------------------------------------------------------------------------ // Spender of tokens transfer an amount of tokens from the token owner's // balance to another account. The owner of the tokens must already // have approve(...)-d this transfer // ------------------------------------------------------------------------ function transferFrom( address _from, address _to, uint _amount ) returns (bool success) { if (balances[_from] >= _amount // From a/c has balance && allowed[_from][msg.sender] >= _amount // Transfer approved && _amount > 0 // Non-zero transfer && balances[_to] + _amount > balances[_to] // Overflow check ) { balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); Transfer(_from, _to, _amount); return true; } else { return false; } } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance( address _owner, address _spender ) constant returns (uint remaining) { return allowed[_owner][_spender]; } // ------------------------------------------------------------------------ // Don't accept ethers - no payable modifier // ------------------------------------------------------------------------ function () { } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint amount) onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, amount); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals // ----------------------------------------------------------------------------
LineComment
transferAnyERC20Token
function transferAnyERC20Token(address tokenAddress, uint amount) onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, amount); }
// ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------
LineComment
v0.4.11+commit.68ef5810
bzzr://6ed9fd6311099635f0b1b6902cf325fe2b8cc62829be4b03809a828d911b4ea1
{ "func_code_index": [ 5109, 5304 ] }
84
Shiboki
Shiboki.sol
0x542267d7802dd7b59bee57de8908463173f5ca23
Solidity
Shiboki
contract Shiboki is ERC721Enumerable, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenId; uint256 public MAX_SUPPLY = 3333; uint256 public MAX_ALLOWED = 5; uint256 public OWNER_RESERVED = 333; uint256 public price = 50000000000000000; //0.05 Ether string baseTokenURI; bool public saleOpen = true; event NFTMinted(uint256 totalMinted); constructor(string memory baseURI) ERC721("SHIBOKI", "SHBK") { setBaseURI(baseURI); } //Get token Ids of all tokens owned by _owner function walletOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function setBaseURI(string memory baseURI) public onlyOwner { baseTokenURI = baseURI; } function setPrice(uint256 _newPrice) public onlyOwner { price = _newPrice; } function setMaxAllowd(uint256 _maxAllowed) public onlyOwner { MAX_ALLOWED = _maxAllowed; } function setOwnerReserved(uint256 _ownerReserved) public onlyOwner { OWNER_RESERVED = _ownerReserved; } function getPrice() external view returns(uint256){ return price; } //Close sale function pauseSale() public onlyOwner { saleOpen = false; } //Open sale function unpauseSale() public onlyOwner { saleOpen = true; } function withdrawAll() public onlyOwner { (bool success, ) = msg.sender.call{value: address(this).balance}(""); require(success, "Transfer failed."); } //mint NFT function mintNFT(uint256 _count) public payable { if (msg.sender != owner()) { require((saleOpen == true), "Sale is not open please try again later"); } require( _count > 0 && _count <= MAX_ALLOWED, "You have reached the NFT minting limit per transaction" ); require(balanceOf(msg.sender) < MAX_ALLOWED, "You have reached maximum NFT minting limit per account"); if (msg.sender != owner()) { require( totalSupply() + _count <= (MAX_SUPPLY - OWNER_RESERVED), "All NFTs sold" ); }else{ require( totalSupply() + _count <= (MAX_SUPPLY), "All NFTs sold" ); } require( msg.value >= price * _count, "Ether sent with this transaction is not correct" ); address _to = msg.sender; for (uint256 i = 0; i < _count; i++) { _mint(_to); if (msg.sender == owner()) { if(OWNER_RESERVED > 0){ OWNER_RESERVED--; } } } } function _mint(address _to) private { _tokenId.increment(); uint256 tokenId = _tokenId.current(); _safeMint(_to, tokenId); emit NFTMinted(tokenId); } function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; } }
walletOfOwner
function walletOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; }
//Get token Ids of all tokens owned by _owner
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://602cadda2c7da950513581ae1d5dbb3f87abec345279cc2718928ee8fc9a18e4
{ "func_code_index": [ 586, 976 ] }
85
Shiboki
Shiboki.sol
0x542267d7802dd7b59bee57de8908463173f5ca23
Solidity
Shiboki
contract Shiboki is ERC721Enumerable, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenId; uint256 public MAX_SUPPLY = 3333; uint256 public MAX_ALLOWED = 5; uint256 public OWNER_RESERVED = 333; uint256 public price = 50000000000000000; //0.05 Ether string baseTokenURI; bool public saleOpen = true; event NFTMinted(uint256 totalMinted); constructor(string memory baseURI) ERC721("SHIBOKI", "SHBK") { setBaseURI(baseURI); } //Get token Ids of all tokens owned by _owner function walletOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function setBaseURI(string memory baseURI) public onlyOwner { baseTokenURI = baseURI; } function setPrice(uint256 _newPrice) public onlyOwner { price = _newPrice; } function setMaxAllowd(uint256 _maxAllowed) public onlyOwner { MAX_ALLOWED = _maxAllowed; } function setOwnerReserved(uint256 _ownerReserved) public onlyOwner { OWNER_RESERVED = _ownerReserved; } function getPrice() external view returns(uint256){ return price; } //Close sale function pauseSale() public onlyOwner { saleOpen = false; } //Open sale function unpauseSale() public onlyOwner { saleOpen = true; } function withdrawAll() public onlyOwner { (bool success, ) = msg.sender.call{value: address(this).balance}(""); require(success, "Transfer failed."); } //mint NFT function mintNFT(uint256 _count) public payable { if (msg.sender != owner()) { require((saleOpen == true), "Sale is not open please try again later"); } require( _count > 0 && _count <= MAX_ALLOWED, "You have reached the NFT minting limit per transaction" ); require(balanceOf(msg.sender) < MAX_ALLOWED, "You have reached maximum NFT minting limit per account"); if (msg.sender != owner()) { require( totalSupply() + _count <= (MAX_SUPPLY - OWNER_RESERVED), "All NFTs sold" ); }else{ require( totalSupply() + _count <= (MAX_SUPPLY), "All NFTs sold" ); } require( msg.value >= price * _count, "Ether sent with this transaction is not correct" ); address _to = msg.sender; for (uint256 i = 0; i < _count; i++) { _mint(_to); if (msg.sender == owner()) { if(OWNER_RESERVED > 0){ OWNER_RESERVED--; } } } } function _mint(address _to) private { _tokenId.increment(); uint256 tokenId = _tokenId.current(); _safeMint(_to, tokenId); emit NFTMinted(tokenId); } function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; } }
pauseSale
function pauseSale() public onlyOwner { saleOpen = false; }
//Close sale
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://602cadda2c7da950513581ae1d5dbb3f87abec345279cc2718928ee8fc9a18e4
{ "func_code_index": [ 1542, 1620 ] }
86
Shiboki
Shiboki.sol
0x542267d7802dd7b59bee57de8908463173f5ca23
Solidity
Shiboki
contract Shiboki is ERC721Enumerable, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenId; uint256 public MAX_SUPPLY = 3333; uint256 public MAX_ALLOWED = 5; uint256 public OWNER_RESERVED = 333; uint256 public price = 50000000000000000; //0.05 Ether string baseTokenURI; bool public saleOpen = true; event NFTMinted(uint256 totalMinted); constructor(string memory baseURI) ERC721("SHIBOKI", "SHBK") { setBaseURI(baseURI); } //Get token Ids of all tokens owned by _owner function walletOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function setBaseURI(string memory baseURI) public onlyOwner { baseTokenURI = baseURI; } function setPrice(uint256 _newPrice) public onlyOwner { price = _newPrice; } function setMaxAllowd(uint256 _maxAllowed) public onlyOwner { MAX_ALLOWED = _maxAllowed; } function setOwnerReserved(uint256 _ownerReserved) public onlyOwner { OWNER_RESERVED = _ownerReserved; } function getPrice() external view returns(uint256){ return price; } //Close sale function pauseSale() public onlyOwner { saleOpen = false; } //Open sale function unpauseSale() public onlyOwner { saleOpen = true; } function withdrawAll() public onlyOwner { (bool success, ) = msg.sender.call{value: address(this).balance}(""); require(success, "Transfer failed."); } //mint NFT function mintNFT(uint256 _count) public payable { if (msg.sender != owner()) { require((saleOpen == true), "Sale is not open please try again later"); } require( _count > 0 && _count <= MAX_ALLOWED, "You have reached the NFT minting limit per transaction" ); require(balanceOf(msg.sender) < MAX_ALLOWED, "You have reached maximum NFT minting limit per account"); if (msg.sender != owner()) { require( totalSupply() + _count <= (MAX_SUPPLY - OWNER_RESERVED), "All NFTs sold" ); }else{ require( totalSupply() + _count <= (MAX_SUPPLY), "All NFTs sold" ); } require( msg.value >= price * _count, "Ether sent with this transaction is not correct" ); address _to = msg.sender; for (uint256 i = 0; i < _count; i++) { _mint(_to); if (msg.sender == owner()) { if(OWNER_RESERVED > 0){ OWNER_RESERVED--; } } } } function _mint(address _to) private { _tokenId.increment(); uint256 tokenId = _tokenId.current(); _safeMint(_to, tokenId); emit NFTMinted(tokenId); } function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; } }
unpauseSale
function unpauseSale() public onlyOwner { saleOpen = true; }
//Open sale
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://602cadda2c7da950513581ae1d5dbb3f87abec345279cc2718928ee8fc9a18e4
{ "func_code_index": [ 1645, 1724 ] }
87
Shiboki
Shiboki.sol
0x542267d7802dd7b59bee57de8908463173f5ca23
Solidity
Shiboki
contract Shiboki is ERC721Enumerable, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenId; uint256 public MAX_SUPPLY = 3333; uint256 public MAX_ALLOWED = 5; uint256 public OWNER_RESERVED = 333; uint256 public price = 50000000000000000; //0.05 Ether string baseTokenURI; bool public saleOpen = true; event NFTMinted(uint256 totalMinted); constructor(string memory baseURI) ERC721("SHIBOKI", "SHBK") { setBaseURI(baseURI); } //Get token Ids of all tokens owned by _owner function walletOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function setBaseURI(string memory baseURI) public onlyOwner { baseTokenURI = baseURI; } function setPrice(uint256 _newPrice) public onlyOwner { price = _newPrice; } function setMaxAllowd(uint256 _maxAllowed) public onlyOwner { MAX_ALLOWED = _maxAllowed; } function setOwnerReserved(uint256 _ownerReserved) public onlyOwner { OWNER_RESERVED = _ownerReserved; } function getPrice() external view returns(uint256){ return price; } //Close sale function pauseSale() public onlyOwner { saleOpen = false; } //Open sale function unpauseSale() public onlyOwner { saleOpen = true; } function withdrawAll() public onlyOwner { (bool success, ) = msg.sender.call{value: address(this).balance}(""); require(success, "Transfer failed."); } //mint NFT function mintNFT(uint256 _count) public payable { if (msg.sender != owner()) { require((saleOpen == true), "Sale is not open please try again later"); } require( _count > 0 && _count <= MAX_ALLOWED, "You have reached the NFT minting limit per transaction" ); require(balanceOf(msg.sender) < MAX_ALLOWED, "You have reached maximum NFT minting limit per account"); if (msg.sender != owner()) { require( totalSupply() + _count <= (MAX_SUPPLY - OWNER_RESERVED), "All NFTs sold" ); }else{ require( totalSupply() + _count <= (MAX_SUPPLY), "All NFTs sold" ); } require( msg.value >= price * _count, "Ether sent with this transaction is not correct" ); address _to = msg.sender; for (uint256 i = 0; i < _count; i++) { _mint(_to); if (msg.sender == owner()) { if(OWNER_RESERVED > 0){ OWNER_RESERVED--; } } } } function _mint(address _to) private { _tokenId.increment(); uint256 tokenId = _tokenId.current(); _safeMint(_to, tokenId); emit NFTMinted(tokenId); } function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; } }
mintNFT
function mintNFT(uint256 _count) public payable { if (msg.sender != owner()) { require((saleOpen == true), "Sale is not open please try again later"); } require( _count > 0 && _count <= MAX_ALLOWED, "You have reached the NFT minting limit per transaction" ); require(balanceOf(msg.sender) < MAX_ALLOWED, "You have reached maximum NFT minting limit per account"); if (msg.sender != owner()) { require( totalSupply() + _count <= (MAX_SUPPLY - OWNER_RESERVED), "All NFTs sold" ); }else{ require( totalSupply() + _count <= (MAX_SUPPLY), "All NFTs sold" ); } require( msg.value >= price * _count, "Ether sent with this transaction is not correct" ); address _to = msg.sender; for (uint256 i = 0; i < _count; i++) { _mint(_to); if (msg.sender == owner()) { if(OWNER_RESERVED > 0){ OWNER_RESERVED--; } } } }
//mint NFT
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://602cadda2c7da950513581ae1d5dbb3f87abec345279cc2718928ee8fc9a18e4
{ "func_code_index": [ 1929, 3178 ] }
88
AMC
AMC.sol
0x4da7e3336b2c89812b0f4b6a04142cf487db005c
Solidity
AbstractToken
contract AbstractToken is Token, SafeMath { /** * Create new Abstract Token contract. */ constructor () public { // Do nothing } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf(address _owner) public view returns (uint256 balance) { return accounts [_owner]; } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transfer(address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (accounts [msg.sender] < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (allowances [_from][msg.sender] < _value) return false; if (accounts [_from] < _value) return false; if (_value > 0 && _from != _to) { allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value); accounts [_from] = safeSub (accounts [_from], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer(_from, _to, _value); return true; } /** * Allow given spender to transfer given number of tokens from message sender. * @param _spender address to allow the owner of to transfer tokens from message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true; } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance(address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; } /** * Mapping from addresses of token holders to the numbers of tokens belonging * to these token holders. */ mapping (address => uint256) accounts; /** * Mapping from addresses of token holders to the mapping of addresses of * spenders to the allowances set by these token holders to these spenders. */ mapping (address => mapping (address => uint256)) private allowances; }
/** * Abstract Token Smart Contract that could be used as a base contract for * ERC-20 token contracts. */
NatSpecMultiLine
balanceOf
function balanceOf(address _owner) public view returns (uint256 balance) { return accounts [_owner]; }
/** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */
NatSpecMultiLine
v0.5.3+commit.10d17f24
bzzr://41df23959bb22a0fe404ddaac29b6cc0432eca9d7662d3fdc99d91e57a2a6beb
{ "func_code_index": [ 421, 534 ] }
89
AMC
AMC.sol
0x4da7e3336b2c89812b0f4b6a04142cf487db005c
Solidity
AbstractToken
contract AbstractToken is Token, SafeMath { /** * Create new Abstract Token contract. */ constructor () public { // Do nothing } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf(address _owner) public view returns (uint256 balance) { return accounts [_owner]; } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transfer(address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (accounts [msg.sender] < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (allowances [_from][msg.sender] < _value) return false; if (accounts [_from] < _value) return false; if (_value > 0 && _from != _to) { allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value); accounts [_from] = safeSub (accounts [_from], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer(_from, _to, _value); return true; } /** * Allow given spender to transfer given number of tokens from message sender. * @param _spender address to allow the owner of to transfer tokens from message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true; } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance(address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; } /** * Mapping from addresses of token holders to the numbers of tokens belonging * to these token holders. */ mapping (address => uint256) accounts; /** * Mapping from addresses of token holders to the mapping of addresses of * spenders to the allowances set by these token holders to these spenders. */ mapping (address => mapping (address => uint256)) private allowances; }
/** * Abstract Token Smart Contract that could be used as a base contract for * ERC-20 token contracts. */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (accounts [msg.sender] < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; }
/** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */
NatSpecMultiLine
v0.5.3+commit.10d17f24
bzzr://41df23959bb22a0fe404ddaac29b6cc0432eca9d7662d3fdc99d91e57a2a6beb
{ "func_code_index": [ 951, 1370 ] }
90
AMC
AMC.sol
0x4da7e3336b2c89812b0f4b6a04142cf487db005c
Solidity
AbstractToken
contract AbstractToken is Token, SafeMath { /** * Create new Abstract Token contract. */ constructor () public { // Do nothing } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf(address _owner) public view returns (uint256 balance) { return accounts [_owner]; } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transfer(address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (accounts [msg.sender] < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (allowances [_from][msg.sender] < _value) return false; if (accounts [_from] < _value) return false; if (_value > 0 && _from != _to) { allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value); accounts [_from] = safeSub (accounts [_from], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer(_from, _to, _value); return true; } /** * Allow given spender to transfer given number of tokens from message sender. * @param _spender address to allow the owner of to transfer tokens from message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true; } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance(address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; } /** * Mapping from addresses of token holders to the numbers of tokens belonging * to these token holders. */ mapping (address => uint256) accounts; /** * Mapping from addresses of token holders to the mapping of addresses of * spenders to the allowances set by these token holders to these spenders. */ mapping (address => mapping (address => uint256)) private allowances; }
/** * Abstract Token Smart Contract that could be used as a base contract for * ERC-20 token contracts. */
NatSpecMultiLine
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (allowances [_from][msg.sender] < _value) return false; if (accounts [_from] < _value) return false; if (_value > 0 && _from != _to) { allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value); accounts [_from] = safeSub (accounts [_from], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer(_from, _to, _value); return true; }
/** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */
NatSpecMultiLine
v0.5.3+commit.10d17f24
bzzr://41df23959bb22a0fe404ddaac29b6cc0432eca9d7662d3fdc99d91e57a2a6beb
{ "func_code_index": [ 1867, 2436 ] }
91
AMC
AMC.sol
0x4da7e3336b2c89812b0f4b6a04142cf487db005c
Solidity
AbstractToken
contract AbstractToken is Token, SafeMath { /** * Create new Abstract Token contract. */ constructor () public { // Do nothing } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf(address _owner) public view returns (uint256 balance) { return accounts [_owner]; } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transfer(address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (accounts [msg.sender] < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (allowances [_from][msg.sender] < _value) return false; if (accounts [_from] < _value) return false; if (_value > 0 && _from != _to) { allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value); accounts [_from] = safeSub (accounts [_from], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer(_from, _to, _value); return true; } /** * Allow given spender to transfer given number of tokens from message sender. * @param _spender address to allow the owner of to transfer tokens from message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true; } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance(address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; } /** * Mapping from addresses of token holders to the numbers of tokens belonging * to these token holders. */ mapping (address => uint256) accounts; /** * Mapping from addresses of token holders to the mapping of addresses of * spenders to the allowances set by these token holders to these spenders. */ mapping (address => mapping (address => uint256)) private allowances; }
/** * Abstract Token Smart Contract that could be used as a base contract for * ERC-20 token contracts. */
NatSpecMultiLine
approve
function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true;
/** * Allow given spender to transfer given number of tokens from message sender. * @param _spender address to allow the owner of to transfer tokens from message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */
NatSpecMultiLine
v0.5.3+commit.10d17f24
bzzr://41df23959bb22a0fe404ddaac29b6cc0432eca9d7662d3fdc99d91e57a2a6beb
{ "func_code_index": [ 2764, 2974 ] }
92
AMC
AMC.sol
0x4da7e3336b2c89812b0f4b6a04142cf487db005c
Solidity
AbstractToken
contract AbstractToken is Token, SafeMath { /** * Create new Abstract Token contract. */ constructor () public { // Do nothing } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf(address _owner) public view returns (uint256 balance) { return accounts [_owner]; } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transfer(address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (accounts [msg.sender] < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_to != address(0)); if (allowances [_from][msg.sender] < _value) return false; if (accounts [_from] < _value) return false; if (_value > 0 && _from != _to) { allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value); accounts [_from] = safeSub (accounts [_from], _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer(_from, _to, _value); return true; } /** * Allow given spender to transfer given number of tokens from message sender. * @param _spender address to allow the owner of to transfer tokens from message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true; } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance(address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; } /** * Mapping from addresses of token holders to the numbers of tokens belonging * to these token holders. */ mapping (address => uint256) accounts; /** * Mapping from addresses of token holders to the mapping of addresses of * spenders to the allowances set by these token holders to these spenders. */ mapping (address => mapping (address => uint256)) private allowances; }
/** * Abstract Token Smart Contract that could be used as a base contract for * ERC-20 token contracts. */
NatSpecMultiLine
allowance
function allowance(address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; }
/** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */
NatSpecMultiLine
v0.5.3+commit.10d17f24
bzzr://41df23959bb22a0fe404ddaac29b6cc0432eca9d7662d3fdc99d91e57a2a6beb
{ "func_code_index": [ 3422, 3570 ] }
93
AMC
AMC.sol
0x4da7e3336b2c89812b0f4b6a04142cf487db005c
Solidity
AMC
contract AMC is AbstractToken { /** * Maximum allowed number of tokens in circulation. * tokenSupply = tokensIActuallyWant * (10 ^ decimals) */ uint256 constant MAX_TOKEN_COUNT = 10000000 * (10**18); /** * Address of the owner of this smart contract. */ address private owner; /** * Frozen account list holder */ mapping (address => bool) private frozenAccount; /** * Current number of tokens in circulation. */ uint256 tokenCount = 0; /** * True if tokens transfers are currently frozen, false otherwise. */ bool frozen = false; /** * Create new token smart contract and make msg.sender the * owner of this smart contract. */ constructor () public { owner = msg.sender; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply() public view returns (uint256 supply) { return tokenCount; } string constant public name = "Anymous Coin"; string constant public symbol = "AMC"; uint8 constant public decimals = 18; /** * Transfer given number of tokens from message sender to given recipient. * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer(address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[msg.sender]); if (frozen) return false; else return AbstractToken.transfer (_to, _value); } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[_from]); if (frozen) return false; else return AbstractToken.transferFrom (_from, _to, _value); } /** * Change how many tokens given spender is allowed to transfer from message * spender. In order to prevent double spending of allowance, * To change the approve amount you first have to reduce the addresses` * allowance to zero by calling `approve(_spender, 0)` if it is not * already 0 to mitigate the race condition described here: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { require(allowance (msg.sender, _spender) == 0 || _value == 0); return AbstractToken.approve (_spender, _value); } /** * Create _value new tokens and give new created tokens to msg.sender. * May only be called by smart contract owner. * * @param _value number of tokens to create * @return true if tokens were created successfully, false otherwise */ function createTokens(uint256 _value) public returns (bool success) { require (msg.sender == owner); if (_value > 0) { if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false; accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokenCount = safeAdd (tokenCount, _value); // adding transfer event and _from address as null address emit Transfer(address(0), msg.sender, _value); return true; } return false; } /** * Set new owner for the smart contract. * May only be called by smart contract owner. * * @param _newOwner address of new owner of the smart contract */ function setOwner(address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Freeze ALL token transfers. * May only be called by smart contract owner. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze ALL token transfers. * May only be called by smart contract owner. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /*A user is able to unintentionally send tokens to a contract * and if the contract is not prepared to refund them they will get stuck in the contract. * The same issue used to happen for Ether too but new Solidity versions added the payable modifier to * prevent unintended Ether transfers. However, there’s no such mechanism for token transfers. * so the below function is created */ function refundTokens(address _token, address _refund, uint256 _value) public { require (msg.sender == owner); require(_token != address(this)); AbstractToken token = AbstractToken(_token); token.transfer(_refund, _value); emit RefundTokens(_token, _refund, _value); } /** * Freeze specific account * May only be called by smart contract owner. */ function freezeAccount(address _target, bool freeze) public { require (msg.sender == owner); require (msg.sender != _target); frozenAccount[_target] = freeze; emit FrozenFunds(_target, freeze); } /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); /** * Logged when a particular account is frozen. */ event FrozenFunds(address target, bool frozen); /** * when accidentally send other tokens are refunded */ event RefundTokens(address _token, address _refund, uint256 _value); }
/** * Anymous Coin smart contract. */
NatSpecMultiLine
totalSupply
function totalSupply() public view returns (uint256 supply) { return tokenCount; }
/** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */
NatSpecMultiLine
v0.5.3+commit.10d17f24
bzzr://41df23959bb22a0fe404ddaac29b6cc0432eca9d7662d3fdc99d91e57a2a6beb
{ "func_code_index": [ 932, 1025 ] }
94
AMC
AMC.sol
0x4da7e3336b2c89812b0f4b6a04142cf487db005c
Solidity
AMC
contract AMC is AbstractToken { /** * Maximum allowed number of tokens in circulation. * tokenSupply = tokensIActuallyWant * (10 ^ decimals) */ uint256 constant MAX_TOKEN_COUNT = 10000000 * (10**18); /** * Address of the owner of this smart contract. */ address private owner; /** * Frozen account list holder */ mapping (address => bool) private frozenAccount; /** * Current number of tokens in circulation. */ uint256 tokenCount = 0; /** * True if tokens transfers are currently frozen, false otherwise. */ bool frozen = false; /** * Create new token smart contract and make msg.sender the * owner of this smart contract. */ constructor () public { owner = msg.sender; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply() public view returns (uint256 supply) { return tokenCount; } string constant public name = "Anymous Coin"; string constant public symbol = "AMC"; uint8 constant public decimals = 18; /** * Transfer given number of tokens from message sender to given recipient. * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer(address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[msg.sender]); if (frozen) return false; else return AbstractToken.transfer (_to, _value); } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[_from]); if (frozen) return false; else return AbstractToken.transferFrom (_from, _to, _value); } /** * Change how many tokens given spender is allowed to transfer from message * spender. In order to prevent double spending of allowance, * To change the approve amount you first have to reduce the addresses` * allowance to zero by calling `approve(_spender, 0)` if it is not * already 0 to mitigate the race condition described here: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { require(allowance (msg.sender, _spender) == 0 || _value == 0); return AbstractToken.approve (_spender, _value); } /** * Create _value new tokens and give new created tokens to msg.sender. * May only be called by smart contract owner. * * @param _value number of tokens to create * @return true if tokens were created successfully, false otherwise */ function createTokens(uint256 _value) public returns (bool success) { require (msg.sender == owner); if (_value > 0) { if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false; accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokenCount = safeAdd (tokenCount, _value); // adding transfer event and _from address as null address emit Transfer(address(0), msg.sender, _value); return true; } return false; } /** * Set new owner for the smart contract. * May only be called by smart contract owner. * * @param _newOwner address of new owner of the smart contract */ function setOwner(address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Freeze ALL token transfers. * May only be called by smart contract owner. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze ALL token transfers. * May only be called by smart contract owner. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /*A user is able to unintentionally send tokens to a contract * and if the contract is not prepared to refund them they will get stuck in the contract. * The same issue used to happen for Ether too but new Solidity versions added the payable modifier to * prevent unintended Ether transfers. However, there’s no such mechanism for token transfers. * so the below function is created */ function refundTokens(address _token, address _refund, uint256 _value) public { require (msg.sender == owner); require(_token != address(this)); AbstractToken token = AbstractToken(_token); token.transfer(_refund, _value); emit RefundTokens(_token, _refund, _value); } /** * Freeze specific account * May only be called by smart contract owner. */ function freezeAccount(address _target, bool freeze) public { require (msg.sender == owner); require (msg.sender != _target); frozenAccount[_target] = freeze; emit FrozenFunds(_target, freeze); } /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); /** * Logged when a particular account is frozen. */ event FrozenFunds(address target, bool frozen); /** * when accidentally send other tokens are refunded */ event RefundTokens(address _token, address _refund, uint256 _value); }
/** * Anymous Coin smart contract. */
NatSpecMultiLine
transfer
function transfer(address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[msg.sender]); f (frozen) return false; else return AbstractToken.transfer (_to, _value); }
/** * Transfer given number of tokens from message sender to given recipient. * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */
NatSpecMultiLine
v0.5.3+commit.10d17f24
bzzr://41df23959bb22a0fe404ddaac29b6cc0432eca9d7662d3fdc99d91e57a2a6beb
{ "func_code_index": [ 1470, 1681 ] }
95
AMC
AMC.sol
0x4da7e3336b2c89812b0f4b6a04142cf487db005c
Solidity
AMC
contract AMC is AbstractToken { /** * Maximum allowed number of tokens in circulation. * tokenSupply = tokensIActuallyWant * (10 ^ decimals) */ uint256 constant MAX_TOKEN_COUNT = 10000000 * (10**18); /** * Address of the owner of this smart contract. */ address private owner; /** * Frozen account list holder */ mapping (address => bool) private frozenAccount; /** * Current number of tokens in circulation. */ uint256 tokenCount = 0; /** * True if tokens transfers are currently frozen, false otherwise. */ bool frozen = false; /** * Create new token smart contract and make msg.sender the * owner of this smart contract. */ constructor () public { owner = msg.sender; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply() public view returns (uint256 supply) { return tokenCount; } string constant public name = "Anymous Coin"; string constant public symbol = "AMC"; uint8 constant public decimals = 18; /** * Transfer given number of tokens from message sender to given recipient. * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer(address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[msg.sender]); if (frozen) return false; else return AbstractToken.transfer (_to, _value); } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[_from]); if (frozen) return false; else return AbstractToken.transferFrom (_from, _to, _value); } /** * Change how many tokens given spender is allowed to transfer from message * spender. In order to prevent double spending of allowance, * To change the approve amount you first have to reduce the addresses` * allowance to zero by calling `approve(_spender, 0)` if it is not * already 0 to mitigate the race condition described here: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { require(allowance (msg.sender, _spender) == 0 || _value == 0); return AbstractToken.approve (_spender, _value); } /** * Create _value new tokens and give new created tokens to msg.sender. * May only be called by smart contract owner. * * @param _value number of tokens to create * @return true if tokens were created successfully, false otherwise */ function createTokens(uint256 _value) public returns (bool success) { require (msg.sender == owner); if (_value > 0) { if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false; accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokenCount = safeAdd (tokenCount, _value); // adding transfer event and _from address as null address emit Transfer(address(0), msg.sender, _value); return true; } return false; } /** * Set new owner for the smart contract. * May only be called by smart contract owner. * * @param _newOwner address of new owner of the smart contract */ function setOwner(address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Freeze ALL token transfers. * May only be called by smart contract owner. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze ALL token transfers. * May only be called by smart contract owner. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /*A user is able to unintentionally send tokens to a contract * and if the contract is not prepared to refund them they will get stuck in the contract. * The same issue used to happen for Ether too but new Solidity versions added the payable modifier to * prevent unintended Ether transfers. However, there’s no such mechanism for token transfers. * so the below function is created */ function refundTokens(address _token, address _refund, uint256 _value) public { require (msg.sender == owner); require(_token != address(this)); AbstractToken token = AbstractToken(_token); token.transfer(_refund, _value); emit RefundTokens(_token, _refund, _value); } /** * Freeze specific account * May only be called by smart contract owner. */ function freezeAccount(address _target, bool freeze) public { require (msg.sender == owner); require (msg.sender != _target); frozenAccount[_target] = freeze; emit FrozenFunds(_target, freeze); } /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); /** * Logged when a particular account is frozen. */ event FrozenFunds(address target, bool frozen); /** * when accidentally send other tokens are refunded */ event RefundTokens(address _token, address _refund, uint256 _value); }
/** * Anymous Coin smart contract. */
NatSpecMultiLine
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { equire(!frozenAccount[_from]); if (frozen) return false; else return AbstractToken.transferFrom (_from, _to, _value); }
/** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */
NatSpecMultiLine
v0.5.3+commit.10d17f24
bzzr://41df23959bb22a0fe404ddaac29b6cc0432eca9d7662d3fdc99d91e57a2a6beb
{ "func_code_index": [ 2077, 2318 ] }
96
AMC
AMC.sol
0x4da7e3336b2c89812b0f4b6a04142cf487db005c
Solidity
AMC
contract AMC is AbstractToken { /** * Maximum allowed number of tokens in circulation. * tokenSupply = tokensIActuallyWant * (10 ^ decimals) */ uint256 constant MAX_TOKEN_COUNT = 10000000 * (10**18); /** * Address of the owner of this smart contract. */ address private owner; /** * Frozen account list holder */ mapping (address => bool) private frozenAccount; /** * Current number of tokens in circulation. */ uint256 tokenCount = 0; /** * True if tokens transfers are currently frozen, false otherwise. */ bool frozen = false; /** * Create new token smart contract and make msg.sender the * owner of this smart contract. */ constructor () public { owner = msg.sender; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply() public view returns (uint256 supply) { return tokenCount; } string constant public name = "Anymous Coin"; string constant public symbol = "AMC"; uint8 constant public decimals = 18; /** * Transfer given number of tokens from message sender to given recipient. * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer(address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[msg.sender]); if (frozen) return false; else return AbstractToken.transfer (_to, _value); } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[_from]); if (frozen) return false; else return AbstractToken.transferFrom (_from, _to, _value); } /** * Change how many tokens given spender is allowed to transfer from message * spender. In order to prevent double spending of allowance, * To change the approve amount you first have to reduce the addresses` * allowance to zero by calling `approve(_spender, 0)` if it is not * already 0 to mitigate the race condition described here: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { require(allowance (msg.sender, _spender) == 0 || _value == 0); return AbstractToken.approve (_spender, _value); } /** * Create _value new tokens and give new created tokens to msg.sender. * May only be called by smart contract owner. * * @param _value number of tokens to create * @return true if tokens were created successfully, false otherwise */ function createTokens(uint256 _value) public returns (bool success) { require (msg.sender == owner); if (_value > 0) { if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false; accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokenCount = safeAdd (tokenCount, _value); // adding transfer event and _from address as null address emit Transfer(address(0), msg.sender, _value); return true; } return false; } /** * Set new owner for the smart contract. * May only be called by smart contract owner. * * @param _newOwner address of new owner of the smart contract */ function setOwner(address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Freeze ALL token transfers. * May only be called by smart contract owner. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze ALL token transfers. * May only be called by smart contract owner. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /*A user is able to unintentionally send tokens to a contract * and if the contract is not prepared to refund them they will get stuck in the contract. * The same issue used to happen for Ether too but new Solidity versions added the payable modifier to * prevent unintended Ether transfers. However, there’s no such mechanism for token transfers. * so the below function is created */ function refundTokens(address _token, address _refund, uint256 _value) public { require (msg.sender == owner); require(_token != address(this)); AbstractToken token = AbstractToken(_token); token.transfer(_refund, _value); emit RefundTokens(_token, _refund, _value); } /** * Freeze specific account * May only be called by smart contract owner. */ function freezeAccount(address _target, bool freeze) public { require (msg.sender == owner); require (msg.sender != _target); frozenAccount[_target] = freeze; emit FrozenFunds(_target, freeze); } /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); /** * Logged when a particular account is frozen. */ event FrozenFunds(address target, bool frozen); /** * when accidentally send other tokens are refunded */ event RefundTokens(address _token, address _refund, uint256 _value); }
/** * Anymous Coin smart contract. */
NatSpecMultiLine
approve
function approve (address _spender, uint256 _value) public returns (bool success) { equire(allowance (msg.sender, _spender) == 0 || _value == 0); return AbstractToken.approve (_spender, _value); }
/** * Change how many tokens given spender is allowed to transfer from message * spender. In order to prevent double spending of allowance, * To change the approve amount you first have to reduce the addresses` * allowance to zero by calling `approve(_spender, 0)` if it is not * already 0 to mitigate the race condition described here: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */
NatSpecMultiLine
v0.5.3+commit.10d17f24
bzzr://41df23959bb22a0fe404ddaac29b6cc0432eca9d7662d3fdc99d91e57a2a6beb
{ "func_code_index": [ 3004, 3219 ] }
97
AMC
AMC.sol
0x4da7e3336b2c89812b0f4b6a04142cf487db005c
Solidity
AMC
contract AMC is AbstractToken { /** * Maximum allowed number of tokens in circulation. * tokenSupply = tokensIActuallyWant * (10 ^ decimals) */ uint256 constant MAX_TOKEN_COUNT = 10000000 * (10**18); /** * Address of the owner of this smart contract. */ address private owner; /** * Frozen account list holder */ mapping (address => bool) private frozenAccount; /** * Current number of tokens in circulation. */ uint256 tokenCount = 0; /** * True if tokens transfers are currently frozen, false otherwise. */ bool frozen = false; /** * Create new token smart contract and make msg.sender the * owner of this smart contract. */ constructor () public { owner = msg.sender; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply() public view returns (uint256 supply) { return tokenCount; } string constant public name = "Anymous Coin"; string constant public symbol = "AMC"; uint8 constant public decimals = 18; /** * Transfer given number of tokens from message sender to given recipient. * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer(address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[msg.sender]); if (frozen) return false; else return AbstractToken.transfer (_to, _value); } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[_from]); if (frozen) return false; else return AbstractToken.transferFrom (_from, _to, _value); } /** * Change how many tokens given spender is allowed to transfer from message * spender. In order to prevent double spending of allowance, * To change the approve amount you first have to reduce the addresses` * allowance to zero by calling `approve(_spender, 0)` if it is not * already 0 to mitigate the race condition described here: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { require(allowance (msg.sender, _spender) == 0 || _value == 0); return AbstractToken.approve (_spender, _value); } /** * Create _value new tokens and give new created tokens to msg.sender. * May only be called by smart contract owner. * * @param _value number of tokens to create * @return true if tokens were created successfully, false otherwise */ function createTokens(uint256 _value) public returns (bool success) { require (msg.sender == owner); if (_value > 0) { if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false; accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokenCount = safeAdd (tokenCount, _value); // adding transfer event and _from address as null address emit Transfer(address(0), msg.sender, _value); return true; } return false; } /** * Set new owner for the smart contract. * May only be called by smart contract owner. * * @param _newOwner address of new owner of the smart contract */ function setOwner(address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Freeze ALL token transfers. * May only be called by smart contract owner. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze ALL token transfers. * May only be called by smart contract owner. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /*A user is able to unintentionally send tokens to a contract * and if the contract is not prepared to refund them they will get stuck in the contract. * The same issue used to happen for Ether too but new Solidity versions added the payable modifier to * prevent unintended Ether transfers. However, there’s no such mechanism for token transfers. * so the below function is created */ function refundTokens(address _token, address _refund, uint256 _value) public { require (msg.sender == owner); require(_token != address(this)); AbstractToken token = AbstractToken(_token); token.transfer(_refund, _value); emit RefundTokens(_token, _refund, _value); } /** * Freeze specific account * May only be called by smart contract owner. */ function freezeAccount(address _target, bool freeze) public { require (msg.sender == owner); require (msg.sender != _target); frozenAccount[_target] = freeze; emit FrozenFunds(_target, freeze); } /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); /** * Logged when a particular account is frozen. */ event FrozenFunds(address target, bool frozen); /** * when accidentally send other tokens are refunded */ event RefundTokens(address _token, address _refund, uint256 _value); }
/** * Anymous Coin smart contract. */
NatSpecMultiLine
createTokens
function createTokens(uint256 _value) public returns (bool success) { require (msg.sender == owner); if (_value > 0) { if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false; accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokenCount = safeAdd (tokenCount, _value); // adding transfer event and _from address as null address emit Transfer(address(0), msg.sender, _value); return true; } return false; }
/** * Create _value new tokens and give new created tokens to msg.sender. * May only be called by smart contract owner. * * @param _value number of tokens to create * @return true if tokens were created successfully, false otherwise */
NatSpecMultiLine
v0.5.3+commit.10d17f24
bzzr://41df23959bb22a0fe404ddaac29b6cc0432eca9d7662d3fdc99d91e57a2a6beb
{ "func_code_index": [ 3485, 4003 ] }
98
AMC
AMC.sol
0x4da7e3336b2c89812b0f4b6a04142cf487db005c
Solidity
AMC
contract AMC is AbstractToken { /** * Maximum allowed number of tokens in circulation. * tokenSupply = tokensIActuallyWant * (10 ^ decimals) */ uint256 constant MAX_TOKEN_COUNT = 10000000 * (10**18); /** * Address of the owner of this smart contract. */ address private owner; /** * Frozen account list holder */ mapping (address => bool) private frozenAccount; /** * Current number of tokens in circulation. */ uint256 tokenCount = 0; /** * True if tokens transfers are currently frozen, false otherwise. */ bool frozen = false; /** * Create new token smart contract and make msg.sender the * owner of this smart contract. */ constructor () public { owner = msg.sender; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply() public view returns (uint256 supply) { return tokenCount; } string constant public name = "Anymous Coin"; string constant public symbol = "AMC"; uint8 constant public decimals = 18; /** * Transfer given number of tokens from message sender to given recipient. * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer(address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[msg.sender]); if (frozen) return false; else return AbstractToken.transfer (_to, _value); } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(!frozenAccount[_from]); if (frozen) return false; else return AbstractToken.transferFrom (_from, _to, _value); } /** * Change how many tokens given spender is allowed to transfer from message * spender. In order to prevent double spending of allowance, * To change the approve amount you first have to reduce the addresses` * allowance to zero by calling `approve(_spender, 0)` if it is not * already 0 to mitigate the race condition described here: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { require(allowance (msg.sender, _spender) == 0 || _value == 0); return AbstractToken.approve (_spender, _value); } /** * Create _value new tokens and give new created tokens to msg.sender. * May only be called by smart contract owner. * * @param _value number of tokens to create * @return true if tokens were created successfully, false otherwise */ function createTokens(uint256 _value) public returns (bool success) { require (msg.sender == owner); if (_value > 0) { if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false; accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokenCount = safeAdd (tokenCount, _value); // adding transfer event and _from address as null address emit Transfer(address(0), msg.sender, _value); return true; } return false; } /** * Set new owner for the smart contract. * May only be called by smart contract owner. * * @param _newOwner address of new owner of the smart contract */ function setOwner(address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Freeze ALL token transfers. * May only be called by smart contract owner. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze ALL token transfers. * May only be called by smart contract owner. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /*A user is able to unintentionally send tokens to a contract * and if the contract is not prepared to refund them they will get stuck in the contract. * The same issue used to happen for Ether too but new Solidity versions added the payable modifier to * prevent unintended Ether transfers. However, there’s no such mechanism for token transfers. * so the below function is created */ function refundTokens(address _token, address _refund, uint256 _value) public { require (msg.sender == owner); require(_token != address(this)); AbstractToken token = AbstractToken(_token); token.transfer(_refund, _value); emit RefundTokens(_token, _refund, _value); } /** * Freeze specific account * May only be called by smart contract owner. */ function freezeAccount(address _target, bool freeze) public { require (msg.sender == owner); require (msg.sender != _target); frozenAccount[_target] = freeze; emit FrozenFunds(_target, freeze); } /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); /** * Logged when a particular account is frozen. */ event FrozenFunds(address target, bool frozen); /** * when accidentally send other tokens are refunded */ event RefundTokens(address _token, address _refund, uint256 _value); }
/** * Anymous Coin smart contract. */
NatSpecMultiLine
setOwner
function setOwner(address _newOwner) public { require (msg.sender == owner); owner = _newOwner; }
/** * Set new owner for the smart contract. * May only be called by smart contract owner. * * @param _newOwner address of new owner of the smart contract */
NatSpecMultiLine
v0.5.3+commit.10d17f24
bzzr://41df23959bb22a0fe404ddaac29b6cc0432eca9d7662d3fdc99d91e57a2a6beb
{ "func_code_index": [ 4194, 4309 ] }
99