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
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
Ownable
contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { if (newOwner != address(0)) { owner = newOwner; } } function _setupOwner(address newOwner) internal { owner = newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
transferOwnership
function transferOwnership(address newOwner) public onlyOwner { if (newOwner != address(0)) { owner = newOwner; } }
/** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 587, 743 ] }
9,707
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
totalSupply
function totalSupply() external view returns (uint256);
/** * @dev Returns the amount of tokens in existence. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 94, 154 ] }
9,708
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
balanceOf
function balanceOf(address account) external view returns (uint256);
/** * @dev Returns the amount of tokens owned by `account`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 237, 310 ] }
9,709
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
transfer
function transfer(address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 534, 616 ] }
9,710
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
allowance
function allowance(address owner, address spender) external view returns (uint256);
/** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 895, 983 ] }
9,711
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
approve
function approve(address spender, uint256 amount) external returns (bool);
/** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * * Emits an {Approval} event. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 1647, 1726 ] }
9,712
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
transferFrom
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 2039, 2141 ] }
9,713
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
add
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
/** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 259, 445 ] }
9,714
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); }
/** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 723, 864 ] }
9,715
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; }
/** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 1162, 1359 ] }
9,716
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; }
/** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 1613, 2089 ] }
9,717
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); }
/** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 2560, 2697 ] }
9,718
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
div
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
/** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 3188, 3471 ] }
9,719
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mod
function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); }
/** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 3931, 4066 ] }
9,720
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
SafeMath
library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
/** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */
NatSpecMultiLine
mod
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; }
/** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 4546, 4717 ] }
9,721
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
name
function name() public view returns (string memory) { return _name; }
/** * @dev Returns the name of the token. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 870, 958 ] }
9,722
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
symbol
function symbol() public view returns (string memory) { return _symbol; }
/** * @dev Returns the symbol of the token, usually a shorter version of the * name. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 1072, 1164 ] }
9,723
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
decimals
function decimals() public view returns (uint8) { return _decimals; }
/** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 1797, 1885 ] }
9,724
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
totalSupply
function totalSupply() public view override returns (uint256) { return _totalSupply; }
/** * @dev See {IERC20-totalSupply}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 1945, 2050 ] }
9,725
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
balanceOf
function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }
/** * @dev See {IERC20-balanceOf}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 2108, 2232 ] }
9,726
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
transfer
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
/** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 2440, 2620 ] }
9,727
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
allowance
function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; }
/** * @dev See {IERC20-allowance}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 2678, 2834 ] }
9,728
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
approve
function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; }
/** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 2976, 3150 ] }
9,729
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
transferFrom
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; }
/** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 3627, 3953 ] }
9,730
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
increaseAllowance
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; }
/** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 4357, 4580 ] }
9,731
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
decreaseAllowance
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; }
/** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 5078, 5352 ] }
9,732
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_transfer
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); }
/** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 5837, 6381 ] }
9,733
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_mint
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); }
/** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 6658, 7041 ] }
9,734
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_burn
function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); }
/** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 7544, 7967 ] }
9,735
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_approve
function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); }
/** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 8400, 8751 ] }
9,736
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_setupDecimals
function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; }
/** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 9078, 9173 ] }
9,737
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20
contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _premine(address account, uint256 amount) internal virtual { _balances[account] = amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
/** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */
NatSpecMultiLine
_beforeTokenTransfer
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
/** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 9771, 9868 ] }
9,738
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20Burnable
abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); } }
/** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */
NatSpecMultiLine
burn
function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); }
/** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 161, 257 ] }
9,739
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20Burnable
abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); } }
/** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */
NatSpecMultiLine
burnFrom
function burnFrom(address account, uint256 amount) public virtual { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); }
/** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 571, 871 ] }
9,740
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
Pausable
contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () internal { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
/** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */
NatSpecMultiLine
paused
function paused() public view returns (bool) { return _paused; }
/** * @dev Returns true if the contract is paused, and false otherwise. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 531, 614 ] }
9,741
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
Pausable
contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () internal { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
/** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */
NatSpecMultiLine
_pause
function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); }
/** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 1321, 1444 ] }
9,742
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
Pausable
contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () internal { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
/** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */
NatSpecMultiLine
_unpause
function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); }
/** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 1580, 1705 ] }
9,743
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
ERC20Pausable
abstract contract ERC20Pausable is ERC20, Pausable { /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); } }
/** * @dev ERC20 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */
NatSpecMultiLine
_beforeTokenTransfer
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); }
/** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 200, 443 ] }
9,744
HUBToken
HUBToken.sol
0x8e9a29e7ed21db7c5b2e1cd75e676da0236dfb45
Solidity
HUBToken
contract HUBToken is ERC20Burnable, ERC20Pausable, BlackList { bool public prefilled = false; constructor() ERC20("Minter Hub", "HUB") public { _setupOwner(msg.sender); } /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. * - the sender should not be blacklisted. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override(ERC20, ERC20Pausable) { super._beforeTokenTransfer(from, to, amount); require(!isBlackListed[from] || to == address(0)); require(!paused(), "ERC20Pausable: token transfer while paused"); } function prefill(address[] calldata _addresses, uint256[] calldata _values) public onlyNotPrefilled onlyOwner { for (uint i = 0; i < _addresses.length; i++) { _mint(_addresses[i], _values[i]); } } function launch() public onlyNotPrefilled onlyOwner { prefilled = true; } function pause() public onlyOwner { _pause(); } function unpause() public onlyOwner { _unpause(); } modifier onlyNotPrefilled() { assert(!prefilled); _; } }
_beforeTokenTransfer
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override(ERC20, ERC20Pausable) { super._beforeTokenTransfer(from, to, amount); require(!isBlackListed[from] || to == address(0)); require(!paused(), "ERC20Pausable: token transfer while paused"); }
/** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. * - the sender should not be blacklisted. */
NatSpecMultiLine
v0.6.12+commit.27d51765
MIT
ipfs://4279e1167f743b3be86d265a5c79e25d89d0b648fd8ab5d490c528d312b80f19
{ "func_code_index": [ 410, 743 ] }
9,745
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
StandardToken
contract StandardToken{ using SafeMath for uint256; // create mapping from ether address to uint for balances mapping (address => uint256) balances; mapping (address => mapping(address => uint256)) approved; // public events on ether network for Transfer and Approval event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); uint256 public totalSupply; // returns the total supply of all prosperium presale tokens function totalSupply() constant returns (uint totalSupply){ return totalSupply; } // returns address specified as "_owner" function balanceOf(address _owner) constant returns (uint256 balance){ return balances[_owner]; } // transfer _value PP tokens from msg.sender to _to function transfer(address _to, uint256 _value) returns (bool success){ require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } // permission from owner to approve spender(s) function approve(address _spender, uint _value) returns (bool success){ require((_value == 0) || (approved[msg.sender][_spender] == 0)); approved[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } // amount of coins allowed to spend from another account function allowance(address _owner, address _spender) constant returns (uint256 remaining){ return approved[_owner][_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 https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/StandardToken.sol */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { approved[msg.sender][_spender] = approved[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { uint oldValue = approved[msg.sender][_spender]; if (_subtractedValue > oldValue) { approved[msg.sender][_spender] = 0; } else { approved[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } // transfer tokens from owners account to given address _to function transferFrom(address _from, address _to, uint _value) returns (bool success){ require(_to != address(0)); var _allowance = approved[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); approved[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } }
totalSupply
function totalSupply() constant returns (uint totalSupply){ return totalSupply; }
// returns the total supply of all prosperium presale tokens
LineComment
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 598, 698 ] }
9,746
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
StandardToken
contract StandardToken{ using SafeMath for uint256; // create mapping from ether address to uint for balances mapping (address => uint256) balances; mapping (address => mapping(address => uint256)) approved; // public events on ether network for Transfer and Approval event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); uint256 public totalSupply; // returns the total supply of all prosperium presale tokens function totalSupply() constant returns (uint totalSupply){ return totalSupply; } // returns address specified as "_owner" function balanceOf(address _owner) constant returns (uint256 balance){ return balances[_owner]; } // transfer _value PP tokens from msg.sender to _to function transfer(address _to, uint256 _value) returns (bool success){ require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } // permission from owner to approve spender(s) function approve(address _spender, uint _value) returns (bool success){ require((_value == 0) || (approved[msg.sender][_spender] == 0)); approved[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } // amount of coins allowed to spend from another account function allowance(address _owner, address _spender) constant returns (uint256 remaining){ return approved[_owner][_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 https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/StandardToken.sol */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { approved[msg.sender][_spender] = approved[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { uint oldValue = approved[msg.sender][_spender]; if (_subtractedValue > oldValue) { approved[msg.sender][_spender] = 0; } else { approved[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } // transfer tokens from owners account to given address _to function transferFrom(address _from, address _to, uint _value) returns (bool success){ require(_to != address(0)); var _allowance = approved[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); approved[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } }
balanceOf
function balanceOf(address _owner) constant returns (uint256 balance){ return balances[_owner]; }
// returns address specified as "_owner"
LineComment
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 751, 867 ] }
9,747
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
StandardToken
contract StandardToken{ using SafeMath for uint256; // create mapping from ether address to uint for balances mapping (address => uint256) balances; mapping (address => mapping(address => uint256)) approved; // public events on ether network for Transfer and Approval event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); uint256 public totalSupply; // returns the total supply of all prosperium presale tokens function totalSupply() constant returns (uint totalSupply){ return totalSupply; } // returns address specified as "_owner" function balanceOf(address _owner) constant returns (uint256 balance){ return balances[_owner]; } // transfer _value PP tokens from msg.sender to _to function transfer(address _to, uint256 _value) returns (bool success){ require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } // permission from owner to approve spender(s) function approve(address _spender, uint _value) returns (bool success){ require((_value == 0) || (approved[msg.sender][_spender] == 0)); approved[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } // amount of coins allowed to spend from another account function allowance(address _owner, address _spender) constant returns (uint256 remaining){ return approved[_owner][_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 https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/StandardToken.sol */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { approved[msg.sender][_spender] = approved[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { uint oldValue = approved[msg.sender][_spender]; if (_subtractedValue > oldValue) { approved[msg.sender][_spender] = 0; } else { approved[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } // transfer tokens from owners account to given address _to function transferFrom(address _from, address _to, uint _value) returns (bool success){ require(_to != address(0)); var _allowance = approved[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); approved[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } }
transfer
function transfer(address _to, uint256 _value) returns (bool success){ require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; }
// transfer _value PP tokens from msg.sender to _to
LineComment
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 932, 1265 ] }
9,748
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
StandardToken
contract StandardToken{ using SafeMath for uint256; // create mapping from ether address to uint for balances mapping (address => uint256) balances; mapping (address => mapping(address => uint256)) approved; // public events on ether network for Transfer and Approval event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); uint256 public totalSupply; // returns the total supply of all prosperium presale tokens function totalSupply() constant returns (uint totalSupply){ return totalSupply; } // returns address specified as "_owner" function balanceOf(address _owner) constant returns (uint256 balance){ return balances[_owner]; } // transfer _value PP tokens from msg.sender to _to function transfer(address _to, uint256 _value) returns (bool success){ require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } // permission from owner to approve spender(s) function approve(address _spender, uint _value) returns (bool success){ require((_value == 0) || (approved[msg.sender][_spender] == 0)); approved[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } // amount of coins allowed to spend from another account function allowance(address _owner, address _spender) constant returns (uint256 remaining){ return approved[_owner][_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 https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/StandardToken.sol */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { approved[msg.sender][_spender] = approved[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { uint oldValue = approved[msg.sender][_spender]; if (_subtractedValue > oldValue) { approved[msg.sender][_spender] = 0; } else { approved[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } // transfer tokens from owners account to given address _to function transferFrom(address _from, address _to, uint _value) returns (bool success){ require(_to != address(0)); var _allowance = approved[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); approved[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } }
approve
function approve(address _spender, uint _value) returns (bool success){ require((_value == 0) || (approved[msg.sender][_spender] == 0)); approved[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
// permission from owner to approve spender(s)
LineComment
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 1324, 1624 ] }
9,749
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
StandardToken
contract StandardToken{ using SafeMath for uint256; // create mapping from ether address to uint for balances mapping (address => uint256) balances; mapping (address => mapping(address => uint256)) approved; // public events on ether network for Transfer and Approval event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); uint256 public totalSupply; // returns the total supply of all prosperium presale tokens function totalSupply() constant returns (uint totalSupply){ return totalSupply; } // returns address specified as "_owner" function balanceOf(address _owner) constant returns (uint256 balance){ return balances[_owner]; } // transfer _value PP tokens from msg.sender to _to function transfer(address _to, uint256 _value) returns (bool success){ require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } // permission from owner to approve spender(s) function approve(address _spender, uint _value) returns (bool success){ require((_value == 0) || (approved[msg.sender][_spender] == 0)); approved[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } // amount of coins allowed to spend from another account function allowance(address _owner, address _spender) constant returns (uint256 remaining){ return approved[_owner][_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 https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/StandardToken.sol */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { approved[msg.sender][_spender] = approved[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { uint oldValue = approved[msg.sender][_spender]; if (_subtractedValue > oldValue) { approved[msg.sender][_spender] = 0; } else { approved[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } // transfer tokens from owners account to given address _to function transferFrom(address _from, address _to, uint _value) returns (bool success){ require(_to != address(0)); var _allowance = approved[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); approved[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } }
allowance
function allowance(address _owner, address _spender) constant returns (uint256 remaining){ return approved[_owner][_spender]; }
// amount of coins allowed to spend from another account
LineComment
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 1693, 1859 ] }
9,750
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
StandardToken
contract StandardToken{ using SafeMath for uint256; // create mapping from ether address to uint for balances mapping (address => uint256) balances; mapping (address => mapping(address => uint256)) approved; // public events on ether network for Transfer and Approval event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); uint256 public totalSupply; // returns the total supply of all prosperium presale tokens function totalSupply() constant returns (uint totalSupply){ return totalSupply; } // returns address specified as "_owner" function balanceOf(address _owner) constant returns (uint256 balance){ return balances[_owner]; } // transfer _value PP tokens from msg.sender to _to function transfer(address _to, uint256 _value) returns (bool success){ require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } // permission from owner to approve spender(s) function approve(address _spender, uint _value) returns (bool success){ require((_value == 0) || (approved[msg.sender][_spender] == 0)); approved[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } // amount of coins allowed to spend from another account function allowance(address _owner, address _spender) constant returns (uint256 remaining){ return approved[_owner][_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 https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/StandardToken.sol */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { approved[msg.sender][_spender] = approved[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { uint oldValue = approved[msg.sender][_spender]; if (_subtractedValue > oldValue) { approved[msg.sender][_spender] = 0; } else { approved[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } // transfer tokens from owners account to given address _to function transferFrom(address _from, address _to, uint _value) returns (bool success){ require(_to != address(0)); var _allowance = approved[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); approved[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } }
increaseApproval
function increaseApproval (address _spender, uint _addedValue) returns (bool success) { approved[msg.sender][_spender] = approved[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true;
/** * 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 https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/StandardToken.sol */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 2185, 2462 ] }
9,751
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
StandardToken
contract StandardToken{ using SafeMath for uint256; // create mapping from ether address to uint for balances mapping (address => uint256) balances; mapping (address => mapping(address => uint256)) approved; // public events on ether network for Transfer and Approval event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); uint256 public totalSupply; // returns the total supply of all prosperium presale tokens function totalSupply() constant returns (uint totalSupply){ return totalSupply; } // returns address specified as "_owner" function balanceOf(address _owner) constant returns (uint256 balance){ return balances[_owner]; } // transfer _value PP tokens from msg.sender to _to function transfer(address _to, uint256 _value) returns (bool success){ require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } // permission from owner to approve spender(s) function approve(address _spender, uint _value) returns (bool success){ require((_value == 0) || (approved[msg.sender][_spender] == 0)); approved[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } // amount of coins allowed to spend from another account function allowance(address _owner, address _spender) constant returns (uint256 remaining){ return approved[_owner][_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 https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/StandardToken.sol */ function increaseApproval (address _spender, uint _addedValue) returns (bool success) { approved[msg.sender][_spender] = approved[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } function decreaseApproval (address _spender, uint _subtractedValue) returns (bool success) { uint oldValue = approved[msg.sender][_spender]; if (_subtractedValue > oldValue) { approved[msg.sender][_spender] = 0; } else { approved[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, approved[msg.sender][_spender]); return true; } // transfer tokens from owners account to given address _to function transferFrom(address _from, address _to, uint _value) returns (bool success){ require(_to != address(0)); var _allowance = approved[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); approved[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } }
transferFrom
function transferFrom(address _from, address _to, uint _value) returns (bool success){ require(_to != address(0)); var _allowance = approved[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); approved[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; }
// transfer tokens from owners account to given address _to
LineComment
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 2953, 3408 ] }
9,752
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
Ownable
contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } }
/** * @title Ownable * from OpenZeppelin * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
Ownable
function Ownable() { owner = msg.sender; }
/** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 267, 320 ] }
9,753
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
Ownable
contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } }
/** * @title Ownable * from OpenZeppelin * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
transferOwnership
function transferOwnership(address newOwner) onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; }
/** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 643, 818 ] }
9,754
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
ProsperMintableToken
contract ProsperMintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @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, uint256 _amount) onlyOwner canMint returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(0x0, _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner returns (bool) { mintingFinished = true; MintFinished(); return true; } }
// prosperium will be mintable only by owner // from OpenZeppelin https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/MintableToken.sol
LineComment
mint
function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(0x0, _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.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 490, 747 ] }
9,755
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
ProsperMintableToken
contract ProsperMintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @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, uint256 _amount) onlyOwner canMint returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(0x0, _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner returns (bool) { mintingFinished = true; MintFinished(); return true; } }
// prosperium will be mintable only by owner // from OpenZeppelin https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/MintableToken.sol
LineComment
finishMinting
function finishMinting() onlyOwner returns (bool) { mintingFinished = true; MintFinished(); return true; }
/** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 864, 991 ] }
9,756
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
UpgradeAgent
contract UpgradeAgent { uint public originalSupply; /** Interface marker */ function isUpgradeAgent() public constant returns (bool) { return true; } /** * Upgrade amount of tokens to a new version. * * Only callable by UpgradeableToken. * * @param _tokenHolder Address that wants to upgrade its tokens * @param _amount Number of tokens to upgrade. The address may consider to hold back some amount of tokens in the old version. */ function upgradeFrom(address _tokenHolder, uint256 _amount) external; }
/** * inspirsed from Civic token * Upgrade agent interface inspired by Lunyr. * * Upgrade agent transfers tokens to a new version of a token contract. * Upgrade agent can be set on a token by the upgrade master. * * Steps are * - Upgradeabletoken.upgradeMaster calls UpgradeableToken.setUpgradeAgent() * - Individual token holders can now call UpgradeableToken.upgrade() * -> This results to call UpgradeAgent.upgradeFrom() that issues new tokens * -> UpgradeableToken.upgrade() reduces the original total supply based on amount of upgraded tokens * */
NatSpecMultiLine
isUpgradeAgent
function isUpgradeAgent() public constant returns (bool) { return true; }
/** Interface marker */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 87, 171 ] }
9,757
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
UpgradeAgent
contract UpgradeAgent { uint public originalSupply; /** Interface marker */ function isUpgradeAgent() public constant returns (bool) { return true; } /** * Upgrade amount of tokens to a new version. * * Only callable by UpgradeableToken. * * @param _tokenHolder Address that wants to upgrade its tokens * @param _amount Number of tokens to upgrade. The address may consider to hold back some amount of tokens in the old version. */ function upgradeFrom(address _tokenHolder, uint256 _amount) external; }
/** * inspirsed from Civic token * Upgrade agent interface inspired by Lunyr. * * Upgrade agent transfers tokens to a new version of a token contract. * Upgrade agent can be set on a token by the upgrade master. * * Steps are * - Upgradeabletoken.upgradeMaster calls UpgradeableToken.setUpgradeAgent() * - Individual token holders can now call UpgradeableToken.upgrade() * -> This results to call UpgradeAgent.upgradeFrom() that issues new tokens * -> UpgradeableToken.upgrade() reduces the original total supply based on amount of upgraded tokens * */
NatSpecMultiLine
upgradeFrom
function upgradeFrom(address _tokenHolder, uint256 _amount) external;
/** * Upgrade amount of tokens to a new version. * * Only callable by UpgradeableToken. * * @param _tokenHolder Address that wants to upgrade its tokens * @param _amount Number of tokens to upgrade. The address may consider to hold back some amount of tokens in the old version. */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 487, 559 ] }
9,758
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
UpgradeableToken
contract UpgradeableToken is ProsperMintableToken { /** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */ address public upgradeMaster; /** The next contract where the tokens will be migrated. */ UpgradeAgent public upgradeAgent; /** How many tokens we have upgraded by now. */ uint256 public totalUpgraded; /** * Upgrade states. * * - NotAllowed: The child contract has not reached a condition where the upgrade can bgun * - WaitingForAgent: Token allows upgrade, but we don't have a new agent yet * - ReadyToUpgrade: The agent is set, but not a single token has been upgraded yet * - Upgrading: Upgrade agent is set and the balance holders can upgrade their tokens * */ enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading} /** * Somebody has upgraded some of his tokens. */ event Upgrade(address indexed _from, address indexed _to, uint256 _value); /** * New upgrade agent available. */ event UpgradeAgentSet(address agent); /** * Upgrade master updated. */ event NewUpgradeMaster(address upgradeMaster); /** * Do not allow construction without upgrade master set. */ function UpgradeableToken(address _upgradeMaster) { upgradeMaster = _upgradeMaster; NewUpgradeMaster(upgradeMaster); } /** * Allow the token holder to upgrade some of their tokens to a new contract. */ function upgrade(uint256 value) public { UpgradeState state = getUpgradeState(); if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) { // Called in a bad state throw; } // Validate input value. if (value == 0) throw; balances[msg.sender] = balances[msg.sender].sub(value); // Take tokens out from circulation totalSupply = totalSupply.sub(value); totalUpgraded = totalUpgraded.add(value); // Upgrade agent reissues the tokens upgradeAgent.upgradeFrom(msg.sender, value); Upgrade(msg.sender, upgradeAgent, value); } /** * Set an upgrade agent that handles */ function setUpgradeAgent(address agent) external { if(!canUpgrade()) { // The token is not yet in a state that we could think upgrading throw; } if (agent == 0x0) throw; // Only a master can designate the next agent if (msg.sender != upgradeMaster) throw; // Upgrade has already begun for an agent if (getUpgradeState() == UpgradeState.Upgrading) throw; upgradeAgent = UpgradeAgent(agent); // Bad interface if(!upgradeAgent.isUpgradeAgent()) throw; // Make sure that token supplies match in source and target if (upgradeAgent.originalSupply() != totalSupply) throw; UpgradeAgentSet(upgradeAgent); } /** * Get the state of the token upgrade. */ function getUpgradeState() public constant returns(UpgradeState) { if(!canUpgrade()) return UpgradeState.NotAllowed; else if(address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent; else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade; else return UpgradeState.Upgrading; } /** * Change the upgrade master. * * This allows us to set a new owner for the upgrade mechanism. */ function setUpgradeMaster(address master) public { if (master == 0x0) throw; if (msg.sender != upgradeMaster) throw; upgradeMaster = master; NewUpgradeMaster(upgradeMaster); } /** * Child contract can enable to provide the condition when the upgrade can begun. */ function canUpgrade() public constant returns(bool) { return true; } }
/** * A token upgrade mechanism where users can opt-in amount of tokens to the next smart contract revision. * * First envisioned by Golem and Lunyr projects. */
NatSpecMultiLine
UpgradeableToken
function UpgradeableToken(address _upgradeMaster) { upgradeMaster = _upgradeMaster; NewUpgradeMaster(upgradeMaster); }
/** * Do not allow construction without upgrade master set. */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 1312, 1446 ] }
9,759
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
UpgradeableToken
contract UpgradeableToken is ProsperMintableToken { /** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */ address public upgradeMaster; /** The next contract where the tokens will be migrated. */ UpgradeAgent public upgradeAgent; /** How many tokens we have upgraded by now. */ uint256 public totalUpgraded; /** * Upgrade states. * * - NotAllowed: The child contract has not reached a condition where the upgrade can bgun * - WaitingForAgent: Token allows upgrade, but we don't have a new agent yet * - ReadyToUpgrade: The agent is set, but not a single token has been upgraded yet * - Upgrading: Upgrade agent is set and the balance holders can upgrade their tokens * */ enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading} /** * Somebody has upgraded some of his tokens. */ event Upgrade(address indexed _from, address indexed _to, uint256 _value); /** * New upgrade agent available. */ event UpgradeAgentSet(address agent); /** * Upgrade master updated. */ event NewUpgradeMaster(address upgradeMaster); /** * Do not allow construction without upgrade master set. */ function UpgradeableToken(address _upgradeMaster) { upgradeMaster = _upgradeMaster; NewUpgradeMaster(upgradeMaster); } /** * Allow the token holder to upgrade some of their tokens to a new contract. */ function upgrade(uint256 value) public { UpgradeState state = getUpgradeState(); if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) { // Called in a bad state throw; } // Validate input value. if (value == 0) throw; balances[msg.sender] = balances[msg.sender].sub(value); // Take tokens out from circulation totalSupply = totalSupply.sub(value); totalUpgraded = totalUpgraded.add(value); // Upgrade agent reissues the tokens upgradeAgent.upgradeFrom(msg.sender, value); Upgrade(msg.sender, upgradeAgent, value); } /** * Set an upgrade agent that handles */ function setUpgradeAgent(address agent) external { if(!canUpgrade()) { // The token is not yet in a state that we could think upgrading throw; } if (agent == 0x0) throw; // Only a master can designate the next agent if (msg.sender != upgradeMaster) throw; // Upgrade has already begun for an agent if (getUpgradeState() == UpgradeState.Upgrading) throw; upgradeAgent = UpgradeAgent(agent); // Bad interface if(!upgradeAgent.isUpgradeAgent()) throw; // Make sure that token supplies match in source and target if (upgradeAgent.originalSupply() != totalSupply) throw; UpgradeAgentSet(upgradeAgent); } /** * Get the state of the token upgrade. */ function getUpgradeState() public constant returns(UpgradeState) { if(!canUpgrade()) return UpgradeState.NotAllowed; else if(address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent; else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade; else return UpgradeState.Upgrading; } /** * Change the upgrade master. * * This allows us to set a new owner for the upgrade mechanism. */ function setUpgradeMaster(address master) public { if (master == 0x0) throw; if (msg.sender != upgradeMaster) throw; upgradeMaster = master; NewUpgradeMaster(upgradeMaster); } /** * Child contract can enable to provide the condition when the upgrade can begun. */ function canUpgrade() public constant returns(bool) { return true; } }
/** * A token upgrade mechanism where users can opt-in amount of tokens to the next smart contract revision. * * First envisioned by Golem and Lunyr projects. */
NatSpecMultiLine
upgrade
function upgrade(uint256 value) public { UpgradeState state = getUpgradeState(); if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) { // Called in a bad state throw; } // Validate input value. if (value == 0) throw; balances[msg.sender] = balances[msg.sender].sub(value); // Take tokens out from circulation totalSupply = totalSupply.sub(value); totalUpgraded = totalUpgraded.add(value); // Upgrade agent reissues the tokens upgradeAgent.upgradeFrom(msg.sender, value); Upgrade(msg.sender, upgradeAgent, value); }
/** * Allow the token holder to upgrade some of their tokens to a new contract. */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 1543, 2202 ] }
9,760
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
UpgradeableToken
contract UpgradeableToken is ProsperMintableToken { /** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */ address public upgradeMaster; /** The next contract where the tokens will be migrated. */ UpgradeAgent public upgradeAgent; /** How many tokens we have upgraded by now. */ uint256 public totalUpgraded; /** * Upgrade states. * * - NotAllowed: The child contract has not reached a condition where the upgrade can bgun * - WaitingForAgent: Token allows upgrade, but we don't have a new agent yet * - ReadyToUpgrade: The agent is set, but not a single token has been upgraded yet * - Upgrading: Upgrade agent is set and the balance holders can upgrade their tokens * */ enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading} /** * Somebody has upgraded some of his tokens. */ event Upgrade(address indexed _from, address indexed _to, uint256 _value); /** * New upgrade agent available. */ event UpgradeAgentSet(address agent); /** * Upgrade master updated. */ event NewUpgradeMaster(address upgradeMaster); /** * Do not allow construction without upgrade master set. */ function UpgradeableToken(address _upgradeMaster) { upgradeMaster = _upgradeMaster; NewUpgradeMaster(upgradeMaster); } /** * Allow the token holder to upgrade some of their tokens to a new contract. */ function upgrade(uint256 value) public { UpgradeState state = getUpgradeState(); if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) { // Called in a bad state throw; } // Validate input value. if (value == 0) throw; balances[msg.sender] = balances[msg.sender].sub(value); // Take tokens out from circulation totalSupply = totalSupply.sub(value); totalUpgraded = totalUpgraded.add(value); // Upgrade agent reissues the tokens upgradeAgent.upgradeFrom(msg.sender, value); Upgrade(msg.sender, upgradeAgent, value); } /** * Set an upgrade agent that handles */ function setUpgradeAgent(address agent) external { if(!canUpgrade()) { // The token is not yet in a state that we could think upgrading throw; } if (agent == 0x0) throw; // Only a master can designate the next agent if (msg.sender != upgradeMaster) throw; // Upgrade has already begun for an agent if (getUpgradeState() == UpgradeState.Upgrading) throw; upgradeAgent = UpgradeAgent(agent); // Bad interface if(!upgradeAgent.isUpgradeAgent()) throw; // Make sure that token supplies match in source and target if (upgradeAgent.originalSupply() != totalSupply) throw; UpgradeAgentSet(upgradeAgent); } /** * Get the state of the token upgrade. */ function getUpgradeState() public constant returns(UpgradeState) { if(!canUpgrade()) return UpgradeState.NotAllowed; else if(address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent; else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade; else return UpgradeState.Upgrading; } /** * Change the upgrade master. * * This allows us to set a new owner for the upgrade mechanism. */ function setUpgradeMaster(address master) public { if (master == 0x0) throw; if (msg.sender != upgradeMaster) throw; upgradeMaster = master; NewUpgradeMaster(upgradeMaster); } /** * Child contract can enable to provide the condition when the upgrade can begun. */ function canUpgrade() public constant returns(bool) { return true; } }
/** * A token upgrade mechanism where users can opt-in amount of tokens to the next smart contract revision. * * First envisioned by Golem and Lunyr projects. */
NatSpecMultiLine
setUpgradeAgent
function setUpgradeAgent(address agent) external { if(!canUpgrade()) { // The token is not yet in a state that we could think upgrading throw; } if (agent == 0x0) throw; // Only a master can designate the next agent if (msg.sender != upgradeMaster) throw; // Upgrade has already begun for an agent if (getUpgradeState() == UpgradeState.Upgrading) throw; upgradeAgent = UpgradeAgent(agent); // Bad interface if(!upgradeAgent.isUpgradeAgent()) throw; // Make sure that token supplies match in source and target if (upgradeAgent.originalSupply() != totalSupply) throw; UpgradeAgentSet(upgradeAgent); }
/** * Set an upgrade agent that handles */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 2259, 2982 ] }
9,761
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
UpgradeableToken
contract UpgradeableToken is ProsperMintableToken { /** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */ address public upgradeMaster; /** The next contract where the tokens will be migrated. */ UpgradeAgent public upgradeAgent; /** How many tokens we have upgraded by now. */ uint256 public totalUpgraded; /** * Upgrade states. * * - NotAllowed: The child contract has not reached a condition where the upgrade can bgun * - WaitingForAgent: Token allows upgrade, but we don't have a new agent yet * - ReadyToUpgrade: The agent is set, but not a single token has been upgraded yet * - Upgrading: Upgrade agent is set and the balance holders can upgrade their tokens * */ enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading} /** * Somebody has upgraded some of his tokens. */ event Upgrade(address indexed _from, address indexed _to, uint256 _value); /** * New upgrade agent available. */ event UpgradeAgentSet(address agent); /** * Upgrade master updated. */ event NewUpgradeMaster(address upgradeMaster); /** * Do not allow construction without upgrade master set. */ function UpgradeableToken(address _upgradeMaster) { upgradeMaster = _upgradeMaster; NewUpgradeMaster(upgradeMaster); } /** * Allow the token holder to upgrade some of their tokens to a new contract. */ function upgrade(uint256 value) public { UpgradeState state = getUpgradeState(); if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) { // Called in a bad state throw; } // Validate input value. if (value == 0) throw; balances[msg.sender] = balances[msg.sender].sub(value); // Take tokens out from circulation totalSupply = totalSupply.sub(value); totalUpgraded = totalUpgraded.add(value); // Upgrade agent reissues the tokens upgradeAgent.upgradeFrom(msg.sender, value); Upgrade(msg.sender, upgradeAgent, value); } /** * Set an upgrade agent that handles */ function setUpgradeAgent(address agent) external { if(!canUpgrade()) { // The token is not yet in a state that we could think upgrading throw; } if (agent == 0x0) throw; // Only a master can designate the next agent if (msg.sender != upgradeMaster) throw; // Upgrade has already begun for an agent if (getUpgradeState() == UpgradeState.Upgrading) throw; upgradeAgent = UpgradeAgent(agent); // Bad interface if(!upgradeAgent.isUpgradeAgent()) throw; // Make sure that token supplies match in source and target if (upgradeAgent.originalSupply() != totalSupply) throw; UpgradeAgentSet(upgradeAgent); } /** * Get the state of the token upgrade. */ function getUpgradeState() public constant returns(UpgradeState) { if(!canUpgrade()) return UpgradeState.NotAllowed; else if(address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent; else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade; else return UpgradeState.Upgrading; } /** * Change the upgrade master. * * This allows us to set a new owner for the upgrade mechanism. */ function setUpgradeMaster(address master) public { if (master == 0x0) throw; if (msg.sender != upgradeMaster) throw; upgradeMaster = master; NewUpgradeMaster(upgradeMaster); } /** * Child contract can enable to provide the condition when the upgrade can begun. */ function canUpgrade() public constant returns(bool) { return true; } }
/** * A token upgrade mechanism where users can opt-in amount of tokens to the next smart contract revision. * * First envisioned by Golem and Lunyr projects. */
NatSpecMultiLine
getUpgradeState
function getUpgradeState() public constant returns(UpgradeState) { if(!canUpgrade()) return UpgradeState.NotAllowed; else if(address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent; else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade; else return UpgradeState.Upgrading; }
/** * Get the state of the token upgrade. */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 3041, 3361 ] }
9,762
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
UpgradeableToken
contract UpgradeableToken is ProsperMintableToken { /** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */ address public upgradeMaster; /** The next contract where the tokens will be migrated. */ UpgradeAgent public upgradeAgent; /** How many tokens we have upgraded by now. */ uint256 public totalUpgraded; /** * Upgrade states. * * - NotAllowed: The child contract has not reached a condition where the upgrade can bgun * - WaitingForAgent: Token allows upgrade, but we don't have a new agent yet * - ReadyToUpgrade: The agent is set, but not a single token has been upgraded yet * - Upgrading: Upgrade agent is set and the balance holders can upgrade their tokens * */ enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading} /** * Somebody has upgraded some of his tokens. */ event Upgrade(address indexed _from, address indexed _to, uint256 _value); /** * New upgrade agent available. */ event UpgradeAgentSet(address agent); /** * Upgrade master updated. */ event NewUpgradeMaster(address upgradeMaster); /** * Do not allow construction without upgrade master set. */ function UpgradeableToken(address _upgradeMaster) { upgradeMaster = _upgradeMaster; NewUpgradeMaster(upgradeMaster); } /** * Allow the token holder to upgrade some of their tokens to a new contract. */ function upgrade(uint256 value) public { UpgradeState state = getUpgradeState(); if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) { // Called in a bad state throw; } // Validate input value. if (value == 0) throw; balances[msg.sender] = balances[msg.sender].sub(value); // Take tokens out from circulation totalSupply = totalSupply.sub(value); totalUpgraded = totalUpgraded.add(value); // Upgrade agent reissues the tokens upgradeAgent.upgradeFrom(msg.sender, value); Upgrade(msg.sender, upgradeAgent, value); } /** * Set an upgrade agent that handles */ function setUpgradeAgent(address agent) external { if(!canUpgrade()) { // The token is not yet in a state that we could think upgrading throw; } if (agent == 0x0) throw; // Only a master can designate the next agent if (msg.sender != upgradeMaster) throw; // Upgrade has already begun for an agent if (getUpgradeState() == UpgradeState.Upgrading) throw; upgradeAgent = UpgradeAgent(agent); // Bad interface if(!upgradeAgent.isUpgradeAgent()) throw; // Make sure that token supplies match in source and target if (upgradeAgent.originalSupply() != totalSupply) throw; UpgradeAgentSet(upgradeAgent); } /** * Get the state of the token upgrade. */ function getUpgradeState() public constant returns(UpgradeState) { if(!canUpgrade()) return UpgradeState.NotAllowed; else if(address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent; else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade; else return UpgradeState.Upgrading; } /** * Change the upgrade master. * * This allows us to set a new owner for the upgrade mechanism. */ function setUpgradeMaster(address master) public { if (master == 0x0) throw; if (msg.sender != upgradeMaster) throw; upgradeMaster = master; NewUpgradeMaster(upgradeMaster); } /** * Child contract can enable to provide the condition when the upgrade can begun. */ function canUpgrade() public constant returns(bool) { return true; } }
/** * A token upgrade mechanism where users can opt-in amount of tokens to the next smart contract revision. * * First envisioned by Golem and Lunyr projects. */
NatSpecMultiLine
setUpgradeMaster
function setUpgradeMaster(address master) public { if (master == 0x0) throw; if (msg.sender != upgradeMaster) throw; upgradeMaster = master; NewUpgradeMaster(upgradeMaster); }
/** * Change the upgrade master. * * This allows us to set a new owner for the upgrade mechanism. */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 3484, 3693 ] }
9,763
ProsperPresaleToken
ProsperPresaleToken.sol
0x9b8457919cd3c170bb0e1783fcc02cc67809a3cb
Solidity
UpgradeableToken
contract UpgradeableToken is ProsperMintableToken { /** Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. */ address public upgradeMaster; /** The next contract where the tokens will be migrated. */ UpgradeAgent public upgradeAgent; /** How many tokens we have upgraded by now. */ uint256 public totalUpgraded; /** * Upgrade states. * * - NotAllowed: The child contract has not reached a condition where the upgrade can bgun * - WaitingForAgent: Token allows upgrade, but we don't have a new agent yet * - ReadyToUpgrade: The agent is set, but not a single token has been upgraded yet * - Upgrading: Upgrade agent is set and the balance holders can upgrade their tokens * */ enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading} /** * Somebody has upgraded some of his tokens. */ event Upgrade(address indexed _from, address indexed _to, uint256 _value); /** * New upgrade agent available. */ event UpgradeAgentSet(address agent); /** * Upgrade master updated. */ event NewUpgradeMaster(address upgradeMaster); /** * Do not allow construction without upgrade master set. */ function UpgradeableToken(address _upgradeMaster) { upgradeMaster = _upgradeMaster; NewUpgradeMaster(upgradeMaster); } /** * Allow the token holder to upgrade some of their tokens to a new contract. */ function upgrade(uint256 value) public { UpgradeState state = getUpgradeState(); if(!(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading)) { // Called in a bad state throw; } // Validate input value. if (value == 0) throw; balances[msg.sender] = balances[msg.sender].sub(value); // Take tokens out from circulation totalSupply = totalSupply.sub(value); totalUpgraded = totalUpgraded.add(value); // Upgrade agent reissues the tokens upgradeAgent.upgradeFrom(msg.sender, value); Upgrade(msg.sender, upgradeAgent, value); } /** * Set an upgrade agent that handles */ function setUpgradeAgent(address agent) external { if(!canUpgrade()) { // The token is not yet in a state that we could think upgrading throw; } if (agent == 0x0) throw; // Only a master can designate the next agent if (msg.sender != upgradeMaster) throw; // Upgrade has already begun for an agent if (getUpgradeState() == UpgradeState.Upgrading) throw; upgradeAgent = UpgradeAgent(agent); // Bad interface if(!upgradeAgent.isUpgradeAgent()) throw; // Make sure that token supplies match in source and target if (upgradeAgent.originalSupply() != totalSupply) throw; UpgradeAgentSet(upgradeAgent); } /** * Get the state of the token upgrade. */ function getUpgradeState() public constant returns(UpgradeState) { if(!canUpgrade()) return UpgradeState.NotAllowed; else if(address(upgradeAgent) == 0x00) return UpgradeState.WaitingForAgent; else if(totalUpgraded == 0) return UpgradeState.ReadyToUpgrade; else return UpgradeState.Upgrading; } /** * Change the upgrade master. * * This allows us to set a new owner for the upgrade mechanism. */ function setUpgradeMaster(address master) public { if (master == 0x0) throw; if (msg.sender != upgradeMaster) throw; upgradeMaster = master; NewUpgradeMaster(upgradeMaster); } /** * Child contract can enable to provide the condition when the upgrade can begun. */ function canUpgrade() public constant returns(bool) { return true; } }
/** * A token upgrade mechanism where users can opt-in amount of tokens to the next smart contract revision. * * First envisioned by Golem and Lunyr projects. */
NatSpecMultiLine
canUpgrade
function canUpgrade() public constant returns(bool) { return true; }
/** * Child contract can enable to provide the condition when the upgrade can begun. */
NatSpecMultiLine
v0.4.11+commit.68ef5810
bzzr://643d30ff44df3c4e53a47bf3c899d91761d448eda094cf8b282f7e7268a737a1
{ "func_code_index": [ 3795, 3875 ] }
9,764
WpcToken
contracts/WpcToken.sol
0x3f6f3718921fe9f7c113ee3d46928ff995864078
Solidity
WpcToken
contract WpcToken is StandardToken, BurnableToken, Ownable { string public constant symbol = "wpc"; string public constant name = "World Peace Coin"; uint8 public constant decimals = 18; uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals)); uint256 public constant TOKEN_OFFERING_ALLOWANCE = 400000000 * (10 ** uint256(decimals)); uint256 public constant ADMIN_ALLOWANCE = INITIAL_SUPPLY - TOKEN_OFFERING_ALLOWANCE; // Address of token admin address public adminAddr; // Address of token offering address public tokenOfferingAddr; // Enable transfers after conclusion of token offering bool public transferEnabled = true; /** * Check if transfer is allowed * * Permissions: * Owner Admin OfferingContract Others * transfer (before transferEnabled is true) x x x x * transferFrom (before transferEnabled is true) x o o x * transfer/transferFrom(after transferEnabled is true) o x x o */ modifier onlyWhenTransferAllowed() { require(transferEnabled || msg.sender == adminAddr || msg.sender == tokenOfferingAddr); _; } /** * Check if token offering address is set or not */ modifier onlyTokenOfferingAddrNotSet() { require(tokenOfferingAddr == address(0x0)); _; } /** * Check if address is a valid destination to transfer tokens to * - must not be zero address * - must not be the token address * - must not be the owner's address * - must not be the admin's address * - must not be the token offering contract address */ modifier validDestination(address to) { require(to != address(0x0)); require(to != address(this)); require(to != owner); require(to != address(adminAddr)); require(to != address(tokenOfferingAddr)); _; } /** * Token contract constructor * * @param admin Address of admin account */ function WpcToken(address admin) public { totalSupply_ = INITIAL_SUPPLY; // Mint tokens balances[msg.sender] = totalSupply_; Transfer(address(0x0), msg.sender, totalSupply_); // Approve allowance for admin account adminAddr = admin; approve(adminAddr, ADMIN_ALLOWANCE); } /** * Set token offering to approve allowance for offering contract to distribute tokens * * @param offeringAddr Address of token offering contract * @param amountForSale Amount of tokens for sale, set 0 to max out */ function setTokenOffering(address offeringAddr, uint256 amountForSale) external onlyOwner onlyTokenOfferingAddrNotSet { require(!transferEnabled); uint256 amount = (amountForSale == 0) ? TOKEN_OFFERING_ALLOWANCE : amountForSale; require(amount <= TOKEN_OFFERING_ALLOWANCE); approve(offeringAddr, amount); tokenOfferingAddr = offeringAddr; } /** * Enable transfers */ function enableTransfer() external onlyOwner { transferEnabled = true; // End the offering approve(tokenOfferingAddr, 0); } /** * Transfer from sender to another account * * @param to Destination address * @param value Amount of wpctokens to send */ function transfer(address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transfer(to, value); } /** * Transfer from `from` account to `to` account using allowance in `from` account to the sender * * @param from Origin address * @param to Destination address * @param value Amount of wpctokens to send */ function transferFrom(address from, address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transferFrom(from, to, value); } /** * Burn token, only owner is allowed to do this * * @param value Amount of tokens to burn */ function burn(uint256 value) public { require(transferEnabled || msg.sender == owner); super.burn(value); } }
/* * WpcToken is a standard ERC20 token with some additional functionalities: * - Transfers are only enabled after contract owner enables it (after the ICO) * - Contract sets 40% of the total supply as allowance for ICO contract * * Note: Token Offering == Initial Coin Offering(ICO) */
Comment
WpcToken
function WpcToken(address admin) public { totalSupply_ = INITIAL_SUPPLY; // Mint tokens balances[msg.sender] = totalSupply_; Transfer(address(0x0), msg.sender, totalSupply_); // Approve allowance for admin account adminAddr = admin; approve(adminAddr, ADMIN_ALLOWANCE); }
/** * Token contract constructor * * @param admin Address of admin account */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
MIT
bzzr://63f17ab1062f3f4d396b43cb8e266e9b9fb45dae6ec2b71884793d2e4dbd01e2
{ "func_code_index": [ 1900, 2200 ] }
9,765
WpcToken
contracts/WpcToken.sol
0x3f6f3718921fe9f7c113ee3d46928ff995864078
Solidity
WpcToken
contract WpcToken is StandardToken, BurnableToken, Ownable { string public constant symbol = "wpc"; string public constant name = "World Peace Coin"; uint8 public constant decimals = 18; uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals)); uint256 public constant TOKEN_OFFERING_ALLOWANCE = 400000000 * (10 ** uint256(decimals)); uint256 public constant ADMIN_ALLOWANCE = INITIAL_SUPPLY - TOKEN_OFFERING_ALLOWANCE; // Address of token admin address public adminAddr; // Address of token offering address public tokenOfferingAddr; // Enable transfers after conclusion of token offering bool public transferEnabled = true; /** * Check if transfer is allowed * * Permissions: * Owner Admin OfferingContract Others * transfer (before transferEnabled is true) x x x x * transferFrom (before transferEnabled is true) x o o x * transfer/transferFrom(after transferEnabled is true) o x x o */ modifier onlyWhenTransferAllowed() { require(transferEnabled || msg.sender == adminAddr || msg.sender == tokenOfferingAddr); _; } /** * Check if token offering address is set or not */ modifier onlyTokenOfferingAddrNotSet() { require(tokenOfferingAddr == address(0x0)); _; } /** * Check if address is a valid destination to transfer tokens to * - must not be zero address * - must not be the token address * - must not be the owner's address * - must not be the admin's address * - must not be the token offering contract address */ modifier validDestination(address to) { require(to != address(0x0)); require(to != address(this)); require(to != owner); require(to != address(adminAddr)); require(to != address(tokenOfferingAddr)); _; } /** * Token contract constructor * * @param admin Address of admin account */ function WpcToken(address admin) public { totalSupply_ = INITIAL_SUPPLY; // Mint tokens balances[msg.sender] = totalSupply_; Transfer(address(0x0), msg.sender, totalSupply_); // Approve allowance for admin account adminAddr = admin; approve(adminAddr, ADMIN_ALLOWANCE); } /** * Set token offering to approve allowance for offering contract to distribute tokens * * @param offeringAddr Address of token offering contract * @param amountForSale Amount of tokens for sale, set 0 to max out */ function setTokenOffering(address offeringAddr, uint256 amountForSale) external onlyOwner onlyTokenOfferingAddrNotSet { require(!transferEnabled); uint256 amount = (amountForSale == 0) ? TOKEN_OFFERING_ALLOWANCE : amountForSale; require(amount <= TOKEN_OFFERING_ALLOWANCE); approve(offeringAddr, amount); tokenOfferingAddr = offeringAddr; } /** * Enable transfers */ function enableTransfer() external onlyOwner { transferEnabled = true; // End the offering approve(tokenOfferingAddr, 0); } /** * Transfer from sender to another account * * @param to Destination address * @param value Amount of wpctokens to send */ function transfer(address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transfer(to, value); } /** * Transfer from `from` account to `to` account using allowance in `from` account to the sender * * @param from Origin address * @param to Destination address * @param value Amount of wpctokens to send */ function transferFrom(address from, address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transferFrom(from, to, value); } /** * Burn token, only owner is allowed to do this * * @param value Amount of tokens to burn */ function burn(uint256 value) public { require(transferEnabled || msg.sender == owner); super.burn(value); } }
/* * WpcToken is a standard ERC20 token with some additional functionalities: * - Transfers are only enabled after contract owner enables it (after the ICO) * - Contract sets 40% of the total supply as allowance for ICO contract * * Note: Token Offering == Initial Coin Offering(ICO) */
Comment
setTokenOffering
function setTokenOffering(address offeringAddr, uint256 amountForSale) external onlyOwner onlyTokenOfferingAddrNotSet { require(!transferEnabled); uint256 amount = (amountForSale == 0) ? TOKEN_OFFERING_ALLOWANCE : amountForSale; require(amount <= TOKEN_OFFERING_ALLOWANCE); approve(offeringAddr, amount); tokenOfferingAddr = offeringAddr; }
/** * Set token offering to approve allowance for offering contract to distribute tokens * * @param offeringAddr Address of token offering contract * @param amountForSale Amount of tokens for sale, set 0 to max out */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
MIT
bzzr://63f17ab1062f3f4d396b43cb8e266e9b9fb45dae6ec2b71884793d2e4dbd01e2
{ "func_code_index": [ 2433, 2796 ] }
9,766
WpcToken
contracts/WpcToken.sol
0x3f6f3718921fe9f7c113ee3d46928ff995864078
Solidity
WpcToken
contract WpcToken is StandardToken, BurnableToken, Ownable { string public constant symbol = "wpc"; string public constant name = "World Peace Coin"; uint8 public constant decimals = 18; uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals)); uint256 public constant TOKEN_OFFERING_ALLOWANCE = 400000000 * (10 ** uint256(decimals)); uint256 public constant ADMIN_ALLOWANCE = INITIAL_SUPPLY - TOKEN_OFFERING_ALLOWANCE; // Address of token admin address public adminAddr; // Address of token offering address public tokenOfferingAddr; // Enable transfers after conclusion of token offering bool public transferEnabled = true; /** * Check if transfer is allowed * * Permissions: * Owner Admin OfferingContract Others * transfer (before transferEnabled is true) x x x x * transferFrom (before transferEnabled is true) x o o x * transfer/transferFrom(after transferEnabled is true) o x x o */ modifier onlyWhenTransferAllowed() { require(transferEnabled || msg.sender == adminAddr || msg.sender == tokenOfferingAddr); _; } /** * Check if token offering address is set or not */ modifier onlyTokenOfferingAddrNotSet() { require(tokenOfferingAddr == address(0x0)); _; } /** * Check if address is a valid destination to transfer tokens to * - must not be zero address * - must not be the token address * - must not be the owner's address * - must not be the admin's address * - must not be the token offering contract address */ modifier validDestination(address to) { require(to != address(0x0)); require(to != address(this)); require(to != owner); require(to != address(adminAddr)); require(to != address(tokenOfferingAddr)); _; } /** * Token contract constructor * * @param admin Address of admin account */ function WpcToken(address admin) public { totalSupply_ = INITIAL_SUPPLY; // Mint tokens balances[msg.sender] = totalSupply_; Transfer(address(0x0), msg.sender, totalSupply_); // Approve allowance for admin account adminAddr = admin; approve(adminAddr, ADMIN_ALLOWANCE); } /** * Set token offering to approve allowance for offering contract to distribute tokens * * @param offeringAddr Address of token offering contract * @param amountForSale Amount of tokens for sale, set 0 to max out */ function setTokenOffering(address offeringAddr, uint256 amountForSale) external onlyOwner onlyTokenOfferingAddrNotSet { require(!transferEnabled); uint256 amount = (amountForSale == 0) ? TOKEN_OFFERING_ALLOWANCE : amountForSale; require(amount <= TOKEN_OFFERING_ALLOWANCE); approve(offeringAddr, amount); tokenOfferingAddr = offeringAddr; } /** * Enable transfers */ function enableTransfer() external onlyOwner { transferEnabled = true; // End the offering approve(tokenOfferingAddr, 0); } /** * Transfer from sender to another account * * @param to Destination address * @param value Amount of wpctokens to send */ function transfer(address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transfer(to, value); } /** * Transfer from `from` account to `to` account using allowance in `from` account to the sender * * @param from Origin address * @param to Destination address * @param value Amount of wpctokens to send */ function transferFrom(address from, address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transferFrom(from, to, value); } /** * Burn token, only owner is allowed to do this * * @param value Amount of tokens to burn */ function burn(uint256 value) public { require(transferEnabled || msg.sender == owner); super.burn(value); } }
/* * WpcToken is a standard ERC20 token with some additional functionalities: * - Transfers are only enabled after contract owner enables it (after the ICO) * - Contract sets 40% of the total supply as allowance for ICO contract * * Note: Token Offering == Initial Coin Offering(ICO) */
Comment
enableTransfer
function enableTransfer() external onlyOwner { transferEnabled = true; // End the offering approve(tokenOfferingAddr, 0); }
/** * Enable transfers */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
MIT
bzzr://63f17ab1062f3f4d396b43cb8e266e9b9fb45dae6ec2b71884793d2e4dbd01e2
{ "func_code_index": [ 2831, 2969 ] }
9,767
WpcToken
contracts/WpcToken.sol
0x3f6f3718921fe9f7c113ee3d46928ff995864078
Solidity
WpcToken
contract WpcToken is StandardToken, BurnableToken, Ownable { string public constant symbol = "wpc"; string public constant name = "World Peace Coin"; uint8 public constant decimals = 18; uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals)); uint256 public constant TOKEN_OFFERING_ALLOWANCE = 400000000 * (10 ** uint256(decimals)); uint256 public constant ADMIN_ALLOWANCE = INITIAL_SUPPLY - TOKEN_OFFERING_ALLOWANCE; // Address of token admin address public adminAddr; // Address of token offering address public tokenOfferingAddr; // Enable transfers after conclusion of token offering bool public transferEnabled = true; /** * Check if transfer is allowed * * Permissions: * Owner Admin OfferingContract Others * transfer (before transferEnabled is true) x x x x * transferFrom (before transferEnabled is true) x o o x * transfer/transferFrom(after transferEnabled is true) o x x o */ modifier onlyWhenTransferAllowed() { require(transferEnabled || msg.sender == adminAddr || msg.sender == tokenOfferingAddr); _; } /** * Check if token offering address is set or not */ modifier onlyTokenOfferingAddrNotSet() { require(tokenOfferingAddr == address(0x0)); _; } /** * Check if address is a valid destination to transfer tokens to * - must not be zero address * - must not be the token address * - must not be the owner's address * - must not be the admin's address * - must not be the token offering contract address */ modifier validDestination(address to) { require(to != address(0x0)); require(to != address(this)); require(to != owner); require(to != address(adminAddr)); require(to != address(tokenOfferingAddr)); _; } /** * Token contract constructor * * @param admin Address of admin account */ function WpcToken(address admin) public { totalSupply_ = INITIAL_SUPPLY; // Mint tokens balances[msg.sender] = totalSupply_; Transfer(address(0x0), msg.sender, totalSupply_); // Approve allowance for admin account adminAddr = admin; approve(adminAddr, ADMIN_ALLOWANCE); } /** * Set token offering to approve allowance for offering contract to distribute tokens * * @param offeringAddr Address of token offering contract * @param amountForSale Amount of tokens for sale, set 0 to max out */ function setTokenOffering(address offeringAddr, uint256 amountForSale) external onlyOwner onlyTokenOfferingAddrNotSet { require(!transferEnabled); uint256 amount = (amountForSale == 0) ? TOKEN_OFFERING_ALLOWANCE : amountForSale; require(amount <= TOKEN_OFFERING_ALLOWANCE); approve(offeringAddr, amount); tokenOfferingAddr = offeringAddr; } /** * Enable transfers */ function enableTransfer() external onlyOwner { transferEnabled = true; // End the offering approve(tokenOfferingAddr, 0); } /** * Transfer from sender to another account * * @param to Destination address * @param value Amount of wpctokens to send */ function transfer(address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transfer(to, value); } /** * Transfer from `from` account to `to` account using allowance in `from` account to the sender * * @param from Origin address * @param to Destination address * @param value Amount of wpctokens to send */ function transferFrom(address from, address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transferFrom(from, to, value); } /** * Burn token, only owner is allowed to do this * * @param value Amount of tokens to burn */ function burn(uint256 value) public { require(transferEnabled || msg.sender == owner); super.burn(value); } }
/* * WpcToken is a standard ERC20 token with some additional functionalities: * - Transfers are only enabled after contract owner enables it (after the ICO) * - Contract sets 40% of the total supply as allowance for ICO contract * * Note: Token Offering == Initial Coin Offering(ICO) */
Comment
transfer
function transfer(address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transfer(to, value); }
/** * Transfer from sender to another account * * @param to Destination address * @param value Amount of wpctokens to send */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
MIT
bzzr://63f17ab1062f3f4d396b43cb8e266e9b9fb45dae6ec2b71884793d2e4dbd01e2
{ "func_code_index": [ 3110, 3266 ] }
9,768
WpcToken
contracts/WpcToken.sol
0x3f6f3718921fe9f7c113ee3d46928ff995864078
Solidity
WpcToken
contract WpcToken is StandardToken, BurnableToken, Ownable { string public constant symbol = "wpc"; string public constant name = "World Peace Coin"; uint8 public constant decimals = 18; uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals)); uint256 public constant TOKEN_OFFERING_ALLOWANCE = 400000000 * (10 ** uint256(decimals)); uint256 public constant ADMIN_ALLOWANCE = INITIAL_SUPPLY - TOKEN_OFFERING_ALLOWANCE; // Address of token admin address public adminAddr; // Address of token offering address public tokenOfferingAddr; // Enable transfers after conclusion of token offering bool public transferEnabled = true; /** * Check if transfer is allowed * * Permissions: * Owner Admin OfferingContract Others * transfer (before transferEnabled is true) x x x x * transferFrom (before transferEnabled is true) x o o x * transfer/transferFrom(after transferEnabled is true) o x x o */ modifier onlyWhenTransferAllowed() { require(transferEnabled || msg.sender == adminAddr || msg.sender == tokenOfferingAddr); _; } /** * Check if token offering address is set or not */ modifier onlyTokenOfferingAddrNotSet() { require(tokenOfferingAddr == address(0x0)); _; } /** * Check if address is a valid destination to transfer tokens to * - must not be zero address * - must not be the token address * - must not be the owner's address * - must not be the admin's address * - must not be the token offering contract address */ modifier validDestination(address to) { require(to != address(0x0)); require(to != address(this)); require(to != owner); require(to != address(adminAddr)); require(to != address(tokenOfferingAddr)); _; } /** * Token contract constructor * * @param admin Address of admin account */ function WpcToken(address admin) public { totalSupply_ = INITIAL_SUPPLY; // Mint tokens balances[msg.sender] = totalSupply_; Transfer(address(0x0), msg.sender, totalSupply_); // Approve allowance for admin account adminAddr = admin; approve(adminAddr, ADMIN_ALLOWANCE); } /** * Set token offering to approve allowance for offering contract to distribute tokens * * @param offeringAddr Address of token offering contract * @param amountForSale Amount of tokens for sale, set 0 to max out */ function setTokenOffering(address offeringAddr, uint256 amountForSale) external onlyOwner onlyTokenOfferingAddrNotSet { require(!transferEnabled); uint256 amount = (amountForSale == 0) ? TOKEN_OFFERING_ALLOWANCE : amountForSale; require(amount <= TOKEN_OFFERING_ALLOWANCE); approve(offeringAddr, amount); tokenOfferingAddr = offeringAddr; } /** * Enable transfers */ function enableTransfer() external onlyOwner { transferEnabled = true; // End the offering approve(tokenOfferingAddr, 0); } /** * Transfer from sender to another account * * @param to Destination address * @param value Amount of wpctokens to send */ function transfer(address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transfer(to, value); } /** * Transfer from `from` account to `to` account using allowance in `from` account to the sender * * @param from Origin address * @param to Destination address * @param value Amount of wpctokens to send */ function transferFrom(address from, address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transferFrom(from, to, value); } /** * Burn token, only owner is allowed to do this * * @param value Amount of tokens to burn */ function burn(uint256 value) public { require(transferEnabled || msg.sender == owner); super.burn(value); } }
/* * WpcToken is a standard ERC20 token with some additional functionalities: * - Transfers are only enabled after contract owner enables it (after the ICO) * - Contract sets 40% of the total supply as allowance for ICO contract * * Note: Token Offering == Initial Coin Offering(ICO) */
Comment
transferFrom
function transferFrom(address from, address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transferFrom(from, to, value); }
/** * Transfer from `from` account to `to` account using allowance in `from` account to the sender * * @param from Origin address * @param to Destination address * @param value Amount of wpctokens to send */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
MIT
bzzr://63f17ab1062f3f4d396b43cb8e266e9b9fb45dae6ec2b71884793d2e4dbd01e2
{ "func_code_index": [ 3491, 3675 ] }
9,769
WpcToken
contracts/WpcToken.sol
0x3f6f3718921fe9f7c113ee3d46928ff995864078
Solidity
WpcToken
contract WpcToken is StandardToken, BurnableToken, Ownable { string public constant symbol = "wpc"; string public constant name = "World Peace Coin"; uint8 public constant decimals = 18; uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals)); uint256 public constant TOKEN_OFFERING_ALLOWANCE = 400000000 * (10 ** uint256(decimals)); uint256 public constant ADMIN_ALLOWANCE = INITIAL_SUPPLY - TOKEN_OFFERING_ALLOWANCE; // Address of token admin address public adminAddr; // Address of token offering address public tokenOfferingAddr; // Enable transfers after conclusion of token offering bool public transferEnabled = true; /** * Check if transfer is allowed * * Permissions: * Owner Admin OfferingContract Others * transfer (before transferEnabled is true) x x x x * transferFrom (before transferEnabled is true) x o o x * transfer/transferFrom(after transferEnabled is true) o x x o */ modifier onlyWhenTransferAllowed() { require(transferEnabled || msg.sender == adminAddr || msg.sender == tokenOfferingAddr); _; } /** * Check if token offering address is set or not */ modifier onlyTokenOfferingAddrNotSet() { require(tokenOfferingAddr == address(0x0)); _; } /** * Check if address is a valid destination to transfer tokens to * - must not be zero address * - must not be the token address * - must not be the owner's address * - must not be the admin's address * - must not be the token offering contract address */ modifier validDestination(address to) { require(to != address(0x0)); require(to != address(this)); require(to != owner); require(to != address(adminAddr)); require(to != address(tokenOfferingAddr)); _; } /** * Token contract constructor * * @param admin Address of admin account */ function WpcToken(address admin) public { totalSupply_ = INITIAL_SUPPLY; // Mint tokens balances[msg.sender] = totalSupply_; Transfer(address(0x0), msg.sender, totalSupply_); // Approve allowance for admin account adminAddr = admin; approve(adminAddr, ADMIN_ALLOWANCE); } /** * Set token offering to approve allowance for offering contract to distribute tokens * * @param offeringAddr Address of token offering contract * @param amountForSale Amount of tokens for sale, set 0 to max out */ function setTokenOffering(address offeringAddr, uint256 amountForSale) external onlyOwner onlyTokenOfferingAddrNotSet { require(!transferEnabled); uint256 amount = (amountForSale == 0) ? TOKEN_OFFERING_ALLOWANCE : amountForSale; require(amount <= TOKEN_OFFERING_ALLOWANCE); approve(offeringAddr, amount); tokenOfferingAddr = offeringAddr; } /** * Enable transfers */ function enableTransfer() external onlyOwner { transferEnabled = true; // End the offering approve(tokenOfferingAddr, 0); } /** * Transfer from sender to another account * * @param to Destination address * @param value Amount of wpctokens to send */ function transfer(address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transfer(to, value); } /** * Transfer from `from` account to `to` account using allowance in `from` account to the sender * * @param from Origin address * @param to Destination address * @param value Amount of wpctokens to send */ function transferFrom(address from, address to, uint256 value) public onlyWhenTransferAllowed validDestination(to) returns (bool) { return super.transferFrom(from, to, value); } /** * Burn token, only owner is allowed to do this * * @param value Amount of tokens to burn */ function burn(uint256 value) public { require(transferEnabled || msg.sender == owner); super.burn(value); } }
/* * WpcToken is a standard ERC20 token with some additional functionalities: * - Transfers are only enabled after contract owner enables it (after the ICO) * - Contract sets 40% of the total supply as allowance for ICO contract * * Note: Token Offering == Initial Coin Offering(ICO) */
Comment
burn
function burn(uint256 value) public { require(transferEnabled || msg.sender == owner); super.burn(value); }
/** * Burn token, only owner is allowed to do this * * @param value Amount of tokens to burn */
NatSpecMultiLine
v0.4.25+commit.59dbf8f1
MIT
bzzr://63f17ab1062f3f4d396b43cb8e266e9b9fb45dae6ec2b71884793d2e4dbd01e2
{ "func_code_index": [ 3784, 3901 ] }
9,770
PickleII
PickleII.sol
0xcf3e08e0875573a78c540cfd00acb16e87c7e285
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.26+commit.4563c3fc
MIT
bzzr://44ce8fe852dcd8fdc853fbc0128b26053f9d6b994b2497a5d7dcfe6f7788697c
{ "func_code_index": [ 60, 124 ] }
9,771
PickleII
PickleII.sol
0xcf3e08e0875573a78c540cfd00acb16e87c7e285
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.26+commit.4563c3fc
MIT
bzzr://44ce8fe852dcd8fdc853fbc0128b26053f9d6b994b2497a5d7dcfe6f7788697c
{ "func_code_index": [ 232, 309 ] }
9,772
PickleII
PickleII.sol
0xcf3e08e0875573a78c540cfd00acb16e87c7e285
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.26+commit.4563c3fc
MIT
bzzr://44ce8fe852dcd8fdc853fbc0128b26053f9d6b994b2497a5d7dcfe6f7788697c
{ "func_code_index": [ 546, 623 ] }
9,773
PickleII
PickleII.sol
0xcf3e08e0875573a78c540cfd00acb16e87c7e285
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.26+commit.4563c3fc
MIT
bzzr://44ce8fe852dcd8fdc853fbc0128b26053f9d6b994b2497a5d7dcfe6f7788697c
{ "func_code_index": [ 946, 1042 ] }
9,774
PickleII
PickleII.sol
0xcf3e08e0875573a78c540cfd00acb16e87c7e285
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.26+commit.4563c3fc
MIT
bzzr://44ce8fe852dcd8fdc853fbc0128b26053f9d6b994b2497a5d7dcfe6f7788697c
{ "func_code_index": [ 1326, 1407 ] }
9,775
PickleII
PickleII.sol
0xcf3e08e0875573a78c540cfd00acb16e87c7e285
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.26+commit.4563c3fc
MIT
bzzr://44ce8fe852dcd8fdc853fbc0128b26053f9d6b994b2497a5d7dcfe6f7788697c
{ "func_code_index": [ 1615, 1712 ] }
9,776
PickleII
PickleII.sol
0xcf3e08e0875573a78c540cfd00acb16e87c7e285
Solidity
PickleII
contract PickleII 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 PickleII( ) { balances[msg.sender] = 17000000000000000000000; // Give the creator all initial tokens (100000 for example) totalSupply = 17000000000000000000000; // Update total supply (100000 for example) name = "Pickle II"; // Set the name for display purposes decimals = 18; // Amount of decimals for display purposes symbol = "PICII"; // 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
PickleII
function PickleII( ) { balances[msg.sender] = 17000000000000000000000; // Give the creator all initial tokens (100000 for example) totalSupply = 17000000000000000000000; // Update total supply (100000 for example) name = "Pickle II"; // Set the name for display purposes decimals = 18; // Amount of decimals for display purposes symbol = "PICII"; // 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.26+commit.4563c3fc
MIT
bzzr://44ce8fe852dcd8fdc853fbc0128b26053f9d6b994b2497a5d7dcfe6f7788697c
{ "func_code_index": [ 1157, 1736 ] }
9,777
PickleII
PickleII.sol
0xcf3e08e0875573a78c540cfd00acb16e87c7e285
Solidity
PickleII
contract PickleII 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 PickleII( ) { balances[msg.sender] = 17000000000000000000000; // Give the creator all initial tokens (100000 for example) totalSupply = 17000000000000000000000; // Update total supply (100000 for example) name = "Pickle II"; // Set the name for display purposes decimals = 18; // Amount of decimals for display purposes symbol = "PICII"; // 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.26+commit.4563c3fc
MIT
bzzr://44ce8fe852dcd8fdc853fbc0128b26053f9d6b994b2497a5d7dcfe6f7788697c
{ "func_code_index": [ 1797, 2602 ] }
9,778
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
owned
contract owned { address public owner; //*** OwnershipTransferred ***// event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function owned() public { owner = msg.sender; } //*** Change Owner ***// function changeOwner(address newOwner) onlyOwner public { owner = newOwner; } //*** Transfer OwnerShip ***// function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } //*** Only Owner ***// modifier onlyOwner { require(msg.sender == owner); _; } }
//*** Owner ***//
LineComment
changeOwner
function changeOwner(address newOwner) onlyOwner public { owner = newOwner; }
//*** Change Owner ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 265, 349 ] }
9,779
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
owned
contract owned { address public owner; //*** OwnershipTransferred ***// event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function owned() public { owner = msg.sender; } //*** Change Owner ***// function changeOwner(address newOwner) onlyOwner public { owner = newOwner; } //*** Transfer OwnerShip ***// function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } //*** Only Owner ***// modifier onlyOwner { require(msg.sender == owner); _; } }
//*** Owner ***//
LineComment
transferOwnership
function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; }
//*** Transfer OwnerShip ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 392, 584 ] }
9,780
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); }
//*** Payable ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 2277, 3928 ] }
9,781
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
transfer
function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } }
/* Send coins */
Comment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 3951, 4437 ] }
9,782
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } }
//*** Transfer From ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 4468, 5069 ] }
9,783
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
transferOwner
function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; }
//*** Transfer OnlyOwner ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 5106, 5454 ] }
9,784
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
burnOwner
function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; }
//*** Burn Owner***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 5919, 6123 ] }
9,785
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
destroyOwner
function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); }
//*** Destroy Owner ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 6155, 6468 ] }
9,786
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
killTotalSupply
function killTotalSupply() onlyOwner public { totalSupply=0; }
//*** Kill Balance ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 6499, 6571 ] }
9,787
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
GetBalanceOwnerForTransfer
function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } }
//*** Get Balance for owner(tranfer for sale) ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 6630, 7037 ] }
9,788
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
killTokensForGPower
function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } }
//*** Kill Tokens For GPower***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 7083, 7884 ] }
9,789
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
contractBalance
function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; }
//*** Contract Balance ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 7919, 8022 ] }
9,790
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
setParamsStopSale
function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; }
//*** Set Params For Sale ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 8060, 8146 ] }
9,791
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
setParamsTransfer
function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; }
//*** Set ParamsTransfer ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 8183, 8277 ] }
9,792
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
setParamsIco
function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; }
//*** Set ParamsICO ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 8309, 8443 ] }
9,793
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
setParamsPreSale
function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; }
//*** Set ParamsPreSale ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 8482, 8624 ] }
9,794
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
setCourceSale
function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; }
//*** Set CourceSale ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 8663, 8760 ] }
9,795
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
isIco
function isIco() constant public returns (bool ico) { ool result=((icoStart+(35*24*60*60)) >= now); f(enableIco){ return true; lse{ return result;
//*** Is ico ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 8785, 8983 ] }
9,796
GPowerToken
GPowerToken.sol
0x9df10486168cb25278c7ec72a3090e34f7aac29a
Solidity
GPowerToken
contract GPowerToken is owned{ //************** Token ************// string public standard = 'Token 1'; string public name = 'GPower'; string public symbol = 'GRP'; uint8 public decimals = 18; uint256 public totalSupply =0; //*** Pre-sale ***// uint preSaleStart=1513771200; uint preSaleEnd=1515585600; uint256 preSaleTotalTokens=30000000; uint256 preSaleTokenCost=6000; address preSaleAddress; bool public enablePreSale=false; //*** ICO ***// uint icoStart; uint256 icoSaleTotalTokens=400000000; address icoAddress; bool public enableIco=false; //*** Advisers,Consultants ***// uint256 advisersConsultantTokens=15000000; address advisersConsultantsAddress; //*** Bounty ***// uint256 bountyTokens=15000000; address bountyAddress; //*** Founders ***// uint256 founderTokens=40000000; address founderAddress; //*** Walet ***// address public wallet; //*** TranferCoin ***// bool public transfersEnabled = false; bool public stopSale=false; uint256 newCourceSale=0; //*** Balance ***// mapping (address => uint256) public balanceOf; mapping (address => uint256) public balanceOfPreSale; //*** Alowed ***// mapping (address => mapping (address => uint256)) allowed; //*** Tranfer ***// event Transfer(address from, address to, uint256 value); //*** Approval ***// event Approval(address indexed _owner, address indexed _spender, uint256 _value); //*** Destruction ***// event Destruction(uint256 _amount); //*** Burn ***// event Burn(address indexed from, uint256 value); //*** Issuance ***// event Issuance(uint256 _amount); function GPowerToken() public{ preSaleAddress=0xC07850969A0EC345A84289f9C5bb5F979f27110f; icoAddress=0x1C21Cf57BF4e2dd28883eE68C03a9725056D29F1; advisersConsultantsAddress=0xe8B6dA1B801b7F57e3061C1c53a011b31C9315C7; bountyAddress=0xD53E82Aea770feED8e57433D3D61674caEC1D1Be; founderAddress=0xDA0D3Dad39165EA2d7386f18F96664Ee2e9FD8db; totalSupply =(500000000*1000000000000000000); } //*** Payable ***// function() payable public { require(msg.value>0); require(msg.sender != 0x0); if(!stopSale){ uint256 weiAmount; uint256 tokens; wallet=owner; if(newCourceSale>0){ weiAmount=newCourceSale; } if(isPreSale()){ wallet=preSaleAddress; weiAmount=6000; } else if(isIco()){ wallet=icoAddress; if((icoStart+(7*24*60*60)) >= now){ weiAmount=4000; } else if((icoStart+(14*24*60*60)) >= now){ weiAmount=3750; } else if((icoStart+(21*24*60*60)) >= now){ weiAmount=3500; } else if((icoStart+(28*24*60*60)) >= now){ weiAmount=3250; } else if((icoStart+(35*24*60*60)) >= now){ weiAmount=3000; } else{ weiAmount=2000; } } else{ weiAmount=4000; } tokens=msg.value*weiAmount/1000000000000000000; Transfer(this, msg.sender, tokens*1000000000000000000); balanceOf[msg.sender]+=tokens*1000000000000000000; totalSupply-=tokens*1000000000000000000; wallet.transfer(msg.value); } else{ require(0>1); } } /* Send coins */ function transfer(address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ require(balanceOf[msg.sender] >= _value*1000000000000000000); // Subtract from the sender balanceOf[msg.sender]-= _value*1000000000000000000; balanceOf[_to] += _value*1000000000000000000; Transfer(msg.sender, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer From ***// function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { if(transfersEnabled || msg.sender==owner){ // Check if the sender has enough require(balanceOf[_from] >= _value*1000000000000000000); // Check allowed // Subtract from the sender balanceOf[_from] -= _value*1000000000000000000; // Add the same to the recipient balanceOf[_to] += _value*1000000000000000000; Transfer(_from, _to, _value*1000000000000000000); return true; } else{ return false; } } //*** Transfer OnlyOwner ***// function transferOwner(address _to,uint256 _value) public onlyOwner returns(bool success){ // Subtract from the sender totalSupply-=_value*1000000000000000000; // Add the same to the recipient balanceOf[_to] = (balanceOf[_to] + _value*1000000000000000000); Transfer(this, _to, _value*1000000000000000000); return true; } function transferArrayBalanceForPreSale(address[] addrs,uint256[] values) public onlyOwner returns(bool result){ for(uint i=0;i<addrs.length;i++){ transfer(addrs[i],values[i]*1000000000000000000); } return true; } function transferBalanceForPreSale(address addrs,uint256 value) public onlyOwner returns(bool result){ transfer(addrs,value*1000000000000000000); return true; } //*** Burn Owner***// function burnOwner(uint256 _value) public onlyOwner returns (bool success) { destroyOwner(msg.sender, _value*1000000000000000000); Burn(msg.sender, _value*1000000000000000000); return true; } //*** Destroy Owner ***// function destroyOwner(address _from, uint256 _amount) public onlyOwner{ balanceOf[_from] =(balanceOf[_from] - _amount*1000000000000000000); totalSupply = (totalSupply - _amount*1000000000000000000); Transfer(_from, this, _amount*1000000000000000000); Destruction(_amount*1000000000000000000); } //*** Kill Balance ***// function killTotalSupply() onlyOwner public { totalSupply=0; } //*** Get Balance for owner(tranfer for sale) ***// function GetBalanceOwnerForTransfer(uint256 value) onlyOwner public{ require(msg.sender==owner); if(totalSupply>=value*1000000000000000000){ balanceOf[this]-= value*1000000000000000000; balanceOf[owner] += value*1000000000000000000; totalSupply-=value*1000000000000000000; Transfer(this,owner,value*1000000000000000000); } } //*** Kill Tokens For GPower***// function killTokensForGPower() onlyOwner public{ if(bountyTokens>0){ Transfer(this,bountyAddress,bountyTokens*1000000000000000000); Transfer(this,founderAddress,founderTokens*1000000000000000000); Transfer(this,advisersConsultantsAddress,advisersConsultantTokens*1000000000000000000); balanceOf[bountyAddress]+=(bountyTokens*1000000000000000000); balanceOf[founderAddress]+=(founderTokens*1000000000000000000); balanceOf[advisersConsultantsAddress]+=advisersConsultantTokens*1000000000000000000; totalSupply-=((bountyTokens+founderTokens+advisersConsultantTokens)*1000000000000000000); bountyTokens=0; founderTokens=0; advisersConsultantTokens=0; } } //*** Contract Balance ***// function contractBalance() constant public returns (uint256 balance) { return balanceOf[this]; } //*** Set Params For Sale ***// function setParamsStopSale(bool _value) public onlyOwner{ stopSale=_value; } //*** Set ParamsTransfer ***// function setParamsTransfer(bool _value) public onlyOwner{ transfersEnabled=_value; } //*** Set ParamsICO ***// function setParamsIco(bool _value) public onlyOwner returns(bool result){ enableIco=_value; return true; } //*** Set ParamsPreSale ***// function setParamsPreSale(bool _value) public onlyOwner returns(bool result){ enablePreSale=_value; return true; } //*** Set CourceSale ***// function setCourceSale(uint256 value) public onlyOwner{ newCourceSale=value; } //*** Is ico ***// function isIco() constant public returns (bool ico) { bool result=((icoStart+(35*24*60*60)) >= now); if(enableIco){ return true; } else{ return result; } } //*** Is PreSale ***// function isPreSale() constant public returns (bool preSale) { bool result=(preSaleEnd >= now); if(enablePreSale){ return true; } else{ return result; } } }
//*** GraphenePowerToken ***//
LineComment
isPreSale
function isPreSale() constant public returns (bool preSale) { ol result=(preSaleEnd >= now); (enablePreSale){ return true; se{ return result;
//*** Is PreSale ***//
LineComment
v0.4.19+commit.c4cbbb05
bzzr://eb3137bc2eba5528d90cdfccd84603779543a92c31dcf45cdf5246b161abf1f8
{ "func_code_index": [ 9018, 9207 ] }
9,797
DraGONS
contracts/DraGONS.sol
0xf7f83cbb51ba65fb19ab9ed6ca9520e637b6f192
Solidity
DraGONS
contract DraGONS is ERC721Enumerable, Ownable, RandomlyAssigned { GONS private gons; uint constant public MAX_DRAGONS_MINT = 5000; uint constant public MAX_DRAGONS_AIRDROP = 904; uint256 public constant dragonPrice = 70000000000000000; //0.07 ETH address private gonsContract = 0x984EEA281Bf65638ac6ed30C4FF7977EA7fe0433; // GONS SC bool public saleIsActive = false; bool public airdropIsActive = false; uint256 public maxDragons; string private baseURI; uint256 public totalDragonsMinted = 0; uint256 public totalDragonsAirdropped = 0; mapping(uint256 => uint256) public mintedIDs; constructor() ERC721("DraGONS 2171", "DRAGONS") RandomlyAssigned (MAX_DRAGONS_MINT+MAX_DRAGONS_AIRDROP,0) { maxDragons = MAX_DRAGONS_MINT; gons = GONS(gonsContract); } function _baseURI() internal view override returns (string memory) { return baseURI; } function setBaseURI(string memory uri) public onlyOwner { baseURI = uri; } function flipSaleState() public onlyOwner { saleIsActive = !saleIsActive; } function flipAirdropState() public onlyOwner { airdropIsActive = !airdropIsActive; } // Shows if a GON can mint a DraGON function canMint(uint256 tokenId) view public returns (bool) { bool res = true; if (mintedIDs[tokenId] == 1){ res = false; } return res; } // Returns the amount of DraGONS available to be minted function getMintableTokenNumber(address user) view public returns (uint256 mintableTokenNumber) { mintableTokenNumber = 0; for (uint256 i = 0; i < gons.balanceOf(user); i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(user, i); if (canMint(tokenId)) mintableTokenNumber++; } return mintableTokenNumber; } function getAvailableIDs() public view returns (uint256[] memory) { uint256[] memory availableIDs = new uint256[](MAX_DRAGONS_MINT); for (uint256 i = 0; i < MAX_DRAGONS_MINT; i++) { if (mintedIDs[i] != 1){ availableIDs[i] = i; } else { availableIDs[i] = MAX_DRAGONS_MINT; } } return availableIDs; } /** * Mint a DraGON */ function mintDragon(uint256 gonsTokenId) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(totalDragonsMinted < maxDragons, "The purchase would exceed the max supply of DraGONS"); require(gonsTokenId < maxDragons, "The requested tokenId exceeds upper bound"); require(gons.ownerOf(gonsTokenId) == msg.sender, "Must own the specific Gorilla Nemesis with the requested tokenId to mint this DraGON"); require(dragonPrice <= msg.value, "Ether value sent is not correct"); require(canMint(gonsTokenId), "DraGON already minted"); uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[gonsTokenId] = 1; totalDragonsMinted++; } /** * Mint N DraGONS */ function mintNDragons(uint256 numDragons) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(numDragons > 0, "Must mint at least one DraGON"); require(totalDragonsMinted + numDragons <= MAX_DRAGONS_MINT, "The purchase would exceed the max supply of DraGONS"); uint balanceGons = gons.balanceOf(msg.sender); require(balanceGons >= numDragons, "Must hold N Gorilla Nemesis to mint N DraGONS"); uint256 toBeMinted = getMintableTokenNumber(msg.sender); require(toBeMinted > 0, "You must have at least one Gorilla Nemesis elegible to mint"); if (toBeMinted > numDragons) { toBeMinted = numDragons; } require(dragonPrice * toBeMinted <= msg.value, "Ether value sent is not correct"); uint256 minted = 0; for (uint256 i = 0; i < balanceGons; i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(msg.sender, i); if (canMint(tokenId)) { uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[tokenId] = 1; minted++; totalDragonsMinted++; } if (minted == toBeMinted) { break; } } } /** * Airdrop-phase: DraGONS assigned to MK owners [1 : 1] (500) + GONS Character owners [1 : 1] (404) * We take care of the transaction fees. */ function airdropDragons(address to, uint count) public onlyOwner{ require(airdropIsActive, "Airdrop-phase must be active to airdrop a DraGON"); require(totalDragonsAirdropped + count <= MAX_DRAGONS_AIRDROP, "The number of dragons would exceed the maximum airdrop supply"); for(uint i = 0; i < count; i++) { uint mintIndex = nextToken(); _safeMint(to, mintIndex); totalDragonsAirdropped++; } } /* * Withdraw from the contract */ function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } }
canMint
function canMint(uint256 tokenId) view public returns (bool) { bool res = true; if (mintedIDs[tokenId] == 1){ res = false; } return res; }
// Shows if a GON can mint a DraGON
LineComment
v0.8.6+commit.11564f7e
MIT
ipfs://b1f9e34675fdced25ca48d38eae9fb9298fc794ff8807f02f9832521abe678a4
{ "func_code_index": [ 1234, 1425 ] }
9,798
DraGONS
contracts/DraGONS.sol
0xf7f83cbb51ba65fb19ab9ed6ca9520e637b6f192
Solidity
DraGONS
contract DraGONS is ERC721Enumerable, Ownable, RandomlyAssigned { GONS private gons; uint constant public MAX_DRAGONS_MINT = 5000; uint constant public MAX_DRAGONS_AIRDROP = 904; uint256 public constant dragonPrice = 70000000000000000; //0.07 ETH address private gonsContract = 0x984EEA281Bf65638ac6ed30C4FF7977EA7fe0433; // GONS SC bool public saleIsActive = false; bool public airdropIsActive = false; uint256 public maxDragons; string private baseURI; uint256 public totalDragonsMinted = 0; uint256 public totalDragonsAirdropped = 0; mapping(uint256 => uint256) public mintedIDs; constructor() ERC721("DraGONS 2171", "DRAGONS") RandomlyAssigned (MAX_DRAGONS_MINT+MAX_DRAGONS_AIRDROP,0) { maxDragons = MAX_DRAGONS_MINT; gons = GONS(gonsContract); } function _baseURI() internal view override returns (string memory) { return baseURI; } function setBaseURI(string memory uri) public onlyOwner { baseURI = uri; } function flipSaleState() public onlyOwner { saleIsActive = !saleIsActive; } function flipAirdropState() public onlyOwner { airdropIsActive = !airdropIsActive; } // Shows if a GON can mint a DraGON function canMint(uint256 tokenId) view public returns (bool) { bool res = true; if (mintedIDs[tokenId] == 1){ res = false; } return res; } // Returns the amount of DraGONS available to be minted function getMintableTokenNumber(address user) view public returns (uint256 mintableTokenNumber) { mintableTokenNumber = 0; for (uint256 i = 0; i < gons.balanceOf(user); i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(user, i); if (canMint(tokenId)) mintableTokenNumber++; } return mintableTokenNumber; } function getAvailableIDs() public view returns (uint256[] memory) { uint256[] memory availableIDs = new uint256[](MAX_DRAGONS_MINT); for (uint256 i = 0; i < MAX_DRAGONS_MINT; i++) { if (mintedIDs[i] != 1){ availableIDs[i] = i; } else { availableIDs[i] = MAX_DRAGONS_MINT; } } return availableIDs; } /** * Mint a DraGON */ function mintDragon(uint256 gonsTokenId) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(totalDragonsMinted < maxDragons, "The purchase would exceed the max supply of DraGONS"); require(gonsTokenId < maxDragons, "The requested tokenId exceeds upper bound"); require(gons.ownerOf(gonsTokenId) == msg.sender, "Must own the specific Gorilla Nemesis with the requested tokenId to mint this DraGON"); require(dragonPrice <= msg.value, "Ether value sent is not correct"); require(canMint(gonsTokenId), "DraGON already minted"); uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[gonsTokenId] = 1; totalDragonsMinted++; } /** * Mint N DraGONS */ function mintNDragons(uint256 numDragons) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(numDragons > 0, "Must mint at least one DraGON"); require(totalDragonsMinted + numDragons <= MAX_DRAGONS_MINT, "The purchase would exceed the max supply of DraGONS"); uint balanceGons = gons.balanceOf(msg.sender); require(balanceGons >= numDragons, "Must hold N Gorilla Nemesis to mint N DraGONS"); uint256 toBeMinted = getMintableTokenNumber(msg.sender); require(toBeMinted > 0, "You must have at least one Gorilla Nemesis elegible to mint"); if (toBeMinted > numDragons) { toBeMinted = numDragons; } require(dragonPrice * toBeMinted <= msg.value, "Ether value sent is not correct"); uint256 minted = 0; for (uint256 i = 0; i < balanceGons; i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(msg.sender, i); if (canMint(tokenId)) { uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[tokenId] = 1; minted++; totalDragonsMinted++; } if (minted == toBeMinted) { break; } } } /** * Airdrop-phase: DraGONS assigned to MK owners [1 : 1] (500) + GONS Character owners [1 : 1] (404) * We take care of the transaction fees. */ function airdropDragons(address to, uint count) public onlyOwner{ require(airdropIsActive, "Airdrop-phase must be active to airdrop a DraGON"); require(totalDragonsAirdropped + count <= MAX_DRAGONS_AIRDROP, "The number of dragons would exceed the maximum airdrop supply"); for(uint i = 0; i < count; i++) { uint mintIndex = nextToken(); _safeMint(to, mintIndex); totalDragonsAirdropped++; } } /* * Withdraw from the contract */ function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } }
getMintableTokenNumber
function getMintableTokenNumber(address user) view public returns (uint256 mintableTokenNumber) { mintableTokenNumber = 0; for (uint256 i = 0; i < gons.balanceOf(user); i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(user, i); if (canMint(tokenId)) mintableTokenNumber++; } return mintableTokenNumber; }
// Returns the amount of DraGONS available to be minted
LineComment
v0.8.6+commit.11564f7e
MIT
ipfs://b1f9e34675fdced25ca48d38eae9fb9298fc794ff8807f02f9832521abe678a4
{ "func_code_index": [ 1487, 1863 ] }
9,799
DraGONS
contracts/DraGONS.sol
0xf7f83cbb51ba65fb19ab9ed6ca9520e637b6f192
Solidity
DraGONS
contract DraGONS is ERC721Enumerable, Ownable, RandomlyAssigned { GONS private gons; uint constant public MAX_DRAGONS_MINT = 5000; uint constant public MAX_DRAGONS_AIRDROP = 904; uint256 public constant dragonPrice = 70000000000000000; //0.07 ETH address private gonsContract = 0x984EEA281Bf65638ac6ed30C4FF7977EA7fe0433; // GONS SC bool public saleIsActive = false; bool public airdropIsActive = false; uint256 public maxDragons; string private baseURI; uint256 public totalDragonsMinted = 0; uint256 public totalDragonsAirdropped = 0; mapping(uint256 => uint256) public mintedIDs; constructor() ERC721("DraGONS 2171", "DRAGONS") RandomlyAssigned (MAX_DRAGONS_MINT+MAX_DRAGONS_AIRDROP,0) { maxDragons = MAX_DRAGONS_MINT; gons = GONS(gonsContract); } function _baseURI() internal view override returns (string memory) { return baseURI; } function setBaseURI(string memory uri) public onlyOwner { baseURI = uri; } function flipSaleState() public onlyOwner { saleIsActive = !saleIsActive; } function flipAirdropState() public onlyOwner { airdropIsActive = !airdropIsActive; } // Shows if a GON can mint a DraGON function canMint(uint256 tokenId) view public returns (bool) { bool res = true; if (mintedIDs[tokenId] == 1){ res = false; } return res; } // Returns the amount of DraGONS available to be minted function getMintableTokenNumber(address user) view public returns (uint256 mintableTokenNumber) { mintableTokenNumber = 0; for (uint256 i = 0; i < gons.balanceOf(user); i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(user, i); if (canMint(tokenId)) mintableTokenNumber++; } return mintableTokenNumber; } function getAvailableIDs() public view returns (uint256[] memory) { uint256[] memory availableIDs = new uint256[](MAX_DRAGONS_MINT); for (uint256 i = 0; i < MAX_DRAGONS_MINT; i++) { if (mintedIDs[i] != 1){ availableIDs[i] = i; } else { availableIDs[i] = MAX_DRAGONS_MINT; } } return availableIDs; } /** * Mint a DraGON */ function mintDragon(uint256 gonsTokenId) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(totalDragonsMinted < maxDragons, "The purchase would exceed the max supply of DraGONS"); require(gonsTokenId < maxDragons, "The requested tokenId exceeds upper bound"); require(gons.ownerOf(gonsTokenId) == msg.sender, "Must own the specific Gorilla Nemesis with the requested tokenId to mint this DraGON"); require(dragonPrice <= msg.value, "Ether value sent is not correct"); require(canMint(gonsTokenId), "DraGON already minted"); uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[gonsTokenId] = 1; totalDragonsMinted++; } /** * Mint N DraGONS */ function mintNDragons(uint256 numDragons) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(numDragons > 0, "Must mint at least one DraGON"); require(totalDragonsMinted + numDragons <= MAX_DRAGONS_MINT, "The purchase would exceed the max supply of DraGONS"); uint balanceGons = gons.balanceOf(msg.sender); require(balanceGons >= numDragons, "Must hold N Gorilla Nemesis to mint N DraGONS"); uint256 toBeMinted = getMintableTokenNumber(msg.sender); require(toBeMinted > 0, "You must have at least one Gorilla Nemesis elegible to mint"); if (toBeMinted > numDragons) { toBeMinted = numDragons; } require(dragonPrice * toBeMinted <= msg.value, "Ether value sent is not correct"); uint256 minted = 0; for (uint256 i = 0; i < balanceGons; i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(msg.sender, i); if (canMint(tokenId)) { uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[tokenId] = 1; minted++; totalDragonsMinted++; } if (minted == toBeMinted) { break; } } } /** * Airdrop-phase: DraGONS assigned to MK owners [1 : 1] (500) + GONS Character owners [1 : 1] (404) * We take care of the transaction fees. */ function airdropDragons(address to, uint count) public onlyOwner{ require(airdropIsActive, "Airdrop-phase must be active to airdrop a DraGON"); require(totalDragonsAirdropped + count <= MAX_DRAGONS_AIRDROP, "The number of dragons would exceed the maximum airdrop supply"); for(uint i = 0; i < count; i++) { uint mintIndex = nextToken(); _safeMint(to, mintIndex); totalDragonsAirdropped++; } } /* * Withdraw from the contract */ function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } }
mintDragon
function mintDragon(uint256 gonsTokenId) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(totalDragonsMinted < maxDragons, "The purchase would exceed the max supply of DraGONS"); require(gonsTokenId < maxDragons, "The requested tokenId exceeds upper bound"); require(gons.ownerOf(gonsTokenId) == msg.sender, "Must own the specific Gorilla Nemesis with the requested tokenId to mint this DraGON"); require(dragonPrice <= msg.value, "Ether value sent is not correct"); require(canMint(gonsTokenId), "DraGON already minted"); uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[gonsTokenId] = 1; totalDragonsMinted++; }
/** * Mint a DraGON */
NatSpecMultiLine
v0.8.6+commit.11564f7e
MIT
ipfs://b1f9e34675fdced25ca48d38eae9fb9298fc794ff8807f02f9832521abe678a4
{ "func_code_index": [ 2306, 3049 ] }
9,800
DraGONS
contracts/DraGONS.sol
0xf7f83cbb51ba65fb19ab9ed6ca9520e637b6f192
Solidity
DraGONS
contract DraGONS is ERC721Enumerable, Ownable, RandomlyAssigned { GONS private gons; uint constant public MAX_DRAGONS_MINT = 5000; uint constant public MAX_DRAGONS_AIRDROP = 904; uint256 public constant dragonPrice = 70000000000000000; //0.07 ETH address private gonsContract = 0x984EEA281Bf65638ac6ed30C4FF7977EA7fe0433; // GONS SC bool public saleIsActive = false; bool public airdropIsActive = false; uint256 public maxDragons; string private baseURI; uint256 public totalDragonsMinted = 0; uint256 public totalDragonsAirdropped = 0; mapping(uint256 => uint256) public mintedIDs; constructor() ERC721("DraGONS 2171", "DRAGONS") RandomlyAssigned (MAX_DRAGONS_MINT+MAX_DRAGONS_AIRDROP,0) { maxDragons = MAX_DRAGONS_MINT; gons = GONS(gonsContract); } function _baseURI() internal view override returns (string memory) { return baseURI; } function setBaseURI(string memory uri) public onlyOwner { baseURI = uri; } function flipSaleState() public onlyOwner { saleIsActive = !saleIsActive; } function flipAirdropState() public onlyOwner { airdropIsActive = !airdropIsActive; } // Shows if a GON can mint a DraGON function canMint(uint256 tokenId) view public returns (bool) { bool res = true; if (mintedIDs[tokenId] == 1){ res = false; } return res; } // Returns the amount of DraGONS available to be minted function getMintableTokenNumber(address user) view public returns (uint256 mintableTokenNumber) { mintableTokenNumber = 0; for (uint256 i = 0; i < gons.balanceOf(user); i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(user, i); if (canMint(tokenId)) mintableTokenNumber++; } return mintableTokenNumber; } function getAvailableIDs() public view returns (uint256[] memory) { uint256[] memory availableIDs = new uint256[](MAX_DRAGONS_MINT); for (uint256 i = 0; i < MAX_DRAGONS_MINT; i++) { if (mintedIDs[i] != 1){ availableIDs[i] = i; } else { availableIDs[i] = MAX_DRAGONS_MINT; } } return availableIDs; } /** * Mint a DraGON */ function mintDragon(uint256 gonsTokenId) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(totalDragonsMinted < maxDragons, "The purchase would exceed the max supply of DraGONS"); require(gonsTokenId < maxDragons, "The requested tokenId exceeds upper bound"); require(gons.ownerOf(gonsTokenId) == msg.sender, "Must own the specific Gorilla Nemesis with the requested tokenId to mint this DraGON"); require(dragonPrice <= msg.value, "Ether value sent is not correct"); require(canMint(gonsTokenId), "DraGON already minted"); uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[gonsTokenId] = 1; totalDragonsMinted++; } /** * Mint N DraGONS */ function mintNDragons(uint256 numDragons) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(numDragons > 0, "Must mint at least one DraGON"); require(totalDragonsMinted + numDragons <= MAX_DRAGONS_MINT, "The purchase would exceed the max supply of DraGONS"); uint balanceGons = gons.balanceOf(msg.sender); require(balanceGons >= numDragons, "Must hold N Gorilla Nemesis to mint N DraGONS"); uint256 toBeMinted = getMintableTokenNumber(msg.sender); require(toBeMinted > 0, "You must have at least one Gorilla Nemesis elegible to mint"); if (toBeMinted > numDragons) { toBeMinted = numDragons; } require(dragonPrice * toBeMinted <= msg.value, "Ether value sent is not correct"); uint256 minted = 0; for (uint256 i = 0; i < balanceGons; i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(msg.sender, i); if (canMint(tokenId)) { uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[tokenId] = 1; minted++; totalDragonsMinted++; } if (minted == toBeMinted) { break; } } } /** * Airdrop-phase: DraGONS assigned to MK owners [1 : 1] (500) + GONS Character owners [1 : 1] (404) * We take care of the transaction fees. */ function airdropDragons(address to, uint count) public onlyOwner{ require(airdropIsActive, "Airdrop-phase must be active to airdrop a DraGON"); require(totalDragonsAirdropped + count <= MAX_DRAGONS_AIRDROP, "The number of dragons would exceed the maximum airdrop supply"); for(uint i = 0; i < count; i++) { uint mintIndex = nextToken(); _safeMint(to, mintIndex); totalDragonsAirdropped++; } } /* * Withdraw from the contract */ function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } }
mintNDragons
function mintNDragons(uint256 numDragons) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(numDragons > 0, "Must mint at least one DraGON"); require(totalDragonsMinted + numDragons <= MAX_DRAGONS_MINT, "The purchase would exceed the max supply of DraGONS"); uint balanceGons = gons.balanceOf(msg.sender); require(balanceGons >= numDragons, "Must hold N Gorilla Nemesis to mint N DraGONS"); uint256 toBeMinted = getMintableTokenNumber(msg.sender); require(toBeMinted > 0, "You must have at least one Gorilla Nemesis elegible to mint"); if (toBeMinted > numDragons) { toBeMinted = numDragons; } require(dragonPrice * toBeMinted <= msg.value, "Ether value sent is not correct"); uint256 minted = 0; for (uint256 i = 0; i < balanceGons; i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(msg.sender, i); if (canMint(tokenId)) { uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[tokenId] = 1; minted++; totalDragonsMinted++; } if (minted == toBeMinted) { break; } } }
/** * Mint N DraGONS */
NatSpecMultiLine
v0.8.6+commit.11564f7e
MIT
ipfs://b1f9e34675fdced25ca48d38eae9fb9298fc794ff8807f02f9832521abe678a4
{ "func_code_index": [ 3087, 4382 ] }
9,801
DraGONS
contracts/DraGONS.sol
0xf7f83cbb51ba65fb19ab9ed6ca9520e637b6f192
Solidity
DraGONS
contract DraGONS is ERC721Enumerable, Ownable, RandomlyAssigned { GONS private gons; uint constant public MAX_DRAGONS_MINT = 5000; uint constant public MAX_DRAGONS_AIRDROP = 904; uint256 public constant dragonPrice = 70000000000000000; //0.07 ETH address private gonsContract = 0x984EEA281Bf65638ac6ed30C4FF7977EA7fe0433; // GONS SC bool public saleIsActive = false; bool public airdropIsActive = false; uint256 public maxDragons; string private baseURI; uint256 public totalDragonsMinted = 0; uint256 public totalDragonsAirdropped = 0; mapping(uint256 => uint256) public mintedIDs; constructor() ERC721("DraGONS 2171", "DRAGONS") RandomlyAssigned (MAX_DRAGONS_MINT+MAX_DRAGONS_AIRDROP,0) { maxDragons = MAX_DRAGONS_MINT; gons = GONS(gonsContract); } function _baseURI() internal view override returns (string memory) { return baseURI; } function setBaseURI(string memory uri) public onlyOwner { baseURI = uri; } function flipSaleState() public onlyOwner { saleIsActive = !saleIsActive; } function flipAirdropState() public onlyOwner { airdropIsActive = !airdropIsActive; } // Shows if a GON can mint a DraGON function canMint(uint256 tokenId) view public returns (bool) { bool res = true; if (mintedIDs[tokenId] == 1){ res = false; } return res; } // Returns the amount of DraGONS available to be minted function getMintableTokenNumber(address user) view public returns (uint256 mintableTokenNumber) { mintableTokenNumber = 0; for (uint256 i = 0; i < gons.balanceOf(user); i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(user, i); if (canMint(tokenId)) mintableTokenNumber++; } return mintableTokenNumber; } function getAvailableIDs() public view returns (uint256[] memory) { uint256[] memory availableIDs = new uint256[](MAX_DRAGONS_MINT); for (uint256 i = 0; i < MAX_DRAGONS_MINT; i++) { if (mintedIDs[i] != 1){ availableIDs[i] = i; } else { availableIDs[i] = MAX_DRAGONS_MINT; } } return availableIDs; } /** * Mint a DraGON */ function mintDragon(uint256 gonsTokenId) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(totalDragonsMinted < maxDragons, "The purchase would exceed the max supply of DraGONS"); require(gonsTokenId < maxDragons, "The requested tokenId exceeds upper bound"); require(gons.ownerOf(gonsTokenId) == msg.sender, "Must own the specific Gorilla Nemesis with the requested tokenId to mint this DraGON"); require(dragonPrice <= msg.value, "Ether value sent is not correct"); require(canMint(gonsTokenId), "DraGON already minted"); uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[gonsTokenId] = 1; totalDragonsMinted++; } /** * Mint N DraGONS */ function mintNDragons(uint256 numDragons) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(numDragons > 0, "Must mint at least one DraGON"); require(totalDragonsMinted + numDragons <= MAX_DRAGONS_MINT, "The purchase would exceed the max supply of DraGONS"); uint balanceGons = gons.balanceOf(msg.sender); require(balanceGons >= numDragons, "Must hold N Gorilla Nemesis to mint N DraGONS"); uint256 toBeMinted = getMintableTokenNumber(msg.sender); require(toBeMinted > 0, "You must have at least one Gorilla Nemesis elegible to mint"); if (toBeMinted > numDragons) { toBeMinted = numDragons; } require(dragonPrice * toBeMinted <= msg.value, "Ether value sent is not correct"); uint256 minted = 0; for (uint256 i = 0; i < balanceGons; i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(msg.sender, i); if (canMint(tokenId)) { uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[tokenId] = 1; minted++; totalDragonsMinted++; } if (minted == toBeMinted) { break; } } } /** * Airdrop-phase: DraGONS assigned to MK owners [1 : 1] (500) + GONS Character owners [1 : 1] (404) * We take care of the transaction fees. */ function airdropDragons(address to, uint count) public onlyOwner{ require(airdropIsActive, "Airdrop-phase must be active to airdrop a DraGON"); require(totalDragonsAirdropped + count <= MAX_DRAGONS_AIRDROP, "The number of dragons would exceed the maximum airdrop supply"); for(uint i = 0; i < count; i++) { uint mintIndex = nextToken(); _safeMint(to, mintIndex); totalDragonsAirdropped++; } } /* * Withdraw from the contract */ function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } }
airdropDragons
function airdropDragons(address to, uint count) public onlyOwner{ require(airdropIsActive, "Airdrop-phase must be active to airdrop a DraGON"); require(totalDragonsAirdropped + count <= MAX_DRAGONS_AIRDROP, "The number of dragons would exceed the maximum airdrop supply"); for(uint i = 0; i < count; i++) { uint mintIndex = nextToken(); _safeMint(to, mintIndex); totalDragonsAirdropped++; } }
/** * Airdrop-phase: DraGONS assigned to MK owners [1 : 1] (500) + GONS Character owners [1 : 1] (404) * We take care of the transaction fees. */
NatSpecMultiLine
v0.8.6+commit.11564f7e
MIT
ipfs://b1f9e34675fdced25ca48d38eae9fb9298fc794ff8807f02f9832521abe678a4
{ "func_code_index": [ 4554, 5034 ] }
9,802
DraGONS
contracts/DraGONS.sol
0xf7f83cbb51ba65fb19ab9ed6ca9520e637b6f192
Solidity
DraGONS
contract DraGONS is ERC721Enumerable, Ownable, RandomlyAssigned { GONS private gons; uint constant public MAX_DRAGONS_MINT = 5000; uint constant public MAX_DRAGONS_AIRDROP = 904; uint256 public constant dragonPrice = 70000000000000000; //0.07 ETH address private gonsContract = 0x984EEA281Bf65638ac6ed30C4FF7977EA7fe0433; // GONS SC bool public saleIsActive = false; bool public airdropIsActive = false; uint256 public maxDragons; string private baseURI; uint256 public totalDragonsMinted = 0; uint256 public totalDragonsAirdropped = 0; mapping(uint256 => uint256) public mintedIDs; constructor() ERC721("DraGONS 2171", "DRAGONS") RandomlyAssigned (MAX_DRAGONS_MINT+MAX_DRAGONS_AIRDROP,0) { maxDragons = MAX_DRAGONS_MINT; gons = GONS(gonsContract); } function _baseURI() internal view override returns (string memory) { return baseURI; } function setBaseURI(string memory uri) public onlyOwner { baseURI = uri; } function flipSaleState() public onlyOwner { saleIsActive = !saleIsActive; } function flipAirdropState() public onlyOwner { airdropIsActive = !airdropIsActive; } // Shows if a GON can mint a DraGON function canMint(uint256 tokenId) view public returns (bool) { bool res = true; if (mintedIDs[tokenId] == 1){ res = false; } return res; } // Returns the amount of DraGONS available to be minted function getMintableTokenNumber(address user) view public returns (uint256 mintableTokenNumber) { mintableTokenNumber = 0; for (uint256 i = 0; i < gons.balanceOf(user); i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(user, i); if (canMint(tokenId)) mintableTokenNumber++; } return mintableTokenNumber; } function getAvailableIDs() public view returns (uint256[] memory) { uint256[] memory availableIDs = new uint256[](MAX_DRAGONS_MINT); for (uint256 i = 0; i < MAX_DRAGONS_MINT; i++) { if (mintedIDs[i] != 1){ availableIDs[i] = i; } else { availableIDs[i] = MAX_DRAGONS_MINT; } } return availableIDs; } /** * Mint a DraGON */ function mintDragon(uint256 gonsTokenId) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(totalDragonsMinted < maxDragons, "The purchase would exceed the max supply of DraGONS"); require(gonsTokenId < maxDragons, "The requested tokenId exceeds upper bound"); require(gons.ownerOf(gonsTokenId) == msg.sender, "Must own the specific Gorilla Nemesis with the requested tokenId to mint this DraGON"); require(dragonPrice <= msg.value, "Ether value sent is not correct"); require(canMint(gonsTokenId), "DraGON already minted"); uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[gonsTokenId] = 1; totalDragonsMinted++; } /** * Mint N DraGONS */ function mintNDragons(uint256 numDragons) public payable { require(saleIsActive, "The sale must be active to mint a DraGON"); require(numDragons > 0, "Must mint at least one DraGON"); require(totalDragonsMinted + numDragons <= MAX_DRAGONS_MINT, "The purchase would exceed the max supply of DraGONS"); uint balanceGons = gons.balanceOf(msg.sender); require(balanceGons >= numDragons, "Must hold N Gorilla Nemesis to mint N DraGONS"); uint256 toBeMinted = getMintableTokenNumber(msg.sender); require(toBeMinted > 0, "You must have at least one Gorilla Nemesis elegible to mint"); if (toBeMinted > numDragons) { toBeMinted = numDragons; } require(dragonPrice * toBeMinted <= msg.value, "Ether value sent is not correct"); uint256 minted = 0; for (uint256 i = 0; i < balanceGons; i++) { uint256 tokenId = gons.tokenOfOwnerByIndex(msg.sender, i); if (canMint(tokenId)) { uint256 mintIndex = nextToken(); _safeMint(msg.sender, mintIndex); mintedIDs[tokenId] = 1; minted++; totalDragonsMinted++; } if (minted == toBeMinted) { break; } } } /** * Airdrop-phase: DraGONS assigned to MK owners [1 : 1] (500) + GONS Character owners [1 : 1] (404) * We take care of the transaction fees. */ function airdropDragons(address to, uint count) public onlyOwner{ require(airdropIsActive, "Airdrop-phase must be active to airdrop a DraGON"); require(totalDragonsAirdropped + count <= MAX_DRAGONS_AIRDROP, "The number of dragons would exceed the maximum airdrop supply"); for(uint i = 0; i < count; i++) { uint mintIndex = nextToken(); _safeMint(to, mintIndex); totalDragonsAirdropped++; } } /* * Withdraw from the contract */ function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } }
withdrawAll
function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); }
/* * Withdraw from the contract */
Comment
v0.8.6+commit.11564f7e
MIT
ipfs://b1f9e34675fdced25ca48d38eae9fb9298fc794ff8807f02f9832521abe678a4
{ "func_code_index": [ 5081, 5206 ] }
9,803
FutureBase
IERC20.sol
0x8a59500444d48041eb90f6fcbb5814a938d5a428
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
totalSupply
function totalSupply() external view returns (uint256);
/** * @dev Returns the amount of tokens in existence. */
NatSpecMultiLine
v0.6.10+commit.00c0fcaf
MIT
ipfs://82b3495233d8bd2be4d68d74faedfa6037048924c56a8d3a93f91d69ca636337
{ "func_code_index": [ 94, 154 ] }
9,804
FutureBase
IERC20.sol
0x8a59500444d48041eb90f6fcbb5814a938d5a428
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
balanceOf
function balanceOf(address account) external view returns (uint256);
/** * @dev Returns the amount of tokens owned by `account`. */
NatSpecMultiLine
v0.6.10+commit.00c0fcaf
MIT
ipfs://82b3495233d8bd2be4d68d74faedfa6037048924c56a8d3a93f91d69ca636337
{ "func_code_index": [ 237, 310 ] }
9,805
FutureBase
IERC20.sol
0x8a59500444d48041eb90f6fcbb5814a938d5a428
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/** * @dev Interface of the ERC20 standard as defined in the EIP. */
NatSpecMultiLine
transfer
function transfer(address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.6.10+commit.00c0fcaf
MIT
ipfs://82b3495233d8bd2be4d68d74faedfa6037048924c56a8d3a93f91d69ca636337
{ "func_code_index": [ 534, 616 ] }
9,806